From cc0d0d40c5076b835d88ba8cc11e3167f957d115 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Mon, 21 Dec 2015 17:48:16 -0800 Subject: [PATCH] JCLOUDS-844: Atmos putBlob ACLs --- .../atmos/blobstore/AtmosBlobStore.java | 29 ++++++++++++------- .../integration/AtmosIntegrationLiveTest.java | 6 ++++ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobStore.java b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobStore.java index 9e11ff840a..65161983e5 100644 --- a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobStore.java +++ b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobStore.java @@ -231,14 +231,7 @@ public class AtmosBlobStore extends BaseBlobStore { */ @Override public String putBlob(final String container, final Blob blob) { - final org.jclouds.atmos.options.PutOptions options = new org.jclouds.atmos.options.PutOptions(); - try { - if (isPublic.getUnchecked(container + "/")) - options.publicRead(); - } catch (CacheLoader.InvalidCacheLoadException e) { - // nulls not permitted - } - return AtmosUtils.putBlob(sync, crypto, blob2Object, container, blob, options); + return putBlob(container, blob, PutOptions.NONE); } /** @@ -248,8 +241,22 @@ public class AtmosBlobStore extends BaseBlobStore { */ @Override public String putBlob(String container, Blob blob, PutOptions options) { - // TODO implement options - return putBlob(container, blob); + if (options.isMultipart()) { + throw new UnsupportedOperationException("Atmos does not support multipart uploads"); + } + org.jclouds.atmos.options.PutOptions atmosOptions = new org.jclouds.atmos.options.PutOptions(); + atmosOptions.publicNone(); + try { + // TODO: not needed + if (isPublic.getUnchecked(container + "/")) + atmosOptions.publicRead(); + } catch (CacheLoader.InvalidCacheLoadException e) { + // nulls not permitted + } + if (options.getBlobAccess() == BlobAccess.PUBLIC_READ) { + atmosOptions.publicRead(); + } + return AtmosUtils.putBlob(sync, crypto, blob2Object, container, blob, atmosOptions); } /** @@ -289,7 +296,7 @@ public class AtmosBlobStore extends BaseBlobStore { } @Override - public MultipartUpload initiateMultipartUpload(String container, BlobMetadata blobMetadata) { + public MultipartUpload initiateMultipartUpload(String container, BlobMetadata blobMetadata, PutOptions options) { throw new UnsupportedOperationException("Atmos does not support multipart uploads"); } diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosIntegrationLiveTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosIntegrationLiveTest.java index 1e5263c9b3..ee2590d243 100644 --- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosIntegrationLiveTest.java +++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosIntegrationLiveTest.java @@ -150,4 +150,10 @@ public class AtmosIntegrationLiveTest extends BaseBlobIntegrationTest { public void testPutMultipartInputStream() throws Exception { throw new SkipException("Atmos does not support multipart uploads"); } + + @Override + @Test(groups = { "integration", "live" }, expectedExceptions = UnsupportedOperationException.class) + public void testPutBlobAccessMultipart() throws Exception { + super.testPutBlobAccessMultipart(); + } }