mirror of https://github.com/apache/jclouds.git
Renamed FalseIfVaultNotEmpty to be more generic. deleteVault should return false on any IllegalArgumentException.
This commit is contained in:
parent
deec26110c
commit
3b5aadc182
|
@ -32,7 +32,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|||
import org.jclouds.blobstore.attr.BlobScope;
|
||||
import org.jclouds.glacier.domain.PaginatedVaultCollection;
|
||||
import org.jclouds.glacier.domain.VaultMetadata;
|
||||
import org.jclouds.glacier.fallbacks.FalseIfVaultNotEmpty;
|
||||
import org.jclouds.glacier.fallbacks.FalseOnIllegalArgumentException;
|
||||
import org.jclouds.glacier.filters.RequestAuthorizeSignature;
|
||||
import org.jclouds.glacier.functions.ParseVaultMetadataFromHttpContent;
|
||||
import org.jclouds.glacier.functions.ParseVaultMetadataListFromHttpContent;
|
||||
|
@ -73,8 +73,8 @@ public interface GlacierAsyncClient extends Closeable {
|
|||
@Named("DeleteVault")
|
||||
@DELETE
|
||||
@Path("/-/vaults/{vault}")
|
||||
@Fallback(FalseIfVaultNotEmpty.class)
|
||||
ListenableFuture<Boolean> deleteVault(@PathParam("vault") @ParamValidators(VaultNameValidator.class) String vaultName);
|
||||
@Fallback(FalseOnIllegalArgumentException.class)
|
||||
ListenableFuture<Boolean> deleteVault(@PathParam("vault") String vaultName);
|
||||
|
||||
/**
|
||||
* @see GlacierClient#describeVault
|
||||
|
|
|
@ -43,7 +43,7 @@ public interface GlacierClient extends Closeable {
|
|||
URI createVault(String vaultName);
|
||||
|
||||
/**
|
||||
* A DELETE request operation with a vault name to delete an existing vault.
|
||||
* Deletes a vault.
|
||||
*
|
||||
* @param vaultName
|
||||
* Name of the Vault being deleted.
|
||||
|
@ -73,7 +73,7 @@ public interface GlacierClient extends Closeable {
|
|||
PaginatedVaultCollection listVaults(PaginationOptions options);
|
||||
|
||||
/**
|
||||
* List vaults.
|
||||
* Lists vaults.
|
||||
*
|
||||
* @see GlacierClient#listVaults(PaginationOptions)
|
||||
*/
|
||||
|
|
|
@ -26,9 +26,9 @@ import org.jclouds.Fallback;
|
|||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Fallback used when deleting a vault.
|
||||
* Returns false when encountering an IllegalArgumentException.
|
||||
*/
|
||||
public class FalseIfVaultNotEmpty implements Fallback<Boolean> {
|
||||
public class FalseOnIllegalArgumentException implements Fallback<Boolean> {
|
||||
|
||||
@Override
|
||||
public ListenableFuture<Boolean> create(Throwable t) throws Exception {
|
|
@ -57,10 +57,10 @@ public class RequestAuthorizeSignature implements HttpRequestFilter {
|
|||
@Inject
|
||||
public RequestAuthorizeSignature(@TimeStamp Provider<String> timeStampProvider,
|
||||
@org.jclouds.location.Provider Supplier<Credentials> creds, Crypto crypto, HttpUtils utils) {
|
||||
checkNotNull(creds);
|
||||
this.signer = new AWSRequestSignerV4(creds.get().identity, creds.get().credential, checkNotNull(crypto));
|
||||
this.timeStampProvider = checkNotNull(timeStampProvider);
|
||||
this.utils = checkNotNull(utils);
|
||||
checkNotNull(creds, "creds");
|
||||
this.signer = new AWSRequestSignerV4(creds.get().identity, creds.get().credential, checkNotNull(crypto, "crypto"));
|
||||
this.timeStampProvider = checkNotNull(timeStampProvider, "timeStampProvider");
|
||||
this.utils = checkNotNull(utils, "utils");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -62,9 +62,9 @@ public class AWSRequestSignerV4 {
|
|||
private final String credential;
|
||||
|
||||
public AWSRequestSignerV4(String identity, String credential, Crypto crypto) {
|
||||
this.crypto = checkNotNull(crypto);
|
||||
this.identity = checkNotNull(identity);
|
||||
this.credential = checkNotNull(credential);
|
||||
this.crypto = checkNotNull(crypto, "crypto");
|
||||
this.identity = checkNotNull(identity, "identity");
|
||||
this.credential = checkNotNull(credential, "credential");
|
||||
}
|
||||
|
||||
private static String buildHashedCanonicalRequest(String method, String endpoint, String hashedPayload,
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.jclouds.concurrent.config.ExecutorServiceModule;
|
|||
import org.jclouds.glacier.domain.PaginatedVaultCollection;
|
||||
import org.jclouds.glacier.domain.VaultMetadata;
|
||||
import org.jclouds.glacier.options.PaginationOptions;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Module;
|
||||
|
@ -45,6 +46,7 @@ import com.google.mockwebserver.RecordedRequest;
|
|||
/**
|
||||
* Mock test for Glacier.
|
||||
*/
|
||||
@Test
|
||||
public class GlacierClientMockTest {
|
||||
|
||||
private static final String VAULT_NAME = "ConcreteVaultName";
|
||||
|
|
Loading…
Reference in New Issue