@@ -86,7 +86,7 @@ public class TestRouterMountTable {
8686 public static void globalSetUp () throws Exception {
8787 startTime = Time .now ();
8888
89- // Build and start a federated cluster
89+ // Build and start a federated cluster.
9090 cluster = new StateStoreDFSCluster (false , 2 );
9191 Configuration conf = new RouterConfigBuilder ()
9292 .stateStore ()
@@ -99,7 +99,7 @@ public static void globalSetUp() throws Exception {
9999 cluster .startRouters ();
100100 cluster .waitClusterUp ();
101101
102- // Get the end points
102+ // Get the end points.
103103 nnContext0 = cluster .getNamenode ("ns0" , null );
104104 nnContext1 = cluster .getNamenode ("ns1" , null );
105105 nnFs0 = nnContext0 .getFileSystem ();
@@ -139,18 +139,18 @@ public void clearMountTable() throws IOException {
139139 @ Test
140140 public void testReadOnly () throws Exception {
141141
142- // Add a read only entry
142+ // Add a read only entry.
143143 MountTable readOnlyEntry = MountTable .newInstance (
144144 "/readonly" , Collections .singletonMap ("ns0" , "/testdir" ));
145145 readOnlyEntry .setReadOnly (true );
146146 assertTrue (addMountTable (readOnlyEntry ));
147147
148- // Add a regular entry
148+ // Add a regular entry.
149149 MountTable regularEntry = MountTable .newInstance (
150150 "/regular" , Collections .singletonMap ("ns0" , "/testdir" ));
151151 assertTrue (addMountTable (regularEntry ));
152152
153- // Create a folder which should show in all locations
153+ // Create a folder which should show in all locations.
154154 assertTrue (routerFs .mkdirs (new Path ("/regular/newdir" )));
155155
156156 FileStatus dirStatusNn =
@@ -163,7 +163,7 @@ public void testReadOnly() throws Exception {
163163 routerFs .getFileStatus (new Path ("/readonly/newdir" ));
164164 assertTrue (dirStatusReadOnly .isDirectory ());
165165
166- // It should fail writing into a read only path
166+ // It should fail writing into a read only path.
167167 try {
168168 routerFs .mkdirs (new Path ("/readonly/newdirfail" ));
169169 fail ("We should not be able to write into a read only mount point" );
@@ -188,7 +188,7 @@ private boolean addMountTable(final MountTable entry) throws IOException {
188188 AddMountTableEntryResponse addResponse =
189189 mountTableManager .addMountTableEntry (addRequest );
190190
191- // Reload the Router cache
191+ // Reload the Router cache.
192192 mountTable .loadCache (true );
193193
194194 return addResponse .getStatus ();
@@ -208,7 +208,7 @@ private boolean updateMountTable(final MountTable entry) throws IOException {
208208 UpdateMountTableEntryResponse updateResponse =
209209 mountTableManager .updateMountTableEntry (updateRequest );
210210
211- // Reload the Router cache
211+ // Reload the Router cache.
212212 mountTable .loadCache (true );
213213
214214 return updateResponse .getStatus ();
@@ -220,7 +220,7 @@ private boolean updateMountTable(final MountTable entry) throws IOException {
220220 */
221221 @ Test
222222 public void testMountPointLimit () throws Exception {
223- // Add mount table entry
223+ // Add mount table entry.
224224 MountTable addEntry = MountTable .newInstance ("/testdir-shortlength" ,
225225 Collections .singletonMap ("ns0" , "/testdir-shortlength" ));
226226 assertTrue (addMountTable (addEntry ));
@@ -249,7 +249,7 @@ public void testMountPointLimit() throws Exception {
249249 @ Test
250250 public void testListFilesTime () throws Exception {
251251 try {
252- // Add mount table entry
252+ // Add mount table entry.
253253 MountTable addEntry = MountTable .newInstance ("/testdir" ,
254254 Collections .singletonMap ("ns0" , "/testdir" ));
255255 assertTrue (addMountTable (addEntry ));
@@ -266,7 +266,7 @@ public void testListFilesTime() throws Exception {
266266 Collections .singletonMap ("ns0" , "/test" ));
267267 assertTrue (addMountTable (addEntry ));
268268
269- // Create test dir in NN
269+ // Create test dir in NN.
270270 assertTrue (nnFs0 .mkdirs (new Path ("/newdir" )));
271271
272272 Map <String , Long > pathModTime = new TreeMap <>();
@@ -288,12 +288,12 @@ public void testListFilesTime() throws Exception {
288288 for (FileStatus file : iterator ) {
289289 pathModTime .put (file .getPath ().getName (), file .getModificationTime ());
290290 }
291- // Fetch listing
291+ // Fetch listing.
292292 DirectoryListing listing =
293293 routerProtocol .getListing ("/" , HdfsFileStatus .EMPTY_NAME , false );
294294 Iterator <String > pathModTimeIterator = pathModTime .keySet ().iterator ();
295295
296- // Match date/time for each path returned
296+ // Match date/time for each path returned.
297297 for (HdfsFileStatus f : listing .getPartialListing ()) {
298298 String fileName = pathModTimeIterator .next ();
299299 String currentFile = f .getFullPath (new Path ("/" )).getName ();
@@ -304,7 +304,7 @@ public void testListFilesTime() throws Exception {
304304 assertTrue (currentTime > startTime );
305305 assertEquals (currentTime , expectedTime );
306306 }
307- // Verify the total number of results found/matched
307+ // Verify the total number of results found/matched.
308308 assertEquals (pathModTime .size (), listing .getPartialListing ().length );
309309 } finally {
310310 nnFs0 .delete (new Path ("/newdir" ), true );
@@ -646,7 +646,7 @@ public void testPathInException() throws Exception {
646646 @ Test
647647 public void testGetListingWithTrailingSlash () throws IOException {
648648 try {
649- // Add mount table entry
649+ // Add mount table entry.
650650 MountTable addEntry = MountTable .newInstance ("/testlist" ,
651651 Collections .singletonMap ("ns0" , "/testlist" ));
652652 assertTrue (addMountTable (addEntry ));
@@ -659,11 +659,11 @@ public void testGetListingWithTrailingSlash() throws IOException {
659659
660660 nnFs0 .mkdirs (new Path ("/testlist/tmp0" ));
661661 nnFs1 .mkdirs (new Path ("/testlist/tmp1" ));
662- // Fetch listing
662+ // Fetch listing.
663663 DirectoryListing list = routerProtocol .getListing (
664664 "/testlist/" , HdfsFileStatus .EMPTY_NAME , false );
665665 HdfsFileStatus [] statuses = list .getPartialListing ();
666- // should return tmp0 and tmp1
666+ // Should return tmp0 and tmp1.
667667 assertEquals (2 , statuses .length );
668668 } finally {
669669 nnFs0 .delete (new Path ("/testlist/tmp0" ), true );
@@ -674,7 +674,7 @@ public void testGetListingWithTrailingSlash() throws IOException {
674674 @ Test
675675 public void testGetFileInfoWithMountPoint () throws IOException {
676676 try {
677- // Add mount table entry
677+ // Add mount table entry.
678678 MountTable addEntry = MountTable .newInstance ("/testgetfileinfo/ns1/dir" ,
679679 Collections .singletonMap ("ns1" , "/testgetfileinfo/ns1/dir" ));
680680 assertTrue (addMountTable (addEntry ));
@@ -740,27 +740,27 @@ public void testRenameMountPoint() throws Exception {
740740 nnFs0 .mkdirs (new Path ("/testrename1/sub/sub" ));
741741 nnFs0 .mkdirs (new Path ("/testrename2" ));
742742
743- // Success: rename a directory to a mount point
743+ // Success: rename a directory to a mount point.
744744 assertTrue (nnFs0 .exists (new Path ("/testrename1/sub/sub" )));
745745 assertFalse (nnFs0 .exists (new Path ("/testrename2/sub" )));
746746 assertTrue (routerFs .rename (new Path ("/testrename1/sub/sub" ),
747747 new Path ("/testrename2" )));
748748 assertFalse (nnFs0 .exists (new Path ("/testrename1/sub/sub" )));
749749 assertTrue (nnFs0 .exists (new Path ("/testrename2/sub" )));
750750
751- // Fail: the target already exists
751+ // Fail: the target already exists.
752752 nnFs0 .mkdirs (new Path ("/testrename1/sub/sub" ));
753753 assertFalse (routerFs .rename (new Path ("/testrename1/sub/sub" ),
754754 new Path ("/testrename2" )));
755755
756- // Fail: The src is a mount point
756+ // Fail: The src is a mount point.
757757 LambdaTestUtils .intercept (AccessControlException .class ,
758758 "The operation is not allowed because the path: "
759759 + "/testrename1/sub is a mount point" ,
760760 () -> routerFs .rename (new Path ("/testrename1/sub" ),
761761 new Path ("/testrename2/sub" )));
762762
763- // Fail: There is a mount point under the src
763+ // Fail: There is a mount point under the src.
764764 LambdaTestUtils .intercept (AccessControlException .class ,
765765 "The operation is not allowed because there are mount points: "
766766 + "sub under the path: /testrename1" ,
@@ -791,7 +791,7 @@ public void testListStatusMountPoint() throws Exception {
791791 @ Test
792792 public void testGetEnclosingRoot () throws Exception {
793793
794- // Add a read only entry
794+ // Add a read only entry.
795795 MountTable readOnlyEntry = MountTable .newInstance (
796796 "/readonly" , Collections .singletonMap ("ns0" , "/testdir" ));
797797 readOnlyEntry .setReadOnly (true );
@@ -802,13 +802,13 @@ public void testGetEnclosingRoot() throws Exception {
802802 assertEquals (routerFs .getEnclosingRoot (new Path ("/regular" )),
803803 routerFs .getEnclosingRoot (routerFs .getEnclosingRoot (new Path ("/regular" ))));
804804
805- // Add a regular entry
805+ // Add a regular entry.
806806 MountTable regularEntry = MountTable .newInstance (
807807 "/regular" , Collections .singletonMap ("ns0" , "/testdir" ));
808808 assertTrue (addMountTable (regularEntry ));
809809 assertEquals (routerFs .getEnclosingRoot (new Path ("/regular" )), new Path ("/regular" ));
810810
811- // path does not need to exist
811+ // Path does not need to exist.
812812 assertEquals (routerFs .getEnclosingRoot (new Path ("/regular/pathDNE" )), new Path ("/regular" ));
813813
814814 }
0 commit comments