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 01:30:23 UTC

[2/8] jclouds git commit: JCLOUDS-651: S3 support for conditional copies

JCLOUDS-651: S3 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/6cdb1216
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/6cdb1216
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/6cdb1216

Branch: refs/heads/master
Commit: 6cdb1216a7bc2ca341f3774e4eff3e594c49b31b
Parents: 467f348
Author: Andrew Gaul <ga...@apache.org>
Authored: Thu Feb 11 21:31:55 2016 -0800
Committer: Andrew Gaul <ga...@apache.org>
Committed: Tue Feb 16 16:29:54 2016 -0800

----------------------------------------------------------------------
 .../main/java/org/jclouds/s3/blobstore/S3BlobStore.java | 12 ++++++++++++
 .../integration/AWSS3BlobIntegrationLiveTest.java       |  6 ++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/6cdb1216/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobStore.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobStore.java b/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobStore.java
index e01c498..ef3729f 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobStore.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobStore.java
@@ -270,6 +270,18 @@ public class S3BlobStore extends BaseBlobStore {
    public String copyBlob(String fromContainer, String fromName, String toContainer, String toName,
          CopyOptions options) {
       CopyObjectOptions s3Options = new CopyObjectOptions();
+      if (options.ifMatch() != null) {
+         s3Options.ifSourceETagMatches(options.ifMatch());
+      }
+      if (options.ifNoneMatch() != null) {
+         s3Options.ifSourceETagDoesntMatch(options.ifNoneMatch());
+      }
+      if (options.ifModifiedSince() != null) {
+         s3Options.ifSourceModifiedSince(options.ifModifiedSince());
+      }
+      if (options.ifUnmodifiedSince() != null) {
+         s3Options.ifSourceUnmodifiedSince(options.ifUnmodifiedSince());
+      }
 
       ContentMetadata contentMetadata = options.contentMetadata();
       if (contentMetadata != null) {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6cdb1216/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/integration/AWSS3BlobIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/integration/AWSS3BlobIntegrationLiveTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/integration/AWSS3BlobIntegrationLiveTest.java
index cba1f72..ddbe114 100644
--- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/integration/AWSS3BlobIntegrationLiveTest.java
+++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/integration/AWSS3BlobIntegrationLiveTest.java
@@ -18,10 +18,16 @@ package org.jclouds.aws.s3.blobstore.integration;
 
 import org.jclouds.s3.blobstore.integration.S3BlobIntegrationLiveTest;
 import org.testng.annotations.Test;
+import org.testng.SkipException;
 
 @Test(groups = "live", testName = "AWSS3BlobIntegrationLiveTest")
 public class AWSS3BlobIntegrationLiveTest extends S3BlobIntegrationLiveTest {
    public AWSS3BlobIntegrationLiveTest() {
       provider = "aws-s3";
    }
+
+   @Override
+   public void testCopyIfModifiedSinceNegative() throws Exception {
+      throw new SkipException("S3 supports copyIfModifiedSince but test uses time in the future which Amazon does not support");
+   }
 }