Search in sources :

Example 1 with OMPrefixAddAclRequest

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());
}
Also used : PrefixManager(org.apache.hadoop.ozone.om.PrefixManager) OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) PrefixManagerImpl(org.apache.hadoop.ozone.om.PrefixManagerImpl) OzoneAcl(org.apache.hadoop.ozone.OzoneAcl) OMClientResponse(org.apache.hadoop.ozone.om.response.OMClientResponse) OMPrefixAddAclRequest(org.apache.hadoop.ozone.om.request.key.acl.prefix.OMPrefixAddAclRequest) Test(org.junit.Test)

Aggregations

OzoneAcl (org.apache.hadoop.ozone.OzoneAcl)1 PrefixManager (org.apache.hadoop.ozone.om.PrefixManager)1 PrefixManagerImpl (org.apache.hadoop.ozone.om.PrefixManagerImpl)1 OMPrefixAddAclRequest (org.apache.hadoop.ozone.om.request.key.acl.prefix.OMPrefixAddAclRequest)1 OMClientResponse (org.apache.hadoop.ozone.om.response.OMClientResponse)1 OMRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest)1 Test (org.junit.Test)1