use of org.apache.hadoop.ozone.client.OzoneClientStub in project ozone by apache.
the class TestPartUpload method setUp.
@BeforeClass
public static void setUp() throws Exception {
OzoneClient client = new OzoneClientStub();
client.getObjectStore().createS3Bucket(OzoneConsts.S3_BUCKET);
HttpHeaders headers = Mockito.mock(HttpHeaders.class);
when(headers.getHeaderString(STORAGE_CLASS_HEADER)).thenReturn("STANDARD");
REST.setHeaders(headers);
REST.setClient(client);
REST.setOzoneConfiguration(new OzoneConfiguration());
}
use of org.apache.hadoop.ozone.client.OzoneClientStub in project ozone by apache.
the class TestRootList method setup.
@Before
public void setup() throws Exception {
// Create client stub and object store stub.
clientStub = new OzoneClientStub();
// Create HeadBucket and setClient to OzoneClientStub
rootEndpoint = new RootEndpoint();
rootEndpoint.setClient(clientStub);
}
use of org.apache.hadoop.ozone.client.OzoneClientStub in project ozone by apache.
the class TestS3GatewayMetrics method setup.
@Before
public void setup() throws Exception {
clientStub = new OzoneClientStub();
clientStub.getObjectStore().createS3Bucket(bucketName);
bucket = clientStub.getObjectStore().getS3Bucket(bucketName);
bucketEndpoint = new BucketEndpoint();
bucketEndpoint.setClient(clientStub);
rootEndpoint = new RootEndpoint();
rootEndpoint.setClient(clientStub);
keyEndpoint = new ObjectEndpoint();
keyEndpoint.setClient(clientStub);
keyEndpoint.setOzoneConfiguration(new OzoneConfiguration());
headers = Mockito.mock(HttpHeaders.class);
when(headers.getHeaderString(STORAGE_CLASS_HEADER)).thenReturn("STANDARD");
keyEndpoint.setHeaders(headers);
metrics = bucketEndpoint.getMetrics();
}
use of org.apache.hadoop.ozone.client.OzoneClientStub in project ozone by apache.
the class TestS3GatewayAuditLog method setup.
@Before
public void setup() throws Exception {
parametersMap.clear();
clientStub = new OzoneClientStub();
clientStub.getObjectStore().createS3Bucket(bucketName);
bucket = clientStub.getObjectStore().getS3Bucket(bucketName);
bucketEndpoint = new BucketEndpoint() {
@Override
protected Map<String, String> getAuditParameters() {
return parametersMap;
}
};
bucketEndpoint.setClient(clientStub);
rootEndpoint = new RootEndpoint();
rootEndpoint.setClient(clientStub);
keyEndpoint = new ObjectEndpoint() {
@Override
protected Map<String, String> getAuditParameters() {
return parametersMap;
}
};
keyEndpoint.setClient(clientStub);
keyEndpoint.setOzoneConfiguration(new OzoneConfiguration());
}
use of org.apache.hadoop.ozone.client.OzoneClientStub in project ozone by apache.
the class TestAbortMultipartUpload method testAbortMultipartUpload.
@Test
public void testAbortMultipartUpload() throws Exception {
String bucket = OzoneConsts.S3_BUCKET;
String key = OzoneConsts.KEY;
OzoneClient client = new OzoneClientStub();
client.getObjectStore().createS3Bucket(bucket);
HttpHeaders headers = Mockito.mock(HttpHeaders.class);
when(headers.getHeaderString(STORAGE_CLASS_HEADER)).thenReturn("STANDARD");
ObjectEndpoint rest = new ObjectEndpoint();
rest.setHeaders(headers);
rest.setClient(client);
rest.setOzoneConfiguration(new OzoneConfiguration());
Response response = rest.initializeMultipartUpload(bucket, key);
assertEquals(200, response.getStatus());
MultipartUploadInitiateResponse multipartUploadInitiateResponse = (MultipartUploadInitiateResponse) response.getEntity();
assertNotNull(multipartUploadInitiateResponse.getUploadID());
String uploadID = multipartUploadInitiateResponse.getUploadID();
// Abort multipart upload
response = rest.delete(bucket, key, uploadID);
assertEquals(204, response.getStatus());
// test with unknown upload Id.
try {
rest.delete(bucket, key, "random");
} catch (OS3Exception ex) {
assertEquals(S3ErrorTable.NO_SUCH_UPLOAD.getCode(), ex.getCode());
assertEquals(S3ErrorTable.NO_SUCH_UPLOAD.getErrorMessage(), ex.getErrorMessage());
}
}
Aggregations