Package org.jclouds.s3.domain.internal

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


               URI.create("http://localhost")).build());
   }

   @Test
   public void testExtendedPropertiesBind() {
      S3Object object = injector.getInstance(S3Object.Factory.class).create(null);
      Payload payload = Payloads.newStringPayload("");
      payload.getContentMetadata().setContentLength(5368709120l);
      object.setPayload(payload);
      object.getMetadata().setKey("foo");
      object.getMetadata().setCacheControl("no-cache");
      object.getMetadata().setUserMetadata(ImmutableMap.of("foo", "bar"));

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

      assertEquals(binder.bindToRequest(request, object), HttpRequest.builder().method("PUT").endpoint(
View Full Code Here


               ImmutableMultimap.of("Cache-Control", "no-cache", "x-amz-meta-foo", "bar")).build());
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testNoContentLengthIsBad() {
      S3Object object = injector.getInstance(S3Object.Factory.class).create(null);
      Payload payload = Payloads.newStringPayload("");
      payload.getContentMetadata().setContentLength(null);
      object.setPayload(payload);
      object.getMetadata().setKey("foo");

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

      binder.bindToRequest(request, object);
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testNoKeyIsBad() {
      S3Object object = injector.getInstance(S3Object.Factory.class).create(null);
      Payload payload = Payloads.newStringPayload("");
      payload.getContentMetadata().setContentLength(5368709120000l);
      object.setPayload(payload);

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

      binder.bindToRequest(request, object);
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testOver5GBIsBad() {
      S3Object object = injector.getInstance(S3Object.Factory.class).create(null);
      Payload payload = Payloads.newStringPayload("");
      payload.getContentMetadata().setContentLength(5368709120000l);
      object.setPayload(payload);
      object.getMetadata().setKey("foo");

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

      }
   }

   protected void addAlphabetUnderRoot(String bucketName) {
      for (char letter = 'a'; letter <= 'z'; letter++) {
         S3Object blob = getApi().newS3Object();
         blob.getMetadata().setKey(letter + "");
         blob.setPayload(letter + "content");
         getApi().putObject(bucketName, blob);
      }
   }
View Full Code Here

      }
   }

   protected void add15UnderRoot(String bucketName) {
      for (int i = 0; i < 15; i++) {
         S3Object blob = getApi().newS3Object();
         blob.getMetadata().setKey(i + "");
         blob.setPayload(i + "content");
         getApi().putObject(bucketName, blob);
      }
   }
View Full Code Here

      }
   }

   protected void addTenObjectsUnderPrefix(String bucketName, String prefix) {
      for (int i = 0; i < 10; i++) {
         S3Object blob = getApi().newS3Object();
         blob.getMetadata().setKey(prefix + "/" + i);
         blob.setPayload(i + "content");
         getApi().putObject(bucketName, blob);
      }
   }
View Full Code Here

      filter.appendAmzHeaders(canonicalizedHeaders, builder);
      assertEquals(builder.toString(), S3Headers.USER_METADATA_PREFIX + "adrian:foo\n");
   }

   private HttpRequest putObject() throws NoSuchMethodException {
      S3Object object = blobToS3Object.apply(BindBlobToMultipartFormTest.TEST_BLOB);
      object.getMetadata().getUserMetadata().put("Adrian", "foo");
      return processor.createRequest(method(S3AsyncClient.class, "putObject", String.class,
            S3Object.class, PutObjectOptions[].class), ImmutableList.<Object> of("bucket", object));
   }
View Full Code Here

   public ListBucketHandler(DateService dateParser) {
      this.dateParser = dateParser;
   }

   public ListBucketResponse getResult() {
      return new ListBucketResponseImpl(bucketName, contents.build(), prefix, marker,
               (isTruncated && nextMarker == null) ? currentKey : nextMarker, maxResults, delimiter, isTruncated,
               commonPrefixes.build());
   }
View Full Code Here

   public void testMultiPageResult() throws Exception {
      String nextMarker = "FOO";
      S3Client api = createMock(S3Client.class);
      ListBucketOptions options = new ListBucketOptions();
      ListBucketResponse response2 = new ListBucketHandlerTest().expected();
      ListBucketResponse response1 = new ListBucketResponseImpl(response2.getName(), response2, response2.getPrefix(),
            null, nextMarker, response2.getMaxKeys(), response2.getDelimiter(), false, response2.getCommonPrefixes());

      expect(api.listBucket("bucket", options)).andReturn(response1).once();
      expect(api.listBucket("bucket", options.afterMarker(nextMarker))).andReturn(response2).once();
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.