From 52dc1a3ccfc6413d3350bc8f1d092cda8d7a25d3 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Tue, 19 Jan 2016 14:38:38 -0800 Subject: [PATCH] Add BaseBlobIntegrationTest.testSetBlobAccess Similar to BaseContainerIntegrationTest.testSetContainerAccess. --- .../integration/FilesystemContainerIntegrationTest.java | 2 +- .../integration/TransientBlobIntegrationTest.java | 7 +++++++ .../integration/TransientContainerIntegrationTest.java | 2 +- .../integration/internal/BaseBlobIntegrationTest.java | 8 ++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemContainerIntegrationTest.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemContainerIntegrationTest.java index b150b6ad31..7a701a0a1d 100644 --- a/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemContainerIntegrationTest.java +++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemContainerIntegrationTest.java @@ -189,6 +189,6 @@ public class FilesystemContainerIntegrationTest extends BaseContainerIntegration @Override @Test(groups = { "integration", "live" }) public void testSetContainerAccess() throws Exception { - throw new SkipException("transient does not support anonymous access"); + throw new SkipException("filesystem does not support anonymous access"); } } diff --git a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java index eeaaf962ca..e2b842ecc5 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java @@ -18,10 +18,17 @@ package org.jclouds.blobstore.integration; import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest; import org.testng.annotations.Test; +import org.testng.SkipException; @Test(groups = { "integration" }) public class TransientBlobIntegrationTest extends BaseBlobIntegrationTest { public TransientBlobIntegrationTest() { provider = "transient"; } + + @Override + @Test(groups = { "integration", "live" }) + public void testSetBlobAccess() throws Exception { + throw new SkipException("transient does not support anonymous access"); + } } diff --git a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientContainerIntegrationTest.java b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientContainerIntegrationTest.java index f12f27333b..c676b23196 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientContainerIntegrationTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientContainerIntegrationTest.java @@ -85,6 +85,6 @@ public class TransientContainerIntegrationTest extends BaseContainerIntegrationT @Override @Test(groups = { "integration", "live" }) public void testSetContainerAccess() throws Exception { - throw new SkipException("filesystem does not support anonymous access"); + throw new SkipException("transient does not support anonymous access"); } } diff --git a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java index 479c174713..8442377098 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java @@ -65,6 +65,8 @@ import org.jclouds.blobstore.options.PutOptions; import org.jclouds.blobstore.strategy.internal.MultipartUploadSlicingAlgorithm; import org.jclouds.crypto.Crypto; import org.jclouds.encryption.internal.JCECrypto; +import org.jclouds.http.HttpRequest; +import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponseException; import org.jclouds.io.ByteStreams2; import org.jclouds.io.ContentMetadataBuilder; @@ -667,6 +669,12 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest { blobStore.setBlobAccess(containerName, blobName, BlobAccess.PUBLIC_READ); assertThat(blobStore.getBlobAccess(containerName, blobName)).isEqualTo(BlobAccess.PUBLIC_READ); + // test that blob is anonymously readable + HttpRequest request = view.getSigner().signGetBlob(containerName, blobName).toBuilder() + .replaceQueryParams(ImmutableMap.of()).build(); + HttpResponse response = view.utils().http().invoke(request); + assertThat(response.getStatusCode()).isEqualTo(200); + blobStore.setBlobAccess(containerName, blobName, BlobAccess.PRIVATE); assertThat(blobStore.getBlobAccess(containerName, blobName)).isEqualTo(BlobAccess.PRIVATE); } finally {