Package org.jclouds.s3.domain

Examples of org.jclouds.s3.domain.ListBucketResponse


   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 testListMyBucketsWithDelimiterSlashAndCommonPrefixesAppsSlash() throws HttpException {

      ListBucketResponse bucket = createParser().parse(
               Strings2.toInputStream(listBucketWithSlashDelimiterAndCommonPrefixApps));
      assertEquals(bucket.getCommonPrefixes().iterator().next(), "apps/");
      assertEquals(bucket.getDelimiter(), "/");
      assert bucket.getMarker() == null;
   }
View Full Code Here

   }

   @Test
   public void testListMyBucketsWithPrefixAppsSlash() throws HttpException {

      ListBucketResponse bucket = createParser().parse(Strings2.toInputStream(listBucketWithPrefixAppsSlash));
      assertEquals(bucket.getPrefix(), "apps/");
      assertEquals(bucket.getMaxKeys(), 1000);
      assert bucket.getMarker() == null;
   }
View Full Code Here

    * Verifies that the parser doesn't barf if the timestamp returned in the
    * list bucket response has time zone designators in it.
    */
   @Test
   public void testListMyBucketsWithSecondsDate() {
      ListBucketResponse bucket = createParser().parse(
            Strings2.toInputStream(listBucketWithSecondsDate));
      ObjectMetadata expected = new CopyObjectResult(
            new SimpleDateFormatDateService()
                  .iso8601SecondsDateParse("2014-07-23T20:53:17+0000"),
            "\"92836a3ea45a6984d1b4d23a747d46bb\"");

      // Verify that the date was parsed successfully.
      ObjectMetadata metadata = bucket.iterator().next();
      assertEquals(metadata.getLastModified(), expected.getLastModified());
   }
View Full Code Here

   }

   public static final String listContainerResult = "<ListContainerHandler xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Name>adrianjbosstest</Name><Prefix></Prefix><Marker></Marker><MaxKeys>1000</MaxKeys><IsTruncated>false</IsTruncated><Contents><Key>3366</Key><LastModified>2009-03-12T02:00:13.000Z</LastModified><ETag>&quot;9d7bb64e8e18ee34eec06dd2cf37b766&quot;</ETag><Size>136</Size><Owner><ID>e1a5f66a480ca99a4fdfe8e318c3020446c9989d7004e7778029fbcc5d990fa0</ID><DisplayName>ferncam</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents></ListContainerHandler>";

   public void testCanParseListContainerResult() throws HttpException {
      ListBucketResponse container = runParseListContainerResult();
      assert !container.isTruncated();
      assert container.getName().equals("adrianjbosstest");
      assert container.size() == 1;
      ObjectMetadata object = container.iterator().next();
      assert object.getKey().equals("3366");
      Date expected = new SimpleDateFormatDateService().iso8601DateParse("2009-03-12T02:00:13.000Z");
      assert object.getLastModified().equals(expected) : String.format("expected %1$s, but got %1$s", expected, object
               .getLastModified());
      assertEquals(object.getETag(), "\"9d7bb64e8e18ee34eec06dd2cf37b766\"");
View Full Code Here

         Blob blob = blobStore.blobBuilder(blobName).payload("something").build();
         blobStore.putBlob(containerName, blob,
            storageClass(StorageClass.REDUCED_REDUNDANCY));

         S3Client s3Client = view.unwrapApi(S3Client.class);
         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

         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

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.