@@ -222,108 +222,108 @@ public void testBasicPaths() {
222
222
public void testOperationsThroughMountLinks () throws IOException {
223
223
// Create file
224
224
fileContextTestHelper .createFileNonRecursive (fcView , "/user/foo" );
225
- assertTrue (isFile (fcView , new Path ("/user/foo" )),
225
+ assertTrue (isFile (fcView , new Path ("/user/foo" )),
226
226
"Create file should be file" );
227
- assertTrue (isFile (fcTarget , new Path (targetTestRoot ,"user/foo" )),
227
+ assertTrue (isFile (fcTarget , new Path (targetTestRoot , "user/foo" )),
228
228
"Target of created file should be type file" );
229
229
230
230
// Delete the created file
231
- assertTrue (fcView .delete (new Path ("/user/foo" ), false ),
231
+ assertTrue (fcView .delete (new Path ("/user/foo" ), false ),
232
232
"Delete should succeed" );
233
233
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" )),
235
235
"Target File should not exist after delete" );
236
236
237
237
// Create file with a 2 component dirs
238
238
fileContextTestHelper .createFileNonRecursive (fcView ,
239
239
"/internalDir/linkToDir2/foo" );
240
- assertTrue (isFile (fcView , new Path ("/internalDir/linkToDir2/foo" )),
240
+ assertTrue (isFile (fcView , new Path ("/internalDir/linkToDir2/foo" )),
241
241
"Created file should be type file" );
242
- assertTrue (isFile (fcTarget , new Path (targetTestRoot ,"dir2/foo" )),
242
+ assertTrue (isFile (fcTarget , new Path (targetTestRoot , "dir2/foo" )),
243
243
"Target of created file should be type file" );
244
244
245
245
// Delete the created file
246
- assertTrue (fcView .delete (new Path ("/internalDir/linkToDir2/foo" ),false ),
246
+ assertTrue (fcView .delete (new Path ("/internalDir/linkToDir2/foo" ), false ),
247
247
"Delete should succeed" );
248
- assertFalse (exists (fcView , new Path ("/internalDir/linkToDir2/foo" )),
248
+ assertFalse (exists (fcView , new Path ("/internalDir/linkToDir2/foo" )),
249
249
"File should not exist after deletion" );
250
- assertFalse (exists (fcTarget , new Path (targetTestRoot ,"dir2/foo" )),
250
+ assertFalse (exists (fcTarget , new Path (targetTestRoot , "dir2/foo" )),
251
251
"Target should not exist after deletion" );
252
252
253
253
254
254
// Create file with a 3 component dirs
255
255
fileContextTestHelper .createFileNonRecursive (fcView ,
256
256
"/internalDir/internalDir2/linkToDir3/foo" );
257
- assertTrue (isFile (fcView , new Path ("/internalDir/internalDir2/linkToDir3/foo" )),
257
+ assertTrue (isFile (fcView , new Path ("/internalDir/internalDir2/linkToDir3/foo" )),
258
258
"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" )),
260
260
"Target of created file should also be type file" );
261
261
262
262
// Recursive Create file with missing dirs
263
263
fileContextTestHelper .createFile (fcView ,
264
264
"/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" )),
266
266
"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" )),
268
268
"Target of created file should also be type file" );
269
269
270
270
271
271
// 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 ),
273
273
"Delete should succeed" );
274
- assertFalse (exists (fcView , new Path ("/internalDir/internalDir2/linkToDir3/foo" )),
274
+ assertFalse (exists (fcView , new Path ("/internalDir/internalDir2/linkToDir3/foo" )),
275
275
"Deleted File should not exist" );
276
- assertFalse (exists (fcTarget , new Path (targetTestRoot ,"dir3/foo" )),
276
+ assertFalse (exists (fcTarget , new Path (targetTestRoot , "dir3/foo" )),
277
277
"Target of deleted file should not exist" );
278
278
279
279
280
280
// mkdir
281
281
fcView .mkdir (fileContextTestHelper .getTestRootPath (fcView , "/user/dirX" ),
282
282
FileContext .DEFAULT_PERM , false );
283
283
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" )),
285
285
"Target of new dir should be of type dir" );
286
286
287
287
fcView .mkdir (fileContextTestHelper .getTestRootPath (fcView , "/user/dirX/dirY" ),
288
288
FileContext .DEFAULT_PERM , false );
289
- assertTrue (isDir (fcView , new Path ("/user/dirX/dirY" )),
289
+ assertTrue (isDir (fcView , new Path ("/user/dirX/dirY" )),
290
290
"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" )),
292
292
"Target of new dir should be of type dir" );
293
293
294
294
295
295
// Delete the created dir
296
- assertTrue (fcView .delete (new Path ("/user/dirX/dirY" ), false ),
296
+ assertTrue (fcView .delete (new Path ("/user/dirX/dirY" ), false ),
297
297
"Delete should succeed" );
298
- assertFalse (exists (fcView , new Path ("/user/dirX/dirY" )),
298
+ assertFalse (exists (fcView , new Path ("/user/dirX/dirY" )),
299
299
"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" )),
301
301
"Deleted Target should not exist" );
302
302
303
303
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" )),
305
305
"Deleted File should not exist" );
306
- assertFalse (exists (fcTarget , new Path (targetTestRoot ,"user/dirX" )),
306
+ assertFalse (exists (fcTarget , new Path (targetTestRoot , "user/dirX" )),
307
307
"Deleted Target should not exist" );
308
308
309
309
// Rename a file
310
310
fileContextTestHelper .createFile (fcView , "/user/foo" );
311
311
fcView .rename (new Path ("/user/foo" ), new Path ("/user/fooBar" ));
312
312
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" )));
314
314
assertTrue (isFile (fcView ,
315
315
fileContextTestHelper .getTestRootPath (fcView ,"/user/fooBar" )));
316
- assertTrue (isFile (fcTarget , new Path (targetTestRoot ,"user/fooBar" )));
316
+ assertTrue (isFile (fcTarget , new Path (targetTestRoot , "user/fooBar" )));
317
317
318
318
fcView .mkdir (new Path ("/user/dirFoo" ), FileContext .DEFAULT_PERM , false );
319
319
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" )),
321
321
"Renamed src should not exist" );
322
- assertFalse (exists (fcTarget , new Path (targetTestRoot ,"user/dirFoo" )),
322
+ assertFalse (exists (fcTarget , new Path (targetTestRoot , "user/dirFoo" )),
323
323
"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" )),
325
325
"Renamed dest should exist as dir" );
326
- assertTrue (isDir (fcTarget ,new Path (targetTestRoot ,"user/dirFooBar" )),
326
+ assertTrue (isDir (fcTarget , new Path (targetTestRoot , "user/dirFooBar" )),
327
327
"Renamed dest should exist as dir in target" );
328
328
329
329
// Make a directory under a directory that's mounted from the root of another FS
@@ -488,42 +488,40 @@ public void testListOnInternalDirsOfMountTable() throws IOException {
488
488
FileStatus fs ;
489
489
assertEquals (7 , dirPaths .length );
490
490
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" );
493
493
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" );
496
496
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" );
499
499
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" );
502
502
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" );
505
505
506
506
507
507
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 );
511
511
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" );
520
518
}
521
519
522
520
@ Test
523
521
public void testFileStatusOnMountLink () throws IOException {
524
522
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" );
527
525
checkFileStatus (fcView , "/" , fileType .isDir );
528
526
checkFileStatus (fcView , "/user" , fileType .isDir );
529
527
checkFileStatus (fcView , "/data" , fileType .isDir );
@@ -585,7 +583,7 @@ public void testgetFileLinkStatusonNonExistingInternalDir()
585
583
assertThrows (FileNotFoundException .class , () -> {
586
584
fcView .getFileLinkStatus (new Path ("/internalDir/nonExisting" ));
587
585
});
588
- }
586
+ }
589
587
590
588
@ Test
591
589
public void testSymlinkTarget () throws IOException {
@@ -626,34 +624,34 @@ public void testResolvePathInternalPaths() throws IOException {
626
624
}
627
625
@ Test
628
626
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" ),
632
630
fcView .resolvePath (new Path ("/data" )));
633
- assertEquals (new Path (targetTestRoot ,"dir2" ),
631
+ assertEquals (new Path (targetTestRoot , "dir2" ),
634
632
fcView .resolvePath (new Path ("/internalDir/linkToDir2" )));
635
- assertEquals (new Path (targetTestRoot ,"dir3" ),
633
+ assertEquals (new Path (targetTestRoot , "dir3" ),
636
634
fcView .resolvePath (new Path ("/internalDir/internalDir2/linkToDir3" )));
637
635
638
636
}
639
637
640
638
@ Test
641
639
public void testResolvePathThroughMountPoints () throws IOException {
642
640
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" )));
645
643
646
644
fcView .mkdir (
647
645
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" ),
650
648
fcView .resolvePath (new Path ("/user/dirX" )));
651
649
652
650
653
651
fcView .mkdir (
654
652
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" ),
657
655
fcView .resolvePath (new Path ("/user/dirX/dirY" )));
658
656
}
659
657
@@ -676,7 +674,7 @@ public void testResolvePathMissingThroughMountPoints() throws IOException {
676
674
public void testResolvePathMissingThroughMountPoints2 () throws IOException {
677
675
assertThrows (FileNotFoundException .class , () -> {
678
676
fcView .mkdir (fileContextTestHelper .getTestRootPath (fcView , "/user/dirX" ),
679
- FileContext .DEFAULT_PERM , false );
677
+ FileContext .DEFAULT_PERM , false );
680
678
fcView .resolvePath (new Path ("/user/dirX/nonExisting" ));
681
679
});
682
680
}
@@ -696,37 +694,37 @@ public void testResolvePathMissingThroughMountPoints2() throws IOException {
696
694
public void testInternalMkdirSlash () throws IOException {
697
695
assertThrows (AccessControlException .class , () -> {
698
696
fcView .mkdir (fileContextTestHelper .getTestRootPath (fcView , "/" ),
699
- FileContext .DEFAULT_PERM , false );
697
+ FileContext .DEFAULT_PERM , false );
700
698
});
701
699
}
702
700
703
701
@ Test
704
702
public void testInternalMkdirExisting1 () throws IOException {
705
703
assertThrows (AccessControlException .class , () -> {
706
704
fcView .mkdir (fileContextTestHelper .getTestRootPath (fcView , "/internalDir" ),
707
- FileContext .DEFAULT_PERM , false );
705
+ FileContext .DEFAULT_PERM , false );
708
706
});
709
707
}
710
708
@ Test
711
709
public void testInternalMkdirExisting2 () throws IOException {
712
710
assertThrows (AccessControlException .class , () -> {
713
- fcView .mkdir (fileContextTestHelper .getTestRootPath (fcView ,
714
- "/internalDir/linkToDir2" ),
711
+ fcView .mkdir (fileContextTestHelper .getTestRootPath (fcView ,
712
+ "/internalDir/linkToDir2" ),
715
713
FileContext .DEFAULT_PERM , false );
716
714
});
717
715
}
718
716
@ Test
719
717
public void testInternalMkdirNew () throws IOException {
720
718
assertThrows (AccessControlException .class , () -> {
721
719
fcView .mkdir (fileContextTestHelper .getTestRootPath (fcView , "/dirNew" ),
722
- FileContext .DEFAULT_PERM , false );
720
+ FileContext .DEFAULT_PERM , false );
723
721
});
724
722
}
725
723
@ Test
726
724
public void testInternalMkdirNew2 () throws IOException {
727
725
assertThrows (AccessControlException .class , () -> {
728
726
fcView .mkdir (fileContextTestHelper .getTestRootPath (fcView , "/internalDir/dirNew" ),
729
- FileContext .DEFAULT_PERM , false );
727
+ FileContext .DEFAULT_PERM , false );
730
728
});
731
729
}
732
730
@@ -791,7 +789,7 @@ public void testInternalDeleteExisting() throws IOException {
791
789
@ Test
792
790
public void testInternalDeleteExisting2 () throws IOException {
793
791
assertThrows (AccessControlException .class , () -> {
794
- assertTrue (fcView .getFileStatus (new Path ("/internalDir/linkToDir2" )).isDirectory (),
792
+ assertTrue (fcView .getFileStatus (new Path ("/internalDir/linkToDir2" )).isDirectory (),
795
793
"Delete of link to dir should succeed" );
796
794
fcView .delete (new Path ("/internalDir/linkToDir2" ), false );
797
795
});
@@ -809,7 +807,7 @@ public void testInternalRename1() throws IOException {
809
807
@ Test
810
808
public void testInternalRename2 () throws IOException {
811
809
assertThrows (AccessControlException .class , () -> {
812
- assertTrue (fcView .getFileStatus (new Path ("/internalDir/linkToDir2" )).isDirectory (),
810
+ assertTrue (fcView .getFileStatus (new Path ("/internalDir/linkToDir2" )).isDirectory (),
813
811
"linkTODir2 should be a dir" );
814
812
fcView .rename (new Path ("/internalDir/linkToDir2" ), new Path ("/internalDir/dir1" ));
815
813
});
0 commit comments