use of org.apache.hadoop.ozone.om.request.key.acl.prefix.OMPrefixAddAclRequest in project ozone by apache.
the class TestOMPrefixAclRequest method testAclRequest.
@Test
public void testAclRequest() throws Exception {
PrefixManager prefixManager = new PrefixManagerImpl(ozoneManager.getMetadataManager(), true);
when(ozoneManager.getPrefixManager()).thenReturn(prefixManager);
// Manually add volume, bucket and key to DB
OMRequestTestUtils.addVolumeAndBucketToDB(volumeName, bucketName, omMetadataManager);
OMRequestTestUtils.addKeyToTable(false, false, volumeName, bucketName, keyName, clientID, replicationType, replicationFactor, 1L, omMetadataManager);
OzoneAcl acl = OzoneAcl.parseAcl("user:bilbo:rwdlncxy[ACCESS]");
// Create KeyAddAcl request
OMRequest originalRequest = createAddAclkeyRequest(acl);
OMPrefixAddAclRequest omKeyPrefixAclRequest = new OMPrefixAddAclRequest(originalRequest);
omKeyPrefixAclRequest.preExecute(ozoneManager);
// Execute original request
OMClientResponse omClientResponse = omKeyPrefixAclRequest.validateAndUpdateCache(ozoneManager, 2, ozoneManagerDoubleBufferHelper);
Assert.assertEquals(OzoneManagerProtocolProtos.Status.OK, omClientResponse.getOMResponse().getStatus());
}
Aggregations