slfan1989 commented on code in PR #7652:
URL: https://github.com/apache/hadoop/pull/7652#discussion_r2073467005
##########
hadoop-tools/hadoop-azure-datalake/src/test/java/org/apache/hadoop/fs/adl/live/TestAdlSupportedCharsetInPath.java:
##########
@@ -286,49 +284,45 @@ private boolean contains(FileStatus[] statuses, String
remotePath) {
return false;
}
- @Before
+ @BeforeEach
public void setup() throws Exception {
- org.junit.Assume
- .assumeTrue(AdlStorageConfiguration.isContractTestEnabled());
+ assumeTrue(AdlStorageConfiguration.isContractTestEnabled());
}
- @Test
- public void testAllowedSpecialCharactersRename()
+ @MethodSource("adlCharTestData")
+ @ParameterizedTest(name = "filePath {0}")
+ public void testAllowedSpecialCharactersRename(String filePath)
throws IOException, URISyntaxException {
-
+ initTestAdlSupportedCharsetInPath(filePath);
String parentPath = TEST_ROOT + UUID.randomUUID().toString() + "/";
Path specialFile = new Path(parentPath + path);
Path anotherLocation = new Path(parentPath + UUID.randomUUID().toString());
FileSystem fs = AdlStorageConfiguration.createStorageConnector();
- Assert.assertTrue("Could not create " + specialFile.toString(),
- fs.createNewFile(specialFile));
- Assert.assertTrue(
- "Failed to rename " + specialFile.toString() + " --> " +
anotherLocation
- .toString(), fs.rename(specialFile, anotherLocation));
- Assert.assertFalse("File should not be present after successful rename : "
- + specialFile.toString(), fs.exists(specialFile));
- Assert.assertTrue("File should be present after successful rename : "
- + anotherLocation.toString(), fs.exists(anotherLocation));
- Assert.assertFalse(
- "Listed under parent whereas expected not listed : " + parentPath,
- contains(fs.listStatus(new Path(parentPath)),
- fs.makeQualified(specialFile).toString()));
+ assertTrue(fs.createNewFile(specialFile),
+ "Could not create " + specialFile.toString());
+ assertTrue(fs.rename(specialFile, anotherLocation),
+ "Failed to rename " + specialFile.toString() + " --> " +
anotherLocation.toString());
+ assertFalse(fs.exists(specialFile), "File should not be present after
successful rename : "
+ + specialFile.toString());
+ assertTrue(fs.exists(anotherLocation), "File should be present after
successful rename : "
+ + anotherLocation.toString());
+ assertFalse(contains(fs.listStatus(new Path(parentPath)),
+ fs.makeQualified(specialFile).toString()),
+ "Listed under parent whereas expected not listed : " + parentPath);
- Assert.assertTrue(
+ assertTrue(fs.rename(anotherLocation, specialFile),
"Failed to rename " + anotherLocation.toString() + " --> " +
specialFile
- .toString(), fs.rename(anotherLocation, specialFile));
- Assert.assertTrue(
- "File should be present after successful rename : " + "" + specialFile
- .toString(), fs.exists(specialFile));
- Assert.assertFalse("File should not be present after successful rename : "
- + anotherLocation.toString(), fs.exists(anotherLocation));
+ .toString());
+ assertTrue(fs.exists(specialFile),
+ "File should be present after successful rename : " + "" +
specialFile.toString());
+ assertFalse(fs.exists(anotherLocation),
+ "File should not be present after successful rename : "
+ + anotherLocation.toString());
- Assert.assertTrue("Not listed under parent " + parentPath,
- contains(fs.listStatus(new Path(parentPath)),
- fs.makeQualified(specialFile).toString()));
+ assertTrue(contains(fs.listStatus(new Path(parentPath)),
+ fs.makeQualified(specialFile).toString()), "Not listed under parent "
+ parentPath);
- Assert.assertTrue("Failed to delete " + parentPath,
- fs.delete(new Path(parentPath), true));
+ assertTrue(fs.delete(new Path(parentPath), true), "Failed to delete " +
parentPath);
}
}
Review Comment:
Thank you for helping with the review! I will make improvements to it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]