Skip to content

Commit 20b615e

Browse files
committed
HADOOP-19415. Fix CheckStyle Issue.
1 parent c8d59e9 commit 20b615e

File tree

7 files changed

+120
-118
lines changed

7 files changed

+120
-118
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,7 @@ 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(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
1439+
assertTrue(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
14401440
"The atime of symlink should not be lesser after setTimes()");
14411441
assertEquals(2000, wrapper.getFileStatus(file).getModificationTime());
14421442
assertEquals(3000, wrapper.getFileStatus(file).getAccessTime());
@@ -1453,7 +1453,7 @@ 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(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
1456+
assertTrue(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
14571457
"The atime of symlink should not be lesser after setTimes()");
14581458
assertEquals(2000, wrapper.getFileStatus(dir).getModificationTime());
14591459
assertEquals(3000, wrapper.getFileStatus(dir).getAccessTime());
@@ -1473,7 +1473,7 @@ public void testSetTimesDanglingLink() throws IOException {
14731473
} catch (IOException e) {
14741474
// Expected
14751475
}
1476-
assertTrue(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
1476+
assertTrue(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
14771477
"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/ViewFsBaseTest.java

Lines changed: 72 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -222,108 +222,108 @@ public void testBasicPaths() {
222222
public void testOperationsThroughMountLinks() throws IOException {
223223
// Create file
224224
fileContextTestHelper.createFileNonRecursive(fcView, "/user/foo");
225-
assertTrue(isFile(fcView, new Path("/user/foo")),
225+
assertTrue(isFile(fcView, new Path("/user/foo")),
226226
"Create file should be file");
227-
assertTrue(isFile(fcTarget, new Path(targetTestRoot,"user/foo")),
227+
assertTrue(isFile(fcTarget, new Path(targetTestRoot, "user/foo")),
228228
"Target of created file should be type file");
229229

230230
// Delete the created file
231-
assertTrue(fcView.delete(new Path("/user/foo"), false),
231+
assertTrue(fcView.delete(new Path("/user/foo"), false),
232232
"Delete should succeed");
233233
assertFalse(exists(fcView, new Path("/user/foo")), "File should not exist after delete");
234-
assertFalse(exists(fcTarget, new Path(targetTestRoot,"user/foo")),
234+
assertFalse(exists(fcTarget, new Path(targetTestRoot, "user/foo")),
235235
"Target File should not exist after delete");
236236

237237
// Create file with a 2 component dirs
238238
fileContextTestHelper.createFileNonRecursive(fcView,
239239
"/internalDir/linkToDir2/foo");
240-
assertTrue(isFile(fcView, new Path("/internalDir/linkToDir2/foo")),
240+
assertTrue(isFile(fcView, new Path("/internalDir/linkToDir2/foo")),
241241
"Created file should be type file");
242-
assertTrue(isFile(fcTarget, new Path(targetTestRoot,"dir2/foo")),
242+
assertTrue(isFile(fcTarget, new Path(targetTestRoot, "dir2/foo")),
243243
"Target of created file should be type file");
244244

245245
// Delete the created file
246-
assertTrue(fcView.delete(new Path("/internalDir/linkToDir2/foo"),false),
246+
assertTrue(fcView.delete(new Path("/internalDir/linkToDir2/foo"), false),
247247
"Delete should succeed");
248-
assertFalse(exists(fcView, new Path("/internalDir/linkToDir2/foo")),
248+
assertFalse(exists(fcView, new Path("/internalDir/linkToDir2/foo")),
249249
"File should not exist after deletion");
250-
assertFalse(exists(fcTarget, new Path(targetTestRoot,"dir2/foo")),
250+
assertFalse(exists(fcTarget, new Path(targetTestRoot, "dir2/foo")),
251251
"Target should not exist after deletion");
252252

253253

254254
// Create file with a 3 component dirs
255255
fileContextTestHelper.createFileNonRecursive(fcView,
256256
"/internalDir/internalDir2/linkToDir3/foo");
257-
assertTrue(isFile(fcView, new Path("/internalDir/internalDir2/linkToDir3/foo")),
257+
assertTrue(isFile(fcView, new Path("/internalDir/internalDir2/linkToDir3/foo")),
258258
"Created file should be of type file");
259-
assertTrue(isFile(fcTarget, new Path(targetTestRoot,"dir3/foo")),
259+
assertTrue(isFile(fcTarget, new Path(targetTestRoot, "dir3/foo")),
260260
"Target of created file should also be type file");
261261

262262
// Recursive Create file with missing dirs
263263
fileContextTestHelper.createFile(fcView,
264264
"/internalDir/linkToDir2/missingDir/miss2/foo");
265-
assertTrue(isFile(fcView, new Path("/internalDir/linkToDir2/missingDir/miss2/foo")),
265+
assertTrue(isFile(fcView, new Path("/internalDir/linkToDir2/missingDir/miss2/foo")),
266266
"Created file should be of type file");
267-
assertTrue(isFile(fcTarget, new Path(targetTestRoot,"dir2/missingDir/miss2/foo")),
267+
assertTrue(isFile(fcTarget, new Path(targetTestRoot, "dir2/missingDir/miss2/foo")),
268268
"Target of created file should also be type file");
269269

270270

271271
// Delete the created file
272-
assertTrue( fcView.delete(new Path("/internalDir/internalDir2/linkToDir3/foo"), false),
272+
assertTrue(fcView.delete(new Path("/internalDir/internalDir2/linkToDir3/foo"), false),
273273
"Delete should succeed");
274-
assertFalse(exists(fcView, new Path("/internalDir/internalDir2/linkToDir3/foo")),
274+
assertFalse(exists(fcView, new Path("/internalDir/internalDir2/linkToDir3/foo")),
275275
"Deleted File should not exist");
276-
assertFalse(exists(fcTarget, new Path(targetTestRoot,"dir3/foo")),
276+
assertFalse(exists(fcTarget, new Path(targetTestRoot, "dir3/foo")),
277277
"Target of deleted file should not exist");
278278

279279

280280
// mkdir
281281
fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
282282
FileContext.DEFAULT_PERM, false);
283283
assertTrue(isDir(fcView, new Path("/user/dirX")), "New dir should be type dir");
284-
assertTrue(isDir(fcTarget, new Path(targetTestRoot,"user/dirX")),
284+
assertTrue(isDir(fcTarget, new Path(targetTestRoot, "user/dirX")),
285285
"Target of new dir should be of type dir");
286286

287287
fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/user/dirX/dirY"),
288288
FileContext.DEFAULT_PERM, false);
289-
assertTrue(isDir(fcView, new Path("/user/dirX/dirY")),
289+
assertTrue(isDir(fcView, new Path("/user/dirX/dirY")),
290290
"New dir should be type dir");
291-
assertTrue(isDir(fcTarget,new Path(targetTestRoot,"user/dirX/dirY")),
291+
assertTrue(isDir(fcTarget, new Path(targetTestRoot, "user/dirX/dirY")),
292292
"Target of new dir should be of type dir");
293293

294294

295295
// Delete the created dir
296-
assertTrue(fcView.delete(new Path("/user/dirX/dirY"), false),
296+
assertTrue(fcView.delete(new Path("/user/dirX/dirY"), false),
297297
"Delete should succeed");
298-
assertFalse(exists(fcView, new Path("/user/dirX/dirY")),
298+
assertFalse(exists(fcView, new Path("/user/dirX/dirY")),
299299
"Deleted File should not exist");
300-
assertFalse(exists(fcTarget, new Path(targetTestRoot,"user/dirX/dirY")),
300+
assertFalse(exists(fcTarget, new Path(targetTestRoot, "user/dirX/dirY")),
301301
"Deleted Target should not exist");
302302

303303
assertTrue(fcView.delete(new Path("/user/dirX"), false), "Delete should succeed");
304-
assertFalse(exists(fcView, new Path("/user/dirX")),
304+
assertFalse(exists(fcView, new Path("/user/dirX")),
305305
"Deleted File should not exist");
306-
assertFalse(exists(fcTarget, new Path(targetTestRoot,"user/dirX")),
306+
assertFalse(exists(fcTarget, new Path(targetTestRoot, "user/dirX")),
307307
"Deleted Target should not exist");
308308

309309
// Rename a file
310310
fileContextTestHelper.createFile(fcView, "/user/foo");
311311
fcView.rename(new Path("/user/foo"), new Path("/user/fooBar"));
312312
assertFalse(exists(fcView, new Path("/user/foo")), "Renamed src should not exist");
313-
assertFalse(exists(fcTarget, new Path(targetTestRoot,"user/foo")));
313+
assertFalse(exists(fcTarget, new Path(targetTestRoot, "user/foo")));
314314
assertTrue(isFile(fcView,
315315
fileContextTestHelper.getTestRootPath(fcView,"/user/fooBar")));
316-
assertTrue(isFile(fcTarget, new Path(targetTestRoot,"user/fooBar")));
316+
assertTrue(isFile(fcTarget, new Path(targetTestRoot, "user/fooBar")));
317317

318318
fcView.mkdir(new Path("/user/dirFoo"), FileContext.DEFAULT_PERM, false);
319319
fcView.rename(new Path("/user/dirFoo"), new Path("/user/dirFooBar"));
320-
assertFalse(exists(fcView, new Path("/user/dirFoo")),
320+
assertFalse(exists(fcView, new Path("/user/dirFoo")),
321321
"Renamed src should not exist");
322-
assertFalse(exists(fcTarget, new Path(targetTestRoot,"user/dirFoo")),
322+
assertFalse(exists(fcTarget, new Path(targetTestRoot, "user/dirFoo")),
323323
"Renamed src should not exist in target");
324-
assertTrue(isDir(fcView, fileContextTestHelper.getTestRootPath(fcView,"/user/dirFooBar")),
324+
assertTrue(isDir(fcView, fileContextTestHelper.getTestRootPath(fcView, "/user/dirFooBar")),
325325
"Renamed dest should exist as dir");
326-
assertTrue(isDir(fcTarget,new Path(targetTestRoot,"user/dirFooBar")),
326+
assertTrue(isDir(fcTarget, new Path(targetTestRoot, "user/dirFooBar")),
327327
"Renamed dest should exist as dir in target");
328328

329329
// Make a directory under a directory that's mounted from the root of another FS
@@ -488,42 +488,40 @@ public void testListOnInternalDirsOfMountTable() throws IOException {
488488
FileStatus fs;
489489
assertEquals(7, dirPaths.length);
490490
fs = fileContextTestHelper.containsPath(fcView, "/user", dirPaths);
491-
assertNotNull(fs);
492-
assertTrue(fs.isSymlink(), "A mount should appear as symlink");
491+
assertNotNull(fs);
492+
assertTrue(fs.isSymlink(), "A mount should appear as symlink");
493493
fs = fileContextTestHelper.containsPath(fcView, "/data", dirPaths);
494-
assertNotNull(fs);
495-
assertTrue(fs.isSymlink(), "A mount should appear as symlink");
494+
assertNotNull(fs);
495+
assertTrue(fs.isSymlink(), "A mount should appear as symlink");
496496
fs = fileContextTestHelper.containsPath(fcView, "/internalDir", dirPaths);
497-
assertNotNull(fs);
498-
assertTrue(fs.isDirectory(), "InternalDirs should appear as dir");
497+
assertNotNull(fs);
498+
assertTrue(fs.isDirectory(), "InternalDirs should appear as dir");
499499
fs = fileContextTestHelper.containsPath(fcView, "/danglingLink", dirPaths);
500-
assertNotNull(fs);
501-
assertTrue(fs.isSymlink(), "A mount should appear as symlink");
500+
assertNotNull(fs);
501+
assertTrue(fs.isSymlink(), "A mount should appear as symlink");
502502
fs = fileContextTestHelper.containsPath(fcView, "/linkToAFile", dirPaths);
503-
assertNotNull(fs);
504-
assertTrue(fs.isSymlink(), "A mount should appear as symlink");
503+
assertNotNull(fs);
504+
assertTrue(fs.isSymlink(), "A mount should appear as symlink");
505505

506506

507507

508-
// list on internal dir
509-
dirPaths = fcView.util().listStatus(new Path("/internalDir"));
510-
assertEquals(2, dirPaths.length);
508+
// list on internal dir
509+
dirPaths = fcView.util().listStatus(new Path("/internalDir"));
510+
assertEquals(2, dirPaths.length);
511511

512-
fs = fileContextTestHelper.containsPath(fcView,
513-
"/internalDir/internalDir2", dirPaths);
514-
assertNotNull(fs);
515-
assertTrue(fs.isDirectory(), "InternalDirs should appear as dir");
516-
fs = fileContextTestHelper.containsPath(fcView,
517-
"/internalDir/linkToDir2", dirPaths);
518-
assertNotNull(fs);
519-
assertTrue(fs.isSymlink(), "A mount should appear as symlink");
512+
fs = fileContextTestHelper.containsPath(fcView, "/internalDir/internalDir2", dirPaths);
513+
assertNotNull(fs);
514+
assertTrue(fs.isDirectory(), "InternalDirs should appear as dir");
515+
fs = fileContextTestHelper.containsPath(fcView, "/internalDir/linkToDir2", dirPaths);
516+
assertNotNull(fs);
517+
assertTrue(fs.isSymlink(), "A mount should appear as symlink");
520518
}
521519

522520
@Test
523521
public void testFileStatusOnMountLink() throws IOException {
524522
assertThrows(FileNotFoundException.class, () -> {
525-
assertTrue(fcView.getFileStatus(new Path("/")).isDirectory(),
526-
"Slash should appear as dir");
523+
assertTrue(fcView.getFileStatus(new Path("/")).isDirectory(),
524+
"Slash should appear as dir");
527525
checkFileStatus(fcView, "/", fileType.isDir);
528526
checkFileStatus(fcView, "/user", fileType.isDir);
529527
checkFileStatus(fcView, "/data", fileType.isDir);
@@ -585,7 +583,7 @@ public void testgetFileLinkStatusonNonExistingInternalDir()
585583
assertThrows(FileNotFoundException.class, () -> {
586584
fcView.getFileLinkStatus(new Path("/internalDir/nonExisting"));
587585
});
588-
}
586+
}
589587

590588
@Test
591589
public void testSymlinkTarget() throws IOException {
@@ -626,34 +624,34 @@ public void testResolvePathInternalPaths() throws IOException {
626624
}
627625
@Test
628626
public void testResolvePathMountPoints() throws IOException {
629-
assertEquals(new Path(targetTestRoot,"user"),
630-
fcView.resolvePath(new Path("/user")));
631-
assertEquals(new Path(targetTestRoot,"data"),
627+
assertEquals(new Path(targetTestRoot, "user"),
628+
fcView.resolvePath(new Path("/user")));
629+
assertEquals(new Path(targetTestRoot, "data"),
632630
fcView.resolvePath(new Path("/data")));
633-
assertEquals(new Path(targetTestRoot,"dir2"),
631+
assertEquals(new Path(targetTestRoot, "dir2"),
634632
fcView.resolvePath(new Path("/internalDir/linkToDir2")));
635-
assertEquals(new Path(targetTestRoot,"dir3"),
633+
assertEquals(new Path(targetTestRoot, "dir3"),
636634
fcView.resolvePath(new Path("/internalDir/internalDir2/linkToDir3")));
637635

638636
}
639637

640638
@Test
641639
public void testResolvePathThroughMountPoints() throws IOException {
642640
fileContextTestHelper.createFile(fcView, "/user/foo");
643-
assertEquals(new Path(targetTestRoot,"user/foo"),
644-
fcView.resolvePath(new Path("/user/foo")));
641+
assertEquals(new Path(targetTestRoot, "user/foo"),
642+
fcView.resolvePath(new Path("/user/foo")));
645643

646644
fcView.mkdir(
647645
fileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
648-
FileContext.DEFAULT_PERM, false);
649-
assertEquals(new Path(targetTestRoot,"user/dirX"),
646+
FileContext.DEFAULT_PERM, false);
647+
assertEquals(new Path(targetTestRoot, "user/dirX"),
650648
fcView.resolvePath(new Path("/user/dirX")));
651649

652650

653651
fcView.mkdir(
654652
fileContextTestHelper.getTestRootPath(fcView, "/user/dirX/dirY"),
655-
FileContext.DEFAULT_PERM, false);
656-
assertEquals(new Path(targetTestRoot,"user/dirX/dirY"),
653+
FileContext.DEFAULT_PERM, false);
654+
assertEquals(new Path(targetTestRoot, "user/dirX/dirY"),
657655
fcView.resolvePath(new Path("/user/dirX/dirY")));
658656
}
659657

@@ -676,7 +674,7 @@ public void testResolvePathMissingThroughMountPoints() throws IOException {
676674
public void testResolvePathMissingThroughMountPoints2() throws IOException {
677675
assertThrows(FileNotFoundException.class, () -> {
678676
fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
679-
FileContext.DEFAULT_PERM, false);
677+
FileContext.DEFAULT_PERM, false);
680678
fcView.resolvePath(new Path("/user/dirX/nonExisting"));
681679
});
682680
}
@@ -696,37 +694,37 @@ public void testResolvePathMissingThroughMountPoints2() throws IOException {
696694
public void testInternalMkdirSlash() throws IOException {
697695
assertThrows(AccessControlException.class, () -> {
698696
fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/"),
699-
FileContext.DEFAULT_PERM, false);
697+
FileContext.DEFAULT_PERM, false);
700698
});
701699
}
702700

703701
@Test
704702
public void testInternalMkdirExisting1() throws IOException {
705703
assertThrows(AccessControlException.class, () -> {
706704
fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/internalDir"),
707-
FileContext.DEFAULT_PERM, false);
705+
FileContext.DEFAULT_PERM, false);
708706
});
709707
}
710708
@Test
711709
public void testInternalMkdirExisting2() throws IOException {
712710
assertThrows(AccessControlException.class, () -> {
713-
fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView,
714-
"/internalDir/linkToDir2"),
711+
fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView,
712+
"/internalDir/linkToDir2"),
715713
FileContext.DEFAULT_PERM, false);
716714
});
717715
}
718716
@Test
719717
public void testInternalMkdirNew() throws IOException {
720718
assertThrows(AccessControlException.class, () -> {
721719
fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/dirNew"),
722-
FileContext.DEFAULT_PERM, false);
720+
FileContext.DEFAULT_PERM, false);
723721
});
724722
}
725723
@Test
726724
public void testInternalMkdirNew2() throws IOException {
727725
assertThrows(AccessControlException.class, () -> {
728726
fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/internalDir/dirNew"),
729-
FileContext.DEFAULT_PERM, false);
727+
FileContext.DEFAULT_PERM, false);
730728
});
731729
}
732730

@@ -791,7 +789,7 @@ public void testInternalDeleteExisting() throws IOException {
791789
@Test
792790
public void testInternalDeleteExisting2() throws IOException {
793791
assertThrows(AccessControlException.class, () -> {
794-
assertTrue(fcView.getFileStatus(new Path("/internalDir/linkToDir2")).isDirectory(),
792+
assertTrue(fcView.getFileStatus(new Path("/internalDir/linkToDir2")).isDirectory(),
795793
"Delete of link to dir should succeed");
796794
fcView.delete(new Path("/internalDir/linkToDir2"), false);
797795
});
@@ -809,7 +807,7 @@ public void testInternalRename1() throws IOException {
809807
@Test
810808
public void testInternalRename2() throws IOException {
811809
assertThrows(AccessControlException.class, () -> {
812-
assertTrue(fcView.getFileStatus(new Path("/internalDir/linkToDir2")).isDirectory(),
810+
assertTrue(fcView.getFileStatus(new Path("/internalDir/linkToDir2")).isDirectory(),
813811
"linkTODir2 should be a dir");
814812
fcView.rename(new Path("/internalDir/linkToDir2"), new Path("/internalDir/dir1"));
815813
});

0 commit comments

Comments
 (0)