Package org.jclouds.s3.domain

Examples of org.jclouds.s3.domain.Payer


               .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

         currentOwner = null;
      } else if (qName.equals("StorageClass")) {
         builder.storageClass(ObjectMetadata.StorageClass.valueOf(currentOrNull(currentText)));
      } else if (qName.equals("Contents")) {
         contents.add(builder.build());
         builder = new ObjectMetadataBuilder().bucket(bucketName);
      } else if (qName.equals("Name")) {
         this.bucketName = currentOrNull(currentText);
         builder.bucket(bucketName);
      } else if (qName.equals("Prefix")) {
         String prefix = currentOrNull(currentText);
View Full Code Here

      checkNotNull(length,
            "please invoke payload.getContentMetadata().setContentLength(length) prior to multipart upload");
      long chunkSize = algorithm.calculateChunkSize(length);
      int partCount = algorithm.getParts();
      if (partCount > 0) {
         ObjectMetadataBuilder builder = ObjectMetadataBuilder.create().key(key)
            .contentType(metadata.getContentType())
            .contentDisposition(metadata.getContentDisposition());
         String uploadId = client.initiateMultipartUpload(container, builder.build());
         try {
            SortedMap<Integer, String> etags = Maps.newTreeMap();
            int part;
            while ((part = algorithm.getNextPart()) <= partCount) {
               prepareUploadPart(container, key, uploadId, part, payload, algorithm.getNextChunkOffset(), chunkSize,
View Full Code Here

      return parser;
   }

   @Test
   public void testPayerRequester() throws HttpException {
      Payer payer = createParser()
               .parse(
                        Strings2
                                 .toInputStream("<RequestPaymentConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Payer>Requester</Payer></RequestPaymentConfiguration>"));
      assertEquals(payer, Payer.REQUESTER);
View Full Code Here

   }

   @Test
   public void testPayerBucketOwner() throws HttpException {
      Payer payer = createParser()
               .parse(
                        Strings2
                                 .toInputStream("<RequestPaymentConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Payer>BucketOwner</Payer></RequestPaymentConfiguration>"));
      assertEquals(payer, Payer.BUCKET_OWNER);
View Full Code Here

      return parser;
   }

   @Test
   public void testPayerRequester() throws HttpException {
      Payer payer = createParser()
               .parse(
                        Strings2
                                 .toInputStream("<RequestPaymentConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Payer>Requester</Payer></RequestPaymentConfiguration>"));
      assertEquals(payer, Payer.REQUESTER);
View Full Code Here

   }

   @Test
   public void testPayerBucketOwner() throws HttpException {
      Payer payer = createParser()
               .parse(
                        Strings2
                                 .toInputStream("<RequestPaymentConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Payer>BucketOwner</Payer></RequestPaymentConfiguration>"));
      assertEquals(payer, Payer.BUCKET_OWNER);
View Full Code Here

TOP

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

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.