Package org.jclouds.s3.domain.AccessControlList

Examples of org.jclouds.s3.domain.AccessControlList.Grant


   public void testEnableBucketLoggingOwner() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(S3AsyncClient.class, "enableBucketLogging", String.class, BucketLogging.class);
      GeneratedHttpRequest request = processor
               .createRequest(method, ImmutableList.<Object> of("bucket", new BucketLogging("mylogs", "access_log-", ImmutableSet
                        .<Grant> of(new Grant(new EmailAddressGrantee("adrian@jclouds.org"), Permission.FULL_CONTROL)))));

      assertRequestLineEquals(request, "PUT https://bucket." + url + "/?logging HTTP/1.1");
      assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/bucket_logging.xml")),
               "text/xml", false);
View Full Code Here


            currentGrantee = new CanonicalUserGrantee(currentId, currentDisplayName);
         } else if ("Group".equals(currentGranteeType)) {
            currentGrantee = new GroupGrantee(URI.create(currentId));
         }
      } else if (qName.equals("Grant")) {
         targetGrants.add(new Grant(currentGrantee, currentPermission));
      } else if (qName.equals("ID") || qName.equals("EmailAddress") || qName.equals("URI")) {
         currentId = currentOrNull(currentText);
      } else if (qName.equals("DisplayName")) {
         currentDisplayName = currentOrNull(currentText);
      } else if (qName.equals("Permission")) {
View Full Code Here

      try {
         assertNull(getApi().getBucketLogging(bucketName));

         setupAclForBucketLoggingTarget(targetBucket);
         final BucketLogging logging = new BucketLogging(targetBucket, "access_log-",
               ImmutableSet.<Grant> of(new Grant(new EmailAddressGrantee(StubS3AsyncClient.TEST_ACL_EMAIL),
                     Permission.FULL_CONTROL)));

         getApi().enableBucketLogging(bucketName, logging);

         assertConsistencyAware(new Runnable() {
View Full Code Here

   public void testEnableBucketLoggingOwner() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(S3Client.class, "enableBucketLogging", String.class, BucketLogging.class);
      GeneratedHttpRequest request = processor
               .createRequest(method, ImmutableList.<Object> of("bucket", new BucketLogging("mylogs", "access_log-", ImmutableSet
                        .<Grant> of(new Grant(new EmailAddressGrantee("adrian@jclouds.org"), Permission.FULL_CONTROL)))));

      assertRequestLineEquals(request, "PUT https://bucket." + url + "/?logging HTTP/1.1");
      assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/bucket_logging.xml")),
               "text/xml", false);
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

      try {
         assertNull(getApi().getBucketLogging(bucketName));

         setupAclForBucketLoggingTarget(targetBucket);
         final BucketLogging logging = new BucketLogging(targetBucket, "access_log-",
               ImmutableSet.<Grant> of(new Grant(new EmailAddressGrantee(TEST_ACL_EMAIL), FULL_CONTROL)));

         getApi().enableBucketLogging(bucketName, logging);

         assertConsistencyAware(new Runnable() {
            public void run() {
View Full Code Here

@Test(groups = "unit", testName = "BucketLoggingHandlerTest")
public class BucketLoggingHandlerTest extends BaseHandlerTest {
   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/bucket_logging.xml");

      BucketLogging expected = new BucketLogging("mylogs", "access_log-", ImmutableSet.<Grant> of(new Grant(
            new EmailAddressGrantee("adrian@jclouds.org"), Permission.FULL_CONTROL)));
      BucketLoggingHandler handler = injector.getInstance(BucketLoggingHandler.class);
      BucketLogging result = factory.create(handler).parse(is);

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

            currentGrantee = new CanonicalUserGrantee(currentId, currentDisplayName);
         } else if ("Group".equals(currentGranteeType)) {
            currentGrantee = new GroupGrantee(URI.create(currentId));
         }
      } else if (qName.equals("Grant")) {
         targetGrants.add(new Grant(currentGrantee, currentPermission));
      } else if (qName.equals("ID") || qName.equals("EmailAddress") || qName.equals("URI")) {
         currentId = currentOrNull(currentText);
      } else if (qName.equals("DisplayName")) {
         currentDisplayName = currentOrNull(currentText);
      } else if (qName.equals("Permission")) {
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

TOP

Related Classes of org.jclouds.s3.domain.AccessControlList.Grant

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.