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());
}
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());
}
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;
}
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));
}
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;
}
Aggregations