hemantk-12 commented on code in PR #4125:
URL: https://github.com/apache/ozone/pull/4125#discussion_r1087167605
##########
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:
It is general practice to add new line at the end of the file. AFAIK, the
idea comes from the Unix file system. There is no problem as such if it is not
there. It is more of a coding guideline.
https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file,
https://gist.github.com/OleksiyRudenko/d51388345ea55767b7672307fe35adf3
--
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]