Package org.jclouds.s3.domain.internal

Examples of org.jclouds.s3.domain.internal.ListBucketResponseImpl


         getApi().copyObject(containerName, sourceKey, destinationContainer, destinationKey,
                  overrideMetadataWith(metadata));

         validateContent(destinationContainer, destinationKey);

         ObjectMetadata objectMeta = getApi().headObject(destinationContainer, destinationKey);

         assertEquals(objectMeta.getUserMetadata(), metadata);
      } finally {
         returnContainer(containerName);
         returnContainer(destinationContainer);

      }
View Full Code Here


            storageClass(StorageClass.REDUCED_REDUNDANCY));

         S3Client s3Client = S3Client.class.cast(view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi());
         ListBucketResponse response = s3Client.listBucket(containerName, withPrefix(blobName));

         ObjectMetadata metadata = response.iterator().next();
         assertEquals(metadata.getStorageClass(), StorageClass.REDUCED_REDUNDANCY);

      } finally {
         returnContainer(containerName);
      }
   }
View Full Code Here

@Test(groups = "unit", testName = "BindObjectMetadataToRequestTest")
public class BindObjectMetadataToRequestTest extends BaseS3AsyncClientTest<S3AsyncClient> {

   @Test
   public void testPassWithMinimumDetailsAndPayload5GB() {
      ObjectMetadata md = ObjectMetadataBuilder.create().key("foo").build();

      HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build();
      BindObjectMetadataToRequest binder = injector.getInstance(BindObjectMetadataToRequest.class);

      assertEquals(binder.bindToRequest(request, md), HttpRequest.builder().method("POST")
View Full Code Here

               .endpoint("http://localhost").addHeader("Content-Type", "binary/octet-stream").build());
   }

   @Test
   public void testExtendedPropertiesBind() {
      ObjectMetadata md = ObjectMetadataBuilder.create().key("foo").cacheControl("no-cache").userMetadata(
               ImmutableMap.of("foo", "bar")).build();

      HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build();
      BindObjectMetadataToRequest binder = injector.getInstance(BindObjectMetadataToRequest.class);
View Full Code Here

                        "binary/octet-stream")).build());
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testNoKeyIsBad() {
      ObjectMetadata md = ObjectMetadataBuilder.create().build();

      HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build();
      BindObjectMetadataToRequest binder = injector.getInstance(BindObjectMetadataToRequest.class);
      binder.bindToRequest(request, md);
   }
View Full Code Here

@Test(groups = "unit", testName = "BindObjectMetadataToRequestTest")
public class BindObjectMetadataToRequestTest extends BaseS3AsyncClientTest<S3AsyncClient> {

   @Test
   public void testPassWithMinimumDetailsAndPayload5GB() {
      ObjectMetadata md = ObjectMetadataBuilder.create().key("foo").build();

      HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build();
      BindObjectMetadataToRequest binder = injector.getInstance(BindObjectMetadataToRequest.class);

      assertEquals(binder.bindToRequest(request, md), HttpRequest.builder().method("POST")
View Full Code Here

               .endpoint("http://localhost").addHeader("Content-Type", "binary/octet-stream").build());
   }

   @Test
   public void testExtendedPropertiesBind() {
      ObjectMetadata md = ObjectMetadataBuilder.create().key("foo").cacheControl("no-cache").userMetadata(
               ImmutableMap.of("foo", "bar")).build();

      HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build();
      BindObjectMetadataToRequest binder = injector.getInstance(BindObjectMetadataToRequest.class);
View Full Code Here

                        "binary/octet-stream")).build());
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testNoKeyIsBad() {
      ObjectMetadata md = ObjectMetadataBuilder.create().build();

      HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build();
      BindObjectMetadataToRequest binder = injector.getInstance(BindObjectMetadataToRequest.class);
      binder.bindToRequest(request, md);
   }
View Full Code Here

            storageClass(StorageClass.REDUCED_REDUNDANCY));

         S3Client s3Client = S3Client.class.cast(view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi());
         ListBucketResponse response = s3Client.listBucket(containerName, withPrefix(blobName));

         ObjectMetadata metadata = response.iterator().next();
         assertEquals(metadata.getStorageClass(), StorageClass.REDUCED_REDUNDANCY);

      } finally {
         returnContainer(containerName);
      }
   }
View Full Code Here

   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
      checkArgument(checkNotNull(input, "input") instanceof ObjectMetadata,
               "this binder is only valid for ObjectMetadata!");
      checkNotNull(request, "request");

      ObjectMetadata md = ObjectMetadata.class.cast(input);
      checkArgument(md.getKey() != null, "objectMetadata.getKey() must be set!");

      request = metadataPrefixer.bindToRequest(request, md.getUserMetadata());

      Builder<String, String> headers = ImmutableMultimap.builder();
      if (md.getCacheControl() != null) {
         headers.put(HttpHeaders.CACHE_CONTROL, md.getCacheControl());
      }

      if (md.getContentMetadata().getContentDisposition() != null) {
         headers.put("Content-Disposition", md.getContentMetadata().getContentDisposition());
      }

      if (md.getContentMetadata().getContentEncoding() != null) {
         headers.put("Content-Encoding", md.getContentMetadata().getContentEncoding());
      }
      if (md.getContentMetadata().getContentType() != null) {
         headers.put(HttpHeaders.CONTENT_TYPE, md.getContentMetadata().getContentType());
      } else {
         headers.put(HttpHeaders.CONTENT_TYPE, "binary/octet-stream");
      }

      if (md.getContentMetadata().getContentMD5() != null) {
         headers.put("Content-MD5", base64().encode(md.getContentMetadata().getContentMD5()));
      }

      return (R) request.toBuilder().replaceHeaders(headers.build()).build();
   }
View Full Code Here

TOP

Related Classes of org.jclouds.s3.domain.internal.ListBucketResponseImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.