Package org.jclouds.s3.domain

Examples of org.jclouds.s3.domain.ListBucketResponse


      try {
         String prefix = "apps";
         addTenObjectsUnderPrefix(bucketName, prefix);
         add15UnderRoot(bucketName);

         ListBucketResponse bucket = getApi().listBucket(bucketName, withPrefix("apps/"));
         assert !bucket.isTruncated();
         assertEquals(bucket.size(), 10);
         assertEquals(bucket.getPrefix(), "apps/");
      } finally {
         returnContainer(bucketName);
      }

   }
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

   public void testListBucketMarker() throws InterruptedException, ExecutionException, TimeoutException {
      String bucketName = getContainerName();
      try {
         addAlphabetUnderRoot(bucketName);
         ListBucketResponse bucket = getApi().listBucket(bucketName, afterMarker("y"));
         assertEquals(bucket.getMarker(), "y");
         assert !bucket.isTruncated();
         assertEquals(bucket.size(), 1);
      } finally {
         returnContainer(bucketName);
      }
   }
View Full Code Here

      String bucketName = getContainerName();
      try {
         String prefix = "apps";
         addTenObjectsUnderPrefix(bucketName, prefix);
         add15UnderRoot(bucketName);
         ListBucketResponse bucket = getApi().listBucket(bucketName, delimiter("/"));
         assertEquals(bucket.getDelimiter(), "/");
         assert !bucket.isTruncated();
         assertEquals(bucket.size(), 15);
         assertEquals(bucket.getCommonPrefixes().size(), 1);
      } finally {
         returnContainer(bucketName);
      }

   }
View Full Code Here

      try {
         String prefix = "apps";
         addTenObjectsUnderPrefix(bucketName, prefix);
         add15UnderRoot(bucketName);

         ListBucketResponse bucket = getApi().listBucket(bucketName, withPrefix("apps/"));
         assert !bucket.isTruncated();
         assertEquals(bucket.size(), 10);
         assertEquals(bucket.getPrefix(), "apps/");
      } finally {
         returnContainer(bucketName);
      }

   }
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

    */
   @Test
   public void testSinglePageResult() throws Exception {
      S3Client api = createMock(S3Client.class);
      ListBucketOptions options = new ListBucketOptions();
      ListBucketResponse response = new ListBucketHandlerTest().expected();

      expect(api.listBucket("bucket", options)).andReturn(response).once();

      EasyMock.replay(api);

View Full Code Here

   @Test
   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

   private DateService dateService = new SimpleDateFormatDateService();

   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/list_bucket.xml");

      ListBucketResponse result = createParser().parse(is);

      ListBucketResponse expected = expected();

      assertEquals(result.toString(), expected.toString());
   }
View Full Code Here

   public ListBucketResponse expected() {
      CanonicalUser owner = new CanonicalUser("e1a5f66a480ca99a4fdfe8e318c3020446c9989d7004e7778029fbcc5d990fa0",
               "ferncam");
      String bucket = "adriancole.org.jclouds.aws.s3.amazons3testdelimiter";
      ListBucketResponse expected = new ListBucketResponseImpl(bucket, ImmutableList.<ObjectMetadata> of(
               new ObjectMetadataBuilder().key("apps/0").bucket(bucket).uri(URI.create("http://bucket.com/apps/0"))
                        .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:08.000Z")).eTag(
                                 "\"c82e6a0025c31c5de5947fda62ac51ab\"").owner(owner).contentMD5(
                                 base16().lowerCase().decode("c82e6a0025c31c5de5947fda62ac51ab")).contentLength(8l).build(),
               new ObjectMetadataBuilder().key("apps/1").bucket(bucket).uri(URI.create("http://bucket.com/apps/1"))
View Full Code Here

TOP

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

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.