GeorgeJahad commented on code in PR #4125:
URL: https://github.com/apache/ozone/pull/4125#discussion_r1071541408
##########
hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java:
##########
@@ -96,14 +108,38 @@ 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 = "Delimiters (/) not allowed following " +
Review Comment:
NIT: if you are going to check for a precise error message, I would define
it in a string constant in the class being tested, and then use that string
constant in the test. DRY!
--
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]