GCS support for conditional copies
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/2499cb0a Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/2499cb0a Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/2499cb0a Branch: refs/heads/master Commit: 2499cb0ac27b49a6d0b915730dcee13ed72c7a45 Parents: 165e9af Author: Andrew Gaul <[email protected]> Authored: Fri Feb 12 19:33:10 2016 -0800 Committer: Andrew Gaul <[email protected]> Committed: Fri Feb 12 20:44:18 2016 -0800 ---------------------------------------------------------------------- .../blobstore/GoogleCloudStorageBlobStore.java | 13 ++++++ ...ogleCloudStorageBlobIntegrationLiveTest.java | 48 ++++++++++++++++++++ 2 files changed, 61 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/2499cb0a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java ---------------------------------------------------------------------- diff --git a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java index 4f2cf3d..10ebfc1 100644 --- a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java +++ b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java @@ -308,6 +308,19 @@ public final class GoogleCloudStorageBlobStore extends BaseBlobStore { @Override public String copyBlob(String fromContainer, String fromName, String toContainer, String toName, CopyOptions options) { + if (options.ifMatch() != null) { + throw new UnsupportedOperationException("GCS does not support ifMatch"); + } + if (options.ifNoneMatch() != null) { + throw new UnsupportedOperationException("GCS does not support ifNoneMatch"); + } + if (options.ifModifiedSince() != null) { + throw new UnsupportedOperationException("GCS does not support ifModifiedSince"); + } + if (options.ifUnmodifiedSince() != null) { + throw new UnsupportedOperationException("GCS does not support ifUnmodifiedSince"); + } + if (options.contentMetadata() == null && options.userMetadata() == null) { return api.getObjectApi().copyObject(toContainer, Strings2.urlEncode(toName), fromContainer, Strings2.urlEncode(fromName)).etag(); http://git-wip-us.apache.org/repos/asf/jclouds/blob/2499cb0a/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java ---------------------------------------------------------------------- diff --git a/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java b/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java index 803307f..8aa3fe1 100644 --- a/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java +++ b/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java @@ -268,4 +268,52 @@ public class GoogleCloudStorageBlobIntegrationLiveTest extends BaseBlobIntegrati throw new SkipException("request signing not supported on GCS", uoe); } } + + @Override + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testCopyIfMatch() throws Exception { + super.testCopyIfMatch(); + } + + @Override + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testCopyIfMatchNegative() throws Exception { + super.testCopyIfMatch(); + } + + @Override + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testCopyIfNoneMatch() throws Exception { + super.testCopyIfNoneMatch(); + } + + @Override + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testCopyIfNoneMatchNegative() throws Exception { + super.testCopyIfNoneMatch(); + } + + @Override + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testCopyIfModifiedSince() throws Exception { + super.testCopyIfModifiedSince(); + } + + @Override + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testCopyIfModifiedSinceNegative() throws Exception { + super.testCopyIfModifiedSince(); + } + + @Override + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testCopyIfUnmodifiedSince() throws Exception { + super.testCopyIfUnmodifiedSince(); + } + + @Override + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testCopyIfUnmodifiedSinceNegative() throws Exception { + super.testCopyIfUnmodifiedSince(); + } }
