Search in sources :

Example 16 with OzoneClientStub

use of org.apache.hadoop.ozone.client.OzoneClientStub in project ozone by apache.

the class TestBucketHead method setup.

@Before
public void setup() throws Exception {
    clientStub = new OzoneClientStub();
    clientStub.getObjectStore().createS3Bucket(bucketName);
    // Create HeadBucket and setClient to OzoneClientStub
    bucketEndpoint = new BucketEndpoint();
    bucketEndpoint.setClient(clientStub);
}
Also used : OzoneClientStub(org.apache.hadoop.ozone.client.OzoneClientStub) Before(org.junit.Before)

Example 17 with OzoneClientStub

use of org.apache.hadoop.ozone.client.OzoneClientStub in project ozone by apache.

the class TestBucketPut method setup.

@Before
public void setup() throws Exception {
    // Create client stub and object store stub.
    clientStub = new OzoneClientStub();
    // Create HeadBucket and setClient to OzoneClientStub
    bucketEndpoint = new BucketEndpoint();
    bucketEndpoint.setClient(clientStub);
}
Also used : OzoneClientStub(org.apache.hadoop.ozone.client.OzoneClientStub) Before(org.junit.Before)

Example 18 with OzoneClientStub

use of org.apache.hadoop.ozone.client.OzoneClientStub in project ozone by apache.

the class TestListParts 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());
    Response response = REST.initializeMultipartUpload(OzoneConsts.S3_BUCKET, OzoneConsts.KEY);
    MultipartUploadInitiateResponse multipartUploadInitiateResponse = (MultipartUploadInitiateResponse) response.getEntity();
    assertNotNull(multipartUploadInitiateResponse.getUploadID());
    uploadID = multipartUploadInitiateResponse.getUploadID();
    assertEquals(200, response.getStatus());
    String content = "Multipart Upload";
    ByteArrayInputStream body = new ByteArrayInputStream(content.getBytes(UTF_8));
    response = REST.put(OzoneConsts.S3_BUCKET, OzoneConsts.KEY, content.length(), 1, uploadID, body);
    assertNotNull(response.getHeaderString("ETag"));
    response = REST.put(OzoneConsts.S3_BUCKET, OzoneConsts.KEY, content.length(), 2, uploadID, body);
    assertNotNull(response.getHeaderString("ETag"));
    response = REST.put(OzoneConsts.S3_BUCKET, OzoneConsts.KEY, content.length(), 3, uploadID, body);
    assertNotNull(response.getHeaderString("ETag"));
}
Also used : Response(javax.ws.rs.core.Response) HttpHeaders(javax.ws.rs.core.HttpHeaders) ByteArrayInputStream(java.io.ByteArrayInputStream) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) OzoneClientStub(org.apache.hadoop.ozone.client.OzoneClientStub) OzoneClient(org.apache.hadoop.ozone.client.OzoneClient) BeforeClass(org.junit.BeforeClass)

Example 19 with OzoneClientStub

use of org.apache.hadoop.ozone.client.OzoneClientStub in project ozone by apache.

the class TestObjectPut method setup.

@Before
public void setup() throws IOException {
    // Create client stub and object store stub.
    clientStub = new OzoneClientStub();
    // Create bucket
    clientStub.getObjectStore().createS3Bucket(bucketName);
    clientStub.getObjectStore().createS3Bucket(destBucket);
    // Create PutObject and setClient to OzoneClientStub
    objectEndpoint = new ObjectEndpoint();
    objectEndpoint.setClient(clientStub);
    objectEndpoint.setOzoneConfiguration(new OzoneConfiguration());
}
Also used : OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) OzoneClientStub(org.apache.hadoop.ozone.client.OzoneClientStub) Before(org.junit.Before)

Aggregations

OzoneClientStub (org.apache.hadoop.ozone.client.OzoneClientStub)19 OzoneClient (org.apache.hadoop.ozone.client.OzoneClient)11 OzoneConfiguration (org.apache.hadoop.hdds.conf.OzoneConfiguration)9 Before (org.junit.Before)9 HttpHeaders (javax.ws.rs.core.HttpHeaders)8 Test (org.junit.Test)7 Response (javax.ws.rs.core.Response)5 OzoneBucket (org.apache.hadoop.ozone.client.OzoneBucket)5 ByteArrayInputStream (java.io.ByteArrayInputStream)2 Map (java.util.Map)2 BucketEndpoint (org.apache.hadoop.ozone.s3.endpoint.BucketEndpoint)2 DeleteObject (org.apache.hadoop.ozone.s3.endpoint.MultiDeleteRequest.DeleteObject)2 ObjectEndpoint (org.apache.hadoop.ozone.s3.endpoint.ObjectEndpoint)2 RootEndpoint (org.apache.hadoop.ozone.s3.endpoint.RootEndpoint)2 BeforeClass (org.junit.BeforeClass)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 ECReplicationConfig (org.apache.hadoop.hdds.client.ECReplicationConfig)1 OzoneInputStream (org.apache.hadoop.ozone.client.io.OzoneInputStream)1