Skip to content

Commit c8d59e9

Browse files
committed
HADOOP-19415. Fix Junit Test Error & CheckStyle Issue.
1 parent 579bc48 commit c8d59e9

File tree

11 files changed

+427
-431
lines changed

11 files changed

+427
-431
lines changed

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,13 +1005,13 @@ private void doTestRenameDirectoryAsNonExistentDirectory(Rename... options)
10051005
fSys.mkdirs(dst.getParent());
10061006

10071007
rename(src, dst, true, false, true, options);
1008-
assertFalse(exists(fSys, getTestRootPath(fSys,
1008+
assertFalse(exists(fSys, getTestRootPath(fSys,
10091009
"test/hadoop/dir/file1")), "Nested file1 exists");
1010-
assertFalse(exists(fSys, getTestRootPath(fSys, "test/hadoop/dir/subdir/file2")),
1010+
assertFalse(exists(fSys, getTestRootPath(fSys, "test/hadoop/dir/subdir/file2")),
10111011
"Nested file2 exists");
1012-
assertTrue(exists(fSys, getTestRootPath(fSys, "test/new/newdir/file1")),
1012+
assertTrue(exists(fSys, getTestRootPath(fSys, "test/new/newdir/file1")),
10131013
"Renamed nested file1 exists");
1014-
assertTrue(exists(fSys, getTestRootPath(fSys, "test/new/newdir/subdir/file2")),
1014+
assertTrue(exists(fSys, getTestRootPath(fSys, "test/new/newdir/subdir/file2")),
10151015
"Renamed nested exists");
10161016
}
10171017

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ public void testListStatus() throws Exception {
357357
paths));
358358
assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/c"),
359359
paths));
360+
360361
paths = fc.util().listStatus(getTestRootPath(fc, "test/hadoop/a"));
361362
assertEquals(0, paths.length);
362363

@@ -1189,13 +1190,13 @@ private void testRenameDirectoryAsNonExistentDirectory(Rename... options) throws
11891190
fc.mkdir(dst.getParent(), FileContext.DEFAULT_PERM, true);
11901191

11911192
rename(src, dst, false, true, options);
1192-
assertFalse(exists(fc, getTestRootPath(fc,
1193+
assertFalse(exists(fc, getTestRootPath(fc,
11931194
"test/hadoop/dir/file1")), "Nested file1 exists");
1194-
assertFalse(exists(fc, getTestRootPath(fc,
1195+
assertFalse(exists(fc, getTestRootPath(fc,
11951196
"test/hadoop/dir/subdir/file2")), "Nested file2 exists");
1196-
assertTrue(exists(fc, getTestRootPath(fc,
1197+
assertTrue(exists(fc, getTestRootPath(fc,
11971198
"test/new/newdir/file1")), "Renamed nested file1 exists");
1198-
assertTrue(exists(fc, getTestRootPath(fc,
1199+
assertTrue(exists(fc, getTestRootPath(fc,
11991200
"test/new/newdir/subdir/file2")), "Renamed nested exists");
12001201
}
12011202

@@ -1546,7 +1547,7 @@ public void testOpenFileApplyRead() throws Throwable {
15461547
CompletableFuture<Long> readAllBytes = fc.openFile(path)
15471548
.build()
15481549
.thenApply(ContractTestUtils::readStream);
1549-
assertEquals(data.length, (long) readAllBytes.get(),
1550+
assertEquals(data.length, (long) readAllBytes.get(),
15501551
"Wrong number of bytes read from stream");
15511552
}
15521553

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/SymlinkBaseTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,8 +1436,8 @@ public void testSetTimesSymlinkToFile() throws IOException {
14361436
long at = wrapper.getFileLinkStatus(link).getAccessTime();
14371437
// the local file system may not support millisecond timestamps
14381438
wrapper.setTimes(link, 2000L, 3000L);
1439-
assertTrue(
1440-
wrapper.getFileLinkStatus(link).getAccessTime() >= at, "The atime of symlink should not be lesser after setTimes()");
1439+
assertTrue(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
1440+
"The atime of symlink should not be lesser after setTimes()");
14411441
assertEquals(2000, wrapper.getFileStatus(file).getModificationTime());
14421442
assertEquals(3000, wrapper.getFileStatus(file).getAccessTime());
14431443
}
@@ -1453,8 +1453,8 @@ public void testSetTimesSymlinkToDir() throws IOException {
14531453
long at = wrapper.getFileLinkStatus(link).getAccessTime();
14541454
// the local file system may not support millisecond timestamps
14551455
wrapper.setTimes(link, 2000L, 3000L);
1456-
assertTrue(
1457-
wrapper.getFileLinkStatus(link).getAccessTime() >= at, "The atime of symlink should not be lesser after setTimes()");
1456+
assertTrue(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
1457+
"The atime of symlink should not be lesser after setTimes()");
14581458
assertEquals(2000, wrapper.getFileStatus(dir).getModificationTime());
14591459
assertEquals(3000, wrapper.getFileStatus(dir).getAccessTime());
14601460
}
@@ -1473,7 +1473,7 @@ public void testSetTimesDanglingLink() throws IOException {
14731473
} catch (IOException e) {
14741474
// Expected
14751475
}
1476-
assertTrue(
1477-
wrapper.getFileLinkStatus(link).getAccessTime() >= at, "The atime of symlink should not be lesser after setTimes()");
1476+
assertTrue(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
1477+
"The atime of symlink should not be lesser after setTimes()");
14781478
}
14791479
}

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsWithAuthorityLocalFs.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package org.apache.hadoop.fs.viewfs;
1919

20+
import static org.junit.jupiter.api.Assertions.assertEquals;
2021

2122
import java.net.URI;
2223

@@ -25,7 +26,6 @@
2526
import org.apache.hadoop.fs.Path;
2627

2728
import org.junit.jupiter.api.AfterEach;
28-
import org.junit.jupiter.api.Assertions;
2929
import org.junit.jupiter.api.BeforeEach;
3030
import org.junit.jupiter.api.Test;
3131

@@ -63,16 +63,15 @@ public void tearDown() throws Exception {
6363
@Override
6464
@Test
6565
public void testBasicPaths() {
66-
Assertions.assertEquals(schemeWithAuthority,
67-
fcView.getDefaultFileSystem().getUri());
68-
Assertions.assertEquals(fcView.makeQualified(
69-
new Path("/user/" + System.getProperty("user.name"))),
70-
fcView.getWorkingDirectory());
71-
Assertions.assertEquals(fcView.makeQualified(
72-
new Path("/user/" + System.getProperty("user.name"))),
73-
fcView.getHomeDirectory());
74-
Assertions.assertEquals(
75-
new Path("/foo/bar").makeQualified(schemeWithAuthority, null),
76-
fcView.makeQualified(new Path("/foo/bar")));
66+
assertEquals(schemeWithAuthority, fcView.getDefaultFileSystem().getUri());
67+
assertEquals(fcView.makeQualified(
68+
new Path("/user/" + System.getProperty("user.name"))),
69+
fcView.getWorkingDirectory());
70+
assertEquals(fcView.makeQualified(
71+
new Path("/user/" + System.getProperty("user.name"))),
72+
fcView.getHomeDirectory());
73+
assertEquals(
74+
new Path("/foo/bar").makeQualified(schemeWithAuthority, null),
75+
fcView.makeQualified(new Path("/foo/bar")));
7776
}
7877
}

0 commit comments

Comments
 (0)