xiaoyuyao commented on a change in pull request #1202: HDDS-1884. Support
Bucket addACL operations for OM HA.
URL: https://github.com/apache/hadoop/pull/1202#discussion_r309844892
##########
File path:
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHA.java
##########
@@ -759,6 +766,43 @@ public void testReadRequest() throws Exception {
}
}
+ @Test
+ public void testAddBucketAcl() throws Exception {
+ OzoneBucket ozoneBucket = setupBucket();
+ String remoteUserName = "remoteUser";
+ OzoneAcl defaultUserAcl = new OzoneAcl(USER, remoteUserName,
+ READ, DEFAULT);
+
+ OzoneObj ozoneObj = OzoneObjInfo.Builder.newBuilder()
+ .setResType(OzoneObj.ResourceType.BUCKET)
+ .setStoreType(OzoneObj.StoreType.OZONE)
+ .setVolumeName(ozoneBucket.getVolumeName())
+ .setBucketName(ozoneBucket.getName()).build();
+
+ boolean addAcl = objectStore.addAcl(ozoneObj, defaultUserAcl);
+ Assert.assertTrue(addAcl);
+
+ ozoneBucket.addAcls(Collections.singletonList(defaultUserAcl));
+ List<OzoneAcl> acls = ozoneBucket.getAcls();
+
+ Assert.assertTrue(containsAcl(defaultUserAcl, acls));
+
+ addAcl = objectStore.addAcl(ozoneObj, defaultUserAcl);
+ Assert.assertFalse(addAcl);
+ }
+
+ private boolean containsAcl(OzoneAcl ozoneAcl, List<OzoneAcl> ozoneAcls) {
+ for (OzoneAcl acl : ozoneAcls) {
+ if (acl.getType().equals(ozoneAcl.getType())
+ && acl.getName().equals(ozoneAcl.getName())
+ && acl.getAclBitSet().equals(ozoneAcl.getAclBitSet())
Review comment:
containersAcl() may not work for the case when the added is OR-ed into
existing BitSet where .equals will not be the same?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]