mirror of
https://github.com/apache/jclouds.git
synced 2025-03-03 23:09:10 +00:00
JCLOUDS-1271: Remove BlobStore.signRemoveBlob
Most providers never supported this functionality and the portable abstraction should not have included it.
This commit is contained in:
parent
775921cd5d
commit
90fac3b683
@ -111,15 +111,6 @@ public class AtmosBlobRequestSigner implements BlobRequestSigner {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public HttpRequest signRemoveBlob(String container, String name) {
|
|
||||||
checkNotNull(container, "container");
|
|
||||||
checkNotNull(name, "name");
|
|
||||||
return cleanRequest(processor.apply(Invocation.create(deleteMethod,
|
|
||||||
ImmutableList.<Object> of(getPath(container, name)))));
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getPath(String container, String name) {
|
private String getPath(String container, String name) {
|
||||||
return checkNotNull(container, "container") + "/" + checkNotNull(name, "name");
|
return checkNotNull(container, "container") + "/" + checkNotNull(name, "name");
|
||||||
}
|
}
|
||||||
|
@ -66,20 +66,6 @@ public class AtmosBlobRequestSignerTest extends BaseRestAnnotationProcessingTest
|
|||||||
assertEquals(request.getFilters().size(), 0);
|
assertEquals(request.getFilters().size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSignRemoveBlob() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
|
||||||
NoSuchMethodException, IOException {
|
|
||||||
HttpRequest request = signer.signRemoveBlob("container", "name");
|
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
|
||||||
"DELETE https://accesspoint.atmosonline.com/rest/namespace/container/name HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(
|
|
||||||
request,
|
|
||||||
"Accept: */*\nDate: Thu, 05 Jun 2008 16:38:19 GMT\nx-emc-signature: cPnxwSdWfIjChx8sox+43U9oo20=\nx-emc-uid: identity\n");
|
|
||||||
assertPayloadEquals(request, null, null, false);
|
|
||||||
|
|
||||||
assertEquals(request.getFilters().size(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSignPutBlob() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
public void testSignPutBlob() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
||||||
NoSuchMethodException, IOException {
|
NoSuchMethodException, IOException {
|
||||||
HashCode hashCode = HashCode.fromBytes(new byte[16]);
|
HashCode hashCode = HashCode.fromBytes(new byte[16]);
|
||||||
|
@ -806,14 +806,6 @@ public class FilesystemBlobStoreTest {
|
|||||||
.build();
|
.build();
|
||||||
assertEquals(expected, request);
|
assertEquals(expected, request);
|
||||||
|
|
||||||
request = signer.signRemoveBlob(containerName, blobName);
|
|
||||||
expected = HttpRequest.builder()
|
|
||||||
.method("DELETE")
|
|
||||||
.endpoint(endPoint)
|
|
||||||
.headers(request.getHeaders())
|
|
||||||
.build();
|
|
||||||
assertEquals(expected, request);
|
|
||||||
|
|
||||||
Blob blob = blobStore.blobBuilder(blobName).forSigning().build();
|
Blob blob = blobStore.blobBuilder(blobName).forSigning().build();
|
||||||
request = signer.signPutBlob(containerName, blob);
|
request = signer.signPutBlob(containerName, blob);
|
||||||
expected = HttpRequest.builder()
|
expected = HttpRequest.builder()
|
||||||
|
@ -88,12 +88,6 @@ public class RegionScopedTemporaryUrlBlobSigner implements BlobRequestSigner {
|
|||||||
return sign("PUT", container, blob.getMetadata().getName(), GetOptions.NONE, timestamp.get() + timeInSeconds);
|
return sign("PUT", container, blob.getMetadata().getName(), GetOptions.NONE, timestamp.get() + timeInSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public HttpRequest signRemoveBlob(String container, String name) {
|
|
||||||
return sign("DELETE", container, name, GetOptions.NONE, timestamp.get() + DEFAULT_SIGNING_TIMEOUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
private HttpRequest sign(String method, String container, String name, GetOptions options, long expires) {
|
private HttpRequest sign(String method, String container, String name, GetOptions options, long expires) {
|
||||||
checkNotNull(container, "container");
|
checkNotNull(container, "container");
|
||||||
checkNotNull(name, "name");
|
checkNotNull(name, "name");
|
||||||
|
@ -95,14 +95,6 @@ public class S3BlobRequestSigner<T extends S3Client> implements BlobRequestSigne
|
|||||||
return cleanRequest(authSigner.signForTemporaryAccess(request, timeInSeconds));
|
return cleanRequest(authSigner.signForTemporaryAccess(request, timeInSeconds));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public HttpRequest signRemoveBlob(String container, String name) {
|
|
||||||
checkNotNull(container, "container");
|
|
||||||
checkNotNull(name, "name");
|
|
||||||
return cleanRequest(processor.apply(Invocation.create(deleteMethod, ImmutableList.<Object> of(container, name))));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpRequest signGetBlob(String container, String name, org.jclouds.blobstore.options.GetOptions options) {
|
public HttpRequest signGetBlob(String container, String name, org.jclouds.blobstore.options.GetOptions options) {
|
||||||
checkNotNull(container, "container");
|
checkNotNull(container, "container");
|
||||||
|
@ -60,20 +60,6 @@ public interface BlobRequestSigner {
|
|||||||
*/
|
*/
|
||||||
HttpRequest signGetBlob(String container, String name, GetOptions options);
|
HttpRequest signGetBlob(String container, String name, GetOptions options);
|
||||||
|
|
||||||
/**
|
|
||||||
* gets a signed request, including headers as necessary, to delete a blob from an external
|
|
||||||
* client.
|
|
||||||
*
|
|
||||||
* @param container
|
|
||||||
* container where the blob resides
|
|
||||||
* @param directory
|
|
||||||
* full path to the blob
|
|
||||||
* @throws UnsupportedOperationException
|
|
||||||
* if not supported by the provider
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
HttpRequest signRemoveBlob(String container, String name);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets a signed request, including headers as necessary, to upload a blob from an external
|
* gets a signed request, including headers as necessary, to upload a blob from an external
|
||||||
* client.
|
* client.
|
||||||
|
@ -75,14 +75,6 @@ public class LocalBlobRequestSigner implements BlobRequestSigner {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public HttpRequest signRemoveBlob(String container, String name) {
|
|
||||||
HttpRequest request = HttpRequest.builder().method("DELETE").endpoint(String.format("%s/%s/%s", endpoint.get(), container,
|
|
||||||
name)).build();
|
|
||||||
return basicAuth.filter(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpRequest signGetBlob(String container, String name, GetOptions options) {
|
public HttpRequest signGetBlob(String container, String name, GetOptions options) {
|
||||||
HttpRequest request = HttpRequest.builder().method("GET").endpoint(
|
HttpRequest request = HttpRequest.builder().method("GET").endpoint(
|
||||||
|
@ -41,12 +41,6 @@ public class RequestSigningUnsupported implements BlobRequestSigner {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public HttpRequest signRemoveBlob(String container, String name) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpRequest signPutBlob(String container, Blob blob) {
|
public HttpRequest signPutBlob(String container, Blob blob) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -61,17 +61,6 @@ public class TransientBlobRequestSignerTest extends BaseRestAnnotationProcessing
|
|||||||
assertEquals(request.getFilters().size(), 0);
|
assertEquals(request.getFilters().size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSignRemoveBlob() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
|
||||||
NoSuchMethodException, IOException {
|
|
||||||
HttpRequest request = signer.signRemoveBlob(containerName, blobName);
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE " + fullUrl + " HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(request, "Authorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==\n");
|
|
||||||
assertPayloadEquals(request, null, null, false);
|
|
||||||
|
|
||||||
assertEquals(request.getFilters().size(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSignPutBlob() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
public void testSignPutBlob() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
||||||
NoSuchMethodException, IOException {
|
NoSuchMethodException, IOException {
|
||||||
HashCode hashCode = HashCode.fromBytes(new byte[16]);
|
HashCode hashCode = HashCode.fromBytes(new byte[16]);
|
||||||
|
@ -193,26 +193,6 @@ public class BaseBlobSignerLiveTest extends BaseBlobStoreIntegrationTest {
|
|||||||
testSignPutUrlWithTime(-getSignedUrlTimeout());
|
testSignPutUrlWithTime(-getSignedUrlTimeout());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSignRemoveUrl() throws Exception {
|
|
||||||
String name = "hello";
|
|
||||||
String text = "fooooooooooooooooooooooo";
|
|
||||||
|
|
||||||
Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
|
|
||||||
String container = getContainerName();
|
|
||||||
try {
|
|
||||||
view.getBlobStore().putBlob(container, blob);
|
|
||||||
awaitConsistency();
|
|
||||||
assertConsistencyAwareContainerSize(container, 1);
|
|
||||||
HttpRequest request = view.getSigner().signRemoveBlob(container, name);
|
|
||||||
assertEquals(request.getFilters().size(), 0);
|
|
||||||
view.utils().http().invoke(request);
|
|
||||||
assert !view.getBlobStore().blobExists(container, name);
|
|
||||||
} finally {
|
|
||||||
returnContainer(container);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void awaitConsistency() {
|
protected void awaitConsistency() {
|
||||||
if (view.getConsistencyModel() == ConsistencyModel.EVENTUAL) {
|
if (view.getConsistencyModel() == ConsistencyModel.EVENTUAL) {
|
||||||
Uninterruptibles.sleepUninterruptibly(AWAIT_CONSISTENCY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
|
Uninterruptibles.sleepUninterruptibly(AWAIT_CONSISTENCY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
|
||||||
|
@ -78,12 +78,6 @@ public abstract class BaseBlobSignerExpectTest extends BaseRestApiExpectTest<Blo
|
|||||||
|
|
||||||
protected abstract HttpRequest getBlobWithOptions();
|
protected abstract HttpRequest getBlobWithOptions();
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSignRemoveBlob() {
|
|
||||||
BlobStore removeBlob = requestsSendResponses(init());
|
|
||||||
assertEquals(removeBlob.getContext().getSigner().signRemoveBlob(container, name), removeBlob());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSignPutBlob() throws Exception {
|
public void testSignPutBlob() throws Exception {
|
||||||
HashCode hashCode = HashCode.fromBytes(new byte[16]);
|
HashCode hashCode = HashCode.fromBytes(new byte[16]);
|
||||||
|
@ -135,11 +135,6 @@ public class AWSS3BlobSignerV4ExpectTest extends S3BlobSignerExpectTest {
|
|||||||
throw new SkipException("skip testSignGetBlobWithOptions");
|
throw new SkipException("skip testSignGetBlobWithOptions");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void testSignRemoveBlob() {
|
|
||||||
throw new SkipException("skip testSignRemoveBlob");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Module createModule() {
|
protected Module createModule() {
|
||||||
return new TestAWSS3SignerV4HttpApiModule();
|
return new TestAWSS3SignerV4HttpApiModule();
|
||||||
|
@ -90,8 +90,6 @@ public class AzureBlobRequestSigner implements BlobRequestSigner {
|
|||||||
blob.getMetadata().getContentMetadata().getContentLength());
|
blob.getMetadata().getContentMetadata().getContentLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public HttpRequest signRemoveBlob(String container, String name) {
|
public HttpRequest signRemoveBlob(String container, String name) {
|
||||||
checkNotNull(container, "container");
|
checkNotNull(container, "container");
|
||||||
checkNotNull(name, "name");
|
checkNotNull(name, "name");
|
||||||
|
@ -50,7 +50,7 @@ public class AzureBlobRequestSignerTest extends BaseRestAnnotationProcessingTest
|
|||||||
credential = "aaaabbbb";
|
credential = "aaaabbbb";
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlobRequestSigner signer;
|
private AzureBlobRequestSigner signer;
|
||||||
private Factory blobFactory;
|
private Factory blobFactory;
|
||||||
|
|
||||||
public void testSignGetBlob() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
public void testSignGetBlob() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
||||||
@ -102,7 +102,7 @@ public class AzureBlobRequestSignerTest extends BaseRestAnnotationProcessingTest
|
|||||||
protected void setupFactory() throws IOException {
|
protected void setupFactory() throws IOException {
|
||||||
super.setupFactory();
|
super.setupFactory();
|
||||||
this.blobFactory = injector.getInstance(Blob.Factory.class);
|
this.blobFactory = injector.getInstance(Blob.Factory.class);
|
||||||
this.signer = injector.getInstance(BlobRequestSigner.class);
|
this.signer = (AzureBlobRequestSigner) injector.getInstance(BlobRequestSigner.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -99,14 +99,4 @@ public final class B2BlobSignerLiveTest extends BaseBlobSignerLiveTest {
|
|||||||
throw new SkipException("unsupported by B2", uoe);
|
throw new SkipException("unsupported by B2", uoe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSignRemoveUrl() throws Exception {
|
|
||||||
try {
|
|
||||||
super.testSignRemoveUrl();
|
|
||||||
failBecauseExceptionWasNotThrown(UnsupportedOperationException.class);
|
|
||||||
} catch (UnsupportedOperationException uoe) {
|
|
||||||
throw new SkipException("unsupported by B2", uoe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -98,12 +98,6 @@ public final class GoogleCloudStorageBlobRequestSigner implements BlobRequestSig
|
|||||||
return sign("PUT", container, blob.getMetadata().getName(), GetOptions.NONE, timestamp.get() + timeInSeconds, null);
|
return sign("PUT", container, blob.getMetadata().getName(), GetOptions.NONE, timestamp.get() + timeInSeconds, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public HttpRequest signRemoveBlob(String container, String name) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private HttpRequest sign(String method, String container, String name, GetOptions options, long expires, String contentType) {
|
private HttpRequest sign(String method, String container, String name, GetOptions options, long expires, String contentType) {
|
||||||
checkNotNull(container, "container");
|
checkNotNull(container, "container");
|
||||||
checkNotNull(name, "name");
|
checkNotNull(name, "name");
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package org.jclouds.googlecloudstorage.blobstore.integration;
|
package org.jclouds.googlecloudstorage.blobstore.integration;
|
||||||
|
|
||||||
import org.jclouds.blobstore.integration.internal.BaseBlobSignerLiveTest;
|
import org.jclouds.blobstore.integration.internal.BaseBlobSignerLiveTest;
|
||||||
import org.testng.SkipException;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@Test(groups = { "live" })
|
@Test(groups = { "live" })
|
||||||
@ -25,12 +24,4 @@ public class GoogleCloudStorageBlobSignerLiveTest extends BaseBlobSignerLiveTest
|
|||||||
public GoogleCloudStorageBlobSignerLiveTest() {
|
public GoogleCloudStorageBlobSignerLiveTest() {
|
||||||
provider = "google-cloud-storage";
|
provider = "google-cloud-storage";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSignRemoveUrl() throws Exception {
|
|
||||||
try {
|
|
||||||
super.testSignRemoveUrl();
|
|
||||||
} catch (UnsupportedOperationException uoe) {
|
|
||||||
throw new SkipException("not yet implemented in GCS", uoe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user