You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2016/02/17 07:59:07 UTC

[1/2] jclouds-labs-google git commit: Convert CopyOptions into an AutoValue

Repository: jclouds-labs-google
Updated Branches:
  refs/heads/master 2eae14985 -> 5e9f60b6f


Convert CopyOptions into an AutoValue

This commit requires an interface change since AutoValue lacks support
for Optional and uses Nullable annotations instead.


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/08e44bce
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/tree/08e44bce
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/diff/08e44bce

Branch: refs/heads/master
Commit: 08e44bce49fe3722893b32278c8c49feb6201cac
Parents: 2eae149
Author: Andrew Gaul <ga...@apache.org>
Authored: Fri Feb 12 19:29:38 2016 -0800
Committer: Andrew Gaul <ga...@apache.org>
Committed: Fri Feb 12 19:29:38 2016 -0800

----------------------------------------------------------------------
 .../blobstore/GoogleCloudStorageBlobStore.java            | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/08e44bce/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 a3b22d1..4f2cf3d 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,15 +308,15 @@ public final class GoogleCloudStorageBlobStore extends BaseBlobStore {
    @Override
    public String copyBlob(String fromContainer, String fromName, String toContainer, String toName,
          CopyOptions options) {
-      if (!options.getContentMetadata().isPresent() && !options.getUserMetadata().isPresent()) {
+      if (options.contentMetadata() == null && options.userMetadata() == null) {
          return api.getObjectApi().copyObject(toContainer, Strings2.urlEncode(toName), fromContainer,
                Strings2.urlEncode(fromName)).etag();
       }
 
       ObjectTemplate template = new ObjectTemplate();
 
-      if (options.getContentMetadata().isPresent()) {
-         ContentMetadata contentMetadata = options.getContentMetadata().get();
+      if (options.contentMetadata() != null) {
+         ContentMetadata contentMetadata = options.contentMetadata();
 
          String contentDisposition = contentMetadata.getContentDisposition();
          if (contentDisposition != null) {
@@ -343,8 +343,8 @@ public final class GoogleCloudStorageBlobStore extends BaseBlobStore {
          }
       }
 
-      if (options.getUserMetadata().isPresent()) {
-         template.customMetadata(options.getUserMetadata().get());
+      if (options.userMetadata() != null) {
+         template.customMetadata(options.userMetadata());
       }
 
       return api.getObjectApi().copyObject(toContainer, Strings2.urlEncode(toName), fromContainer,


[2/2] jclouds-labs-google git commit: GCS support for conditional copies

Posted by ga...@apache.org.
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 <ga...@apache.org>
Authored: Fri Feb 12 19:33:10 2016 -0800
Committer: Andrew Gaul <ga...@apache.org>
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();
+   }
 }