From cf6d316bd00dd76c648ecdd0c84ceb4fac444317 Mon Sep 17 00:00:00 2001 From: hsbhathiya Date: Sat, 24 Jan 2015 03:51:17 +0530 Subject: [PATCH] JCLOUDS-805: Fixed BucketApiLiveTest Failures --- .../config/GoogleCloudStorageOAuthScopes.java | 2 ++ .../googlecloudstorage/features/BucketApiExpectTest.java | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageOAuthScopes.java b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageOAuthScopes.java index 8537e8bd71..358c9a0d74 100644 --- a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageOAuthScopes.java +++ b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageOAuthScopes.java @@ -45,6 +45,8 @@ import com.google.common.collect.ImmutableList; if (path.endsWith("/acl") || path.endsWith("/defaultObjectAcl") // || path.contains("/acl/") || path.contains("/defaultObjectAcl/")) { return fullControlScopes(); + } else if (input.getMethod().equalsIgnoreCase("PUT") || input.getMethod().equalsIgnoreCase("PATCH")) { + return fullControlScopes(); } return readOrWriteScopes().forRequest(input); } diff --git a/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiExpectTest.java b/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiExpectTest.java index 2cfee9b531..4970b193e8 100644 --- a/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiExpectTest.java +++ b/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiExpectTest.java @@ -169,7 +169,7 @@ public class BucketApiExpectTest extends BaseGoogleCloudStorageApiExpectTest { HttpResponse updateResponse = HttpResponse.builder().statusCode(200) .payload(staticPayloadFromResource("/bucket_update_response.json")).build(); - BucketApi api = requestsSendResponses(requestForScopes(STORAGE_READWRITE_SCOPE), TOKEN_RESPONSE, + BucketApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE, updateRequest, updateResponse).getBucketApi(); assertEquals(api.updateBucket(EXPECTED_TEST_BUCKET, template), new BucketUpdateTest().expected()); @@ -197,7 +197,7 @@ public class BucketApiExpectTest extends BaseGoogleCloudStorageApiExpectTest { HttpResponse updateResponse = HttpResponse.builder().statusCode(200) .payload(staticPayloadFromResource("/bucket_update_response.json")).build(); - BucketApi api = requestsSendResponses(requestForScopes(STORAGE_READWRITE_SCOPE), TOKEN_RESPONSE, + BucketApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE, updateRequest, updateResponse).getBucketApi(); assertEquals(api.updateBucket(EXPECTED_TEST_BUCKET, template, options), new BucketUpdateTest().expected()); @@ -222,7 +222,7 @@ public class BucketApiExpectTest extends BaseGoogleCloudStorageApiExpectTest { HttpResponse patchResponse = HttpResponse.builder().statusCode(200) .payload(staticPayloadFromResource("/bucket_update_response.json")).build(); - BucketApi api = requestsSendResponses(requestForScopes(STORAGE_READWRITE_SCOPE), TOKEN_RESPONSE, patchRequest, + BucketApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE, patchRequest, patchResponse).getBucketApi(); assertEquals(api.patchBucket(EXPECTED_TEST_BUCKET, template), new BucketUpdateTest().expected()); @@ -250,7 +250,7 @@ public class BucketApiExpectTest extends BaseGoogleCloudStorageApiExpectTest { HttpResponse patchResponse = HttpResponse.builder().statusCode(200) .payload(staticPayloadFromResource("/bucket_update_response.json")).build(); - BucketApi api = requestsSendResponses(requestForScopes(STORAGE_READWRITE_SCOPE), TOKEN_RESPONSE, patchRequest, + BucketApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE, patchRequest, patchResponse).getBucketApi(); assertEquals(api.updateBucket(EXPECTED_TEST_BUCKET, template, options), new BucketUpdateTest().expected());