JCLOUDS-651: S3 support for conditional copies

This commit is contained in:
Andrew Gaul 2016-02-11 21:31:55 -08:00
parent 467f3483bc
commit 6cdb1216a7
2 changed files with 18 additions and 0 deletions

View File

@ -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) {

View File

@ -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");
}
}