Search in sources :

Example 21 with OMRequest

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest in project ozone by apache.

the class TestS3MultipartUploadCompleteRequest method testValidateAndUpdateCacheNoSuchMultipartUploadError.

@Test
public void testValidateAndUpdateCacheNoSuchMultipartUploadError() throws Exception {
    String volumeName = UUID.randomUUID().toString();
    String bucketName = UUID.randomUUID().toString();
    String keyName = UUID.randomUUID().toString();
    OMRequestTestUtils.addVolumeAndBucketToDB(volumeName, bucketName, omMetadataManager);
    List<Part> partList = new ArrayList<>();
    OMRequest completeMultipartRequest = doPreExecuteCompleteMPU(volumeName, bucketName, keyName, UUID.randomUUID().toString(), partList);
    // Doing  complete multipart upload request with out initiate.
    S3MultipartUploadCompleteRequest s3MultipartUploadCompleteRequest = getS3MultipartUploadCompleteReq(completeMultipartRequest);
    OMClientResponse omClientResponse = s3MultipartUploadCompleteRequest.validateAndUpdateCache(ozoneManager, 3L, ozoneManagerDoubleBufferHelper);
    Assert.assertEquals(OzoneManagerProtocolProtos.Status.NO_SUCH_MULTIPART_UPLOAD_ERROR, omClientResponse.getOMResponse().getStatus());
}
Also used : OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) OMClientResponse(org.apache.hadoop.ozone.om.response.OMClientResponse) Part(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Part) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 22 with OMRequest

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest in project ozone by apache.

the class TestOMCancelPrepareRequest method submitCancelPrepareRequest.

private void submitCancelPrepareRequest() throws Exception {
    OMRequest omRequest = doPreExecute(createCancelPrepareRequest());
    OMCancelPrepareRequest cancelPrepareRequest = new OMCancelPrepareRequest(omRequest);
    OMClientResponse omClientResponse = cancelPrepareRequest.validateAndUpdateCache(ozoneManager, LOG_INDEX, ozoneManagerDoubleBufferHelper);
    Assert.assertEquals(OzoneManagerProtocolProtos.Status.OK, omClientResponse.getOMResponse().getStatus());
}
Also used : OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) OMClientResponse(org.apache.hadoop.ozone.om.response.OMClientResponse)

Example 23 with OMRequest

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest in project ozone by apache.

the class TestOMCancelPrepareRequest method doPreExecute.

private OMRequest doPreExecute(OMRequest originalOmRequest) throws Exception {
    OMOpenKeysDeleteRequest omOpenKeysDeleteRequest = new OMOpenKeysDeleteRequest(originalOmRequest);
    OMRequest modifiedOmRequest = omOpenKeysDeleteRequest.preExecute(ozoneManager);
    // Will not be equal, as UserInfo will be set.
    Assert.assertNotEquals(originalOmRequest, modifiedOmRequest);
    return modifiedOmRequest;
}
Also used : OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) OMOpenKeysDeleteRequest(org.apache.hadoop.ozone.om.request.key.OMOpenKeysDeleteRequest)

Example 24 with OMRequest

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest in project ozone by apache.

the class TestS3InitiateMultipartUploadRequest method testValidateAndUpdateCacheWithVolumeNotFound.

@Test
public void testValidateAndUpdateCacheWithVolumeNotFound() throws Exception {
    String volumeName = UUID.randomUUID().toString();
    String bucketName = UUID.randomUUID().toString();
    String keyName = UUID.randomUUID().toString();
    OMRequest modifiedRequest = doPreExecuteInitiateMPU(volumeName, bucketName, keyName);
    S3InitiateMultipartUploadRequest s3InitiateMultipartUploadRequest = getS3InitiateMultipartUploadReq(modifiedRequest);
    OMClientResponse omClientResponse = s3InitiateMultipartUploadRequest.validateAndUpdateCache(ozoneManager, 100L, ozoneManagerDoubleBufferHelper);
    Assert.assertEquals(OzoneManagerProtocolProtos.Status.VOLUME_NOT_FOUND, omClientResponse.getOMResponse().getStatus());
    String multipartKey = getMultipartKey(volumeName, bucketName, keyName, modifiedRequest.getInitiateMultiPartUploadRequest().getKeyArgs().getMultipartUploadID());
    Assert.assertNull(omMetadataManager.getOpenKeyTable(s3InitiateMultipartUploadRequest.getBucketLayout()).get(multipartKey));
    Assert.assertNull(omMetadataManager.getMultipartInfoTable().get(multipartKey));
}
Also used : OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) OMClientResponse(org.apache.hadoop.ozone.om.response.OMClientResponse) Test(org.junit.Test)

Example 25 with OMRequest

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest in project ozone by apache.

the class TestS3MultipartRequest method doPreExecuteInitiateMPU.

/**
 * Perform preExecute of Initiate Multipart upload request for given
 * volume, bucket and key name.
 * @param volumeName
 * @param bucketName
 * @param keyName
 * @return OMRequest - returned from preExecute.
 */
protected OMRequest doPreExecuteInitiateMPU(String volumeName, String bucketName, String keyName) throws Exception {
    OMRequest omRequest = OMRequestTestUtils.createInitiateMPURequest(volumeName, bucketName, keyName);
    S3InitiateMultipartUploadRequest s3InitiateMultipartUploadRequest = getS3InitiateMultipartUploadReq(omRequest);
    OMRequest modifiedRequest = s3InitiateMultipartUploadRequest.preExecute(ozoneManager);
    Assert.assertNotEquals(omRequest, modifiedRequest);
    Assert.assertTrue(modifiedRequest.hasInitiateMultiPartUploadRequest());
    Assert.assertNotNull(modifiedRequest.getInitiateMultiPartUploadRequest().getKeyArgs().getMultipartUploadID());
    Assert.assertTrue(modifiedRequest.getInitiateMultiPartUploadRequest().getKeyArgs().getModificationTime() > 0);
    return modifiedRequest;
}
Also used : OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest)

Aggregations

OMRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest)209 Test (org.junit.Test)119 OMClientResponse (org.apache.hadoop.ozone.om.response.OMClientResponse)106 OMResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse)30 OmKeyInfo (org.apache.hadoop.ozone.om.helpers.OmKeyInfo)27 ArrayList (java.util.ArrayList)26 OzoneAcl (org.apache.hadoop.ozone.OzoneAcl)26 KeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs)24 OzoneManagerProtocolProtos (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos)19 DeleteKeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeyArgs)17 OmKeyArgs (org.apache.hadoop.ozone.om.helpers.OmKeyArgs)16 OMException (org.apache.hadoop.ozone.om.exceptions.OMException)15 OmBucketInfo (org.apache.hadoop.ozone.om.helpers.OmBucketInfo)15 IOException (java.io.IOException)13 OmKeyLocationInfo (org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo)11 OmVolumeArgs (org.apache.hadoop.ozone.om.helpers.OmVolumeArgs)10 CommitKeyRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CommitKeyRequest)7 VolumeInfo (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.VolumeInfo)7 UpgradeFinalizationStatus (org.apache.hadoop.hdds.protocol.proto.HddsProtos.UpgradeFinalizationStatus)5 Text (org.apache.hadoop.io.Text)5