Package org.jclouds.s3.domain

Examples of org.jclouds.s3.domain.ObjectMetadataBuilder


   protected AccessControlList sanitizeUploadedACL(AccessControlList acl) {
      // Replace any email address grantees with canonical user grantees, using
      // the acl's owner ID as the surrogate replacement.
      for (Grant grant : acl.getGrants()) {
         if (grant.getGrantee() instanceof EmailAddressGrantee) {
            EmailAddressGrantee emailGrantee = (EmailAddressGrantee) grant.getGrantee();
            String id = emailGrantee.getEmailAddress().equals(TEST_ACL_EMAIL) ? TEST_ACL_ID : acl.getOwner().getId();
            grant.setGrantee(new CanonicalUserGrantee(id, acl.getOwner().getDisplayName()));
         }
      }
      return acl;
   }
View Full Code Here


public class BindBucketLoggingToXmlPayloadTest  extends BaseHandlerTest {

   public void testApplyInputStream() throws IOException {
     
      BucketLogging bucketLogging = new BucketLogging("mylogs", "access_log-", ImmutableSet
               .<Grant> of(new Grant(new EmailAddressGrantee("adrian@jclouds.org"),
                        Permission.FULL_CONTROL)));
    
      String expected = Strings2.toStringAndClose(getClass().getResourceAsStream(
               "/bucket_logging.xml"));
     
View Full Code Here

@Test(groups = "unit", testName = "BindBucketLoggingToXmlPayloadTest")
public class BindBucketLoggingToXmlPayloadTest  extends BaseHandlerTest {

   public void testApplyInputStream() throws IOException {
     
      BucketLogging bucketLogging = new BucketLogging("mylogs", "access_log-", ImmutableSet
               .<Grant> of(new Grant(new EmailAddressGrantee("adrian@jclouds.org"),
                        Permission.FULL_CONTROL)));
    
      String expected = Strings2.toStringAndClose(getClass().getResourceAsStream(
               "/bucket_logging.xml"));
View Full Code Here

   public ListenableFuture<? extends Set<BucketMetadata>> listOwnedBuckets() {
      return immediateFuture(Sets.newLinkedHashSet(Iterables.transform(containerToBlobs.keySet(),
               new Function<String, BucketMetadata>() {
                  public BucketMetadata apply(String name) {
                     return new BucketMetadata(name, null, null);
                  }

               })));
   }
View Full Code Here

   public ListenableFuture<? extends Set<BucketMetadata>> listOwnedBuckets() {
      return immediateFuture(Sets.newLinkedHashSet(Iterables.transform(containerToBlobs.keySet(),
               new Function<String, BucketMetadata>() {
                  public BucketMetadata apply(String name) {
                     return new BucketMetadata(name, null, null);
                  }

               })));
   }
View Full Code Here

      }
   }

   public void endElement(String uri, String name, String qName) {
      if (qName.equals("ID")) {
         currentOwner = new CanonicalUser(currentOrNull(currentText));
      } else if (qName.equals("DisplayName")) {
         currentOwner.setDisplayName(currentOrNull(currentText));
      } else if (qName.equals("Key")) { // content stuff
         currentKey = currentOrNull(currentText);
         builder.key(currentKey);
View Full Code Here

         Blob blob = blobStore.blobBuilder(blobName).payload("something").build();
         blobStore.putBlob(containerName, blob,
            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

         Blob blob = blobStore.blobBuilder(blobName).payload("something").build();
         blobStore.putBlob(containerName, blob,
            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 void testListBucketMaxResults() throws InterruptedException, ExecutionException, TimeoutException {
      String bucketName = getContainerName();
      try {
         addAlphabetUnderRoot(bucketName);
         ListBucketResponse bucket = getApi().listBucket(bucketName, maxResults(5));
         assertEquals(bucket.getMaxKeys(), 5);
         assert bucket.isTruncated();
         assertEquals(bucket.size(), 5);
      } finally {
         returnContainer(bucketName);
      }
   }
View Full Code Here

      http.getPayload().getContentMetadata().setContentLength(1025l);
      http.getPayload().getContentMetadata().setContentDisposition("contentDisposition");
      http.getPayload().getContentMetadata().setContentEncoding("encoding");
      http.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_OCTET_STREAM);

      MutableObjectMetadata response = parser.apply(http);

      MutableObjectMetadataImpl expects = new MutableObjectMetadataImpl();
      expects.setCacheControl("cacheControl");
      expects.getContentMetadata().setContentDisposition("contentDisposition");
      expects.getContentMetadata().setContentEncoding("encoding");
View Full Code Here

TOP

Related Classes of org.jclouds.s3.domain.ObjectMetadataBuilder

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.