|
35 | 35 | import com.google.cloud.storage.Acl.Role;
|
36 | 36 | import com.google.cloud.storage.Acl.User;
|
37 | 37 | import com.google.cloud.storage.Blob;
|
38 |
| -import com.google.cloud.storage.BlobId; |
39 | 38 | import com.google.cloud.storage.BlobInfo;
|
40 | 39 | import com.google.cloud.storage.Bucket;
|
41 | 40 | import com.google.cloud.storage.BucketInfo;
|
|
45 | 44 | import com.google.cloud.storage.Storage.BlobTargetOption;
|
46 | 45 | import com.google.cloud.storage.Storage.BucketField;
|
47 | 46 | import com.google.cloud.storage.Storage.BucketGetOption;
|
48 |
| -import com.google.cloud.storage.Storage.BucketSourceOption; |
49 | 47 | import com.google.cloud.storage.Storage.BucketTargetOption;
|
50 | 48 | import com.google.cloud.storage.StorageException;
|
51 | 49 | import com.google.cloud.storage.StorageRoles;
|
|
63 | 61 | import java.time.Duration;
|
64 | 62 | import java.util.ArrayList;
|
65 | 63 | import java.util.Collections;
|
66 |
| -import java.util.HashSet; |
67 | 64 | import java.util.Iterator;
|
68 | 65 | import java.util.List;
|
69 | 66 | import java.util.Map;
|
@@ -97,37 +94,6 @@ public class ITAccessTest {
|
97 | 94 |
|
98 | 95 | @Inject public Generator generator;
|
99 | 96 |
|
100 |
| - @Test |
101 |
| - @CrossRun.Ignore(transports = Transport.GRPC) |
102 |
| - public void bucketAcl_requesterPays_true() { |
103 |
| - String projectId = storage.getOptions().getProjectId(); |
104 |
| - testBucketAclRequesterPays(requesterPaysBucket, BucketSourceOption.userProject(projectId)); |
105 |
| - } |
106 |
| - |
107 |
| - @Test |
108 |
| - @CrossRun.Ignore(transports = Transport.GRPC) |
109 |
| - public void bucketAcl_requesterPays_false() { |
110 |
| - testBucketAclRequesterPays(bucket); |
111 |
| - } |
112 |
| - |
113 |
| - private void testBucketAclRequesterPays( |
114 |
| - BucketInfo bucket, Storage.BucketSourceOption... bucketOptions) { |
115 |
| - // TODO: break into individual tests |
116 |
| - assertNull(storage.getAcl(bucket.getName(), User.ofAllAuthenticatedUsers(), bucketOptions)); |
117 |
| - assertFalse(storage.deleteAcl(bucket.getName(), User.ofAllAuthenticatedUsers(), bucketOptions)); |
118 |
| - Acl acl = Acl.of(User.ofAllAuthenticatedUsers(), Role.READER); |
119 |
| - assertNotNull(storage.createAcl(bucket.getName(), acl, bucketOptions)); |
120 |
| - Acl updatedAcl = |
121 |
| - storage.updateAcl( |
122 |
| - bucket.getName(), acl.toBuilder().setRole(Role.WRITER).build(), bucketOptions); |
123 |
| - assertEquals(Role.WRITER, updatedAcl.getRole()); |
124 |
| - Set<Acl> acls = new HashSet<>(); |
125 |
| - acls.addAll(storage.listAcls(bucket.getName(), bucketOptions)); |
126 |
| - assertTrue(acls.contains(updatedAcl)); |
127 |
| - assertTrue(storage.deleteAcl(bucket.getName(), User.ofAllAuthenticatedUsers(), bucketOptions)); |
128 |
| - assertNull(storage.getAcl(bucket.getName(), User.ofAllAuthenticatedUsers(), bucketOptions)); |
129 |
| - } |
130 |
| - |
131 | 97 | @Test
|
132 | 98 | public void bucket_defaultAcl_get() {
|
133 | 99 | String bucketName = bucket.getName();
|
@@ -1061,68 +1027,6 @@ public void testEnableAndDisableBucketPolicyOnlyOnExistingBucket() throws Except
|
1061 | 1027 | }
|
1062 | 1028 | }
|
1063 | 1029 |
|
1064 |
| - @Test |
1065 |
| - @CrossRun.Ignore(transports = Transport.GRPC) |
1066 |
| - public void testBlobAcl() { |
1067 |
| - // TODO: break this test up into each of the respective scenarios |
1068 |
| - // 1. get ACL for specific entity |
1069 |
| - // 2. Create an ACL for specific entity |
1070 |
| - // 3. Update ACL to change role of a specific entity |
1071 |
| - // 4. List ACLs for an object |
1072 |
| - // 5. Delete an ACL for a specific entity |
1073 |
| - // 6. Attempt to get an acl for an object that doesn't exist |
1074 |
| - // 7. Attempt to delete an acl for an object that doesn't exist |
1075 |
| - // 8. Attempt to create an acl for an object that doesn't exist |
1076 |
| - // 9. Attempt to update an acl for an object that doesn't exist |
1077 |
| - // 10. Attempt to list acls for an object that doesn't exist |
1078 |
| - BlobId blobId = BlobId.of(bucket.getName(), "test-blob-acl"); |
1079 |
| - BlobInfo blob = BlobInfo.newBuilder(blobId).build(); |
1080 |
| - storage.create(blob); |
1081 |
| - assertNull(storage.getAcl(blobId, User.ofAllAuthenticatedUsers())); |
1082 |
| - Acl acl = Acl.of(User.ofAllAuthenticatedUsers(), Role.READER); |
1083 |
| - assertNotNull(storage.createAcl(blobId, acl)); |
1084 |
| - Acl updatedAcl = storage.updateAcl(blobId, acl.toBuilder().setRole(Role.OWNER).build()); |
1085 |
| - assertEquals(Role.OWNER, updatedAcl.getRole()); |
1086 |
| - Set<Acl> acls = new HashSet<>(storage.listAcls(blobId)); |
1087 |
| - assertTrue(acls.contains(updatedAcl)); |
1088 |
| - assertTrue(storage.deleteAcl(blobId, User.ofAllAuthenticatedUsers())); |
1089 |
| - assertNull(storage.getAcl(blobId, User.ofAllAuthenticatedUsers())); |
1090 |
| - // test non-existing blob |
1091 |
| - BlobId otherBlobId = BlobId.of(bucket.getName(), "test-blob-acl", -1L); |
1092 |
| - try { |
1093 |
| - assertNull(storage.getAcl(otherBlobId, User.ofAllAuthenticatedUsers())); |
1094 |
| - fail("Expected an 'Invalid argument' exception"); |
1095 |
| - } catch (StorageException e) { |
1096 |
| - assertThat(e.getMessage()).contains("Invalid argument"); |
1097 |
| - } |
1098 |
| - |
1099 |
| - try { |
1100 |
| - assertFalse(storage.deleteAcl(otherBlobId, User.ofAllAuthenticatedUsers())); |
1101 |
| - fail("Expected an 'Invalid argument' exception"); |
1102 |
| - } catch (StorageException e) { |
1103 |
| - assertThat(e.getMessage()).contains("Invalid argument"); |
1104 |
| - } |
1105 |
| - |
1106 |
| - try { |
1107 |
| - storage.createAcl(otherBlobId, acl); |
1108 |
| - fail("Expected StorageException"); |
1109 |
| - } catch (StorageException ex) { |
1110 |
| - // expected |
1111 |
| - } |
1112 |
| - try { |
1113 |
| - storage.updateAcl(otherBlobId, acl); |
1114 |
| - fail("Expected StorageException"); |
1115 |
| - } catch (StorageException ex) { |
1116 |
| - // expected |
1117 |
| - } |
1118 |
| - try { |
1119 |
| - storage.listAcls(otherBlobId); |
1120 |
| - fail("Expected StorageException"); |
1121 |
| - } catch (StorageException ex) { |
1122 |
| - // expected |
1123 |
| - } |
1124 |
| - } |
1125 |
| - |
1126 | 1030 | static ImmutableList<Acl> dropEtags(List<Acl> defaultAcls) {
|
1127 | 1031 | return defaultAcls.stream()
|
1128 | 1032 | .map(ITAccessTest::dropEtag)
|
|
0 commit comments