mirror of https://github.com/apache/jclouds.git
Issue 64: eventual consistency acl doesn't always commit immediately
git-svn-id: http://jclouds.googlecode.com/svn/trunk@1844 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
44eed3917f
commit
02d79627bf
|
@ -39,6 +39,7 @@ import org.jclouds.aws.s3.domain.S3Object;
|
|||
import org.jclouds.aws.s3.domain.AccessControlList.GroupGranteeURI;
|
||||
import org.jclouds.aws.s3.domain.AccessControlList.Permission;
|
||||
import org.jclouds.aws.s3.options.PutObjectOptions;
|
||||
import org.jclouds.util.Utils;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
|
@ -90,14 +91,17 @@ public class GetAccessControlListIntegrationTest extends S3IntegrationTest {
|
|||
@Test
|
||||
void testPublicReadOnObject() throws InterruptedException, ExecutionException, TimeoutException,
|
||||
IOException {
|
||||
String publicReadObjectKey = "public-read-acl";
|
||||
String bucketName = getBucketName();
|
||||
final String publicReadObjectKey = "public-read-acl";
|
||||
final String bucketName = getBucketName();
|
||||
try {
|
||||
client.putObject(bucketName, new S3Object(publicReadObjectKey, ""), new PutObjectOptions()
|
||||
.withAcl(CannedAccessPolicy.PUBLIC_READ));
|
||||
|
||||
AccessControlList acl = client.getObjectACL(bucketName, publicReadObjectKey).get(10,
|
||||
TimeUnit.SECONDS);
|
||||
assertEventually(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
AccessControlList acl = client.getObjectACL(bucketName, publicReadObjectKey).get(
|
||||
10, TimeUnit.SECONDS);
|
||||
|
||||
assertEquals(acl.getGrants().size(), 2);
|
||||
assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 1);
|
||||
|
@ -105,6 +109,12 @@ public class GetAccessControlListIntegrationTest extends S3IntegrationTest {
|
|||
String ownerId = acl.getOwner().getId();
|
||||
assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
|
||||
assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ));
|
||||
} catch (Exception e) {
|
||||
Utils.<RuntimeException> rethrowIfRuntimeOrSameType(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} finally {
|
||||
returnBucket(bucketName);
|
||||
}
|
||||
|
@ -114,16 +124,18 @@ public class GetAccessControlListIntegrationTest extends S3IntegrationTest {
|
|||
@Test
|
||||
void testPublicWriteOnObject() throws InterruptedException, ExecutionException,
|
||||
TimeoutException, IOException {
|
||||
String publicReadWriteObjectKey = "public-read-write-acl";
|
||||
String bucketName = getBucketName();
|
||||
final String publicReadWriteObjectKey = "public-read-write-acl";
|
||||
final String bucketName = getBucketName();
|
||||
try {
|
||||
// Public Read-Write object
|
||||
client.putObject(bucketName, new S3Object(publicReadWriteObjectKey, ""),
|
||||
new PutObjectOptions().withAcl(CannedAccessPolicy.PUBLIC_READ_WRITE));
|
||||
|
||||
AccessControlList acl = client.getObjectACL(bucketName, publicReadWriteObjectKey).get(10,
|
||||
TimeUnit.SECONDS);
|
||||
|
||||
assertEventually(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
AccessControlList acl = client.getObjectACL(bucketName, publicReadWriteObjectKey)
|
||||
.get(10, TimeUnit.SECONDS);
|
||||
assertEquals(acl.getGrants().size(), 3);
|
||||
assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 2);
|
||||
assertTrue(acl.getOwner() != null);
|
||||
|
@ -134,6 +146,11 @@ public class GetAccessControlListIntegrationTest extends S3IntegrationTest {
|
|||
assertFalse(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ_ACP));
|
||||
assertFalse(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.WRITE_ACP));
|
||||
assertFalse(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.FULL_CONTROL));
|
||||
} catch (Exception e) {
|
||||
Utils.<RuntimeException> rethrowIfRuntimeOrSameType(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
returnBucket(bucketName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue