mirror of https://github.com/apache/jclouds.git
removed custom guava code for scoped binding and type params
This commit is contained in:
parent
202b9be5e5
commit
47c215c63c
|
@ -37,9 +37,7 @@ import org.jclouds.reflect.Invocation;
|
|||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -47,7 +45,7 @@ import org.jclouds.reflect.Invokable;
|
|||
*/
|
||||
@Singleton
|
||||
public class AtmosBlobRequestSigner implements BlobRequestSigner {
|
||||
private final RestAnnotationProcessor processor;
|
||||
private final RestAnnotationProcessor<AtmosAsyncClient> processor;
|
||||
private final BlobToObject blobToObject;
|
||||
private final BlobToHttpGetOptions blob2ObjectGetOptions;
|
||||
|
||||
|
@ -56,17 +54,15 @@ public class AtmosBlobRequestSigner implements BlobRequestSigner {
|
|||
private final Invokable<?, ?> createMethod;
|
||||
|
||||
@Inject
|
||||
public AtmosBlobRequestSigner(RestAnnotationProcessor processor, BlobToObject blobToObject,
|
||||
public AtmosBlobRequestSigner(RestAnnotationProcessor<AtmosAsyncClient> processor, BlobToObject blobToObject,
|
||||
BlobToHttpGetOptions blob2ObjectGetOptions) throws SecurityException, NoSuchMethodException {
|
||||
this.processor = checkNotNull(processor, "processor");
|
||||
this.blobToObject = checkNotNull(blobToObject, "blobToObject");
|
||||
this.blob2ObjectGetOptions = checkNotNull(blob2ObjectGetOptions, "blob2ObjectGetOptions");
|
||||
this.getMethod = Invokable.from(TypeToken.of(AtmosAsyncClient.class),
|
||||
AtmosAsyncClient.class.getMethod("readFile", String.class, GetOptions[].class));
|
||||
this.deleteMethod = Invokable.from(TypeToken.of(AtmosAsyncClient.class),
|
||||
AtmosAsyncClient.class.getMethod("deletePath", String.class));
|
||||
this.createMethod = Invokable.from(TypeToken.of(AtmosAsyncClient.class),
|
||||
AtmosAsyncClient.class.getMethod("createFile", String.class, AtmosObject.class, PutOptions[].class));
|
||||
this.getMethod = Invokable.from(AtmosAsyncClient.class.getMethod("readFile", String.class, GetOptions[].class));
|
||||
this.deleteMethod = Invokable.from(AtmosAsyncClient.class.getMethod("deletePath", String.class));
|
||||
this.createMethod = Invokable.from(AtmosAsyncClient.class.getMethod("createFile", String.class,
|
||||
AtmosObject.class, PutOptions[].class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,7 +47,7 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseURIFromListOrLocationHeaderIf20x;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.options.GetOptions;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
|
|
|
@ -62,7 +62,7 @@ import org.jclouds.openstack.filters.AuthenticateRequest;
|
|||
import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule.GetAuth;
|
||||
import org.jclouds.openstack.keystone.v1_1.domain.Auth;
|
||||
import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
|
|
|
@ -46,7 +46,7 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.filters.BasicAuthentication;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Map;
|
|||
|
||||
import org.jclouds.cloudsigma.options.CloneDriveOptions;
|
||||
import org.jclouds.reflect.Invocation;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class BindCloneDriveOptionsToPlainTextStringTest {
|
|||
protected GeneratedHttpRequest requestForArgs(List<Object> args) {
|
||||
try {
|
||||
Invocation invocation = Invocation.create(Invokable.from(String.class.getDeclaredMethod("toString")), args);
|
||||
return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
return GeneratedHttpRequest.builder(String.class).method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
.invocation(invocation).build();
|
||||
} catch (SecurityException e) {
|
||||
throw Throwables.propagate(e);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.jclouds.cloudstack.config;
|
||||
|
||||
import static com.google.common.base.Throwables.propagate;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
@ -209,9 +209,9 @@ public class CloudStackRestClientModule extends RestClientModule<CloudStackClien
|
|||
});
|
||||
bind(CredentialType.class).toProvider(CredentialTypeFromPropertyOrDefault.class);
|
||||
// session client is used directly for filters and retry handlers, so let's bind it explicitly
|
||||
bindClientAndAsyncClient(binder(), SessionClient.class, SessionAsyncClient.class);
|
||||
bindClientAndAsyncClient(binder(), CloudStackDomainClient.class, CloudStackDomainAsyncClient.class);
|
||||
bindClientAndAsyncClient(binder(), CloudStackGlobalClient.class, CloudStackGlobalAsyncClient.class);
|
||||
bindHttpApi(binder(), SessionClient.class, SessionAsyncClient.class);
|
||||
bindHttpApi(binder(), CloudStackDomainClient.class, CloudStackDomainAsyncClient.class);
|
||||
bindHttpApi(binder(), CloudStackGlobalClient.class, CloudStackGlobalAsyncClient.class);
|
||||
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(InvalidateSessionAndRetryOn401AndLogoutOnClose.class);
|
||||
|
||||
super.configure();
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
|||
import org.jclouds.cloudstack.options.ListAccountsOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.functions.IdentityFunction;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.cloudstack.functions.ParseAsyncJobFromHttpResponse;
|
|||
import org.jclouds.cloudstack.functions.ParseAsyncJobsFromHttpResponse;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListAsyncJobsOptions;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.io.IOException;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.jclouds.cloudstack.domain.ResourceLimit.ResourceType;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.jclouds.cloudstack.functions.ParseEventTypesFromHttpResponse;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListEventsOptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.cloudstack.options.UpdateAccountOptions;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListAlertsOptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.jclouds.cloudstack.domain.Capacity;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListCapacityOptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListHostsOptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.jclouds.cloudstack.options.UpdateServiceOfferingOptions;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
|||
import org.jclouds.cloudstack.options.ListStoragePoolsOptions;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.cloudstack.options.GenerateUsageRecordsOptions;
|
|||
import org.jclouds.cloudstack.options.ListUsageRecordsOptions;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.jclouds.cloudstack.options.UpdateUserOptions;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
|||
import org.jclouds.cloudstack.options.ListOSTypesOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.io.IOException;
|
|||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.functions.ParseNamesFromHttpResponse;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListResourceLimitsOptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.cloudstack.options.UpdateLoadBalancerRuleOptions;
|
|||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.cloudstack.options.ListNetworkOfferingsOptions;
|
|||
import org.jclouds.cloudstack.options.ListServiceOfferingsOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.functions.IdentityFunction;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.functions.IdentityFunction;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListVolumesOptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
|||
import org.jclouds.cloudstack.options.ListZonesOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jclouds.ec2.xml.PermissionHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.ec2.options.DescribeRegionsOptions;
|
|||
import org.jclouds.ec2.xml.DescribeAvailabilityZonesResponseHandler;
|
||||
import org.jclouds.ec2.xml.DescribeRegionsResponseHandler;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.jclouds.ec2.xml.SnapshotHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.ec2.xml.DescribeAddressesResponseHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.jclouds.ec2.xml.UnencodeStringValueHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|||
import org.jclouds.ec2.xml.DescribeKeyPairsResponseHandler;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.jclouds.ec2.xml.DescribeSecurityGroupsResponseHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.ec2.xml.BundleTaskHandler;
|
|||
import org.jclouds.ec2.xml.DescribeBundleTasksResponseHandler;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ import org.jclouds.http.filters.BasicAuthentication;
|
|||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.filesystem.config;
|
||||
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindBlockingApi;
|
||||
|
||||
import org.jclouds.blobstore.AsyncBlobStore;
|
||||
import org.jclouds.blobstore.BlobRequestSigner;
|
||||
|
@ -50,7 +50,7 @@ public class FilesystemBlobStoreContextModule extends AbstractModule {
|
|||
protected void configure() {
|
||||
bind(AsyncBlobStore.class).to(LocalAsyncBlobStore.class).asEagerSingleton();
|
||||
// forward all requests from TransientBlobStore to TransientAsyncBlobStore. needs above binding as cannot proxy a class
|
||||
bindClient(binder(), LocalBlobStore.class, AsyncBlobStore.class);
|
||||
bindBlockingApi(binder(), LocalBlobStore.class, AsyncBlobStore.class);
|
||||
bind(BlobStore.class).to(LocalBlobStore.class);
|
||||
|
||||
install(new BlobStoreObjectModule());
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.openstack.keystone.v2_0.config;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Throwables.propagate;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
@ -144,7 +144,7 @@ public class KeystoneAuthenticationModule extends AbstractModule {
|
|||
|
||||
protected void bindAuthenticationApi() {
|
||||
// AuthenticationApi is used directly for filters and retry handlers, so let's bind it explicitly
|
||||
bindClientAndAsyncClient(binder(), AuthenticationApi.class, AuthenticationAsyncApi.class);
|
||||
bindHttpApi(binder(), AuthenticationApi.class, AuthenticationAsyncApi.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Multimap;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Provides;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.rackspace.cloudidentity.v2_0.config;
|
||||
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class CloudIdentityAuthenticationModule extends KeystoneAuthenticationMod
|
|||
@Override
|
||||
protected void bindAuthenticationApi() {
|
||||
// AuthenticationApi is used directly for filters and retry handlers, so let's bind it explicitly
|
||||
bindClientAndAsyncClient(binder(), CloudIdentityAuthenticationApi.class,
|
||||
bindHttpApi(binder(), CloudIdentityAuthenticationApi.class,
|
||||
CloudIdentityAuthenticationAsyncApi.class);
|
||||
bind(AuthenticationApi.class).to(CloudIdentityAuthenticationApi.class).in(Scopes.SINGLETON);
|
||||
bind(AuthenticationAsyncApi.class).to(CloudIdentityAuthenticationAsyncApi.class).in(Scopes.SINGLETON);
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.options.GetOptions;
|
||||
import org.jclouds.reflect.Invocation;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||
import org.jclouds.s3.S3AsyncClient;
|
||||
import org.jclouds.s3.blobstore.functions.BlobToObject;
|
||||
|
@ -38,7 +37,7 @@ import org.jclouds.s3.domain.S3Object;
|
|||
import org.jclouds.s3.options.PutObjectOptions;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -46,7 +45,7 @@ import com.google.common.reflect.TypeToken;
|
|||
*/
|
||||
@Singleton
|
||||
public class S3BlobRequestSigner<T extends S3AsyncClient> implements BlobRequestSigner {
|
||||
private final RestAnnotationProcessor processor;
|
||||
private final RestAnnotationProcessor<T> processor;
|
||||
private final BlobToObject blobToObject;
|
||||
private final BlobToHttpGetOptions blob2HttpGetOptions;
|
||||
|
||||
|
@ -55,26 +54,24 @@ public class S3BlobRequestSigner<T extends S3AsyncClient> implements BlobRequest
|
|||
private final Invokable<?, ?> createMethod;
|
||||
|
||||
@Inject
|
||||
public S3BlobRequestSigner(RestAnnotationProcessor processor, BlobToObject blobToObject,
|
||||
public S3BlobRequestSigner(RestAnnotationProcessor<T> processor, BlobToObject blobToObject,
|
||||
BlobToHttpGetOptions blob2HttpGetOptions, Class<T> interfaceType) throws SecurityException,
|
||||
NoSuchMethodException {
|
||||
this.processor = checkNotNull(processor, "processor");
|
||||
this.blobToObject = checkNotNull(blobToObject, "blobToObject");
|
||||
this.blob2HttpGetOptions = checkNotNull(blob2HttpGetOptions, "blob2HttpGetOptions");
|
||||
this.getMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("getObject", String.class, String.class, GetOptions[].class));
|
||||
this.deleteMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("deleteObject", String.class, String.class));
|
||||
this.createMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("putObject", String.class, S3Object.class, PutObjectOptions[].class));
|
||||
this.getMethod = Invokable.from(interfaceType.getMethod("getObject", String.class, String.class,
|
||||
GetOptions[].class));
|
||||
this.deleteMethod = Invokable.from(interfaceType.getMethod("deleteObject", String.class, String.class));
|
||||
this.createMethod = Invokable.from(interfaceType.getMethod("putObject", String.class, S3Object.class,
|
||||
PutObjectOptions[].class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpRequest signGetBlob(String container, String name) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(name, "name");
|
||||
return cleanRequest(processor.apply(Invocation.create( getMethod,
|
||||
ImmutableList.<Object> of(container, name))));
|
||||
return cleanRequest(processor.apply(Invocation.create(getMethod, ImmutableList.<Object> of(container, name))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,7 +83,7 @@ public class S3BlobRequestSigner<T extends S3AsyncClient> implements BlobRequest
|
|||
public HttpRequest signPutBlob(String container, Blob blob) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(blob, "blob");
|
||||
return cleanRequest(processor.apply(Invocation.create( createMethod,
|
||||
return cleanRequest(processor.apply(Invocation.create(createMethod,
|
||||
ImmutableList.<Object> of(container, blobToObject.apply(blob)))));
|
||||
}
|
||||
|
||||
|
@ -99,15 +96,14 @@ public class S3BlobRequestSigner<T extends S3AsyncClient> implements BlobRequest
|
|||
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))));
|
||||
return cleanRequest(processor.apply(Invocation.create(deleteMethod, ImmutableList.<Object> of(container, name))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpRequest signGetBlob(String container, String name, org.jclouds.blobstore.options.GetOptions options) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(name, "name");
|
||||
return cleanRequest(processor.apply(Invocation.create( getMethod,
|
||||
return cleanRequest(processor.apply(Invocation.create(getMethod,
|
||||
ImmutableList.of(container, name, blob2HttpGetOptions.apply(checkNotNull(options, "options"))))));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.jclouds.http.functions.ParseSax;
|
|||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.ReturnTrueIf2xx;
|
||||
import org.jclouds.http.options.GetOptions;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.s3.S3Fallbacks.TrueOn404OrNotFoundFalseOnIllegalState;
|
||||
|
@ -80,7 +80,7 @@ import com.google.inject.Module;
|
|||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||
@Test(groups = "unit", testName = "S3AsyncClientTest")
|
||||
public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClientTest<T> {
|
||||
public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClientTest<T> {
|
||||
|
||||
protected String url = "s3.amazonaws.com";
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.jclouds.s3.internal.BaseS3AsyncClientTest;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code BindAsHostPrefixIfConfigured}
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.testng.annotations.DataProvider;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code BindAsHostPrefixIfConfigured}
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.testng.annotations.BeforeClass;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -43,11 +43,11 @@ import org.jclouds.reflect.Invokable;
|
|||
@Test(testName = "FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTest")
|
||||
public class FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTest {
|
||||
|
||||
GeneratedHttpRequest putBucket;
|
||||
GeneratedHttpRequest<S3Client> putBucket;
|
||||
|
||||
@BeforeClass
|
||||
void setUp() throws SecurityException, NoSuchMethodException {
|
||||
putBucket = GeneratedHttpRequest.builder()
|
||||
putBucket = GeneratedHttpRequest.builder(S3Client.class)
|
||||
.method("PUT")
|
||||
.endpoint("https://adriancole-blobstore113.s3.amazonaws.com/")
|
||||
.invocation(
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.SortedSetMultimap;
|
||||
import com.google.common.collect.TreeMultimap;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code RequestAuthorizeSignature}
|
||||
|
|
|
@ -46,7 +46,6 @@ import org.jclouds.openstack.swift.TemporaryUrlKey;
|
|||
import org.jclouds.openstack.swift.blobstore.functions.BlobToObject;
|
||||
import org.jclouds.openstack.swift.domain.SwiftObject;
|
||||
import org.jclouds.reflect.Invocation;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||
|
||||
|
@ -55,7 +54,7 @@ import com.google.common.base.Throwables;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.io.ByteProcessor;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.Provider;
|
||||
|
||||
/**
|
||||
|
@ -64,7 +63,7 @@ import com.google.inject.Provider;
|
|||
@Singleton
|
||||
public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRequestSigner {
|
||||
|
||||
private final RestAnnotationProcessor processor;
|
||||
private final RestAnnotationProcessor<T> processor;
|
||||
private final Crypto crypto;
|
||||
|
||||
private final Provider<Long> unixEpochTimestampProvider;
|
||||
|
@ -86,7 +85,7 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
@Inject
|
||||
protected SwiftBlobSigner(BlobToObject blobToObject, BlobToHttpGetOptions blob2HttpGetOptions, Crypto crypto,
|
||||
@TimeStamp Provider<Long> unixEpochTimestampProvider,
|
||||
@TemporaryUrlKey Supplier<String> temporaryUrlKeySupplier, RestAnnotationProcessor processor,
|
||||
@TemporaryUrlKey Supplier<String> temporaryUrlKeySupplier, RestAnnotationProcessor<T> processor,
|
||||
Class<T> interfaceType) throws SecurityException, NoSuchMethodException {
|
||||
this.processor = checkNotNull(processor, "processor");
|
||||
this.crypto = checkNotNull(crypto, "crypto");
|
||||
|
@ -97,27 +96,24 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
this.blobToObject = checkNotNull(blobToObject, "blobToObject");
|
||||
this.blob2HttpGetOptions = checkNotNull(blob2HttpGetOptions, "blob2HttpGetOptions");
|
||||
|
||||
this.getMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("getObject", String.class, String.class, GetOptions[].class));
|
||||
this.deleteMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("removeObject", String.class, String.class));
|
||||
this.createMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("putObject", String.class, SwiftObject.class));
|
||||
this.getMethod = Invokable.from(interfaceType.getMethod("getObject", String.class, String.class,
|
||||
GetOptions[].class));
|
||||
this.deleteMethod = Invokable.from(interfaceType.getMethod("removeObject", String.class, String.class));
|
||||
this.createMethod = Invokable.from(interfaceType.getMethod("putObject", String.class, SwiftObject.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpRequest signGetBlob(String container, String name) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(name, "name");
|
||||
return cleanRequest(processor.apply(Invocation.create(getMethod,
|
||||
ImmutableList.<Object> of(container, name))));
|
||||
return cleanRequest(processor.apply(Invocation.create(getMethod, ImmutableList.<Object> of(container, name))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpRequest signGetBlob(String container, String name, long timeInSeconds) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(name, "name");
|
||||
GeneratedHttpRequest request = processor.apply(Invocation.create(getMethod,
|
||||
GeneratedHttpRequest<T> request = processor.apply(Invocation.create(getMethod,
|
||||
ImmutableList.<Object> of(container, name)));
|
||||
return cleanRequest(signForTemporaryAccess(request, timeInSeconds));
|
||||
}
|
||||
|
@ -142,7 +138,7 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
public HttpRequest signPutBlob(String container, Blob blob, long timeInSeconds) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(blob, "blob");
|
||||
GeneratedHttpRequest request = processor.apply(Invocation.create(createMethod,
|
||||
GeneratedHttpRequest<T> request = processor.apply(Invocation.create(createMethod,
|
||||
ImmutableList.<Object> of(container, blobToObject.apply(blob))));
|
||||
return cleanRequest(signForTemporaryAccess(request, timeInSeconds));
|
||||
}
|
||||
|
@ -151,8 +147,7 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
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))));
|
||||
return cleanRequest(processor.apply(Invocation.create(deleteMethod, ImmutableList.<Object> of(container, name))));
|
||||
}
|
||||
|
||||
private HttpRequest signForTemporaryAccess(HttpRequest request, long timeInSeconds) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.openstack.swift.blobstore.config;
|
||||
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
|
||||
import org.jclouds.blobstore.BlobRequestSigner;
|
||||
import org.jclouds.date.TimeStamp;
|
||||
|
@ -63,7 +63,7 @@ public abstract class TemporaryUrlExtensionModule<A extends CommonSwiftAsyncClie
|
|||
TemporaryUrlExtensionModule<SwiftKeystoneAsyncClient> {
|
||||
|
||||
protected void bindTemporaryUrlKeyApi() {
|
||||
bindClientAndAsyncClient(binder(), TemporaryUrlKeyApi.class, KeystoneTemporaryUrlKeyAsyncApi.class);
|
||||
bindHttpApi(binder(), TemporaryUrlKeyApi.class, KeystoneTemporaryUrlKeyAsyncApi.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,7 +91,7 @@ public abstract class TemporaryUrlExtensionModule<A extends CommonSwiftAsyncClie
|
|||
protected abstract void bindRequestSigner();
|
||||
|
||||
protected void bindTemporaryUrlKeyApi() {
|
||||
bindClientAndAsyncClient(binder(), TemporaryUrlKeyApi.class, TemporaryUrlKeyAsyncApi.class);
|
||||
bindHttpApi(binder(), TemporaryUrlKeyApi.class, TemporaryUrlKeyAsyncApi.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.nnsoft.guice.rocoto.Rocoto;
|
|||
import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
@ -43,10 +43,10 @@ public class BasePayloadTest {
|
|||
}
|
||||
}), new GsonModule());
|
||||
|
||||
protected GeneratedHttpRequest requestForArgs(List<Object> args) {
|
||||
protected GeneratedHttpRequest<?> requestForArgs(List<Object> args) {
|
||||
try {
|
||||
Invocation invocation = Invocation.create(Invokable.from(String.class.getDeclaredMethod("toString")), args);
|
||||
return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
return GeneratedHttpRequest.builder(String.class).method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
.invocation(invocation).build();
|
||||
} catch (SecurityException e) {
|
||||
throw Throwables.propagate(e);
|
||||
|
|
|
@ -28,7 +28,7 @@ import static com.google.common.collect.Iterables.transform;
|
|||
import static com.google.common.collect.Maps.transformValues;
|
||||
import static com.google.common.collect.Maps.uniqueIndex;
|
||||
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
|
||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
|
||||
|
||||
|
@ -206,8 +206,8 @@ public class VCloudRestClientModule extends RestClientModule<VCloudClient, VClou
|
|||
bind(new TypeLiteral<Function<VAppTemplate, Envelope>>() {
|
||||
}).to(new TypeLiteral<ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException>() {
|
||||
});
|
||||
bindClientAndAsyncClient(binder(), VCloudVersionsClient.class, VCloudVersionsAsyncClient.class);
|
||||
bindClientAndAsyncClient(binder(), VCloudLoginClient.class, VCloudLoginAsyncClient.class);
|
||||
bindHttpApi(binder(), VCloudVersionsClient.class, VCloudVersionsAsyncClient.class);
|
||||
bindHttpApi(binder(), VCloudLoginClient.class, VCloudLoginAsyncClient.class);
|
||||
}
|
||||
|
||||
protected void bindCacheLoaders() {
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.xml.SupportedVersionsHandler;
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.net.URI;
|
|||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.options.CatalogItemOptions;
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.net.URI;
|
|||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.xml.OrgNetworkHandler;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.net.URI;
|
|||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.xml.OrgHandler;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.net.URI;
|
|||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.net.URI;
|
|||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.ovf.xml.EnvelopeHandler;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.domain.network.FenceMode;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.NoSuchElementException;
|
|||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.xml.VDCHandler;
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.ReturnInputStream;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.domain.GuestCustomizationSection;
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.nnsoft.guice.rocoto.Rocoto;
|
|||
import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
@ -40,10 +40,10 @@ public class BasePayloadTest {
|
|||
}
|
||||
}));
|
||||
|
||||
protected GeneratedHttpRequest requestForArgs(List<Object> args) {
|
||||
protected GeneratedHttpRequest<?> requestForArgs(List<Object> args) {
|
||||
try {
|
||||
Invocation invocation = Invocation.create(Invokable.from(String.class.getDeclaredMethod("toString")), args);
|
||||
return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
return GeneratedHttpRequest.builder(String.class).method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
.invocation(invocation).build();
|
||||
} catch (SecurityException e) {
|
||||
throw Throwables.propagate(e);
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.http.filters.BasicAuthentication;
|
|||
import org.jclouds.location.Provider;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.endpoints.VCloudLogin;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.blobstore.config;
|
||||
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindBlockingApi;
|
||||
|
||||
import org.jclouds.blobstore.AsyncBlobStore;
|
||||
import org.jclouds.blobstore.BlobRequestSigner;
|
||||
|
@ -41,7 +41,7 @@ public class TransientBlobStoreContextModule extends AbstractModule {
|
|||
protected void configure() {
|
||||
bind(AsyncBlobStore.class).to(LocalAsyncBlobStore.class).asEagerSingleton();
|
||||
// forward all requests from TransientBlobStore to TransientAsyncBlobStore. needs above binding as cannot proxy a class
|
||||
bindClient(binder(), LocalBlobStore.class, AsyncBlobStore.class);
|
||||
bindBlockingApi(binder(), LocalBlobStore.class, AsyncBlobStore.class);
|
||||
install(new BlobStoreObjectModule());
|
||||
install(new BlobStoreMapModule());
|
||||
bind(BlobStore.class).to(LocalBlobStore.class);
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.jclouds.blobstore.AsyncBlobStore;
|
|||
import org.jclouds.blobstore.domain.Blob;
|
||||
import org.jclouds.blobstore.domain.MutableBlobMetadata;
|
||||
import org.jclouds.reflect.Invocation;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.Providers;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -40,7 +41,6 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code BlobStoreUtils}
|
||||
|
@ -125,23 +125,23 @@ public class BlobStoreUtilsTest {
|
|||
}
|
||||
|
||||
public void testGetKeyForAzureS3AndRackspace() {
|
||||
GeneratedHttpRequest request = requestForEndpointAndArgs(
|
||||
GeneratedHttpRequest<?> request = requestForEndpointAndArgs(
|
||||
"https://jclouds.blob.core.windows.net/adriancole-blobstore0/five",
|
||||
ImmutableList.<Object> of("adriancole-blobstore0", "five"));
|
||||
assertEquals(getNameFor(request), "five");
|
||||
}
|
||||
|
||||
public void testGetKeyForAtmos() {
|
||||
GeneratedHttpRequest request = requestForEndpointAndArgs(
|
||||
GeneratedHttpRequest<?> request = requestForEndpointAndArgs(
|
||||
"https://storage4.clouddrive.com/v1/MossoCloudFS_dc1f419c-5059-4c87-a389-3f2e33a77b22/adriancole-blobstore0/four",
|
||||
ImmutableList.<Object> of("adriancole-blobstore0/four"));
|
||||
assertEquals(getNameFor(request), "four");
|
||||
}
|
||||
|
||||
GeneratedHttpRequest requestForEndpointAndArgs(String endpoint, List<Object> args) {
|
||||
GeneratedHttpRequest<?> requestForEndpointAndArgs(String endpoint, List<Object> args) {
|
||||
try {
|
||||
Invocation invocation = Invocation.create(Invokable.from(String.class.getDeclaredMethod("toString")), args);
|
||||
return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create(endpoint)).invocation(invocation)
|
||||
return GeneratedHttpRequest.builder(String.class).method("POST").endpoint(URI.create(endpoint)).invocation(invocation)
|
||||
.build();
|
||||
} catch (SecurityException e) {
|
||||
throw Throwables.propagate(e);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.jclouds.openstack.config;
|
||||
|
||||
import static com.google.common.base.Suppliers.memoizeWithExpiration;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
@ -59,7 +59,7 @@ public class OpenStackAuthenticationModule extends AbstractModule {
|
|||
@Override
|
||||
protected void configure() {
|
||||
// OpenStackAuthClient is used directly for filters and retry handlers, so let's bind it explicitly
|
||||
bindClientAndAsyncClient(binder(), OpenStackAuthClient.class, OpenStackAuthAsyncClient.class);
|
||||
bindHttpApi(binder(), OpenStackAuthClient.class, OpenStackAuthAsyncClient.class);
|
||||
install(new FactoryModuleBuilder().build(URIFromAuthenticationResponseForService.Factory.class));
|
||||
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(RetryOnRenew.class);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.jclouds.openstack.keystone.v1_1.config;
|
||||
|
||||
import static com.google.common.base.Throwables.propagate;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -59,7 +59,7 @@ public class AuthenticationServiceModule extends AbstractModule {
|
|||
@Override
|
||||
protected void configure() {
|
||||
// ServiceClient is used directly for filters and retry handlers, so let's bind it explicitly
|
||||
bindClientAndAsyncClient(binder(), AuthenticationClient.class, AuthenticationAsyncClient.class);
|
||||
bindHttpApi(binder(), AuthenticationClient.class, AuthenticationAsyncClient.class);
|
||||
install(new FactoryModuleBuilder().implement(RegionIdToURISupplier.class,
|
||||
RegionIdToURIFromAuthForServiceSupplier.class).build(RegionIdToURISupplier.Factory.class));
|
||||
install(new FactoryModuleBuilder().implement(ImplicitRegionIdSupplier.class, V1DefaultRegionIdSupplier.class)
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.IntegrationTestAsyncClient;
|
||||
import org.jclouds.http.IntegrationTestClient;
|
||||
import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.AnonymousRestApiMetadata;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
|
|
|
@ -26,7 +26,7 @@ import static com.google.common.collect.Iterables.transform;
|
|||
import static com.google.common.collect.Maps.transformValues;
|
||||
import static com.google.common.collect.Maps.uniqueIndex;
|
||||
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
import static org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -134,8 +134,8 @@ public class TerremarkVCloudRestClientModule<S, A> extends RestClientModule<S, A
|
|||
bind(new TypeLiteral<Function<org.jclouds.trmk.vcloud_0_8.domain.Org, Iterable<? extends CatalogItem>>>() {
|
||||
}).to(new TypeLiteral<AllCatalogItemsInOrg>() {
|
||||
});
|
||||
bindClientAndAsyncClient(binder(), TerremarkVCloudVersionsClient.class, TerremarkVCloudVersionsAsyncClient.class);
|
||||
bindClientAndAsyncClient(binder(), TerremarkVCloudLoginClient.class, TerremarkVCloudLoginAsyncClient.class);
|
||||
bindHttpApi(binder(), TerremarkVCloudVersionsClient.class, TerremarkVCloudVersionsAsyncClient.class);
|
||||
bindHttpApi(binder(), TerremarkVCloudLoginClient.class, TerremarkVCloudLoginAsyncClient.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
@ -25,14 +25,14 @@ import org.jclouds.reflect.Invocation;
|
|||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
public class BasePayloadTest {
|
||||
|
||||
protected GeneratedHttpRequest requestForArgs(List<Object> args) {
|
||||
protected GeneratedHttpRequest<?> requestForArgs(List<Object> args) {
|
||||
try {
|
||||
Invocation invocation = Invocation.create(Invokable.from(String.class.getDeclaredMethod("toString")), args);
|
||||
return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
return GeneratedHttpRequest.builder(String.class).method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
.invocation(invocation).build();
|
||||
} catch (SecurityException e) {
|
||||
throw Throwables.propagate(e);
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.http.filters.BasicAuthentication;
|
|||
import org.jclouds.location.Provider;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.trmk.vcloud_0_8.endpoints.VCloudLogin;
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.SupportedVersionsHandler;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.jclouds.abiquo.config;
|
|||
|
||||
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
|
||||
import static org.jclouds.abiquo.domain.DomainWrapper.wrap;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -103,7 +103,7 @@ public class AbiquoRestClientModule extends RestClientModule<AbiquoApi, AbiquoAs
|
|||
@Override
|
||||
protected void configure() {
|
||||
super.configure();
|
||||
bindClientAndAsyncClient(binder(), AbiquoHttpClient.class, AbiquoHttpAsyncClient.class);
|
||||
bindHttpApi(binder(), AbiquoHttpClient.class, AbiquoHttpAsyncClient.class);
|
||||
bind(Utils.class).to(ExtendedUtils.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.testng.annotations.Test;
|
|||
import com.abiquo.model.rest.RESTLink;
|
||||
import com.abiquo.model.transport.SingleResourceTransportDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link BindToPath} binder.
|
||||
|
@ -61,7 +61,7 @@ public class BindToPathTest {
|
|||
@Test(expectedExceptions = NullPointerException.class)
|
||||
public void testInvalidNullInput() throws SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> withEndpointLink = Invokable.from(TestEndpointLink.class.getMethod("withEndpointLink", TestDto.class));
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(TestEndpointLink.class)
|
||||
.invocation(Invocation.create(withEndpointLink, ImmutableList.<Object> of(new TestDto())))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://localhost")).build();
|
||||
|
@ -73,7 +73,7 @@ public class BindToPathTest {
|
|||
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||
public void testInvalidInputType() throws SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> withEndpointLink = Invokable.from(TestEndpointLink.class.getMethod("withEndpointLink", TestDto.class));
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(TestEndpointLink.class)
|
||||
.invocation(Invocation.create(withEndpointLink, ImmutableList.<Object> of(new TestDto())))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://localhost")).build();
|
||||
|
@ -86,7 +86,7 @@ public class BindToPathTest {
|
|||
public void testAnnotationNotPresent() throws SecurityException, NoSuchMethodException {
|
||||
TestDto dto = new TestDto();
|
||||
Invokable<?, ?> withoutEndpointLink = Invokable.from(TestEndpointLink.class.getMethod("withoutEndpointLink", TestDto.class));
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(TestEndpointLink.class)
|
||||
.invocation(Invocation.create(withoutEndpointLink, ImmutableList.<Object> of(dto)))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://localhost")).build();
|
||||
|
@ -99,7 +99,7 @@ public class BindToPathTest {
|
|||
public void testLinkNotPresent() throws SecurityException, NoSuchMethodException {
|
||||
TestDto dto = new TestDto();
|
||||
Invokable<?, ?> withUnexistingLink = Invokable.from(TestEndpointLink.class.getMethod("withUnexistingLink", TestDto.class));
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(TestEndpointLink.class)
|
||||
.invocation(Invocation.create(withUnexistingLink, ImmutableList.<Object> of(dto)))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://localhost")).build();
|
||||
|
@ -111,7 +111,7 @@ public class BindToPathTest {
|
|||
public void testBindWithoutParameters() throws SecurityException, NoSuchMethodException {
|
||||
TestDto dto = new TestDto();
|
||||
Invokable<?, ?> withEndpointLink = Invokable.from(TestEndpointLink.class.getMethod("withEndpointLink", TestDto.class));
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(TestEndpointLink.class)
|
||||
.invocation(Invocation.create(withEndpointLink, ImmutableList.<Object> of(dto)))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://localhost")).build();
|
||||
|
@ -124,7 +124,7 @@ public class BindToPathTest {
|
|||
public void testBindWithQueryParameters() throws SecurityException, NoSuchMethodException {
|
||||
TestDto dto = new TestDto();
|
||||
Invokable<?, ?> withEndpointLink = Invokable.from(TestEndpointLink.class.getMethod("withEndpointLink", TestDto.class));
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(TestEndpointLink.class)
|
||||
.invocation(Invocation.create(withEndpointLink, ImmutableList.<Object> of(dto)))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://localhost?param=value")).build();
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.testng.annotations.Test;
|
|||
import com.abiquo.server.core.cloud.VirtualDatacenterDto;
|
||||
import com.abiquo.server.core.infrastructure.storage.VolumeManagementDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link BindMoveVolumeToPath} binder.
|
||||
|
@ -64,7 +64,7 @@ public class BindMoveVolumeToPathTest {
|
|||
private static GeneratedHttpRequest generatedHttpRequest() throws SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> withEndpointLink = Invokable.from(CloudAsyncApi.class.getMethod("moveVolume", VolumeManagementDto.class,
|
||||
VirtualDatacenterDto.class));
|
||||
return GeneratedHttpRequest.builder()
|
||||
return GeneratedHttpRequest.builder(CloudAsyncApi.class)
|
||||
.invocation(Invocation.create(withEndpointLink, ImmutableList.<Object> of(CloudResources.volumePut(), CloudResources.virtualDatacenterPut())))
|
||||
.method(HttpMethod.POST).endpoint(URI.create("http://localhost")).build();
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ import com.abiquo.server.core.cloud.VirtualMachineDto;
|
|||
import com.abiquo.server.core.infrastructure.network.VLANNetworkDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link BindNetworkConfigurationRefToPayload} binder.
|
||||
|
@ -70,7 +70,7 @@ public class BindNetworkConfigurationRefToPayloadTest {
|
|||
|
||||
Invokable<?, ?> method = Invokable.from(TestNetworkConfig.class.getMethod("withAll", VirtualMachineDto.class,
|
||||
VLANNetworkDto.class));
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(TestNetworkConfig.class)
|
||||
.invocation(Invocation.create(method, Lists.<Object> newArrayList(vm, null)))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://localhost")).build();
|
||||
|
@ -86,7 +86,7 @@ public class BindNetworkConfigurationRefToPayloadTest {
|
|||
|
||||
Invokable<?, ?> method = Invokable.from(TestNetworkConfig.class.getMethod("withAll", VirtualMachineDto.class,
|
||||
VLANNetworkDto.class));
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(TestNetworkConfig.class)
|
||||
.invocation(Invocation.create(method, ImmutableList.<Object> of(vm, network)))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://localhost")).build();
|
||||
|
@ -101,7 +101,7 @@ public class BindNetworkConfigurationRefToPayloadTest {
|
|||
|
||||
Invokable<?, ?> method = Invokable.from(TestNetworkConfig.class.getMethod("withoutVirtualMachine",
|
||||
VLANNetworkDto.class));
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(TestNetworkConfig.class)
|
||||
.invocation(Invocation.create(method, ImmutableList.<Object> of(network)))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://localhost")).build();
|
||||
|
@ -116,7 +116,7 @@ public class BindNetworkConfigurationRefToPayloadTest {
|
|||
|
||||
Invokable<?, ?> method = Invokable.from(TestNetworkConfig.class.getMethod("withAll", VirtualMachineDto.class,
|
||||
VLANNetworkDto.class));
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(TestNetworkConfig.class)
|
||||
.invocation(Invocation.create(method, ImmutableList.<Object> of(vm, network)))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://localhost")).build();
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.testng.annotations.Test;
|
|||
import com.abiquo.model.rest.RESTLink;
|
||||
import com.abiquo.server.core.infrastructure.DatacenterDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link BindSupportedDevicesLinkToPath} class.
|
||||
|
@ -63,7 +63,7 @@ public class BindSupportedDevicesLinkToPathTest {
|
|||
Invokable<?, ?> withEndpointLink = Invokable.from(InfrastructureAsyncApi.class.getMethod(
|
||||
"listSupportedStorageDevices", DatacenterDto.class));
|
||||
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(InfrastructureAsyncApi.class)
|
||||
.invocation(Invocation.create(withEndpointLink, ImmutableList.<Object> of(datacenter)))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://foo/bar")).build();
|
||||
|
@ -80,7 +80,7 @@ public class BindSupportedDevicesLinkToPathTest {
|
|||
Invokable<?, ?> withEndpointLink = Invokable.from(InfrastructureAsyncApi.class.getMethod(
|
||||
"listSupportedStorageDevices", DatacenterDto.class));
|
||||
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder()
|
||||
GeneratedHttpRequest request = GeneratedHttpRequest.builder(InfrastructureAsyncApi.class)
|
||||
.invocation(Invocation.create(withEndpointLink, ImmutableList.<Object> of(datacenter)))
|
||||
.method(HttpMethod.GET)
|
||||
.endpoint(URI.create("http://foo/bar")).build();
|
||||
|
|
|
@ -36,7 +36,7 @@ import com.abiquo.server.core.enterprise.RoleDto;
|
|||
import com.abiquo.server.core.enterprise.RolesDto;
|
||||
import com.abiquo.server.core.enterprise.UserDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code AdminAsyncApi}
|
||||
|
|
|
@ -77,7 +77,7 @@ import com.abiquo.server.core.infrastructure.storage.TiersDto;
|
|||
import com.abiquo.server.core.infrastructure.storage.VolumeManagementDto;
|
||||
import com.abiquo.server.core.infrastructure.storage.VolumesManagementDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code CloudAsyncApi}
|
||||
|
|
|
@ -41,7 +41,7 @@ import com.abiquo.server.core.config.SystemPropertyDto;
|
|||
import com.abiquo.server.core.enterprise.PrivilegeDto;
|
||||
import com.abiquo.server.core.enterprise.PrivilegesDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code AdminAsyncApi}.
|
||||
|
|
|
@ -53,7 +53,7 @@ import com.abiquo.server.core.infrastructure.DatacentersDto;
|
|||
import com.abiquo.server.core.infrastructure.MachinesDto;
|
||||
import com.abiquo.server.core.infrastructure.network.VLANNetworksDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code EnterpriseAsyncApi}
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.abiquo.server.core.event.EventsDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code EventAsyncApi}
|
||||
|
|
|
@ -89,7 +89,7 @@ import com.abiquo.server.core.infrastructure.storage.StoragePoolsDto;
|
|||
import com.abiquo.server.core.infrastructure.storage.TierDto;
|
||||
import com.abiquo.server.core.infrastructure.storage.TiersDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code InfrastructureAsyncApi}
|
||||
|
|
|
@ -42,7 +42,7 @@ import com.abiquo.server.core.pricing.PricingTemplatesDto;
|
|||
import com.abiquo.server.core.pricing.PricingTierDto;
|
||||
import com.abiquo.server.core.pricing.PricingTiersDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code PricingAsyncApi}.
|
||||
|
|
|
@ -33,7 +33,7 @@ import com.abiquo.model.transport.SingleResourceTransportDto;
|
|||
import com.abiquo.server.core.task.TaskDto;
|
||||
import com.abiquo.server.core.task.TasksDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code TaskAsyncApi}
|
||||
|
|
|
@ -43,7 +43,7 @@ import com.abiquo.server.core.appslibrary.VirtualMachineTemplateDto;
|
|||
import com.abiquo.server.core.appslibrary.VirtualMachineTemplatePersistentDto;
|
||||
import com.abiquo.server.core.appslibrary.VirtualMachineTemplatesDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code VirtualMachineTemplateAsyncApi}
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.testng.annotations.Test;
|
|||
import com.abiquo.model.rest.RESTLink;
|
||||
import com.abiquo.server.core.infrastructure.DatacentersDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code AbiquoHttpAsyncApi}.
|
||||
|
|
|
@ -45,7 +45,7 @@ public class OAuthModuleWithoutTypeAdapters extends OAuthModule {
|
|||
protected void configure() {
|
||||
bind(new TypeLiteral<Function<byte[], byte[]>>() {}).to(SignOrProduceMacForToken.class);
|
||||
bind(new TypeLiteral<Supplier<OAuthCredentials>>() {}).to(OAuthCredentialsSupplier.class);
|
||||
bind(new TypeLiteral<Function<GeneratedHttpRequest, TokenRequest>>() {}).to(BuildTokenRequest.class);
|
||||
bind(new TypeLiteral<Function<GeneratedHttpRequest<?>, TokenRequest>>() {}).to(BuildTokenRequest.class);
|
||||
bind(new TypeLiteral<Function<TokenRequest, Token>>() {}).to(FetchToken.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ import com.google.common.base.Optional;
|
|||
public abstract class BaseToPagedIterable<T, I extends BaseToPagedIterable<T, I>> implements
|
||||
Function<ListPage<T>, PagedIterable<T>>, InvocationContext<I> {
|
||||
|
||||
private GeneratedHttpRequest request;
|
||||
private GeneratedHttpRequest<?> request;
|
||||
|
||||
@Override
|
||||
public PagedIterable<T> apply(ListPage<T> input) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.joyent.cloudapi.v6_5.config;
|
||||
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterAsyncApi;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterApi;
|
||||
|
@ -41,7 +41,7 @@ public class DatacentersAreZonesModule extends AbstractModule {
|
|||
@Override
|
||||
protected void configure() {
|
||||
// datacenter api is needed for obtaining zone ids
|
||||
bindClientAndAsyncClient(binder(), DatacenterApi.class, DatacenterAsyncApi.class);
|
||||
bindHttpApi(binder(), DatacenterApi.class, DatacenterAsyncApi.class);
|
||||
bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON);
|
||||
bind(ZoneIdToURISupplier.class).to(ZoneIdToURIFromDatacentersApi.class).in(Scopes.SINGLETON);
|
||||
bind(ZoneIdsSupplier.class).to(ZoneIdsFromZoneIdToURIKeySet.class).in(Scopes.SINGLETON);
|
||||
|
|
|
@ -29,7 +29,7 @@ import javax.inject.Named;
|
|||
import javax.inject.Singleton;
|
||||
import java.net.URI;
|
||||
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
|
||||
/**
|
||||
* An OAuth module to be used form other providers.
|
||||
|
@ -40,7 +40,7 @@ public class OAuthAuthenticationModule extends AbstractModule {
|
|||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bindClientAndAsyncClient(binder(), OAuthApi.class, OAuthAsyncApi.class);
|
||||
bindHttpApi(binder(), OAuthApi.class, OAuthAsyncApi.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue