xBis7 commented on code in PR #4125:
URL: https://github.com/apache/ozone/pull/4125#discussion_r1087632290


##########
hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java:
##########
@@ -96,14 +108,37 @@ public void checkUrlTypes() throws OzoneClientException, 
IOException {
     Assert.assertEquals("key1/key3/key", address.getKeyName());
     Assert.assertFalse("this should not be a prefix",
         address.isPrefix());
+  }
 
+  @Test
+  public void checkPrefixUrlType() throws OzoneClientException {
     address = new OzoneAddress(prefix + "vol1/bucket/prefix");
     address.ensurePrefixAddress();
     Assert.assertEquals("vol1", address.getVolumeName());
     Assert.assertEquals("bucket", address.getBucketName());
     Assert.assertEquals("prefix", address.getKeyName());
     Assert.assertTrue("this should be a prefix",
         address.isPrefix());
+  }
+
+  @Test
+  public void checkSnapshotUrlType() throws OzoneClientException {
+    address = new OzoneAddress(prefix + "vol1/bucket/.snapshot/snap1");
+    address.ensureSnapshotAddress();
+    Assert.assertEquals("vol1", address.getVolumeName());
+    Assert.assertEquals("bucket", address.getBucketName());
+    Assert.assertEquals(".snapshot/snap1", address.getSnapshotName());
+    Assert.assertEquals(".snapshot/snap1", address.getKeyName());
+
+
+    String message = "Only a snapshot name with " +
+        "a snapshot indicator is accepted";
+
+    address = new OzoneAddress(prefix + "vol1/bucket/.snapshot");
+
+    exception.expect(OzoneClientException.class);
+    exception.expectMessage(message);
 
+    address.ensureSnapshotAddress();
   }
 }

Review Comment:
   @hemantk-12 That's interesting! Thanks for letting me know, I'll keep it in 
mind.



-- 
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]

Reply via email to