Handle unimplemented signed URL tests in providers

This commit makes it evident in source code which providers do not
support this feature.
This commit is contained in:
Andrew Gaul 2016-05-06 10:10:57 -07:00
parent 0af3380a60
commit a4c40e15cd
3 changed files with 78 additions and 9 deletions

View File

@ -16,7 +16,10 @@
*/
package org.jclouds.atmos.blobstore.integration;
import java.io.IOException;
import org.jclouds.blobstore.integration.internal.BaseBlobSignerLiveTest;
import org.testng.SkipException;
import org.testng.annotations.Test;
@Test(groups = { "live" })
@ -24,4 +27,40 @@ public class AtmosBlobSignerLiveTest extends BaseBlobSignerLiveTest {
public AtmosBlobSignerLiveTest() {
provider = "atmos";
}
@Test
public void testSignGetUrlWithTime() throws InterruptedException, IOException {
try {
super.testSignGetUrlWithTime();
} catch (UnsupportedOperationException uoe) {
throw new SkipException("not supported in Atmos", uoe);
}
}
@Test
public void testSignGetUrlWithTimeExpired() throws InterruptedException, IOException {
try {
super.testSignGetUrlWithTimeExpired();
} catch (UnsupportedOperationException uoe) {
throw new SkipException("not supported in Atmos", uoe);
}
}
@Test
public void testSignPutUrlWithTime() throws Exception {
try {
super.testSignPutUrlWithTime();
} catch (UnsupportedOperationException uoe) {
throw new SkipException("not supported in Atmos", uoe);
}
}
@Test
public void testSignPutUrlWithTimeExpired() throws Exception {
try {
super.testSignPutUrlWithTimeExpired();
} catch (UnsupportedOperationException uoe) {
throw new SkipException("not supported in Atmos", uoe);
}
}
}

View File

@ -29,7 +29,6 @@ import org.jclouds.blobstore.domain.Blob;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.util.Strings2;
import org.testng.SkipException;
import org.testng.annotations.Test;
import com.google.common.util.concurrent.Uninterruptibles;
@ -94,8 +93,6 @@ public class BaseBlobSignerLiveTest extends BaseBlobStoreIntegrationTest {
HttpRequest request = view.getSigner().signGetBlob(container, name, getSignedUrlTimeout());
assertEquals(request.getFilters().size(), 0);
assertEquals(Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().openStream()), text);
} catch (UnsupportedOperationException ignore) {
throw new SkipException("signGetUrl with a time limit is not supported on " + provider);
} finally {
returnContainer(container);
}
@ -119,8 +116,6 @@ public class BaseBlobSignerLiveTest extends BaseBlobStoreIntegrationTest {
fail("Temporary URL did not expire as expected");
} catch (AuthorizationException expected) {
}
} catch (UnsupportedOperationException ignore) {
throw new SkipException("signGetUrl with a time limit is not supported on " + provider);
} finally {
returnContainer(container);
}
@ -159,8 +154,6 @@ public class BaseBlobSignerLiveTest extends BaseBlobStoreIntegrationTest {
// http://www.docjar.com/html/api/sun/net/www/protocol/http/HttpURLConnection.java.html#1021
request = request.toBuilder().removeHeader(EXPECT).build();
Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().openStream());
} catch (UnsupportedOperationException ignore) {
throw new SkipException("signPutUrl with a time limit is not supported on " + provider);
} finally {
returnContainer(container);
}
@ -187,8 +180,6 @@ public class BaseBlobSignerLiveTest extends BaseBlobStoreIntegrationTest {
fail("Temporary URL did not expire as expected");
} catch (AuthorizationException expected) {
}
} catch (UnsupportedOperationException ignore) {
throw new SkipException("signPutUrl with a time limit is not supported on " + provider);
} finally {
returnContainer(container);
}

View File

@ -16,7 +16,10 @@
*/
package org.jclouds.azureblob.blobstore.integration;
import java.io.IOException;
import org.jclouds.blobstore.integration.internal.BaseBlobSignerLiveTest;
import org.testng.SkipException;
import org.testng.annotations.Test;
@Test(groups = { "live" })
@ -24,4 +27,40 @@ public class AzureBlobSignerLiveTest extends BaseBlobSignerLiveTest {
public AzureBlobSignerLiveTest() {
provider = "azureblob";
}
@Test
public void testSignGetUrlWithTime() throws InterruptedException, IOException {
try {
super.testSignGetUrlWithTime();
} catch (UnsupportedOperationException uoe) {
throw new SkipException("not supported in Azure", uoe);
}
}
@Test
public void testSignGetUrlWithTimeExpired() throws InterruptedException, IOException {
try {
super.testSignGetUrlWithTimeExpired();
} catch (UnsupportedOperationException uoe) {
throw new SkipException("not supported in Azure", uoe);
}
}
@Test
public void testSignPutUrlWithTime() throws Exception {
try {
super.testSignPutUrlWithTime();
} catch (UnsupportedOperationException uoe) {
throw new SkipException("not supported in Azure", uoe);
}
}
@Test
public void testSignPutUrlWithTimeExpired() throws Exception {
try {
super.testSignPutUrlWithTimeExpired();
} catch (UnsupportedOperationException uoe) {
throw new SkipException("not supported in Azure", uoe);
}
}
}