GCS support for conditional copies
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/commit/5e9f60b6 Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/tree/5e9f60b6 Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/diff/5e9f60b6 Branch: refs/heads/master Commit: 5e9f60b6fff2bba9ece2f9b4dfdf96d4681a18f7 Parents: 08e44bc 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-labs-google/blob/5e9f60b6/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java index 4f2cf3d..10ebfc1 100644 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java +++ b/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-labs-google/blob/5e9f60b6/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java index 803307f..8aa3fe1 100644 --- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java +++ b/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(); + } }
