From cddd35bc51d836c8b4183634552108cf7f697c64 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Sun, 30 Dec 2012 22:26:03 -0800 Subject: [PATCH] removed unnecessary generic types and made RestAnnotationProcessor immutable --- .../blobstore/AtmosBlobRequestSigner.java | 6 +- .../jclouds/atmos/AtmosAsyncClientTest.java | 8 - .../blobstore/AtmosBlobRequestSignerTest.java | 8 - .../CloudServersAsyncClientTest.java | 8 - .../cloudsigma/CloudSigmaAsyncClientTest.java | 8 - .../cloudstack/CloudStackAsyncClientTest.java | 9 - .../features/AccountAsyncClientTest.java | 7 - .../features/AddressAsyncClientTest.java | 8 - .../features/AsyncJobAsyncClientTest.java | 9 - .../ConfigurationAsyncClientTest.java | 9 - .../DomainAccountAsyncClientTest.java | 9 - .../features/DomainLimitAsyncClientTest.java | 9 - .../features/EventAsyncClientTest.java | 10 - .../features/FirewallAsyncClientTest.java | 9 - .../GlobalAccountAsyncClientTest.java | 9 - .../features/GlobalAlertAsyncClientTest.java | 10 - .../GlobalCapacityAsyncClientTest.java | 10 - .../features/GlobalHostAsyncClientTest.java | 9 - .../GlobalOfferingAsyncClientTest.java | 9 - .../features/GlobalPodClientLiveTest.java | 1 - .../GlobalStoragePoolAsyncClientTest.java | 9 - .../features/GlobalUsageAsyncClientTest.java | 9 - .../features/GlobalUserAsyncClientTest.java | 9 - .../features/GuestOSAsyncClientTest.java | 8 - .../features/HypervisorAsyncClientTest.java | 9 - .../features/ISOAsyncClientTest.java | 9 - .../features/LimitAsyncClientTest.java | 9 - .../features/LoadBalancerAsyncClientTest.java | 9 - .../features/NATAsyncClientTest.java | 9 - .../features/NetworkAsyncClientTest.java | 8 - .../features/OfferingAsyncClientTest.java | 8 - .../features/SSHKeyPairAsyncClientTest.java | 9 - .../SecurityGroupAsyncClientTest.java | 8 - .../features/SnapshotAsyncClientTest.java | 8 - .../features/TemplateAsyncClientTest.java | 8 - .../features/VMGroupAsyncClientTest.java | 8 - .../VirtualMachineAsyncClientTest.java | 8 - .../features/VolumeAsyncClientTest.java | 9 - .../features/ZoneAsyncClientTest.java | 8 - .../cloudwatch/CloudWatchAsyncApiTest.java | 8 +- .../org/jclouds/ec2/EC2AsyncClientTest.java | 9 - .../BindS3UploadPolicyAndSignatureTest.java | 9 - .../ec2/services/AMIAsyncClientTest.java | 9 - ...ilabilityZoneAndRegionAsyncClientTest.java | 10 - .../ElasticBlockStoreAsyncClientTest.java | 9 - .../ElasticIPAddressAsyncClientTest.java | 10 - .../ec2/services/InstanceAsyncClientTest.java | 9 - .../ec2/services/KeyPairAsyncClientTest.java | 10 - .../SecurityGroupAsyncClientTest.java | 10 - .../ec2/services/WindowsAsyncClientTest.java | 10 - .../ElasticStackAsyncClientTest.java | 8 - .../v2_0/handlers/NovaErrorHandlerTest.java | 51 +-- .../s3/blobstore/S3BlobRequestSigner.java | 6 +- ...indAsHostPrefixIfConfiguredNoPathTest.java | 9 - .../BindAsHostPrefixIfConfiguredTest.java | 9 - .../BindNoBucketLoggingToXmlPayloadTest.java | 9 - .../BindS3ObjectMetadataToRequestTest.java | 8 - .../RequestAuthorizeSignatureTest.java | 8 - .../handlers/SQSErrorRetryHandlerTest.java | 54 +-- .../swift/blobstore/SwiftBlobSigner.java | 12 +- .../swift/CommonSwiftClientTest.java | 8 - .../jclouds/vcloud/VCloudAsyncClientTest.java | 9 - .../vcloud/VCloudVersionsAsyncClientTest.java | 9 - .../features/CatalogAsyncClientTest.java | 9 - .../features/NetworkAsyncClientTest.java | 9 - .../vcloud/features/OrgAsyncClientTest.java | 9 - .../vcloud/features/TaskAsyncClientTest.java | 9 - .../vcloud/features/VAppAsyncClientTest.java | 9 - .../features/VAppTemplateAsyncClientTest.java | 9 - .../vcloud/features/VDCAsyncClientTest.java | 9 - .../vcloud/features/VmAsyncClientTest.java | 9 - .../internal/VCloudLoginAsyncClientTest.java | 8 - .../blobstore/LocalAsyncBlobStore.java | 43 +-- .../TransientBlobRequestSignerTest.java | 9 - .../OpenStackAuthAsyncClientTest.java | 10 - ...indAddInternetServiceToXmlPayloadTest.java | 1 - .../TerremarkVCloudLoginAsyncClientTest.java | 8 - ...erremarkVCloudVersionsAsyncClientTest.java | 9 - .../java/org/jclouds/http/HttpCommand.java | 132 +++++-- .../jclouds/http/HttpCommandRendezvous.java | 65 ---- .../jclouds/http/TransformingHttpCommand.java | 41 --- ...ransformingHttpCommandExecutorService.java | 48 --- ...formingHttpCommandExecutorServiceImpl.java | 57 --- .../http/TransformingHttpCommandImpl.java | 172 ---------- ...vaUrlHttpCommandExecutorServiceModule.java | 4 - .../internal/ClassMethodArgsAndReturnVal.java | 23 +- .../org/jclouds/rest/AsyncClientFactory.java | 53 --- .../rest/config/AsyncClientProvider.java | 17 +- .../org/jclouds/rest/config/RestModule.java | 77 +---- .../rest/internal/AsyncRestClientProxy.java | 79 +++-- .../rest/internal/BaseRestApiMetadata.java | 1 + .../internal/CreateAsyncClientForCaller.java | 33 +- .../CreateClientForCaller.java | 2 +- .../internal/RestAnnotationProcessor.java | 324 +++++++++--------- .../rest/internal/SeedAnnotationCache.java | 27 +- .../HeaderToRetryAfterExceptionTest.java | 49 +-- .../BackoffLimitedRetryHandlerTest.java | 20 +- .../jclouds/rest/InputParamValidatorTest.java | 11 +- .../rest/internal/BaseAsyncApiTest.java | 11 +- .../rest/internal/BaseRestApiTest.java | 8 +- .../internal/RestAnnotationProcessorTest.java | 24 +- ...cheHCHttpCommandExecutorServiceModule.java | 5 - .../GoogleAppEngineConfigurationModule.java | 3 - .../jclouds/abiquo/AbiquoDelegateApiTest.java | 9 - .../abiquo/features/AdminAsyncApiTest.java | 9 - .../abiquo/features/CloudAsyncApiTest.java | 8 - .../abiquo/features/ConfigAsyncApiTest.java | 8 - .../features/EnterpriseAsyncApiTest.java | 8 - .../abiquo/features/EventAsyncApiTest.java | 8 - .../features/InfrastructureAsyncApiTest.java | 8 - .../abiquo/features/PricingAsyncApiTest.java | 10 +- .../abiquo/features/TaskAsyncApiTest.java | 8 - .../VirtualMachineTemplateAsyncApiTest.java | 8 - .../internal/AbiquoHttpAsyncClientTest.java | 9 - .../jclouds/savvis/vpdc/VPDCAsyncApiTest.java | 9 - .../vpdc/features/BrowsingAsyncApiTest.java | 10 - .../vpdc/features/FirewallAsyncApiTest.java | 10 - .../ServiceManagementAsyncApiTest.java | 9 - .../savvis/vpdc/features/VMAsyncApiTest.java | 8 - .../aws/ec2/AWSEC2AsyncClientTest.java | 9 - .../ec2/services/AWSAMIAsyncClientTest.java | 9 - .../services/AWSInstanceAsyncClientTest.java | 9 - .../services/AWSKeyPairAsyncClientTest.java | 10 - .../AWSSecurityGroupAsyncClientTest.java | 9 - .../services/MonitoringAsyncClientTest.java | 10 - .../PlacementGroupAsyncClientTest.java | 10 - .../services/SpotInstanceAsyncClientTest.java | 10 - .../aws/ec2/services/TagAsyncClientTest.java | 8 - .../jclouds/aws/s3/AWSS3AsyncClientTest.java | 8 - .../jclouds/aws/s3/AWSS3ClientExpectTest.java | 3 +- .../BindObjectMetadataToRequestTest.java | 8 - .../blobstore/AzureBlobRequestSigner.java | 6 +- .../azureblob/AzureBlobAsyncClientTest.java | 8 - .../BindAzureBlobMetadataToRequestTest.java | 8 - .../blobstore/AzureBlobRequestSignerTest.java | 8 - .../jclouds/glesys/GleSYSAsyncApiTest.java | 9 - .../jclouds/gogrid/mock/HttpCommandMock.java | 72 ---- .../jclouds/gogrid/GoGridAsyncClientTest.java | 9 - .../handlers/GoGridErrorHandlerTest.java | 16 +- .../services/GridImageAsyncClientTest.java | 9 - .../services/GridIpAsyncClientTest.java | 8 - .../services/GridJobAsyncClientTest.java | 9 - .../GridLoadBalancerAsyncClientTest.java | 9 - .../services/GridServerAsyncClientTest.java | 9 - ...HPCloudObjectStorageBlobRequestSigner.java | 15 +- .../softlayer/SoftLayerAsyncClientTest.java | 9 - .../features/AccountAsyncClientTest.java | 9 - .../features/DatacenterAsyncClientTest.java | 8 - .../ProductPackageAsyncClientTest.java | 9 - .../features/VirtualGuestAsyncClientTest.java | 8 - .../TerremarkECloudAsyncClientTest.java | 8 - .../DataCenterOperationsAsyncClientTest.java | 9 - .../TagOperationsAsyncClientTest.java | 9 - ...TerremarkVCloudExpressAsyncClientTest.java | 7 - 154 files changed, 422 insertions(+), 2167 deletions(-) delete mode 100644 core/src/main/java/org/jclouds/http/HttpCommandRendezvous.java delete mode 100644 core/src/main/java/org/jclouds/http/TransformingHttpCommand.java delete mode 100644 core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorService.java delete mode 100644 core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorServiceImpl.java delete mode 100644 core/src/main/java/org/jclouds/http/TransformingHttpCommandImpl.java delete mode 100644 core/src/main/java/org/jclouds/rest/AsyncClientFactory.java rename apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainUserAsyncClientTest.java => core/src/main/java/org/jclouds/rest/internal/CreateAsyncClientForCaller.java (56%) rename core/src/main/java/org/jclouds/rest/{config => internal}/CreateClientForCaller.java (98%) delete mode 100644 providers/gogrid/src/main/java/org/jclouds/gogrid/mock/HttpCommandMock.java diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSigner.java b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSigner.java index 1d211bc4da..a41909ec2a 100644 --- a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSigner.java +++ b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSigner.java @@ -43,7 +43,7 @@ import org.jclouds.rest.internal.RestAnnotationProcessor; */ @Singleton public class AtmosBlobRequestSigner implements BlobRequestSigner { - private final RestAnnotationProcessor processor; + private final RestAnnotationProcessor processor; private final BlobToObject blobToObject; private final BlobToHttpGetOptions blob2ObjectGetOptions; @@ -52,9 +52,9 @@ public class AtmosBlobRequestSigner implements BlobRequestSigner { private final Method createMethod; @Inject - public AtmosBlobRequestSigner(RestAnnotationProcessor processor, BlobToObject blobToObject, + public AtmosBlobRequestSigner(RestAnnotationProcessor.Factory processor, BlobToObject blobToObject, BlobToHttpGetOptions blob2ObjectGetOptions) throws SecurityException, NoSuchMethodException { - this.processor = checkNotNull(processor, "processor"); + this.processor = checkNotNull(processor, "processor").declaring(AtmosAsyncClient.class); this.blobToObject = checkNotNull(blobToObject, "blobToObject"); this.blob2ObjectGetOptions = checkNotNull(blob2ObjectGetOptions, "blob2ObjectGetOptions"); this.getMethod = AtmosAsyncClient.class.getMethod("readFile", String.class, GetOptions[].class); diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java index 73feca4b44..da4572b636 100644 --- a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java +++ b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java @@ -50,13 +50,11 @@ import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.options.GetOptions; import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Supplier; import com.google.inject.Module; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code AtmosAsyncClient} @@ -301,12 +299,6 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest assertEquals(request.getFilters().get(0).getClass(), SignRequest.class); } - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @BeforeClass @Override protected void setupFactory() throws IOException { diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java index 3b56009648..0b063bdc8d 100644 --- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java +++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java @@ -35,13 +35,11 @@ import org.jclouds.date.TimeStamp; import org.jclouds.http.HttpRequest; import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Supplier; import com.google.inject.Module; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code AtmosBlobRequestSigner} @@ -123,12 +121,6 @@ public class AtmosBlobRequestSignerTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected Module createModule() { return new TestAtmosRestClientModule(); diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java index 7421ea5250..cfeccd7d3e 100644 --- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java +++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java @@ -65,13 +65,11 @@ import org.jclouds.openstack.keystone.v1_1.domain.Auth; import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest; import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; import com.google.inject.Module; import com.google.inject.Provides; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code CloudServersAsyncClient} @@ -868,12 +866,6 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected void checkFilters(HttpRequest request) { assertEquals(request.getFilters().size(), 2); diff --git a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaAsyncClientTest.java b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaAsyncClientTest.java index 43a59764d9..8d633cde32 100644 --- a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaAsyncClientTest.java +++ b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaAsyncClientTest.java @@ -48,12 +48,10 @@ import org.jclouds.http.HttpRequest; import org.jclouds.http.filters.BasicAuthentication; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code CloudSigmaAsyncClient} @@ -641,12 +639,6 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected ApiMetadata createApiMetadata() { return new CloudSigmaApiMetadata(); diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackAsyncClientTest.java index 6416caf2af..47393f5bbe 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackAsyncClientTest.java @@ -23,12 +23,9 @@ import java.util.concurrent.ExecutionException; import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code CloudStackAsyncClient} * @@ -106,12 +103,6 @@ public class CloudStackAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @BeforeClass @Override protected void setupFactory() throws IOException { diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountAsyncClientTest.java index 43a2e47f80..645b546e7b 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountAsyncClientTest.java @@ -28,11 +28,9 @@ import org.jclouds.cloudstack.options.ListAccountsOptions; import org.jclouds.functions.IdentityFunction; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code AccountAsyncClient} @@ -97,9 +95,4 @@ public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AddressAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AddressAsyncClientTest.java index 59e08d2b4a..faafab7c2e 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AddressAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AddressAsyncClientTest.java @@ -33,11 +33,9 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code AddressAsyncClient} @@ -136,10 +134,4 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AsyncJobAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AsyncJobAsyncClientTest.java index 2c8c41ef04..608e2b32db 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AsyncJobAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AsyncJobAsyncClientTest.java @@ -28,11 +28,8 @@ import org.jclouds.cloudstack.functions.ParseAsyncJobsFromHttpResponse; import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.cloudstack.options.ListAsyncJobsOptions; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code AsyncJobAsyncClient} * @@ -94,10 +91,4 @@ public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ConfigurationAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ConfigurationAsyncClientTest.java index fcf741b354..2b5196eba8 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ConfigurationAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ConfigurationAsyncClientTest.java @@ -25,11 +25,8 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code ConfigurationAsyncClient} * @@ -56,10 +53,4 @@ public class ConfigurationAsyncClientTest extends BaseCloudStackAsyncClientTest< checkFilters(httpRequest); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainAccountAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainAccountAsyncClientTest.java index 07ddf68d5b..43fdffad42 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainAccountAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainAccountAsyncClientTest.java @@ -25,11 +25,8 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; import org.jclouds.http.functions.UnwrapOnlyJsonValue; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code DomainAccountAsyncClient} * @@ -69,10 +66,4 @@ public class DomainAccountAsyncClientTest extends BaseCloudStackAsyncClientTest< checkFilters(httpRequest); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainLimitAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainLimitAsyncClientTest.java index f37b896440..7ddb8a6133 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainLimitAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainLimitAsyncClientTest.java @@ -27,11 +27,8 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code DomainLimitAsyncClient} * @@ -58,10 +55,4 @@ public class DomainLimitAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/EventAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/EventAsyncClientTest.java index 691db746b1..8f34c05f52 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/EventAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/EventAsyncClientTest.java @@ -27,11 +27,8 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.cloudstack.options.ListEventsOptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code EventAsyncClient} * @@ -91,11 +88,4 @@ public class EventAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallAsyncClientTest.java index 4b08842000..4b6c8d4e1d 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallAsyncClientTest.java @@ -31,11 +31,8 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code FirewallAsyncClient} * @@ -117,10 +114,4 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAccountAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAccountAsyncClientTest.java index 5c200b7271..92835c564b 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAccountAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAccountAsyncClientTest.java @@ -28,11 +28,8 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code GlobalAccountAsyncClient} * @@ -93,10 +90,4 @@ public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest< checkFilters(httpRequest); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAlertAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAlertAsyncClientTest.java index e51e261f2d..99795554b5 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAlertAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAlertAsyncClientTest.java @@ -26,11 +26,8 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.cloudstack.options.ListAlertsOptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code GlobalAlertsAsyncClient} * @@ -74,11 +71,4 @@ public class GlobalAlertAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalCapacityAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalCapacityAsyncClientTest.java index 93deb2d365..dbcdb8b040 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalCapacityAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalCapacityAsyncClientTest.java @@ -27,11 +27,8 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.cloudstack.options.ListCapacityOptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code GlobalCapacityAsyncClient} * @@ -73,11 +70,4 @@ public class GlobalCapacityAsyncClientTest extends BaseCloudStackAsyncClientTest checkFilters(httpRequest); } - - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostAsyncClientTest.java index 626328607c..ee3d392cde 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostAsyncClientTest.java @@ -25,11 +25,8 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.cloudstack.options.ListHostsOptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code GlobalHostAsyncClient} * @@ -53,10 +50,4 @@ public class GlobalHostAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClientTest.java index 6116948937..c1d85c76e9 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClientTest.java @@ -30,11 +30,8 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code GlobalOfferingAsyncClient} * @@ -159,10 +156,4 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest checkFilters(httpRequest); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java index 413282206f..e85bd35972 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java @@ -34,7 +34,6 @@ import org.jclouds.cloudstack.internal.BaseCloudStackClientLiveTest; import org.jclouds.cloudstack.options.CreatePodOptions; import org.jclouds.cloudstack.options.ListPodsOptions; import org.jclouds.cloudstack.options.UpdatePodOptions; -import org.testng.annotations.AfterClass; import org.testng.annotations.AfterGroups; import org.testng.annotations.Test; diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClientTest.java index 629d33dadd..483a09bcf4 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClientTest.java @@ -25,11 +25,8 @@ import org.jclouds.cloudstack.options.ListStoragePoolsOptions; import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code GlobalStoragePoolAsyncClient} * @@ -69,10 +66,4 @@ public class GlobalStoragePoolAsyncClientTest extends BaseCloudStackAsyncClientT checkFilters(httpRequest); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageAsyncClientTest.java index ac4a0ec414..0712852134 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageAsyncClientTest.java @@ -28,11 +28,8 @@ import org.jclouds.cloudstack.options.ListUsageRecordsOptions; import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code GlobalUsageAsyncClient} * @@ -140,10 +137,4 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUserAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUserAsyncClientTest.java index 2087115e27..28d927c6a2 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUserAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUserAsyncClientTest.java @@ -27,11 +27,8 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code GlobalUserAsyncClient} */ @@ -88,10 +85,4 @@ public class GlobalUserAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GuestOSAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GuestOSAsyncClientTest.java index c1f4b2c33c..7ddae56376 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GuestOSAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GuestOSAsyncClientTest.java @@ -30,11 +30,9 @@ import org.jclouds.cloudstack.options.ListOSTypesOptions; import org.jclouds.functions.IdentityFunction; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code GuestOSAsyncClient} @@ -131,10 +129,4 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/HypervisorAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/HypervisorAsyncClientTest.java index c305e58bba..dd73b30ce4 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/HypervisorAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/HypervisorAsyncClientTest.java @@ -25,11 +25,8 @@ import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; import org.jclouds.cloudstack.functions.ParseNamesFromHttpResponse; import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code HypervisorAsyncClient} * @@ -73,10 +70,4 @@ public class HypervisorAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ISOAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ISOAsyncClientTest.java index 11bfa765a5..a89765d387 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ISOAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ISOAsyncClientTest.java @@ -33,11 +33,9 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; -import com.google.inject.TypeLiteral; /** * Tests the behaviour of ISOAsyncClient. * @@ -255,11 +253,4 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LimitAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LimitAsyncClientTest.java index ef8dde82c3..30ce25cc4f 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LimitAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LimitAsyncClientTest.java @@ -26,11 +26,8 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.cloudstack.options.ListResourceLimitsOptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code LimitAsyncClient} * @@ -72,10 +69,4 @@ public class LimitAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LoadBalancerAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LoadBalancerAsyncClientTest.java index 12a472620c..ea14cd5af3 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LoadBalancerAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LoadBalancerAsyncClientTest.java @@ -31,11 +31,8 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code LoadBalancerAsyncClient} * @@ -151,10 +148,4 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/NATAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/NATAsyncClientTest.java index 3ef017bb51..63cde8f095 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/NATAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/NATAsyncClientTest.java @@ -31,11 +31,8 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code NATAsyncClient} * @@ -187,10 +184,4 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/NetworkAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/NetworkAsyncClientTest.java index 68bb3786bd..348c4862fc 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/NetworkAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/NetworkAsyncClientTest.java @@ -31,11 +31,9 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; import org.jclouds.functions.IdentityFunction; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code NetworkAsyncClient} @@ -155,10 +153,4 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/OfferingAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/OfferingAsyncClientTest.java index 19655b5f42..f2d06282c9 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/OfferingAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/OfferingAsyncClientTest.java @@ -32,11 +32,9 @@ import org.jclouds.cloudstack.options.ListServiceOfferingsOptions; import org.jclouds.functions.IdentityFunction; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code OfferingAsyncClient} @@ -206,10 +204,4 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairAsyncClientTest.java index 5fa376f445..06d24cdbd4 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairAsyncClientTest.java @@ -36,11 +36,9 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code SSHKeyPairAsyncClient} @@ -137,11 +135,4 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupAsyncClientTest.java index 3543f7771e..d1c33d4f32 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupAsyncClientTest.java @@ -32,14 +32,12 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code SecurityGroupAsyncClient} @@ -237,10 +235,4 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest< checkFilters(httpRequest); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SnapshotAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SnapshotAsyncClientTest.java index c9463dcbbe..6ea3a15c72 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SnapshotAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SnapshotAsyncClientTest.java @@ -36,12 +36,10 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; import com.google.common.collect.ImmutableSet; -import com.google.inject.TypeLiteral; /** * Tests the behaviour of SnapshotAsyncClient. @@ -231,10 +229,4 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateAsyncClientTest.java index d83bfa8c45..b1ba56e166 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateAsyncClientTest.java @@ -42,12 +42,10 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; import com.google.common.collect.ImmutableSet; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code TemplateAsyncClient} @@ -342,10 +340,4 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VMGroupAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VMGroupAsyncClientTest.java index b8983c24ca..b84ba6e930 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VMGroupAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VMGroupAsyncClientTest.java @@ -33,11 +33,9 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code VMGroupAsyncClient} @@ -170,10 +168,4 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClientTest.java index a8a4bd9f0a..a357eda0e3 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClientTest.java @@ -32,11 +32,9 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code VirtualMachineAsyncClient} @@ -260,10 +258,4 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest checkFilters(httpRequest); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VolumeAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VolumeAsyncClientTest.java index 8a632ea4ae..d85b0d51c0 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VolumeAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VolumeAsyncClientTest.java @@ -27,11 +27,8 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code EventAsyncClient} * @@ -149,10 +146,4 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ZoneAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ZoneAsyncClientTest.java index f7cbf45f03..ecb836b542 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ZoneAsyncClientTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/ZoneAsyncClientTest.java @@ -28,12 +28,10 @@ import org.jclouds.cloudstack.options.ListZonesOptions; import org.jclouds.functions.IdentityFunction; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseFirstJsonValueNamed; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Functions; import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code ZoneAsyncClient} @@ -106,10 +104,4 @@ public class ZoneAsyncClientTest extends BaseCloudStackAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncApiTest.java b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncApiTest.java index 3c49f7eceb..a8d92d7e89 100644 --- a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncApiTest.java +++ b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncApiTest.java @@ -41,14 +41,12 @@ import org.jclouds.location.config.LocationModule; import org.jclouds.location.suppliers.RegionIdToURISupplier; import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.internal.BaseAsyncApiTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.util.Suppliers2; import org.testng.annotations.Test; import com.google.common.base.Supplier; import com.google.common.collect.ImmutableMap; import com.google.inject.Module; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code CloudWatchAsyncApi} @@ -82,11 +80,6 @@ public class CloudWatchAsyncApiTest extends BaseAsyncApiTest checkFilters(request); } - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } @ConfiguresRestClient private static final class TestMonitoringRestClientModule extends CloudWatchRestClientModule { @@ -129,4 +122,5 @@ public class CloudWatchAsyncApiTest extends BaseAsyncApiTest assertEquals(request.getFilters().get(0).getClass(), FormSigner.class); } + } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/EC2AsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/EC2AsyncClientTest.java index 2ead44be27..de2f45b42a 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/EC2AsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/EC2AsyncClientTest.java @@ -23,12 +23,9 @@ import java.util.concurrent.ExecutionException; import org.jclouds.ec2.services.BaseEC2AsyncClientTest; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code EC2AsyncClient} * @@ -64,12 +61,6 @@ public class EC2AsyncClientTest extends BaseEC2AsyncClientTest { assert asyncClient.getWindowsServices() != null; } - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @BeforeClass @Override protected void setupFactory() throws IOException { diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/binders/BindS3UploadPolicyAndSignatureTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/binders/BindS3UploadPolicyAndSignatureTest.java index 53148e073c..e07f905a78 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/binders/BindS3UploadPolicyAndSignatureTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/binders/BindS3UploadPolicyAndSignatureTest.java @@ -25,12 +25,9 @@ import java.io.IOException; import org.jclouds.ec2.services.BaseEC2AsyncClientTest; import org.jclouds.ec2.services.InstanceAsyncClient; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code BindS3UploadPolicyAndSignature} * @@ -63,10 +60,4 @@ public class BindS3UploadPolicyAndSignatureTest extends BaseEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/services/AMIAsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/services/AMIAsyncClientTest.java index fa3fb17a77..f434a1f75b 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/services/AMIAsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/services/AMIAsyncClientTest.java @@ -36,11 +36,9 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code AMIAsyncClient} @@ -315,11 +313,4 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest { checkFilters(request); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java index 442247cba9..c17769b7c5 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/services/AvailabilityZoneAndRegionAsyncClientTest.java @@ -33,11 +33,8 @@ import org.jclouds.ec2.xml.DescribeAvailabilityZonesResponseHandler; import org.jclouds.ec2.xml.DescribeRegionsResponseHandler; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code AvailabilityZoneAndRegionAsyncClient} * @@ -117,11 +114,4 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends checkFilters(request); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticBlockStoreAsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticBlockStoreAsyncClientTest.java index d9fd46e602..542c7094e3 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticBlockStoreAsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticBlockStoreAsyncClientTest.java @@ -38,11 +38,9 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code ElasticBlockStoreAsyncClient} @@ -307,11 +305,4 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticIPAddressAsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticIPAddressAsyncClientTest.java index b909c97c31..5b5ceecd81 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticIPAddressAsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/services/ElasticIPAddressAsyncClientTest.java @@ -28,11 +28,8 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code ElasticIPAddressAsyncClient} * @@ -124,11 +121,4 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/services/InstanceAsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/services/InstanceAsyncClientTest.java index 87fa5df699..1a77e46e43 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/services/InstanceAsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/services/InstanceAsyncClientTest.java @@ -41,11 +41,9 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.Maps; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code InstanceAsyncClient} @@ -505,11 +503,4 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/services/KeyPairAsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/services/KeyPairAsyncClientTest.java index 56babc9781..0f287350c9 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/services/KeyPairAsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/services/KeyPairAsyncClientTest.java @@ -27,11 +27,8 @@ import org.jclouds.ec2.xml.DescribeKeyPairsResponseHandler; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code KeyPairAsyncClient} * @@ -90,11 +87,4 @@ public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/services/SecurityGroupAsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/services/SecurityGroupAsyncClientTest.java index 6841ad7837..9e3e99976b 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/services/SecurityGroupAsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/services/SecurityGroupAsyncClientTest.java @@ -30,11 +30,8 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code SecurityGroupAsyncClient} * @@ -204,11 +201,4 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/services/WindowsAsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/services/WindowsAsyncClientTest.java index 2f74f0a68b..4abad33477 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/services/WindowsAsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/services/WindowsAsyncClientTest.java @@ -27,11 +27,8 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code WindowsAsyncClient} * @@ -119,11 +116,4 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackAsyncClientTest.java b/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackAsyncClientTest.java index a72d769aa1..f87e7b108b 100644 --- a/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackAsyncClientTest.java +++ b/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackAsyncClientTest.java @@ -47,12 +47,10 @@ import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.io.Payload; import org.jclouds.io.Payloads; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code ElasticStackAsyncClient} @@ -446,12 +444,6 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected ApiMetadata createApiMetadata() { return new ElasticStackApiMetadata(); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandlerTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandlerTest.java index 4f9cdb6ef6..7dfca212cb 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandlerTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandlerTest.java @@ -221,56 +221,7 @@ public class NovaErrorHandlerTest { new OverLimitParser(new GsonWrapper(new Gson()))); private HttpCommand command() { - return new HttpCommand() { - - private Exception exception; - - @Override - public int getRedirectCount() { - return 0; - } - - @Override - public int incrementRedirectCount() { - return 0; - } - - @Override - public boolean isReplayable() { - return false; - } - - @Override - public Exception getException() { - return exception; - } - - @Override - public int getFailureCount() { - return 0; - } - - @Override - public int incrementFailureCount() { - return 0; - } - - @Override - public void setException(Exception exception) { - this.exception = exception; - } - - @Override - public HttpRequest getCurrentRequest() { - return HttpRequest.builder().method("POST").endpoint("https://nova/v1.1/servers").build(); - } - - @Override - public void setCurrentRequest(HttpRequest request) { - - } - - }; + return new HttpCommand(HttpRequest.builder().method("POST").endpoint("https://nova/v1.1/servers").build()); } } diff --git a/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobRequestSigner.java b/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobRequestSigner.java index 71718ede7e..18da3f06f0 100644 --- a/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobRequestSigner.java +++ b/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobRequestSigner.java @@ -43,7 +43,7 @@ import org.jclouds.s3.options.PutObjectOptions; */ @Singleton public class S3BlobRequestSigner implements BlobRequestSigner { - private final RestAnnotationProcessor processor; + private final RestAnnotationProcessor processor; private final BlobToObject blobToObject; private final BlobToHttpGetOptions blob2HttpGetOptions; @@ -52,9 +52,9 @@ public class S3BlobRequestSigner implements BlobRequestSigner { private final Method createMethod; @Inject - public S3BlobRequestSigner(RestAnnotationProcessor processor, BlobToObject blobToObject, + public S3BlobRequestSigner(RestAnnotationProcessor.Factory processor, BlobToObject blobToObject, BlobToHttpGetOptions blob2HttpGetOptions) throws SecurityException, NoSuchMethodException { - this.processor = checkNotNull(processor, "processor"); + this.processor = checkNotNull(processor, "processor").declaring(S3AsyncClient.class); this.blobToObject = checkNotNull(blobToObject, "blobToObject"); this.blob2HttpGetOptions = checkNotNull(blob2HttpGetOptions, "blob2HttpGetOptions"); this.getMethod = S3AsyncClient.class.getMethod("getObject", String.class, String.class, GetOptions[].class); diff --git a/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredNoPathTest.java b/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredNoPathTest.java index 21d297f09c..02cbed25c9 100644 --- a/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredNoPathTest.java +++ b/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredNoPathTest.java @@ -25,13 +25,10 @@ import java.lang.reflect.Method; import java.util.Properties; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.internal.BaseS3AsyncClientTest; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code BindAsHostPrefixIfConfigured} * @@ -41,12 +38,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "BindAsHostPrefixIfConfiguredNoPathTest") public class BindAsHostPrefixIfConfiguredNoPathTest extends BaseS3AsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testBucketWithHostnameStyle() throws IOException, SecurityException, NoSuchMethodException { Method method = S3AsyncClient.class.getMethod("deleteObject", String.class, String.class); diff --git a/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredTest.java b/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredTest.java index cb458deb52..a42e0d9af4 100644 --- a/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredTest.java +++ b/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredTest.java @@ -27,14 +27,11 @@ import java.lang.reflect.Method; import java.util.Properties; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.internal.BaseS3AsyncClientTest; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code BindAsHostPrefixIfConfigured} * @@ -44,12 +41,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "BindAsHostPrefixIfConfiguredTest") public class BindAsHostPrefixIfConfiguredTest extends BaseS3AsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testBucket() throws IOException { HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://euc/services/Walrus").build(); diff --git a/apis/s3/src/test/java/org/jclouds/s3/binders/BindNoBucketLoggingToXmlPayloadTest.java b/apis/s3/src/test/java/org/jclouds/s3/binders/BindNoBucketLoggingToXmlPayloadTest.java index f6bd348598..37961cd256 100644 --- a/apis/s3/src/test/java/org/jclouds/s3/binders/BindNoBucketLoggingToXmlPayloadTest.java +++ b/apis/s3/src/test/java/org/jclouds/s3/binders/BindNoBucketLoggingToXmlPayloadTest.java @@ -23,13 +23,10 @@ import static org.testng.Assert.assertEquals; import java.io.IOException; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.internal.BaseS3AsyncClientTest; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code BindNoBucketLoggingToXmlPayload} * @@ -39,12 +36,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "BindNoBucketLoggingToXmlPayloadTest") public class BindNoBucketLoggingToXmlPayloadTest extends BaseS3AsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testApplyInputStream() throws IOException { HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://test").build(); diff --git a/apis/s3/src/test/java/org/jclouds/s3/binders/BindS3ObjectMetadataToRequestTest.java b/apis/s3/src/test/java/org/jclouds/s3/binders/BindS3ObjectMetadataToRequestTest.java index 665abf6737..76329745a5 100644 --- a/apis/s3/src/test/java/org/jclouds/s3/binders/BindS3ObjectMetadataToRequestTest.java +++ b/apis/s3/src/test/java/org/jclouds/s3/binders/BindS3ObjectMetadataToRequestTest.java @@ -27,7 +27,6 @@ import org.jclouds.blobstore.binders.BindMapToHeadersWithPrefix; import org.jclouds.http.HttpRequest; import org.jclouds.io.Payload; import org.jclouds.io.Payloads; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.domain.S3Object; import org.jclouds.s3.internal.BaseS3AsyncClientTest; @@ -35,7 +34,6 @@ import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code BindS3ObjectMetadataToRequest} @@ -46,12 +44,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "BindS3ObjectMetadataToRequestTest") public class BindS3ObjectMetadataToRequestTest extends BaseS3AsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Test public void testPassWithMinimumDetailsAndPayload5GB() { S3Object object = injector.getInstance(S3Object.Factory.class).create(null); diff --git a/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureTest.java b/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureTest.java index 1fef55591e..6b65e2eaed 100644 --- a/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureTest.java +++ b/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureTest.java @@ -28,7 +28,6 @@ import javax.ws.rs.core.HttpHeaders; import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest; import org.jclouds.http.HttpRequest; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.domain.AccessControlList; import org.jclouds.s3.domain.CannedAccessPolicy; @@ -41,7 +40,6 @@ import org.testng.annotations.Test; import com.google.common.collect.SortedSetMultimap; import com.google.common.collect.TreeMultimap; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code RequestAuthorizeSignature} @@ -52,12 +50,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "RequestAuthorizeSignatureTest") public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @DataProvider(parallel = true) public Object[][] dataProvider() throws NoSuchMethodException { return new Object[][] { { listOwnedBuckets() }, { putObject() }, { putBucketAcl() } diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/handlers/SQSErrorRetryHandlerTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/handlers/SQSErrorRetryHandlerTest.java index d9de520019..60b9cae45a 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/handlers/SQSErrorRetryHandlerTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/handlers/SQSErrorRetryHandlerTest.java @@ -83,56 +83,10 @@ public class SQSErrorRetryHandlerTest { assertTrue(watch.stop().elapsedTime(TimeUnit.MILLISECONDS) < 100); } - //TODO: make a builder for this HttpCommand createHttpCommandForFailureCount(final int failureCount) { - return new HttpCommand() { - int fCount = failureCount; - - @Override - public int incrementRedirectCount() { - return 0; - } - - @Override - public int getRedirectCount() { - return 0; - } - - @Override - public boolean isReplayable() { - return false; - } - - @Override - public int incrementFailureCount() { - return ++fCount; - } - - @Override - public int getFailureCount() { - return fCount; - } - - @Override - public HttpRequest getCurrentRequest() { - return null; - } - - @Override - public void setCurrentRequest(HttpRequest request) { - - } - - @Override - public void setException(Exception exception) { - } - - @Override - public Exception getException() { - return null; - } - }; + HttpCommand command = new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://localhost").build()); + while (command.getFailureCount() != failureCount) + command.incrementFailureCount(); + return command; } - - } diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSigner.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSigner.java index 688527ce8d..7430958d13 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSigner.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSigner.java @@ -54,7 +54,7 @@ import com.google.inject.Provider; @Singleton public class SwiftBlobSigner implements BlobRequestSigner { - private final RestAnnotationProcessor processor; + private final RestAnnotationProcessor processor; private final Crypto crypto; private final Provider unixEpochTimestampProvider; @@ -77,9 +77,9 @@ public class SwiftBlobSigner implements BlobRe protected SwiftBlobSigner(BlobToObject blobToObject, BlobToHttpGetOptions blob2HttpGetOptions, Crypto crypto, @TimeStamp Provider unixEpochTimestampProvider, @TemporaryUrlKey Supplier temporaryUrlKeySupplier, - RestAnnotationProcessor processor) + RestAnnotationProcessor.Factory processor, Class clazz) throws SecurityException, NoSuchMethodException { - this.processor = checkNotNull(processor, "processor"); + this.processor = checkNotNull(processor, "processor").declaring(clazz); this.crypto = checkNotNull(crypto, "crypto"); this.unixEpochTimestampProvider = checkNotNull(unixEpochTimestampProvider, "unixEpochTimestampProvider"); @@ -88,9 +88,9 @@ public class SwiftBlobSigner implements BlobRe this.blobToObject = checkNotNull(blobToObject, "blobToObject"); this.blob2HttpGetOptions = checkNotNull(blob2HttpGetOptions, "blob2HttpGetOptions"); - this.getMethod = processor.getDeclaring().getMethod("getObject", String.class, String.class, GetOptions[].class); - this.deleteMethod = processor.getDeclaring().getMethod("removeObject", String.class, String.class); - this.createMethod = processor.getDeclaring().getMethod("putObject", String.class, SwiftObject.class); + this.getMethod = clazz.getMethod("getObject", String.class, String.class, GetOptions[].class); + this.deleteMethod = clazz.getMethod("removeObject", String.class, String.class); + this.createMethod = clazz.getMethod("putObject", String.class, SwiftObject.class); } @Override diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java index f6e75446ea..21a216f119 100644 --- a/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java +++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java @@ -38,7 +38,6 @@ import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule; import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule; import org.jclouds.openstack.swift.config.SwiftRestClientModule; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.base.Supplier; @@ -58,15 +57,8 @@ import com.google.inject.TypeLiteral; public abstract class CommonSwiftClientTest extends BaseAsyncClientTest { public static final long UNIX_EPOCH_TIMESTAMP = 123456789L; - public static final String TEMPORARY_URL_KEY = "get-or-set-X-Account-Meta-Temp-Url-Key"; - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected void checkFilters(HttpRequest request) { } diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java index be59b28cb9..5319f4ca26 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java @@ -21,15 +21,12 @@ package org.jclouds.vcloud; import java.io.IOException; import java.util.concurrent.ExecutionException; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; import org.jclouds.vcloud.utils.TestUtils; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code VCloudAsyncClient} * @@ -40,12 +37,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "VCloudAsyncClientTest") public class VCloudAsyncClientTest extends BaseVCloudAsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - private VCloudAsyncClient asyncClient; private VCloudClient syncClient; diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsAsyncClientTest.java index b1d2ce92f4..3b205b8c4d 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsAsyncClientTest.java @@ -28,12 +28,9 @@ import org.jclouds.http.functions.ParseSax; import org.jclouds.providers.AnonymousProviderMetadata; import org.jclouds.providers.ProviderMetadata; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.vcloud.xml.SupportedVersionsHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code VCloudVersionsAsyncClient} * @@ -63,12 +60,6 @@ public class VCloudVersionsAsyncClientTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected ProviderMetadata createProviderMetadata() { return AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(VCloudVersionsClient.class, diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogAsyncClientTest.java index 7f7873224f..e3b3824294 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogAsyncClientTest.java @@ -25,15 +25,12 @@ import java.net.URI; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; import org.jclouds.vcloud.options.CatalogItemOptions; import org.jclouds.vcloud.xml.CatalogHandler; import org.jclouds.vcloud.xml.CatalogItemHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code CatalogAsyncClient} * @@ -44,12 +41,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "CatalogAsyncClientTest") public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testCatalog() throws SecurityException, NoSuchMethodException, IOException { Method method = CatalogAsyncClient.class.getMethod("getCatalog", URI.class); HttpRequest request = processor.createRequest(method, URI diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkAsyncClientTest.java index d10ff7ba1b..5f9277cca1 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkAsyncClientTest.java @@ -25,13 +25,10 @@ import java.net.URI; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; import org.jclouds.vcloud.xml.OrgNetworkHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code NetworkAsyncClient} * @@ -42,12 +39,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "NetworkAsyncClientTest") public class NetworkAsyncClientTest extends BaseVCloudAsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testNetwork() throws SecurityException, NoSuchMethodException, IOException { Method method = NetworkAsyncClient.class.getMethod("getNetwork", URI.class); HttpRequest request = processor.createRequest(method, URI diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgAsyncClientTest.java index ea81db64f8..8b81d819d1 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgAsyncClientTest.java @@ -26,14 +26,11 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; import org.jclouds.vcloud.xml.OrgHandler; import org.jclouds.vcloud.xml.OrgListHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code OrgAsyncClient} * @@ -44,12 +41,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "OrgAsyncClientTest") public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testlistOrgs() throws SecurityException, NoSuchMethodException, IOException { Method method = OrgAsyncClient.class.getMethod("listOrgs"); HttpRequest request = processor.createRequest(method); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskAsyncClientTest.java index 7ef507cca6..bdf4e77584 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskAsyncClientTest.java @@ -26,14 +26,11 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; import org.jclouds.vcloud.xml.TaskHandler; import org.jclouds.vcloud.xml.TasksListHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code TaskAsyncClient} * @@ -44,12 +41,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "TaskAsyncClientTest") public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException { Method method = TaskAsyncClient.class.getMethod("getTasksList", URI.class); HttpRequest request = processor.createRequest(method, URI diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppAsyncClientTest.java index b62748e9cc..43d81f317a 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppAsyncClientTest.java @@ -27,7 +27,6 @@ import org.jclouds.Fallbacks.VoidOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.util.Strings2; import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; import org.jclouds.vcloud.options.CloneVAppOptions; @@ -35,8 +34,6 @@ import org.jclouds.vcloud.xml.TaskHandler; import org.jclouds.vcloud.xml.VAppHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code VAppAsyncClient} * @@ -47,12 +44,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "VAppAsyncClientTest") public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testopyVAppToVDCAndName() throws SecurityException, NoSuchMethodException, IOException { Method method = VAppAsyncClient.class.getMethod("copyVAppToVDCAndName", URI.class, URI.class, String.class, CloneVAppOptions[].class); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateAsyncClientTest.java index 6340c948cb..0659408700 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateAsyncClientTest.java @@ -28,7 +28,6 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; import org.jclouds.ovf.xml.EnvelopeHandler; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.util.Strings2; import org.jclouds.vcloud.domain.network.FenceMode; import org.jclouds.vcloud.domain.network.NetworkConfig; @@ -41,8 +40,6 @@ import org.jclouds.vcloud.xml.VAppHandler; import org.jclouds.vcloud.xml.VAppTemplateHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code VAppTemplateAsyncClient} * @@ -53,12 +50,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "VAppTemplateAsyncClientTest") public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testCreateVAppInVDCByInstantiatingTemplate() throws SecurityException, NoSuchMethodException, IOException { Method method = VAppTemplateAsyncClient.class.getMethod("createVAppInVDCByInstantiatingTemplate", String.class, diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCAsyncClientTest.java index 2ea3f060bd..990b9e0f4b 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCAsyncClientTest.java @@ -26,13 +26,10 @@ import java.util.NoSuchElementException; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; import org.jclouds.vcloud.xml.VDCHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code VDCAsyncClient} * @@ -43,12 +40,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "VDCAsyncClientTest") public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Test(expectedExceptions = NoSuchElementException.class) public void testFindVDCInOrgNamedBadVDC() throws SecurityException, NoSuchMethodException, IOException { Method method = VDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmAsyncClientTest.java index c99dca8e06..f2e6ca0498 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmAsyncClientTest.java @@ -27,7 +27,6 @@ import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReturnInputStream; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.util.Strings2; import org.jclouds.vcloud.domain.GuestCustomizationSection; import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; @@ -37,8 +36,6 @@ import org.jclouds.vcloud.xml.VmHandler; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code VmAsyncClient} * @@ -49,12 +46,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "VmAsyncClientTest") public class VmAsyncClientTest extends BaseVCloudAsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testGetThumbnailOfVm() throws SecurityException, NoSuchMethodException, IOException { Method method = VmAsyncClient.class.getMethod("getScreenThumbnailForVm", URI.class); HttpRequest request = processor diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClientTest.java index 42143456bf..e5d126cd48 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClientTest.java @@ -32,7 +32,6 @@ import org.jclouds.location.Provider; import org.jclouds.providers.AnonymousProviderMetadata; import org.jclouds.providers.ProviderMetadata; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.vcloud.endpoints.VCloudLogin; import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders; import org.testng.annotations.Test; @@ -41,7 +40,6 @@ import com.google.common.base.Supplier; import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.Provides; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code VCloudLoginAsyncClient} @@ -73,12 +71,6 @@ public class VCloudLoginAsyncClientTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected Module createModule() { return new Module() { diff --git a/blobstore/src/main/java/org/jclouds/blobstore/LocalAsyncBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/LocalAsyncBlobStore.java index 2e5869acf6..ca42a497e4 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/LocalAsyncBlobStore.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/LocalAsyncBlobStore.java @@ -369,47 +369,8 @@ public class LocalAsyncBlobStore extends BaseAsyncBlobStore { public static HttpResponseException returnResponseException(int code) { HttpResponse response = HttpResponse.builder().statusCode(code).build(); - return new HttpResponseException(new HttpCommand() { - - public int getRedirectCount() { - return 0; - } - - public int incrementRedirectCount() { - return 0; - } - - public boolean isReplayable() { - return false; - } - - public Exception getException() { - return null; - } - - public int getFailureCount() { - return 0; - } - - public int incrementFailureCount() { - return 0; - } - - public void setException(Exception exception) { - - } - - @Override - public HttpRequest getCurrentRequest() { - return HttpRequest.builder().method("GET").endpoint("http://stub").build(); - } - - @Override - public void setCurrentRequest(HttpRequest request) { - - } - - }, response); + return new HttpResponseException(new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub") + .build()), response); } /** diff --git a/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java b/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java index 4089855abc..1f883f643d 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java @@ -29,12 +29,9 @@ import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.BlobBuilder; import org.jclouds.http.HttpRequest; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code LocalBlobRequestSigner} * @@ -120,12 +117,6 @@ public class TransientBlobRequestSignerTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override public ApiMetadata createApiMetadata() { return new TransientApiMetadata(); diff --git a/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClientTest.java b/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClientTest.java index c1a9faaf5f..c49ee0448e 100644 --- a/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClientTest.java +++ b/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClientTest.java @@ -29,11 +29,8 @@ import org.jclouds.http.IntegrationTestClient; import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders; import org.jclouds.rest.AnonymousRestApiMetadata; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code OpenStackAuthAsyncClient} * @@ -80,11 +77,4 @@ public class OpenStackAuthAsyncClientTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/binders/BindAddInternetServiceToXmlPayloadTest.java b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/binders/BindAddInternetServiceToXmlPayloadTest.java index 04fbd38606..663001ae4d 100644 --- a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/binders/BindAddInternetServiceToXmlPayloadTest.java +++ b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/binders/BindAddInternetServiceToXmlPayloadTest.java @@ -21,7 +21,6 @@ package org.jclouds.trmk.vcloud_0_8.binders; import static org.jclouds.trmk.vcloud_0_8.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_NS; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotEquals; -import static org.testng.Assert.assertTrue; import java.io.IOException; import java.io.InputStream; diff --git a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClientTest.java b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClientTest.java index 4863f1e0e1..35148857a2 100644 --- a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClientTest.java +++ b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClientTest.java @@ -32,7 +32,6 @@ import org.jclouds.location.Provider; import org.jclouds.providers.AnonymousProviderMetadata; import org.jclouds.providers.ProviderMetadata; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.trmk.vcloud_0_8.endpoints.VCloudLogin; import org.jclouds.trmk.vcloud_0_8.functions.ParseLoginResponseFromHeaders; import org.testng.annotations.Test; @@ -41,7 +40,6 @@ import com.google.common.base.Supplier; import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.Provides; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code VCloudLoginAsyncClient} @@ -74,12 +72,6 @@ public class TerremarkVCloudLoginAsyncClientTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected Module createModule() { return new Module() { diff --git a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsAsyncClientTest.java b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsAsyncClientTest.java index 9222b4e7cc..3141d41128 100644 --- a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsAsyncClientTest.java +++ b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsAsyncClientTest.java @@ -28,12 +28,9 @@ import org.jclouds.http.functions.ParseSax; import org.jclouds.providers.AnonymousProviderMetadata; import org.jclouds.providers.ProviderMetadata; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.trmk.vcloud_0_8.xml.SupportedVersionsHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code VCloudVersionsAsyncClient} * @@ -63,12 +60,6 @@ public class TerremarkVCloudVersionsAsyncClientTest extends BaseAsyncClientTest< assertEquals(request.getFilters().size(), 0); } - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected ProviderMetadata createProviderMetadata() { return AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(TerremarkVCloudVersionsClient.class, diff --git a/core/src/main/java/org/jclouds/http/HttpCommand.java b/core/src/main/java/org/jclouds/http/HttpCommand.java index ebe8d395cf..08499bb82f 100644 --- a/core/src/main/java/org/jclouds/http/HttpCommand.java +++ b/core/src/main/java/org/jclouds/http/HttpCommand.java @@ -18,65 +18,125 @@ */ package org.jclouds.http; +import static com.google.common.base.Preconditions.checkNotNull; + +import org.jclouds.rest.internal.GeneratedHttpRequest; + +import com.google.common.base.Objects; + /** * Command whose endpoint is an http service. * * @author Adrian Cole */ -public interface HttpCommand { +//TODO: get rid of all the mock tests so that this can be made final +public class HttpCommand { - /** - * increments the current number of redirect attempts for this command. - * - * @see #getRedirectCount - */ - int incrementRedirectCount(); + private volatile HttpRequest request; + private volatile int failureCount; + private volatile int redirectCount; + private volatile Exception exception; - /** - * This displays the current number of redirect attempts for this command. - * - * @see org.jclouds.Constants.PROPERTY_MAX_REDIRECTS - */ - int getRedirectCount(); - - /** - * Commands need to be replayed, if redirected or on a retryable error. Typically, this implies - * the payload carried is not a streaming type. - */ - boolean isReplayable(); - - /** - * increment the current failure count. - * - * @see #getFailureCount - */ - int incrementFailureCount(); + public HttpCommand(HttpRequest request) { + this.request = checkNotNull(request, "request"); + this.failureCount = 0; + this.redirectCount = 0; + } /** * This displays the current number of error retries for this command. * * @see org.jclouds.Constants.PROPERTY_MAX_RETRIES */ - int getFailureCount(); + public int getFailureCount() { + return failureCount; + } /** - * The request associated with this command. + * increment the current failure count. + * + * @see #getFailureCount */ - HttpRequest getCurrentRequest(); - - /** - * The request associated with this command. - */ - void setCurrentRequest(HttpRequest request); + public int incrementFailureCount() { + return ++failureCount; + } /** * Used to prevent a command from being re-executed, or having its response parsed. */ - void setException(Exception exception); + public void setException(Exception exception) { + this.exception = exception; + } /** * @see #setException */ - Exception getException(); + public Exception getException() { + return exception; + } + + /** + * increments the current number of redirect attempts for this command. + * + * @see #getRedirectCount + */ + public int incrementRedirectCount() { + return ++redirectCount; + } + + /** + * This displays the current number of redirect attempts for this command. + * + * @see org.jclouds.Constants.PROPERTY_MAX_REDIRECTS + */ + public int getRedirectCount() { + return redirectCount; + } + + /** + * Commands need to be replayed, if redirected or on a retryable error. Typically, this implies + * the payload carried is not a streaming type. + */ + public boolean isReplayable() { + return (request.getPayload() == null) ? true : request.getPayload().isRepeatable(); + } + + /** + * The request associated with this command. + */ + public HttpRequest getCurrentRequest() { + return request; + } + + /** + * The request associated with this command. + */ + public void setCurrentRequest(HttpRequest request) { + this.request = request; + } + + @Override + public int hashCode() { + return Objects.hashCode(request); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (!(that instanceof HttpCommand)) + return false; + return Objects.equal(this.request, HttpCommand.class.cast(that).getCurrentRequest()); + } + + @Override + public String toString() { + if (request instanceof GeneratedHttpRequest) + return String.format("[method=%s.%s, request=%s]", GeneratedHttpRequest.class.cast(request).getDeclaring() + .getSimpleName(), GeneratedHttpRequest.class.cast(request).getJavaMethod().getName(), request + .getRequestLine()); + else + return "[request=" + request.getRequestLine() + "]"; + } } diff --git a/core/src/main/java/org/jclouds/http/HttpCommandRendezvous.java b/core/src/main/java/org/jclouds/http/HttpCommandRendezvous.java deleted file mode 100644 index aee49d09c8..0000000000 --- a/core/src/main/java/org/jclouds/http/HttpCommandRendezvous.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.http; - -import java.util.concurrent.Future; -import java.util.concurrent.SynchronousQueue; - -/** - * Used for passing objects for response processing - * - * @author Adrian Cole - */ -public class HttpCommandRendezvous { - - private final HttpCommand command; - @SuppressWarnings("rawtypes") - private final SynchronousQueue rendezvous; - private final Future future; - - public HttpCommandRendezvous(HttpCommand command, @SuppressWarnings("rawtypes") SynchronousQueue rendezvous, - Future future) { - this.command = command; - this.rendezvous = rendezvous; - this.future = future; - } - - @SuppressWarnings("unchecked") - public void setResponse(HttpResponse response) throws InterruptedException { - this.rendezvous.put(response); - } - - @SuppressWarnings("unchecked") - public void setException(Exception exception) throws InterruptedException { - this.rendezvous.put(exception); - } - - public void cancel() { - getFuture().cancel(true); - } - - public HttpCommand getCommand() { - return command; - } - - public Future getFuture() { - return future; - } - -} diff --git a/core/src/main/java/org/jclouds/http/TransformingHttpCommand.java b/core/src/main/java/org/jclouds/http/TransformingHttpCommand.java deleted file mode 100644 index f4a4a9836a..0000000000 --- a/core/src/main/java/org/jclouds/http/TransformingHttpCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.http; - -import java.util.concurrent.ExecutionException; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Command that utilizes RESTFul apis and extracts T from the HttpResponse. - * - * @author Adrian Cole - */ -public interface TransformingHttpCommand extends HttpCommand { - - /** - * invoke and transform the response {@code } into value type {@code } - * - * @return future containing the expected value - * - * @throws ExecutionException - * if there is a fatal error preventing the command from invoking - */ - ListenableFuture execute() throws ExecutionException; -} diff --git a/core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorService.java b/core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorService.java deleted file mode 100644 index e495b4d283..0000000000 --- a/core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorService.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.http; - -import com.google.common.base.Function; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.inject.ImplementedBy; - -/** - * Executor which will invoke and transform the response of an {@code EndpointCommand} into generic - * type . - * - * @author Adrian Cole - */ -@ImplementedBy(TransformingHttpCommandExecutorServiceImpl.class) -public interface TransformingHttpCommandExecutorService { - /** - * - * Submits the command and transforms the result before requested via {@link Future#get()}. - * - * @param - * type that is required from the value. - * @param command - * holds the state of the request, including metadata such as redirect counts - * @param responseTransformer - * how to transform the response from the above command - * @return value of the intended response. - */ - public ListenableFuture submit(HttpCommand command, - Function responseTransformer); - -} diff --git a/core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorServiceImpl.java b/core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorServiceImpl.java deleted file mode 100644 index ea6cfd3670..0000000000 --- a/core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorServiceImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.http; - -import java.util.concurrent.ExecutorService; - -import javax.inject.Inject; -import javax.inject.Named; - -import org.jclouds.Constants; -import org.jclouds.concurrent.Futures; - -import com.google.common.base.Function; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Executor which will invoke and transform the response of an {@code EndpointCommand} into generic - * type . TODO - * - * @author Adrian Cole - */ -public class TransformingHttpCommandExecutorServiceImpl implements TransformingHttpCommandExecutorService { - private final HttpCommandExecutorService client; - private final ExecutorService userThreads; - - @Inject - public TransformingHttpCommandExecutorServiceImpl(HttpCommandExecutorService client, - @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads) { - this.client = client; - this.userThreads = userThreads; - } - - /** - * {@inheritDoc} - */ - public ListenableFuture submit(HttpCommand command, - Function responseTransformer) { - return Futures.compose(client.submit(command), responseTransformer, userThreads); - } - -} diff --git a/core/src/main/java/org/jclouds/http/TransformingHttpCommandImpl.java b/core/src/main/java/org/jclouds/http/TransformingHttpCommandImpl.java deleted file mode 100644 index aba8389492..0000000000 --- a/core/src/main/java/org/jclouds/http/TransformingHttpCommandImpl.java +++ /dev/null @@ -1,172 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.http; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.concurrent.ExecutionException; - -import javax.annotation.Resource; -import javax.inject.Inject; - -import org.jclouds.logging.Logger; -import org.jclouds.rest.internal.GeneratedHttpRequest; - -import com.google.common.base.Function; -import com.google.common.base.Objects; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Executor which will invoke and transform the response of an {@code EndpointCommand} into generic - * type . - * - * @see TransformingHttpCommand - * - * @author Adrian Cole - */ -public class TransformingHttpCommandImpl implements TransformingHttpCommand { - - protected final TransformingHttpCommandExecutorService executorService; - protected final Function transformer; - - protected volatile HttpRequest request; - protected volatile int failureCount; - protected volatile int redirectCount; - protected volatile Exception exception; - - @Resource - protected Logger logger = Logger.NULL; - - @Inject - public TransformingHttpCommandImpl(TransformingHttpCommandExecutorService executorService, HttpRequest request, - Function transformer) { - this.request = checkNotNull(request, "request"); - this.executorService = checkNotNull(executorService, "executorService"); - this.transformer = checkNotNull(transformer, "transformer"); - this.failureCount = 0; - this.redirectCount = 0; - } - - /** - * {@inheritDoc} - */ - @Override - public ListenableFuture execute() throws ExecutionException { - if (exception != null) - throw new ExecutionException(exception); - return executorService.submit(this, transformer); - } - - /** - * {@inheritDoc} - */ - @Override - public int getFailureCount() { - return failureCount; - } - - /** - * {@inheritDoc} - */ - @Override - public int incrementFailureCount() { - return ++failureCount; - } - - /** - * {@inheritDoc} - */ - @Override - public void setException(Exception exception) { - this.exception = exception; - } - - /** - * {@inheritDoc} - */ - @Override - public Exception getException() { - return exception; - } - - /** - * {@inheritDoc} - */ - @Override - public int incrementRedirectCount() { - return ++redirectCount; - } - - /** - * {@inheritDoc} - */ - @Override - public int getRedirectCount() { - return redirectCount; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isReplayable() { - return (request.getPayload() == null) ? true : request.getPayload().isRepeatable(); - } - - /** - * {@inheritDoc} - */ - @Override - public HttpRequest getCurrentRequest() { - return request; - } - - /** - * {@inheritDoc} - */ - @Override - public void setCurrentRequest(HttpRequest request) { - this.request = request; - } - - @Override - public int hashCode() { - return Objects.hashCode(request); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (!(that instanceof HttpCommand)) - return false; - return Objects.equal(this.request, HttpCommand.class.cast(that).getCurrentRequest()); - } - - @Override - public String toString() { - if (request instanceof GeneratedHttpRequest) - return String.format("[method=%s.%s, request=%s]", GeneratedHttpRequest.class.cast(request).getDeclaring() - .getSimpleName(), GeneratedHttpRequest.class.cast(request).getJavaMethod().getName(), request - .getRequestLine()); - else - return "[request=" + request.getRequestLine() + "]"; - } - -} diff --git a/core/src/main/java/org/jclouds/http/config/JavaUrlHttpCommandExecutorServiceModule.java b/core/src/main/java/org/jclouds/http/config/JavaUrlHttpCommandExecutorServiceModule.java index 022632262c..f5f65946b0 100644 --- a/core/src/main/java/org/jclouds/http/config/JavaUrlHttpCommandExecutorServiceModule.java +++ b/core/src/main/java/org/jclouds/http/config/JavaUrlHttpCommandExecutorServiceModule.java @@ -19,8 +19,6 @@ package org.jclouds.http.config; import org.jclouds.http.HttpCommandExecutorService; -import org.jclouds.http.TransformingHttpCommandExecutorService; -import org.jclouds.http.TransformingHttpCommandExecutorServiceImpl; import org.jclouds.http.internal.JavaUrlHttpCommandExecutorService; import com.google.inject.AbstractModule; @@ -40,8 +38,6 @@ public class JavaUrlHttpCommandExecutorServiceModule extends AbstractModule { protected void configure() { install(new SSLModule()); bind(HttpCommandExecutorService.class).to(JavaUrlHttpCommandExecutorService.class).in(Scopes.SINGLETON); - bind(TransformingHttpCommandExecutorService.class).to(TransformingHttpCommandExecutorServiceImpl.class).in( - Scopes.SINGLETON); } } diff --git a/core/src/main/java/org/jclouds/internal/ClassMethodArgsAndReturnVal.java b/core/src/main/java/org/jclouds/internal/ClassMethodArgsAndReturnVal.java index 909d57fe0f..6884207eae 100644 --- a/core/src/main/java/org/jclouds/internal/ClassMethodArgsAndReturnVal.java +++ b/core/src/main/java/org/jclouds/internal/ClassMethodArgsAndReturnVal.java @@ -29,26 +29,26 @@ import com.google.common.base.Objects.ToStringHelper; * * @author Adrian Cole */ -public class ClassMethodArgsAndReturnVal extends ClassMethodArgs { +public final class ClassMethodArgsAndReturnVal extends ClassMethodArgs { - public static Builder builder() { - return new ConcreteBuilder(); + public static Builder builder() { + return new Builder(); } - public Builder toBuilder() { + public Builder toBuilder() { return builder().fromClassMethodArgsAndReturnVal(this); } - public static class Builder> extends ClassMethodArgs.Builder { + public final static class Builder extends ClassMethodArgs.Builder { private Object returnVal; /** * @see ClassMethodArgsAndReturnVal#getReturnVal() */ - public B returnVal(Object returnVal) { + public Builder returnVal(Object returnVal) { this.returnVal = returnVal; - return self(); + return this; } @Override @@ -56,22 +56,19 @@ public class ClassMethodArgsAndReturnVal extends ClassMethodArgs { return new ClassMethodArgsAndReturnVal(this); } - public B fromClassMethodArgsAndReturnVal(ClassMethodArgsAndReturnVal in) { + public Builder fromClassMethodArgsAndReturnVal(ClassMethodArgsAndReturnVal in) { return fromClassMethodArgs(in).returnVal(in.getReturnVal()); } } - private static class ConcreteBuilder extends Builder { - } - private final Object returnVal; - public ClassMethodArgsAndReturnVal(Class clazz, Method method, Object[] args, Object returnVal) { + private ClassMethodArgsAndReturnVal(Class clazz, Method method, Object[] args, Object returnVal) { super(clazz, method, args); this.returnVal = returnVal; } - public ClassMethodArgsAndReturnVal(Builder builder) { + private ClassMethodArgsAndReturnVal(Builder builder) { super(builder); this.returnVal = builder.returnVal; } diff --git a/core/src/main/java/org/jclouds/rest/AsyncClientFactory.java b/core/src/main/java/org/jclouds/rest/AsyncClientFactory.java deleted file mode 100644 index 3a5655c6d0..0000000000 --- a/core/src/main/java/org/jclouds/rest/AsyncClientFactory.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.rest; - -import static com.google.common.reflect.Reflection.newProxy; -import static com.google.inject.util.Types.newParameterizedType; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.rest.internal.AsyncRestClientProxy; - -import com.google.inject.Injector; -import com.google.inject.Key; -import com.google.inject.TypeLiteral; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class AsyncClientFactory { - private final Injector injector; - - @Inject - private AsyncClientFactory(Injector injector) { - this.injector = injector; - } - - @SuppressWarnings("unchecked") - public T create(Class clazz) { - Key> key = (Key>) Key.get(TypeLiteral.get(newParameterizedType( - AsyncRestClientProxy.class, clazz))); - return newProxy(clazz, injector.getInstance(key)); - } - -} diff --git a/core/src/main/java/org/jclouds/rest/config/AsyncClientProvider.java b/core/src/main/java/org/jclouds/rest/config/AsyncClientProvider.java index ff3f643310..145821b0bc 100644 --- a/core/src/main/java/org/jclouds/rest/config/AsyncClientProvider.java +++ b/core/src/main/java/org/jclouds/rest/config/AsyncClientProvider.java @@ -18,12 +18,16 @@ */ package org.jclouds.rest.config; +import static com.google.common.reflect.Reflection.newProxy; + import javax.inject.Inject; import javax.inject.Singleton; -import org.jclouds.rest.AsyncClientFactory; +import org.jclouds.rest.internal.AsyncRestClientProxy; +import org.jclouds.rest.internal.AsyncRestClientProxy.Factory; import com.google.inject.Provider; +import com.google.inject.TypeLiteral; /** * @@ -31,19 +35,20 @@ import com.google.inject.Provider; */ @Singleton public class AsyncClientProvider implements Provider { - private final Class asyncClientType; - private final AsyncClientFactory factory; + private final Class asyncClientType; + private final Factory factory; @Inject - private AsyncClientProvider(AsyncClientFactory factory, Class asyncClientType) { + private AsyncClientProvider(AsyncRestClientProxy.Factory factory, TypeLiteral asyncClientType) { this.factory = factory; - this.asyncClientType = asyncClientType; + this.asyncClientType = asyncClientType.getRawType(); } + @SuppressWarnings("unchecked") @Override @Singleton public A get() { - return factory.create(asyncClientType); + return (A) newProxy(asyncClientType, factory.declaring(asyncClientType)); } } diff --git a/core/src/main/java/org/jclouds/rest/config/RestModule.java b/core/src/main/java/org/jclouds/rest/config/RestModule.java index c22094c3db..068b899ac2 100644 --- a/core/src/main/java/org/jclouds/rest/config/RestModule.java +++ b/core/src/main/java/org/jclouds/rest/config/RestModule.java @@ -18,7 +18,6 @@ */ package org.jclouds.rest.config; -import static com.google.common.reflect.Reflection.newProxy; import static org.jclouds.Constants.PROPERTY_TIMEOUTS_PREFIX; import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient; @@ -32,11 +31,6 @@ import javax.inject.Singleton; import org.jclouds.concurrent.internal.SyncProxy; import org.jclouds.functions.IdentityFunction; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.TransformingHttpCommand; -import org.jclouds.http.TransformingHttpCommandExecutorService; -import org.jclouds.http.TransformingHttpCommandImpl; import org.jclouds.http.functions.config.SaxParserModule; import org.jclouds.internal.ClassMethodArgs; import org.jclouds.internal.FilterStringsBoundToInjectorByName; @@ -47,6 +41,8 @@ import org.jclouds.rest.HttpAsyncClient; import org.jclouds.rest.HttpClient; import org.jclouds.rest.binders.BindToJsonPayloadWrappedWith; import org.jclouds.rest.internal.AsyncRestClientProxy; +import org.jclouds.rest.internal.CreateAsyncClientForCaller; +import org.jclouds.rest.internal.CreateClientForCaller; import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.rest.internal.RestAnnotationProcessor.MethodKey; import org.jclouds.rest.internal.SeedAnnotationCache; @@ -58,21 +54,14 @@ import com.google.common.base.Predicate; import com.google.common.base.Supplier; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.google.common.util.concurrent.Atomics; import com.google.inject.AbstractModule; -import com.google.inject.Inject; -import com.google.inject.Injector; -import com.google.inject.Key; import com.google.inject.Provides; -import com.google.inject.Scopes; import com.google.inject.TypeLiteral; import com.google.inject.assistedinject.FactoryModuleBuilder; -import com.google.inject.name.Names; -import com.google.inject.util.Types; public class RestModule extends AbstractModule { @@ -80,11 +69,11 @@ public class RestModule extends AbstractModule { }; private final Map, Class> sync2Async; protected final AtomicReference authException = Atomics.newReference(); - + public RestModule() { this(ImmutableMap., Class> of()); } - + public RestModule(Map, Class> sync2Async) { this.sync2Async = sync2Async; } @@ -99,8 +88,9 @@ public class RestModule extends AbstractModule { install(new SaxParserModule()); install(new GsonModule()); install(new FactoryModuleBuilder().build(BindToJsonPayloadWrappedWith.Factory.class)); + install(new FactoryModuleBuilder().build(RestAnnotationProcessor.Factory.class)); + install(new FactoryModuleBuilder().build(AsyncRestClientProxy.Factory.class)); bind(IdentityFunction.class).toInstance(IdentityFunction.INSTANCE); - bind(AsyncRestClientProxy.Factory.class).to(Factory.class).in(Scopes.SINGLETON); install(new FactoryModuleBuilder().build(SyncProxy.Factory.class)); bindClientAndAsyncClient(binder(), HttpClient.class, HttpAsyncClient.class); // this will help short circuit scenarios that can otherwise lock out users @@ -111,18 +101,6 @@ public class RestModule extends AbstractModule { installLocations(); } - /** - * Shared for all types of rest clients. this is read-only in this class, and - * currently populated only by {@link SeedAnnotationCache} - * - * @see SeedAnnotationCache - */ - @Provides - @Singleton - protected Cache delegationMap(){ - return CacheBuilder.newBuilder().build(); - } - @Provides @Singleton @Named("TIMEOUTS") @@ -146,10 +124,10 @@ public class RestModule extends AbstractModule { }); } - + @Provides @Singleton - protected LoadingCache, Boolean> seedAnnotationCache(SeedAnnotationCache seedAnnotationCache) { + private LoadingCache, Cache> seedAnnotationCache(SeedAnnotationCache seedAnnotationCache) { return CacheBuilder.newBuilder().build(seedAnnotationCache); } @@ -160,45 +138,6 @@ public class RestModule extends AbstractModule { return CacheBuilder.newBuilder().build(createAsyncClientForCaller); } - static class CreateAsyncClientForCaller extends CacheLoader { - private final Injector injector; - private final AsyncRestClientProxy.Factory factory; - - @Inject - CreateAsyncClientForCaller(Injector injector, AsyncRestClientProxy.Factory factory) { - this.injector = injector; - this.factory = factory; - } - - @SuppressWarnings( { "unchecked", "rawtypes" }) - @Override - public Object load(final ClassMethodArgs from) { - Class clazz = from.getClazz(); - TypeLiteral typeLiteral = TypeLiteral.get(clazz); - RestAnnotationProcessor util = (RestAnnotationProcessor) injector.getInstance(Key.get(TypeLiteral.get(Types - .newParameterizedType(RestAnnotationProcessor.class, clazz)))); - // cannot use child injectors due to the super coarse guice lock on Singleton - util.setCaller(from); - LoadingCache delegateMap = injector.getInstance(Key.get( - new TypeLiteral>() { - }, Names.named("async"))); - AsyncRestClientProxy proxy = new AsyncRestClientProxy(injector, factory, util, typeLiteral, delegateMap); - injector.injectMembers(proxy); - return newProxy(clazz, proxy); - } - } - - private static class Factory implements AsyncRestClientProxy.Factory { - @Inject - private TransformingHttpCommandExecutorService executorService; - - @SuppressWarnings( { "unchecked", "rawtypes" }) - @Override - public TransformingHttpCommand create(HttpRequest request, Function transformer) { - return new TransformingHttpCommandImpl(executorService, request, transformer); - } - } - @Provides @Singleton @Named("sync") diff --git a/core/src/main/java/org/jclouds/rest/internal/AsyncRestClientProxy.java b/core/src/main/java/org/jclouds/rest/internal/AsyncRestClientProxy.java index ff62011963..38c4f422a3 100644 --- a/core/src/main/java/org/jclouds/rest/internal/AsyncRestClientProxy.java +++ b/core/src/main/java/org/jclouds/rest/internal/AsyncRestClientProxy.java @@ -19,23 +19,28 @@ package org.jclouds.rest.internal; import static com.google.common.util.concurrent.Futures.immediateFailedFuture; +import static com.google.common.util.concurrent.Futures.transform; import static com.google.common.util.concurrent.Futures.withFallback; +import static org.jclouds.concurrent.Futures.makeListenable; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; import javax.annotation.Resource; +import javax.inject.Inject; import javax.inject.Named; import javax.inject.Qualifier; import javax.inject.Singleton; import org.jclouds.Constants; import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; +import org.jclouds.http.HttpCommand; +import org.jclouds.http.HttpCommandExecutorService; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; -import org.jclouds.http.TransformingHttpCommand; import org.jclouds.internal.ClassMethodArgs; import org.jclouds.internal.ClassMethodArgsAndReturnVal; import org.jclouds.logging.Logger; @@ -61,12 +66,11 @@ import com.google.common.util.concurrent.FutureFallback; import com.google.common.util.concurrent.ListenableFuture; import com.google.inject.Binding; import com.google.inject.ConfigurationException; -import com.google.inject.Inject; import com.google.inject.Injector; import com.google.inject.Key; import com.google.inject.Provides; import com.google.inject.ProvisionException; -import com.google.inject.TypeLiteral; +import com.google.inject.assistedinject.Assisted; import com.google.inject.util.Types; /** @@ -94,40 +98,55 @@ import com.google.inject.util.Types; * @author Adrian Cole */ @Singleton -public class AsyncRestClientProxy extends AbstractInvocationHandler { - public Class getDeclaring() { - return declaring; +public abstract class AsyncRestClientProxy extends AbstractInvocationHandler { + public static interface Factory { + Declaring declaring(Class declaring); + + Caller caller(ClassMethodArgs caller); } - private final Injector injector; - private final RestAnnotationProcessor annotationProcessor; - private final Class declaring; - private final Factory commandFactory; + public final static class Declaring extends AsyncRestClientProxy { + @Inject + private Declaring(Injector injector, Function> optionalConverter, + HttpCommandExecutorService http, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads, + @Named("async") LoadingCache delegateMap, RestAnnotationProcessor.Factory rap, + @Assisted Class declaring) { + super(injector, optionalConverter, http, userThreads, delegateMap, rap.declaring(declaring), declaring); + } + } - /** - * maximum duration of an unbackend http Request - */ - @Inject(optional = true) - @Named(Constants.PROPERTY_REQUEST_TIMEOUT) - protected long requestTimeoutMilliseconds = 30000; + public final static class Caller extends AsyncRestClientProxy { + @Inject + private Caller(Injector injector, Function> optionalConverter, + HttpCommandExecutorService http, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads, + @Named("async") LoadingCache delegateMap, RestAnnotationProcessor.Factory rap, + @Assisted ClassMethodArgs caller) { + super(injector, optionalConverter, http, userThreads, delegateMap, rap.caller(caller), caller.getClazz()); + } + } @Resource - protected Logger logger = Logger.NULL; + private Logger logger = Logger.NULL; + + private final Injector injector; + private final HttpCommandExecutorService http; + private final ExecutorService userThreads; private final Function> optionalConverter; private final LoadingCache delegateMap; + private final RestAnnotationProcessor annotationProcessor; + private final Class declaring; - @SuppressWarnings("unchecked") - @Inject - public AsyncRestClientProxy(Injector injector, Factory factory, RestAnnotationProcessor util, - TypeLiteral typeLiteral, @Named("async") LoadingCache delegateMap) { + private AsyncRestClientProxy(Injector injector, + Function> optionalConverter, HttpCommandExecutorService http, + ExecutorService userThreads, LoadingCache delegateMap, + RestAnnotationProcessor annotationProcessor, Class declaring) { this.injector = injector; - this.optionalConverter = injector.getInstance(Key - .get(new TypeLiteral>>() { - })); - this.annotationProcessor = util; - this.declaring = (Class) typeLiteral.getRawType(); - this.commandFactory = factory; + this.optionalConverter = optionalConverter; + this.http = http; + this.userThreads = userThreads; this.delegateMap = delegateMap; + this.declaring = declaring; + this.annotationProcessor = annotationProcessor; } private static final Predicate isQualifierPresent = new Predicate() { @@ -249,7 +268,7 @@ public class AsyncRestClientProxy extends AbstractInvocationHandler { logger.trace("<< response from %s is parsed by %s", name, transformer.getClass().getSimpleName()); logger.debug(">> invoking %s", name); - result = commandFactory.create(request, transformer).execute(); + result = transform(makeListenable(http.submit(new HttpCommand(request)), userThreads), transformer); } catch (RuntimeException e) { AuthorizationException aex = Throwables2.getFirstThrowableOfType(e, AuthorizationException.class); if (aex != null) @@ -264,10 +283,6 @@ public class AsyncRestClientProxy extends AbstractInvocationHandler { return withFallback(result, fallback); } - public static interface Factory { - public TransformingHttpCommand create(HttpRequest request, Function transformer); - } - public String toString() { return "Client Proxy for :" + declaring.getName(); } diff --git a/core/src/main/java/org/jclouds/rest/internal/BaseRestApiMetadata.java b/core/src/main/java/org/jclouds/rest/internal/BaseRestApiMetadata.java index f32ce7fe84..7954cfcdcc 100644 --- a/core/src/main/java/org/jclouds/rest/internal/BaseRestApiMetadata.java +++ b/core/src/main/java/org/jclouds/rest/internal/BaseRestApiMetadata.java @@ -67,6 +67,7 @@ public class BaseRestApiMetadata extends BaseApiMetadata implements RestApiMetad public static TypeToken> contextToken(TypeToken apiToken, TypeToken asyncApiToken) { return new TypeToken>() { + private static final long serialVersionUID = 1L; }.where(new TypeParameter() { }, apiToken).where(new TypeParameter() { }, asyncApiToken); diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainUserAsyncClientTest.java b/core/src/main/java/org/jclouds/rest/internal/CreateAsyncClientForCaller.java similarity index 56% rename from apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainUserAsyncClientTest.java rename to core/src/main/java/org/jclouds/rest/internal/CreateAsyncClientForCaller.java index e70a129f19..1c96625396 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainUserAsyncClientTest.java +++ b/core/src/main/java/org/jclouds/rest/internal/CreateAsyncClientForCaller.java @@ -16,25 +16,26 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.cloudstack.features; +package org.jclouds.rest.internal; -import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.testng.annotations.Test; +import static com.google.common.reflect.Reflection.newProxy; -import com.google.inject.TypeLiteral; +import org.jclouds.internal.ClassMethodArgs; +import org.jclouds.rest.internal.AsyncRestClientProxy.Factory; -/** - * Tests behavior of {@code DomainUserAsyncClient} - * - * @author Andrei Savu - */ -@Test(groups = "unit", testName = "DomainUserAsyncClientTest") -public class DomainUserAsyncClientTest extends BaseCloudStackAsyncClientTest { +import com.google.common.cache.CacheLoader; +import com.google.inject.Inject; + +public final class CreateAsyncClientForCaller extends CacheLoader { + private final Factory factory; + + @Inject + private CreateAsyncClientForCaller(AsyncRestClientProxy.Factory factory) { + this.factory = factory; + } @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; + public Object load(ClassMethodArgs from) { + return newProxy(from.getClazz(), factory.caller(from)); } -} +} \ No newline at end of file diff --git a/core/src/main/java/org/jclouds/rest/config/CreateClientForCaller.java b/core/src/main/java/org/jclouds/rest/internal/CreateClientForCaller.java similarity index 98% rename from core/src/main/java/org/jclouds/rest/config/CreateClientForCaller.java rename to core/src/main/java/org/jclouds/rest/internal/CreateClientForCaller.java index bc5fcd61ae..957b982078 100644 --- a/core/src/main/java/org/jclouds/rest/config/CreateClientForCaller.java +++ b/core/src/main/java/org/jclouds/rest/internal/CreateClientForCaller.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.rest.config; +package org.jclouds.rest.internal; import static com.google.common.base.Preconditions.checkState; import static com.google.common.reflect.Reflection.newProxy; diff --git a/core/src/main/java/org/jclouds/rest/internal/RestAnnotationProcessor.java b/core/src/main/java/org/jclouds/rest/internal/RestAnnotationProcessor.java index 47dd2e347d..45d9511915 100644 --- a/core/src/main/java/org/jclouds/rest/internal/RestAnnotationProcessor.java +++ b/core/src/main/java/org/jclouds/rest/internal/RestAnnotationProcessor.java @@ -17,12 +17,12 @@ * under the License. */ package org.jclouds.rest.internal; - import static com.google.common.base.Functions.compose; import static com.google.common.base.Functions.toStringFunction; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Predicates.and; import static com.google.common.base.Predicates.in; import static com.google.common.base.Predicates.not; @@ -42,6 +42,7 @@ import static com.google.common.collect.Sets.newTreeSet; import static com.google.common.net.HttpHeaders.ACCEPT; import static com.google.common.net.HttpHeaders.CONTENT_TYPE; import static com.google.common.net.HttpHeaders.HOST; +import static java.lang.String.format; import static java.util.Arrays.asList; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static javax.ws.rs.core.MediaType.APPLICATION_XML; @@ -161,6 +162,7 @@ import com.google.inject.Inject; import com.google.inject.Injector; import com.google.inject.Key; import com.google.inject.TypeLiteral; +import com.google.inject.assistedinject.Assisted; import com.google.inject.util.Types; /** @@ -168,13 +170,72 @@ import com.google.inject.util.Types; * * @author Adrian Cole */ -public class RestAnnotationProcessor { +public abstract class RestAnnotationProcessor { + + public static interface Factory { + Declaring declaring(Class declaring); + Caller caller(ClassMethodArgs caller); + } + + public static final class Declaring extends RestAnnotationProcessor { + @Inject + private Declaring(Injector injector, LoadingCache, Cache> delegationMapCache, + @ApiVersion String apiVersion, @BuildVersion String buildVersion, ParseSax.Factory parserFactory, + HttpUtils utils, ContentMetadataCodec contentMetadataCodec, InputParamValidator inputParamValidator, + @Assisted Class declaring) { + super(injector, delegationMapCache, apiVersion, buildVersion, parserFactory, utils, contentMetadataCodec, + inputParamValidator, declaring); + } + } + + public static final class Caller extends RestAnnotationProcessor { + private final ClassMethodArgs caller; + + @Inject + private Caller(Injector injector, LoadingCache, Cache> delegationMapCache, + @ApiVersion String apiVersion, @BuildVersion String buildVersion, ParseSax.Factory parserFactory, + HttpUtils utils, ContentMetadataCodec contentMetadataCodec, InputParamValidator inputParamValidator, + @Assisted ClassMethodArgs caller) { + super(injector, delegationMapCache, apiVersion, buildVersion, parserFactory, utils, contentMetadataCodec, + inputParamValidator, caller.getClazz()); + // declaring class of method is the callee, this will lazily warm annotation cache + // until we have a better annotation cache warming approach + delegationMapCache.getUnchecked(caller.getMethod().getDeclaringClass()); + this.caller = caller; + } + + @Override + protected GeneratedHttpRequest.Builder requestBuilder() { + return super.requestBuilder().caller(caller); + } + + @Override + protected Optional findEndpoint(Method method, Object... args) { + Optional endpoint = getEndpointFor(caller.getMethod(), caller.getArgs()); + if (endpoint.isPresent()) + logger.trace("using endpoint %s from caller %s for %s", endpoint, caller, cma(method, args)); + else + endpoint = super.findEndpoint(method, args); + return endpoint; + } + + @Override + protected Multimap addPathAndGetTokens(Class clazz, Method method, Object[] args, + UriBuilder uriBuilder) { + Class callerClass = caller.getMethod().getDeclaringClass(); + return ImmutableMultimap. builder() + .putAll(super.addPathAndGetTokens(callerClass, caller.getMethod(), caller.getArgs(), uriBuilder)) + .putAll(super.addPathAndGetTokens(clazz, method, args, uriBuilder)).build(); + } + } + + protected ClassMethodArgs cma(Method method, Object... args) { + return logger.isTraceEnabled() ? new ClassMethodArgs(method.getDeclaringClass(), method, args) : null; + } @Resource protected Logger logger = Logger.NULL; - private final Class declaring; - // TODO replace with Table object static final LoadingCache>> methodToIndexOfParamToBinderParamAnnotation = createMethodToIndexOfParamToAnnotation(BinderParam.class); static final LoadingCache>> methodToIndexOfParamToWrapWithAnnotation = createMethodToIndexOfParamToAnnotation(WrapWith.class); @@ -187,9 +248,20 @@ public class RestAnnotationProcessor { static final LoadingCache>> methodToIndexOfParamToPostParamAnnotations = createMethodToIndexOfParamToAnnotation(PayloadParam.class); static final LoadingCache>> methodToIndexOfParamToPartParamAnnotations = createMethodToIndexOfParamToAnnotation(PartParam.class); static final LoadingCache>> methodToIndexOfParamToParamParserAnnotations = createMethodToIndexOfParamToAnnotation(ParamParser.class); - - final Cache delegationMap; - + static final LoadingCache> methodToIndexesOfOptions = CacheBuilder.newBuilder().build( + new CacheLoader>() { + @Override + public Set load(Method method) { + Builder toReturn = ImmutableSet.builder(); + for (int index = 0; index < method.getParameterTypes().length; index++) { + Class type = method.getParameterTypes()[index]; + if (HttpRequestOptions.class.isAssignableFrom(type) || HttpRequestOptions[].class.isAssignableFrom(type)) + toReturn.add(index); + } + return toReturn.build(); + } + }); + static LoadingCache>> createMethodToIndexOfParamToAnnotation( final Class annotation) { return CacheBuilder.newBuilder().build(new CacheLoader>>() { @@ -216,42 +288,15 @@ public class RestAnnotationProcessor { } })); } - } private static final Function, ? extends Part> ENTRY_TO_PART = new Function, Part>() { - @Override public Part apply(Entry from) { return Part.create(from.getKey(), from.getValue().toString()); } - }; - static final LoadingCache> methodToIndexesOfOptions = CacheBuilder.newBuilder().build( - new CacheLoader>() { - @Override - public Set load(Method method) { - Builder toReturn = ImmutableSet.builder(); - for (int index = 0; index < method.getParameterTypes().length; index++) { - Class type = method.getParameterTypes()[index]; - if (HttpRequestOptions.class.isAssignableFrom(type) || HttpRequestOptions[].class.isAssignableFrom(type)) - toReturn.add(index); - } - return toReturn.build(); - } - }); - - private final ParseSax.Factory parserFactory; - private final HttpUtils utils; - private final ContentMetadataCodec contentMetadataCodec; - private final LoadingCache, Boolean> seedAnnotationCache; - private final String apiVersion; - private final String buildVersion; - - @Inject - private InputParamValidator inputParamValidator; - @VisibleForTesting Function createResponseParser(Method method, HttpRequest request) { return createResponseParser(parserFactory, injector, method, request); @@ -298,30 +343,49 @@ public class RestAnnotationProcessor { return transformer; } - @SuppressWarnings("unchecked") - @Inject - public RestAnnotationProcessor(Injector injector, LoadingCache, Boolean> seedAnnotationCache, Cache delegationMap, - @ApiVersion String apiVersion, @BuildVersion String buildVersion, ParseSax.Factory parserFactory, - HttpUtils utils, ContentMetadataCodec contentMetadataCodec, TypeLiteral typeLiteral) { - this.declaring = (Class) typeLiteral.getRawType(); + private final Class declaring; + private final Injector injector; + private final ParseSax.Factory parserFactory; + private final HttpUtils utils; + private final ContentMetadataCodec contentMetadataCodec; + private final Cache delegationMap; + private final String apiVersion; + private final String buildVersion; + private final InputParamValidator inputParamValidator; + + private RestAnnotationProcessor(Injector injector, + LoadingCache, Cache> delegationMapCache, String apiVersion, String buildVersion, + ParseSax.Factory parserFactory, HttpUtils utils, ContentMetadataCodec contentMetadataCodec, + InputParamValidator inputParamValidator, Class declaring) { this.injector = injector; this.parserFactory = parserFactory; this.utils = utils; this.contentMetadataCodec = contentMetadataCodec; - this.seedAnnotationCache = seedAnnotationCache; - seedAnnotationCache.getUnchecked(declaring); - this.delegationMap = delegationMap; + this.delegationMap = delegationMapCache.getUnchecked(declaring); this.apiVersion = apiVersion; this.buildVersion = buildVersion; + this.inputParamValidator = inputParamValidator; + this.declaring = declaring; } - public Method getDelegateOrNull(Method in) { return delegationMap.getIfPresent(new MethodKey(in)); } public static class MethodKey { + private final String name; + private final int parametersTypeHashCode; + private final Class declaringClass; + public MethodKey(Method method) { + this.name = method.getName(); + this.declaringClass = method.getDeclaringClass(); + int parametersTypeHashCode = 0; + for (Class param : method.getParameterTypes()) + parametersTypeHashCode += param.hashCode(); + this.parametersTypeHashCode = parametersTypeHashCode; + } + @Override public int hashCode() { return Objects.hashCode(declaringClass, name, parametersTypeHashCode); @@ -336,71 +400,44 @@ public class RestAnnotationProcessor { && equal(this.name, that.name) && equal(this.parametersTypeHashCode, that.parametersTypeHashCode); } - - private final String name; - private final int parametersTypeHashCode; - private final Class declaringClass; - - public MethodKey(Method method) { - this.name = method.getName(); - this.declaringClass = method.getDeclaringClass(); - int parametersTypeHashCode = 0; - for (Class param : method.getParameterTypes()) - parametersTypeHashCode += param.hashCode(); - this.parametersTypeHashCode = parametersTypeHashCode; - } - - } - - final Injector injector; - - private ClassMethodArgs caller; - - public void setCaller(ClassMethodArgs caller) { - seedAnnotationCache.getUnchecked(caller.getMethod().getDeclaringClass()); - this.caller = caller; } public GeneratedHttpRequest createRequest(Method method, Object... args) { inputParamValidator.validateMethodParametersOrThrow(method, args); - - Optional endpoint = findEndpoint(method, args); - - if (!endpoint.isPresent()) { - throw new NoSuchElementException(String.format("no endpoint found for %s", - new ClassMethodArgs(method.getDeclaringClass(), method, args))); + Optional endpoint = Optional.absent(); + HttpRequest r = findHttpRequestInArgs(args); + if (r != null) { + endpoint = Optional.fromNullable(r.getEndpoint()); + if (endpoint.isPresent()) + logger.trace("using endpoint %s from args for %s", endpoint, cma(method, args)); + } else { + endpoint = findEndpoint(method, args); } - GeneratedHttpRequest.Builder requestBuilder = GeneratedHttpRequest.builder(); - HttpRequest r = RestAnnotationProcessor.findHttpRequestInArgs(args); + if (!endpoint.isPresent()) + throw new NoSuchElementException(format("no endpoint found for %s", cma(method, args))); + + GeneratedHttpRequest.Builder requestBuilder = requestBuilder(); if (r != null) { requestBuilder.fromHttpRequest(r); } else { requestBuilder.method(getHttpMethodOrConstantOrThrowException(method)); } - - // URI template in rfc6570 form - UriBuilder uriBuilder = uriBuilder(endpoint.get().toString()); - - overridePathEncoding(uriBuilder, method); requestBuilder.declaring(declaring) .javaMethod(method) .args(args) - .caller(caller) .filters(getFiltersIfAnnotated(method)); Multimap tokenValues = LinkedHashMultimap.create(); tokenValues.put(Constants.PROPERTY_API_VERSION, apiVersion); tokenValues.put(Constants.PROPERTY_BUILD_VERSION, buildVersion); - - // make sure any path from the caller is a prefix - if (caller != null) { - tokenValues.putAll(addPathAndGetTokens(caller.getMethod().getDeclaringClass(), caller.getMethod(), - caller.getArgs(), uriBuilder)); - } + + UriBuilder uriBuilder = uriBuilder(endpoint.get().toString()); // URI template in rfc6570 form + + overridePathEncoding(uriBuilder, method); tokenValues.putAll(addPathAndGetTokens(declaring, method, args, uriBuilder)); @@ -491,6 +528,10 @@ public class RestAnnotationProcessor { return request; } + protected org.jclouds.rest.internal.GeneratedHttpRequest.Builder requestBuilder() { + return GeneratedHttpRequest.builder(); + } + // TODO cache private void overridePathEncoding(UriBuilder uriBuilder, Method method) { if (declaring.isAnnotationPresent(SkipEncoding.class)) { @@ -504,43 +545,19 @@ public class RestAnnotationProcessor { // different than guava as accepts null private static enum NullableToStringFunction implements Function { INSTANCE; - @Override public String apply(Object o) { if (o == null) return null; return o.toString(); } - - @Override - public String toString() { - return "toString"; - } } - private Optional findEndpoint(Method method, Object... args) { - ClassMethodArgs cma = logger.isTraceEnabled() ? new ClassMethodArgs(method.getDeclaringClass(), method, args) - : null; - Optional endpoint = Optional.absent(); - - HttpRequest r = RestAnnotationProcessor.findHttpRequestInArgs(args); - - if (r != null) { - endpoint = Optional.fromNullable(r.getEndpoint()); - if (endpoint.isPresent()) - logger.trace("using endpoint %s from args for %s", endpoint, cma); - } - - if (!endpoint.isPresent() && caller != null) { - endpoint = getEndpointFor(caller.getMethod(), caller.getArgs()); - if (endpoint.isPresent()) - logger.trace("using endpoint %s from caller %s for %s", endpoint, caller, cma); - } - if (!endpoint.isPresent()) { - endpoint = getEndpointFor(method, args); - if (endpoint.isPresent()) - logger.trace("using endpoint %s for %s", endpoint, cma); - } + protected Optional findEndpoint(Method method, Object... args) { + ClassMethodArgs cma = cma(method, args); + Optional endpoint = getEndpointFor(method, args); + if (endpoint.isPresent()) + logger.trace("using endpoint %s for %s", endpoint, cma); if (!endpoint.isPresent()) { logger.trace("looking up default endpoint for %s", cma); endpoint = Optional.fromNullable(injector.getInstance( @@ -558,7 +575,7 @@ public class RestAnnotationProcessor { public static final String BOUNDARY = "--JCLOUDS--"; - private Multimap addPathAndGetTokens(Class clazz, Method method, Object[] args, UriBuilder uriBuilder) { + protected Multimap addPathAndGetTokens(Class clazz, Method method, Object[] args, UriBuilder uriBuilder) { if (clazz.isAnnotationPresent(Path.class)) uriBuilder.appendPath(clazz.getAnnotation(Path.class).value()); if (method.isAnnotationPresent(Path.class)) @@ -661,8 +678,7 @@ public class RestAnnotationProcessor { //TODO: change to LoadingCache> and move this logic to the CacheLoader. @VisibleForTesting - public static URI getEndpointInParametersOrNull(Method method, final Object[] args, Injector injector) - { + public static URI getEndpointInParametersOrNull(Method method, final Object[] args, Injector injector) { Map> map = indexWithAtLeastOneAnnotation(method, methodToIndexOfParamToEndpointParamAnnotations); if (map.size() >= 1 && args.length > 0) { @@ -674,29 +690,27 @@ public class RestAnnotationProcessor { try { URI returnVal = parser.apply(args[index]); checkArgument(returnVal != null, - String.format("endpoint for [%s] not configured for %s", args[index], method)); + format("endpoint for [%s] not configured for %s", args[index], method)); return returnVal; } catch (NullPointerException e) { - throw new IllegalArgumentException(String.format("argument at index %d on method %s was null", index, method), e); + throw new IllegalArgumentException(format("argument at index %d on method %s was null", index, method), + e); } } else { SortedSet keys = newTreeSet(map.keySet()); Iterable argsToParse = transform(keys, new Function() { - @Override public Object apply(Integer from) { return args[from]; } - }); try { URI returnVal = parser.apply(argsToParse); - checkArgument(returnVal != null, - String.format("endpoint for [%s] not configured for %s", argsToParse, method)); + checkArgument(returnVal != null, format("endpoint for [%s] not configured for %s", argsToParse, method)); return returnVal; } catch (NullPointerException e) { - throw new IllegalArgumentException(String.format("illegal argument in [%s] for method %s", argsToParse, - method), e); + throw new IllegalArgumentException( + format("illegal argument in [%s] for method %s", argsToParse, method), e); } } } @@ -707,7 +721,7 @@ public class RestAnnotationProcessor { }; // TODO: change to LoadingCache and move this logic to the CacheLoader. - private Optional getEndpointFor(Method method, Object[] args) { + protected Optional getEndpointFor(Method method, Object[] args) { URI endpoint = getEndpointInParametersOrNull(method, args, injector); if (endpoint == null) { Endpoint annotation; @@ -721,16 +735,14 @@ public class RestAnnotationProcessor { } endpoint = injector.getInstance(Key.get(uriSupplierLiteral, annotation.value())).get(); } - URI providerEndpoint = injector.getInstance(Key.get(uriSupplierLiteral, org.jclouds.location.Provider.class)) - .get(); - return Optional.fromNullable(addHostIfMissing(endpoint, providerEndpoint)); + URI provider = injector.getInstance(Key.get(uriSupplierLiteral, org.jclouds.location.Provider.class)).get(); + return Optional.fromNullable(addHostIfMissing(endpoint, provider)); } @VisibleForTesting static URI addHostIfMissing(URI original, URI withHost) { checkNotNull(withHost, "URI withHost cannot be null"); checkArgument(withHost.getHost() != null, "URI withHost must have host:" + withHost); - if (original == null) return null; if (original.getHost() != null) @@ -876,25 +888,18 @@ public class RestAnnotationProcessor { if (http != null) methodsBuilder.add(http.value()); } - Set methods = methodsBuilder.build(); - return (methods.size() == 0) ? null : methods; + return methodsBuilder.build(); } public String getHttpMethodOrConstantOrThrowException(Method method) { Set requests = getHttpMethods(method); - if (requests == null || requests.size() != 1) { - throw new IllegalStateException( - "You must use at least one, but no more than one http method or pathparam annotation on: " - + method.toString()); - } - return requests.iterator().next(); + checkState(requests.size() == 1, + "You must use at least one, but no more than one http method or pathparam annotation on: %s", method); + return get(requests, 0); } public boolean shouldAddHostHeader(Method method) { - if (declaring.isAnnotationPresent(VirtualHost.class) || method.isAnnotationPresent(VirtualHost.class)) { - return true; - } - return false; + return (declaring.isAnnotationPresent(VirtualHost.class) || method.isAnnotationPresent(VirtualHost.class)); } private static final Predicate> notEmpty = new Predicate>() { @@ -949,14 +954,13 @@ public class RestAnnotationProcessor { // (first, however, let's make sure we have enough args on the actual method) if (entry.getKey() >= request.getJavaMethod().getParameterAnnotations().length) { // not known whether this happens - throw new IllegalArgumentException("Argument index " + (entry.getKey() + 1) - + " is out of bounds for method " + request.getJavaMethod()); + throw new IllegalArgumentException(format("Argument index %s is out of bounds for method %s", + entry.getKey() + 1, request.getJavaMethod())); } if (request.getJavaMethod().isVarArgs() && entry.getKey() + 1 == request.getJavaMethod().getParameterTypes().length) - // allow null/missing for var args - continue OUTER; + continue OUTER; // allow null/missing for var args Annotation[] annotations = request.getJavaMethod().getParameterAnnotations()[entry.getKey()]; for (Annotation a : annotations) { @@ -966,7 +970,6 @@ public class RestAnnotationProcessor { checkNotNull(null, request.getJavaMethod().getName() + " parameter " + (entry.getKey() + 1)); } } - return request; } @@ -974,7 +977,7 @@ public class RestAnnotationProcessor { LoadingCache>> toRefine) { Map> indexToPayloadAnnotation = indexWithAtLeastOneAnnotation(method, toRefine); if (indexToPayloadAnnotation.size() > 1) { - throw new IllegalStateException(String.format( + throw new IllegalStateException(format( "You must not specify more than one %s annotation on: %s; found %s", description, method.toString(), indexToPayloadAnnotation)); } @@ -1080,7 +1083,6 @@ public class RestAnnotationProcessor { value = replaceTokens(value, tokenValues); headers.put(header.keys()[i], value); } - } private List getParts(Method method, Object[] args, Multimap tokenValues) { @@ -1143,7 +1145,6 @@ public class RestAnnotationProcessor { String paramKey = method.getAnnotation(PathParam.class).value(); String paramValue = injector.getInstance(method.getAnnotation(ParamParser.class).value()).apply(args); pathParamValues.put(paramKey, paramValue); - } return pathParamValues; } @@ -1154,8 +1155,7 @@ public class RestAnnotationProcessor { Object arg = args[argIndex]; if (extractors != null && extractors.size() > 0 && checkPresentOrNullable(method, paramKey, argIndex, arg)) { ParamParser extractor = (ParamParser) extractors.iterator().next(); - // ParamParsers can deal with nullable parameters - arg = injector.getInstance(extractor.value()).apply(arg); + arg = injector.getInstance(extractor.value()).apply(arg); // ParamParsers can deal with nullable parameters } checkPresentOrNullable(method, paramKey, argIndex, arg); return Optional.fromNullable(arg); @@ -1163,7 +1163,7 @@ public class RestAnnotationProcessor { private static boolean checkPresentOrNullable(Method method, String paramKey, Integer argIndex, Object arg) { if (arg == null && !argNullable(method, argIndex)) - throw new NullPointerException(String.format("param{%s} for method %s.%s", paramKey, method + throw new NullPointerException(format("param{%s} for method %s.%s", paramKey, method .getDeclaringClass().getSimpleName(), method.getName())); return true; } @@ -1173,7 +1173,6 @@ public class RestAnnotationProcessor { } private static final Predicate NULLABLE = new Predicate() { - @Override public boolean apply(Annotation in) { return Nullable.class.isAssignableFrom(in.annotationType()); @@ -1184,7 +1183,6 @@ public class RestAnnotationProcessor { return any(ImmutableSet.copyOf(annotations), NULLABLE); } - //TODO: change to LoadingCache and move this logic to the CacheLoader. //take care to manage size of this cache private Multimap getFormParamKeyValues(Method method, Object... args) { @@ -1208,7 +1206,6 @@ public class RestAnnotationProcessor { String paramKey = method.getAnnotation(FormParam.class).value(); String paramValue = injector.getInstance(method.getAnnotation(ParamParser.class).value()).apply(args); formParamValues.put(paramKey, paramValue); - } return formParamValues; } @@ -1230,8 +1227,7 @@ public class RestAnnotationProcessor { if (paramValue.get() instanceof Iterable) { Iterable iterableStrings = transform(Iterable.class.cast(paramValue.get()), toStringFunction()); queryParamValues.putAll(paramKey, iterableStrings); - } - else { + } else { queryParamValues.put(paramKey, paramValue.get().toString()); } } @@ -1242,7 +1238,6 @@ public class RestAnnotationProcessor { String paramKey = method.getAnnotation(QueryParam.class).value(); String paramValue = injector.getInstance(method.getAnnotation(ParamParser.class).value()).apply(args); queryParamValues.put(paramKey, paramValue); - } return queryParamValues; } @@ -1264,11 +1259,4 @@ public class RestAnnotationProcessor { } return postParams; } - - /** - * the class that is being processed - */ - public Class getDeclaring(){ - return declaring; - } } diff --git a/core/src/main/java/org/jclouds/rest/internal/SeedAnnotationCache.java b/core/src/main/java/org/jclouds/rest/internal/SeedAnnotationCache.java index 2dbc3ad642..962067efef 100644 --- a/core/src/main/java/org/jclouds/rest/internal/SeedAnnotationCache.java +++ b/core/src/main/java/org/jclouds/rest/internal/SeedAnnotationCache.java @@ -42,14 +42,15 @@ import javax.ws.rs.Path; import org.jclouds.http.HttpRequest; import org.jclouds.logging.Logger; +import org.jclouds.rest.RestContext; import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.internal.RestAnnotationProcessor.MethodKey; import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.collect.ImmutableSet; -import com.google.inject.Inject; -import com.google.inject.Injector; +import com.google.common.util.concurrent.Callables; import com.google.inject.Provides; /** @@ -61,21 +62,13 @@ import com.google.inject.Provides; * @author Adrian Cole */ @Singleton -public class SeedAnnotationCache extends CacheLoader, Boolean> { +public final class SeedAnnotationCache extends CacheLoader, Cache> { @Resource - protected Logger logger = Logger.NULL; - - protected final Injector injector; - protected final Cache delegationMap; - - @Inject - public SeedAnnotationCache(Injector injector, Cache delegationMap) { - this.injector = injector; - this.delegationMap = delegationMap; - } + private Logger logger = Logger.NULL; @Override - public Boolean load(Class declaring) throws ExecutionException { + public Cache load(Class declaring) throws ExecutionException { + Cache delegationMap = CacheBuilder.newBuilder().build(); for (Method method : difference(ImmutableSet.copyOf(declaring.getMethods()), ImmutableSet.copyOf(Object.class .getMethods()))) { if (isHttpMethod(method) || method.isAnnotationPresent(Delegate.class)) { @@ -93,7 +86,7 @@ public class SeedAnnotationCache extends CacheLoader, Boolean> { methodToIndexOfParamToPartParamAnnotations.get(method).get(index); methodToIndexesOfOptions.get(method); } - delegationMap.put(new MethodKey(method), method); + delegationMap.get(new MethodKey(method), Callables.returning(method)); } else if (!method.getDeclaringClass().equals(declaring)) { logger.trace("skipping potentially overridden method %s", method); } else if (method.isAnnotationPresent(Provides.class)) { @@ -102,11 +95,11 @@ public class SeedAnnotationCache extends CacheLoader, Boolean> { logger.trace("Method is not annotated as either http or provider method: %s", method); } } - return true; + return delegationMap; } public static boolean isHttpMethod(Method method) { - return method.isAnnotationPresent(Path.class) || getHttpMethods(method) != null + return method.isAnnotationPresent(Path.class) || !getHttpMethods(method).isEmpty() || ImmutableSet.copyOf(method.getParameterTypes()).contains(HttpRequest.class); } diff --git a/core/src/test/java/org/jclouds/fallbacks/HeaderToRetryAfterExceptionTest.java b/core/src/test/java/org/jclouds/fallbacks/HeaderToRetryAfterExceptionTest.java index e455d5b8ee..0655aad755 100644 --- a/core/src/test/java/org/jclouds/fallbacks/HeaderToRetryAfterExceptionTest.java +++ b/core/src/test/java/org/jclouds/fallbacks/HeaderToRetryAfterExceptionTest.java @@ -65,54 +65,7 @@ public class HeaderToRetryAfterExceptionTest { .addHeader(HttpHeaders.RETRY_AFTER, "Sun, 2 Jan 2000 00:00:00 GMT").build())); } - public static HttpCommand command = new HttpCommand() { - - @Override - public int getRedirectCount() { - return 0; - } - - @Override - public int incrementRedirectCount() { - return 0; - } - - @Override - public boolean isReplayable() { - return false; - } - - @Override - public Exception getException() { - return null; - } - - @Override - public int getFailureCount() { - return 0; - } - - @Override - public int incrementFailureCount() { - return 0; - } - - @Override - public void setException(Exception exception) { - - } - - @Override - public HttpRequest getCurrentRequest() { - return HttpRequest.builder().method("GET").endpoint("http://stub").build(); - } - - @Override - public void setCurrentRequest(HttpRequest request) { - - } - - }; + public static HttpCommand command = new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub").build()); static DateCodec rfc822 = new DateServiceRfc822Codec(new SimpleDateFormatDateService()); diff --git a/core/src/test/java/org/jclouds/http/handlers/BackoffLimitedRetryHandlerTest.java b/core/src/test/java/org/jclouds/http/handlers/BackoffLimitedRetryHandlerTest.java index 6a86871e3c..8407f984b5 100644 --- a/core/src/test/java/org/jclouds/http/handlers/BackoffLimitedRetryHandlerTest.java +++ b/core/src/test/java/org/jclouds/http/handlers/BackoffLimitedRetryHandlerTest.java @@ -36,12 +36,10 @@ import org.jclouds.date.internal.DateServiceDateCodecFactory; import org.jclouds.date.internal.SimpleDateFormatDateService; import org.jclouds.http.BaseJettyTest; import org.jclouds.http.HttpCommand; +import org.jclouds.http.HttpCommandExecutorService; import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpUtils; import org.jclouds.http.IntegrationTestAsyncClient; -import org.jclouds.http.TransformingHttpCommandExecutorServiceImpl; -import org.jclouds.http.TransformingHttpCommandImpl; -import org.jclouds.http.functions.ReturnStringIf2xx; import org.jclouds.http.internal.HttpWire; import org.jclouds.http.internal.JavaUrlHttpCommandExecutorService; import org.jclouds.io.ContentMetadataCodec; @@ -52,8 +50,6 @@ import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.common.base.Supplier; -import com.google.inject.Key; -import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "BackoffLimitedRetryHandlerTest") public class BackoffLimitedRetryHandlerTest { @@ -97,7 +93,7 @@ public class BackoffLimitedRetryHandlerTest { } - TransformingHttpCommandExecutorServiceImpl executorService; + HttpCommandExecutorService http; @BeforeTest void setupExecutorService() throws Exception { @@ -107,7 +103,7 @@ public class BackoffLimitedRetryHandlerTest { ContentMetadataCodec contentMetadataCodec = new DefaultContentMetadataCodec(new DateServiceDateCodecFactory( new SimpleDateFormatDateService())); RedirectionRetryHandler retry = new RedirectionRetryHandler(backoff); - JavaUrlHttpCommandExecutorService httpService = new JavaUrlHttpCommandExecutorService(utils, + http = new JavaUrlHttpCommandExecutorService(utils, contentMetadataCodec, execService, new DelegatingRetryHandler(backoff, retry), new BackoffLimitedRetryHandler(), new DelegatingErrorHandler(), new HttpWire(), new HostnameVerifier() { @@ -124,7 +120,6 @@ public class BackoffLimitedRetryHandlerTest { } }); - executorService = new TransformingHttpCommandExecutorServiceImpl(httpService, execService); } @Test @@ -170,16 +165,13 @@ public class BackoffLimitedRetryHandlerTest { assertEquals(response.getPayload().getInput().read(), -1); } - private final RestAnnotationProcessor processor = BaseJettyTest.newBuilder(8100, - new Properties()).buildInjector().getInstance( - Key.get(new TypeLiteral>() { - })); + private final RestAnnotationProcessor processor = BaseJettyTest.newBuilder(8100, new Properties()).buildInjector() + .getInstance(RestAnnotationProcessor.Factory.class).declaring(IntegrationTestAsyncClient.class); private HttpCommand createCommand() throws SecurityException, NoSuchMethodException { Method method = IntegrationTestAsyncClient.class.getMethod("download", String.class); - return new TransformingHttpCommandImpl(executorService, processor.createRequest(method, "1"), - new ReturnStringIf2xx()); + return new HttpCommand(processor.createRequest(method, "1")); } @Test diff --git a/core/src/test/java/org/jclouds/rest/InputParamValidatorTest.java b/core/src/test/java/org/jclouds/rest/InputParamValidatorTest.java index 8ed8c63cd8..d032510bd7 100644 --- a/core/src/test/java/org/jclouds/rest/InputParamValidatorTest.java +++ b/core/src/test/java/org/jclouds/rest/InputParamValidatorTest.java @@ -35,9 +35,6 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.inject.Injector; -import com.google.inject.Key; -import com.google.inject.TypeLiteral; -import com.google.inject.util.Types; @Test(groups = "unit") public class InputParamValidatorTest { @@ -65,7 +62,7 @@ public class InputParamValidatorTest { String.class); Method oneParamValidatedMethod = InputParamValidatorForm.class.getMethod("oneParamValidated", String.class, String.class); - RestAnnotationProcessor restAnnotationProcessor = factory(InputParamValidatorForm.class); + RestAnnotationProcessor restAnnotationProcessor = factory(InputParamValidatorForm.class); restAnnotationProcessor.createRequest(allParamsValidatedMethod, "blah", "blah"); restAnnotationProcessor.createRequest(oneParamValidatedMethod, "blah", "blah"); @@ -105,10 +102,8 @@ public class InputParamValidatorTest { new InputParamValidator(injector).validateMethodParametersOrThrow(method, 55); } - @SuppressWarnings("unchecked") - private RestAnnotationProcessor factory(Class clazz) { - return ((RestAnnotationProcessor) injector.getInstance(Key.get(TypeLiteral.get(Types.newParameterizedType( - RestAnnotationProcessor.class, clazz))))); + private RestAnnotationProcessor factory(Class clazz) { + return injector.getInstance(RestAnnotationProcessor.Factory.class).declaring(clazz); } Injector injector; diff --git a/core/src/test/java/org/jclouds/rest/internal/BaseAsyncApiTest.java b/core/src/test/java/org/jclouds/rest/internal/BaseAsyncApiTest.java index d9f37847d7..53175ac088 100644 --- a/core/src/test/java/org/jclouds/rest/internal/BaseAsyncApiTest.java +++ b/core/src/test/java/org/jclouds/rest/internal/BaseAsyncApiTest.java @@ -33,11 +33,10 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; +import com.google.common.reflect.TypeToken; import com.google.inject.Binder; import com.google.inject.Injector; -import com.google.inject.Key; import com.google.inject.Module; -import com.google.inject.TypeLiteral; /** * @@ -46,9 +45,7 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit") public abstract class BaseAsyncApiTest extends BaseRestApiTest { - protected RestAnnotationProcessor processor; - - protected abstract TypeLiteral> createTypeLiteral(); + protected RestAnnotationProcessor processor; protected abstract void checkFilters(HttpRequest request); @@ -67,7 +64,9 @@ public abstract class BaseAsyncApiTest extends BaseRestApiTest { protected void setupFactory() throws IOException { injector = createInjector(); parserFactory = injector.getInstance(ParseSax.Factory.class); - processor = injector.getInstance(Key.get(createTypeLiteral())); + processor = injector.getInstance(RestAnnotationProcessor.Factory.class).declaring(new TypeToken(getClass()) { + private static final long serialVersionUID = 1L; + }.getRawType()); } protected String identity = "identity"; diff --git a/core/src/test/java/org/jclouds/rest/internal/BaseRestApiTest.java b/core/src/test/java/org/jclouds/rest/internal/BaseRestApiTest.java index 64c189f7d6..33c4a50a67 100644 --- a/core/src/test/java/org/jclouds/rest/internal/BaseRestApiTest.java +++ b/core/src/test/java/org/jclouds/rest/internal/BaseRestApiTest.java @@ -18,7 +18,6 @@ */ package org.jclouds.rest.internal; import static com.google.common.base.Throwables.propagate; -import static com.google.inject.util.Types.newParameterizedType; import static org.easymock.EasyMock.createMock; import static org.eclipse.jetty.http.HttpHeaders.TRANSFER_ENCODING; import static org.jclouds.rest.internal.RestAnnotationProcessor.createResponseParser; @@ -53,7 +52,6 @@ import com.google.common.collect.SortedSetMultimap; import com.google.common.collect.TreeMultimap; import com.google.inject.AbstractModule; import com.google.inject.Injector; -import com.google.inject.Key; import com.google.inject.name.Names; /** @@ -181,10 +179,8 @@ public abstract class BaseRestApiTest { assertEquals(createResponseParser(parserFactory, injector, method, request).getClass(), parserClass); } - @SuppressWarnings("unchecked") - protected RestAnnotationProcessor factory(Class clazz) { - return ((RestAnnotationProcessor) injector.getInstance(Key.get(newParameterizedType( - RestAnnotationProcessor.class, clazz)))); + protected RestAnnotationProcessor factory(Class clazz) { + return injector.getInstance(RestAnnotationProcessor.Factory.class).declaring(clazz); } } diff --git a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java index f5115cd438..df63c8be0a 100644 --- a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java +++ b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java @@ -98,7 +98,6 @@ import org.jclouds.io.Payloads; import org.jclouds.javax.annotation.Nullable; import org.jclouds.logging.config.NullLoggingModule; import org.jclouds.providers.AnonymousProviderMetadata; -import org.jclouds.rest.AsyncClientFactory; import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.InvocationContext; @@ -127,6 +126,7 @@ import org.jclouds.rest.annotations.WrapWith; import org.jclouds.rest.binders.BindAsHostPrefix; import org.jclouds.rest.binders.BindToJsonPayload; import org.jclouds.rest.binders.BindToStringPayload; +import org.jclouds.rest.config.AsyncClientProvider; import org.jclouds.rest.config.RestClientModule; import org.jclouds.rest.functions.ImplicitOptionalConverter; import org.jclouds.util.Strings2; @@ -153,6 +153,7 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.inject.AbstractModule; import com.google.inject.ConfigurationException; import com.google.inject.Injector; +import com.google.inject.Key; import com.google.inject.Module; import com.google.inject.Provides; import com.google.inject.TypeLiteral; @@ -1887,7 +1888,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest { } @SuppressWarnings("unchecked") - public static Class> unwrap(RestAnnotationProcessor processor, + public static Class> unwrap(RestAnnotationProcessor processor, Method method) { return (Class>) RestAnnotationProcessor.getParserOrThrowException(method) .getTypeLiteral().getRawType(); @@ -1925,7 +1926,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest { } public void oneTransformerWithContext() throws SecurityException, NoSuchMethodException { - RestAnnotationProcessor processor = factory(TestTransformers.class); + RestAnnotationProcessor processor = factory(TestTransformers.class); Method method = TestTransformers.class.getMethod("oneTransformerWithContext"); GeneratedHttpRequest request = GeneratedHttpRequest.builder() .method("GET").endpoint("http://localhost").declaring(TestTransformers.class) @@ -2297,7 +2298,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest { @Test public void testPut() throws SecurityException, NoSuchMethodException, IOException { - RestAnnotationProcessor processor = factory(TestPayload.class); + RestAnnotationProcessor processor = factory(TestPayload.class); Method method = TestPayload.class.getMethod("put", String.class); GeneratedHttpRequest request = processor.createRequest(method, "test"); @@ -2308,7 +2309,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest { @Test public void putWithPath() throws SecurityException, NoSuchMethodException, IOException { - RestAnnotationProcessor processor = factory(TestPayload.class); + RestAnnotationProcessor processor = factory(TestPayload.class); Method method = TestPayload.class.getMethod("putWithPath", String.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, "rabble", "test"); @@ -2384,26 +2385,27 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest { void oneForm(@PathParam("bucket") String path); } + static final Key> formKey = Key.get(new TypeLiteral>(){}); @Test public void testProvidesWithGeneric() throws SecurityException, NoSuchMethodException { - Set set = injector.getInstance(AsyncClientFactory.class).create(TestClassForm.class).set(); + Set set = injector.getInstance(formKey).get().set(); assertEquals(set, ImmutableSet.of("foo")); } @Test public void testProvidesWithGenericQualified() throws SecurityException, NoSuchMethodException { - Set set = injector.getInstance(AsyncClientFactory.class).create(TestClassForm.class).foo(); + Set set = injector.getInstance(formKey).get().foo(); assertEquals(set, ImmutableSet.of("bar")); } @Test(expectedExceptions = AuthorizationException.class) public void testProvidesWithGenericQualifiedAuthorizationException() throws SecurityException, NoSuchMethodException { - injector.getInstance(AsyncClientFactory.class).create(TestClassForm.class).exception(); + injector.getInstance(formKey).get().exception(); } @Test(expectedExceptions = NoSuchElementException.class) public void testProvidesWithGenericQualifiedNoSuchElementException() throws SecurityException, NoSuchMethodException { - injector.getInstance(AsyncClientFactory.class).create(TestClassForm.class).noSuchElementException(); + injector.getInstance(formKey).get().noSuchElementException(); } @Test @@ -2463,7 +2465,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest { @Test public void testCreateJAXBResponseParserWithAnnotation() throws SecurityException, NoSuchMethodException { - RestAnnotationProcessor processor = factory(TestJAXBResponseParser.class); + RestAnnotationProcessor processor = factory(TestJAXBResponseParser.class); Method method = TestJAXBResponseParser.class.getMethod("jaxbGetWithAnnotation"); GeneratedHttpRequest request = GeneratedHttpRequest.builder().method("GET").endpoint("http://localhost") .declaring(TestJAXBResponseParser.class).javaMethod(method).args(new Object[] {}).build(); @@ -2473,7 +2475,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest { @Test public void testCreateJAXBResponseParserWithAcceptHeader() throws SecurityException, NoSuchMethodException { - RestAnnotationProcessor processor = factory(TestJAXBResponseParser.class); + RestAnnotationProcessor processor = factory(TestJAXBResponseParser.class); Method method = TestJAXBResponseParser.class.getMethod("jaxbGetWithAcceptHeader"); GeneratedHttpRequest request = GeneratedHttpRequest.builder().method("GET").endpoint("http://localhost") .declaring(TestJAXBResponseParser.class).javaMethod(method).args(new Object[] {}).build(); diff --git a/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/config/ApacheHCHttpCommandExecutorServiceModule.java b/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/config/ApacheHCHttpCommandExecutorServiceModule.java index 22b7d3b1ec..1fe98a9fd1 100644 --- a/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/config/ApacheHCHttpCommandExecutorServiceModule.java +++ b/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/config/ApacheHCHttpCommandExecutorServiceModule.java @@ -49,8 +49,6 @@ import org.apache.http.params.HttpParams; import org.apache.http.params.HttpProtocolParams; import org.jclouds.http.HttpCommandExecutorService; import org.jclouds.http.HttpUtils; -import org.jclouds.http.TransformingHttpCommandExecutorService; -import org.jclouds.http.TransformingHttpCommandExecutorServiceImpl; import org.jclouds.http.apachehc.ApacheHCHttpCommandExecutorService; import org.jclouds.http.config.ConfiguresHttpCommandExecutorService; import org.jclouds.http.config.SSLModule; @@ -169,9 +167,6 @@ public class ApacheHCHttpCommandExecutorServiceModule extends AbstractModule { protected void bindClient() { bind(HttpCommandExecutorService.class).to(ApacheHCHttpCommandExecutorService.class).in(Scopes.SINGLETON); - - bind(TransformingHttpCommandExecutorService.class).to(TransformingHttpCommandExecutorServiceImpl.class).in( - Scopes.SINGLETON); } } diff --git a/drivers/gae/src/main/java/org/jclouds/gae/config/GoogleAppEngineConfigurationModule.java b/drivers/gae/src/main/java/org/jclouds/gae/config/GoogleAppEngineConfigurationModule.java index 1f531de7d1..f1900fcdc7 100644 --- a/drivers/gae/src/main/java/org/jclouds/gae/config/GoogleAppEngineConfigurationModule.java +++ b/drivers/gae/src/main/java/org/jclouds/gae/config/GoogleAppEngineConfigurationModule.java @@ -24,8 +24,6 @@ import org.jclouds.concurrent.config.ConfiguresExecutorService; import org.jclouds.concurrent.config.ExecutorServiceModule; import org.jclouds.gae.GaeHttpCommandExecutorService; import org.jclouds.http.HttpCommandExecutorService; -import org.jclouds.http.TransformingHttpCommandExecutorService; -import org.jclouds.http.TransformingHttpCommandExecutorServiceImpl; import org.jclouds.http.config.ConfiguresHttpCommandExecutorService; import org.jclouds.predicates.SocketOpen; import org.jclouds.predicates.SocketOpenUnsupported; @@ -77,7 +75,6 @@ public class GoogleAppEngineConfigurationModule extends AbstractModule { @Override protected void configure() { install(executorServiceModule); - bind(TransformingHttpCommandExecutorService.class).to(TransformingHttpCommandExecutorServiceImpl.class); bind(SocketOpen.class).to(SocketOpenUnsupported.class).in(Scopes.SINGLETON); bindHttpCommandExecutorService(); } diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/AbiquoDelegateApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/AbiquoDelegateApiTest.java index 50098a1773..99488ded4c 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/AbiquoDelegateApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/AbiquoDelegateApiTest.java @@ -26,12 +26,9 @@ import java.util.concurrent.ExecutionException; import org.jclouds.abiquo.features.BaseAbiquoAsyncApiTest; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests asynchronous and synchronous API delegates. * @@ -73,12 +70,6 @@ public class AbiquoDelegateApiTest extends BaseAbiquoAsyncApiTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected void checkFilters(final HttpRequest request) { diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/AdminAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/AdminAsyncApiTest.java index a268de35e4..055abb8a89 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/AdminAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/AdminAsyncApiTest.java @@ -30,14 +30,12 @@ import org.jclouds.abiquo.domain.EnterpriseResources; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.abiquo.server.core.enterprise.PrivilegesDto; import com.abiquo.server.core.enterprise.RoleDto; import com.abiquo.server.core.enterprise.RolesDto; import com.abiquo.server.core.enterprise.UserDto; -import com.google.inject.TypeLiteral; /** * Tests annotation parsing of {@code AdminAsyncApi} @@ -172,11 +170,4 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest { checkFilters(request); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/CloudAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/CloudAsyncApiTest.java index ab83cc7b4c..211088f545 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/CloudAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/CloudAsyncApiTest.java @@ -43,7 +43,6 @@ import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReturnStringIf2xx; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.abiquo.model.enumerator.HypervisorType; @@ -78,7 +77,6 @@ import com.abiquo.server.core.infrastructure.storage.TierDto; 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.inject.TypeLiteral; /** * Tests annotation parsing of {@code CloudAsyncApi} @@ -1253,10 +1251,4 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { checkFilters(request); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/ConfigAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/ConfigAsyncApiTest.java index dbc94246c0..06104e03b5 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/ConfigAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/ConfigAsyncApiTest.java @@ -31,7 +31,6 @@ import org.jclouds.abiquo.domain.config.options.PropertyOptions; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.abiquo.server.core.appslibrary.CategoriesDto; @@ -42,7 +41,6 @@ import com.abiquo.server.core.config.SystemPropertiesDto; import com.abiquo.server.core.config.SystemPropertyDto; import com.abiquo.server.core.enterprise.PrivilegeDto; import com.abiquo.server.core.enterprise.PrivilegesDto; -import com.google.inject.TypeLiteral; /** * Tests annotation parsing of {@code AdminAsyncApi}. @@ -274,10 +272,4 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { checkFilters(request); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EnterpriseAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EnterpriseAsyncApiTest.java index bd64a3d58b..1ec756b35f 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EnterpriseAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EnterpriseAsyncApiTest.java @@ -33,7 +33,6 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.abiquo.am.model.TemplatesStateDto; @@ -54,7 +53,6 @@ import com.abiquo.server.core.infrastructure.DatacenterDto; 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.inject.TypeLiteral; /** * Tests annotation parsing of {@code EnterpriseAsyncApi} @@ -652,10 +650,4 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EventAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EventAsyncApiTest.java index 736f2285d0..3f4e63af9b 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EventAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EventAsyncApiTest.java @@ -24,11 +24,9 @@ import java.lang.reflect.Method; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.abiquo.server.core.event.EventsDto; -import com.google.inject.TypeLiteral; /** * Tests annotation parsing of {@code EventAsyncApi} @@ -52,10 +50,4 @@ public class EventAsyncApiTest extends BaseAbiquoAsyncApiTest { checkFilters(request); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/InfrastructureAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/InfrastructureAsyncApiTest.java index 07808ee7b2..342a4c110a 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/InfrastructureAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/InfrastructureAsyncApiTest.java @@ -45,7 +45,6 @@ import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReturnStringIf2xx; import org.jclouds.http.functions.ReturnTrueIf2xx; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.abiquo.model.enumerator.HypervisorType; @@ -90,7 +89,6 @@ import com.abiquo.server.core.infrastructure.storage.StoragePoolDto; 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.inject.TypeLiteral; /** * Tests annotation parsing of {@code InfrastructureAsyncApi} @@ -1722,10 +1720,4 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/PricingAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/PricingAsyncApiTest.java index 3c146590a6..1155d4e928 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/PricingAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/PricingAsyncApiTest.java @@ -29,7 +29,6 @@ import org.jclouds.abiquo.domain.PricingResources; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.abiquo.server.core.pricing.CostCodeCurrenciesDto; @@ -43,7 +42,6 @@ import com.abiquo.server.core.pricing.PricingTemplateDto; import com.abiquo.server.core.pricing.PricingTemplatesDto; import com.abiquo.server.core.pricing.PricingTierDto; import com.abiquo.server.core.pricing.PricingTiersDto; -import com.google.inject.TypeLiteral; /** * Tests annotation parsing of {@code PricingAsyncApi}. @@ -289,13 +287,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest checkFilters(request); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - + /*********************** Cost Code Currency ***********************/ public void testGetCostCodeCurrencies() throws SecurityException, NoSuchMethodException, IOException { diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/TaskAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/TaskAsyncApiTest.java index 610a4f477e..ec7e86fb42 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/TaskAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/TaskAsyncApiTest.java @@ -27,14 +27,12 @@ import org.jclouds.abiquo.domain.CloudResources; import org.jclouds.abiquo.domain.TemplateResources; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.abiquo.model.rest.RESTLink; import com.abiquo.model.transport.SingleResourceTransportDto; import com.abiquo.server.core.task.TaskDto; import com.abiquo.server.core.task.TasksDto; -import com.google.inject.TypeLiteral; /** * Tests annotation parsing of {@code TaskAsyncApi} @@ -121,10 +119,4 @@ public class TaskAsyncApiTest extends BaseAbiquoAsyncApiTest { checkFilters(request); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/VirtualMachineTemplateAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/VirtualMachineTemplateAsyncApiTest.java index 06f4285fc8..a4f3d5dfbe 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/VirtualMachineTemplateAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/VirtualMachineTemplateAsyncApiTest.java @@ -32,7 +32,6 @@ import org.jclouds.abiquo.functions.ReturnTaskReferenceOrNull; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.abiquo.model.enumerator.ConversionState; @@ -44,7 +43,6 @@ import com.abiquo.server.core.appslibrary.ConversionsDto; import com.abiquo.server.core.appslibrary.VirtualMachineTemplateDto; import com.abiquo.server.core.appslibrary.VirtualMachineTemplatePersistentDto; import com.abiquo.server.core.appslibrary.VirtualMachineTemplatesDto; -import com.google.inject.TypeLiteral; /** * Tests annotation parsing of {@code VirtualMachineTemplateAsyncApi} @@ -245,10 +243,4 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/rest/internal/AbiquoHttpAsyncClientTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/rest/internal/AbiquoHttpAsyncClientTest.java index c7c20c4df3..8e5b8c71f9 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/rest/internal/AbiquoHttpAsyncClientTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/rest/internal/AbiquoHttpAsyncClientTest.java @@ -26,12 +26,10 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.abiquo.features.BaseAbiquoAsyncApiTest; import org.jclouds.functions.IdentityFunction; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.abiquo.model.rest.RESTLink; import com.abiquo.server.core.infrastructure.DatacentersDto; -import com.google.inject.TypeLiteral; /** * Tests annotation parsing of {@code AbiquoHttpAsyncApi}. @@ -57,11 +55,4 @@ public class AbiquoHttpAsyncClientTest extends BaseAbiquoAsyncApiTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/VPDCAsyncApiTest.java b/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/VPDCAsyncApiTest.java index 85247a931f..94bdcdec86 100644 --- a/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/VPDCAsyncApiTest.java +++ b/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/VPDCAsyncApiTest.java @@ -23,13 +23,10 @@ import static org.testng.Assert.assertEquals; import java.io.IOException; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.savvis.vpdc.features.BaseVPDCAsyncApiTest; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code VPDCAsyncApi} * @@ -58,12 +55,6 @@ public class VPDCAsyncApiTest extends BaseVPDCAsyncApiTest { } - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @BeforeClass @Override protected void setupFactory() throws IOException { diff --git a/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/BrowsingAsyncApiTest.java b/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/BrowsingAsyncApiTest.java index f3e03babaa..c30f58f2b9 100644 --- a/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/BrowsingAsyncApiTest.java +++ b/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/BrowsingAsyncApiTest.java @@ -25,7 +25,6 @@ import java.net.URI; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.savvis.vpdc.options.GetVMOptions; import org.jclouds.savvis.vpdc.xml.FirewallServiceHandler; import org.jclouds.savvis.vpdc.xml.NetworkHandler; @@ -35,8 +34,6 @@ import org.jclouds.savvis.vpdc.xml.VDCHandler; import org.jclouds.savvis.vpdc.xml.VMHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests annotation parsing of {@code BrowsingAsyncApi} * @@ -236,11 +233,4 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest checkFilters(request); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/FirewallAsyncApiTest.java b/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/FirewallAsyncApiTest.java index f48779558b..49ff1dedcf 100644 --- a/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/FirewallAsyncApiTest.java +++ b/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/FirewallAsyncApiTest.java @@ -24,14 +24,11 @@ import java.lang.reflect.Method; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.savvis.vpdc.domain.FirewallRule; import org.jclouds.savvis.vpdc.xml.TaskHandler; import org.jclouds.util.Strings2; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests annotation parsing of {@code FirewallAsyncApi} * @@ -78,11 +75,4 @@ public class FirewallAsyncApiTest extends BaseVPDCAsyncApiTest checkFilters(request); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/ServiceManagementAsyncApiTest.java b/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/ServiceManagementAsyncApiTest.java index 26091d529c..e68e47e924 100644 --- a/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/ServiceManagementAsyncApiTest.java +++ b/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/ServiceManagementAsyncApiTest.java @@ -25,12 +25,9 @@ import java.net.URI; import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.savvis.vpdc.xml.TaskHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests annotation parsing of {@code ServiceManagementAsyncApi} * @@ -39,12 +36,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit") public class ServiceManagementAsyncApiTest extends BaseVPDCAsyncApiTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testPowerOnVMVDC() throws SecurityException, NoSuchMethodException, IOException { Method method = ServiceManagementAsyncApi.class.getMethod("powerOnVMInVDC", String.class, String.class, String.class); diff --git a/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/VMAsyncApiTest.java b/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/VMAsyncApiTest.java index ac7ec3e7ee..703ea07967 100644 --- a/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/VMAsyncApiTest.java +++ b/labs/savvis-symphonyvpdc/src/test/java/org/jclouds/savvis/vpdc/features/VMAsyncApiTest.java @@ -29,7 +29,6 @@ import org.jclouds.compute.domain.CIMOperatingSystem; import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.savvis.vpdc.domain.VMSpec; import org.jclouds.savvis.vpdc.xml.TaskHandler; import org.jclouds.savvis.vpdc.xml.TasksListHandler; @@ -265,11 +264,4 @@ public class VMAsyncApiTest extends BaseVPDCAsyncApiTest { checkFilters(request); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/AWSEC2AsyncClientTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/AWSEC2AsyncClientTest.java index ac240cffa1..fc6e94fab4 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/AWSEC2AsyncClientTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/AWSEC2AsyncClientTest.java @@ -23,12 +23,9 @@ import java.util.concurrent.ExecutionException; import org.jclouds.aws.ec2.services.BaseAWSEC2AsyncClientTest; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code AWSEC2AsyncClient} * @@ -70,12 +67,6 @@ public class AWSEC2AsyncClientTest extends BaseAWSEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @BeforeClass @Override protected void setupFactory() throws IOException { diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClientTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClientTest.java index e83df88ad3..c975c09715 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClientTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSAMIAsyncClientTest.java @@ -37,12 +37,10 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code AWSAMIAsyncClient} @@ -372,11 +370,4 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSInstanceAsyncClientTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSInstanceAsyncClientTest.java index 841ee0e589..96aa328683 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSInstanceAsyncClientTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSInstanceAsyncClientTest.java @@ -41,11 +41,9 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.Maps; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code AWSInstanceAsyncClient} @@ -499,11 +497,4 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSKeyPairAsyncClientTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSKeyPairAsyncClientTest.java index cbb2f6ee04..679ebe8943 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSKeyPairAsyncClientTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSKeyPairAsyncClientTest.java @@ -28,11 +28,8 @@ import org.jclouds.ec2.xml.KeyPairResponseHandler; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code AWSKeyPairAsyncClient} * @@ -124,11 +121,4 @@ public class AWSKeyPairAsyncClientTest extends BaseAWSEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSSecurityGroupAsyncClientTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSSecurityGroupAsyncClientTest.java index c5cec9848f..e887d0350c 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSSecurityGroupAsyncClientTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/AWSSecurityGroupAsyncClientTest.java @@ -32,11 +32,9 @@ 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.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code AWSSecurityGroupAsyncClient} @@ -199,11 +197,4 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/MonitoringAsyncClientTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/MonitoringAsyncClientTest.java index c2c57c08f0..c1ef104d37 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/MonitoringAsyncClientTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/MonitoringAsyncClientTest.java @@ -25,11 +25,8 @@ import java.lang.reflect.Method; import org.jclouds.aws.ec2.xml.MonitoringStateHandler; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code MonitoringAsyncClient} * @@ -73,11 +70,4 @@ public class MonitoringAsyncClientTest extends BaseAWSEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/PlacementGroupAsyncClientTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/PlacementGroupAsyncClientTest.java index 90cb186718..4195786dc4 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/PlacementGroupAsyncClientTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/PlacementGroupAsyncClientTest.java @@ -27,11 +27,8 @@ import org.jclouds.aws.ec2.xml.DescribePlacementGroupsResponseHandler; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code PlacementGroupAsyncClient} * @@ -125,11 +122,4 @@ public class PlacementGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/SpotInstanceAsyncClientTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/SpotInstanceAsyncClientTest.java index a43c5ede6c..b426185a99 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/SpotInstanceAsyncClientTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/SpotInstanceAsyncClientTest.java @@ -33,11 +33,8 @@ import org.jclouds.aws.ec2.xml.SpotInstancesHandler; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code SpotInstanceAsyncClient} * @@ -179,11 +176,4 @@ public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/TagAsyncClientTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/TagAsyncClientTest.java index 4d813f7789..f0d70a788e 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/TagAsyncClientTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/services/TagAsyncClientTest.java @@ -29,12 +29,10 @@ import org.jclouds.aws.ec2.xml.DescribeTagsResponseHandler; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code TagsAsyncClient} @@ -107,10 +105,4 @@ public class TagAsyncClientTest extends BaseAWSEC2AsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3AsyncClientTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3AsyncClientTest.java index 2309e7484f..f8fb749298 100644 --- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3AsyncClientTest.java +++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3AsyncClientTest.java @@ -40,7 +40,6 @@ import org.jclouds.io.Payload; import org.jclouds.io.Payloads; import org.jclouds.location.Region; import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.S3AsyncClientTest; import org.jclouds.s3.S3Client; @@ -60,7 +59,6 @@ import com.google.common.base.Supplier; import com.google.common.cache.CacheLoader; import com.google.common.collect.ImmutableMap; import com.google.inject.Module; -import com.google.inject.TypeLiteral; /** * @author Adrian Cole @@ -157,12 +155,6 @@ public class AWSS3AsyncClientTest extends S3AsyncClientTest { checkFilters(request); } - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testInitiateMultipartUpload() throws SecurityException, NegativeArraySizeException, NoSuchMethodException { Method method = AWSS3AsyncClient.class.getMethod("initiateMultipartUpload", String.class, ObjectMetadata.class, diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientExpectTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientExpectTest.java index b504462de6..d6c5bf9c5a 100644 --- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientExpectTest.java +++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientExpectTest.java @@ -21,9 +21,7 @@ package org.jclouds.aws.s3; import static org.jclouds.aws.s3.blobstore.options.AWSS3PutObjectOptions.Builder.storageClass; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import com.google.common.collect.ImmutableSet; import org.jclouds.aws.s3.domain.DeleteResult; import org.jclouds.aws.s3.internal.BaseAWSS3ClientExpectTest; import org.jclouds.blobstore.domain.Blob; @@ -39,6 +37,7 @@ import org.testng.annotations.Test; import com.google.common.base.Functions; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; import com.google.inject.Injector; /** diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequestTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequestTest.java index 731a0ff92b..077f113f16 100644 --- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequestTest.java +++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequestTest.java @@ -24,7 +24,6 @@ import java.io.File; import org.jclouds.blobstore.binders.BindMapToHeadersWithPrefix; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.domain.ObjectMetadata; import org.jclouds.s3.domain.ObjectMetadataBuilder; @@ -33,7 +32,6 @@ import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code BindObjectMetadataToRequest} @@ -44,12 +42,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "BindObjectMetadataToRequestTest") public class BindObjectMetadataToRequestTest extends BaseS3AsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Test public void testPassWithMinimumDetailsAndPayload5GB() { ObjectMetadata md = ObjectMetadataBuilder.create().key("foo").build(); diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSigner.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSigner.java index 72e881a484..a1aac7d716 100644 --- a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSigner.java +++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSigner.java @@ -42,7 +42,7 @@ import org.jclouds.rest.internal.RestAnnotationProcessor; */ @Singleton public class AzureBlobRequestSigner implements BlobRequestSigner { - private final RestAnnotationProcessor processor; + private final RestAnnotationProcessor processor; private final BlobToAzureBlob blobToBlob; private final BlobToHttpGetOptions blob2HttpGetOptions; @@ -51,9 +51,9 @@ public class AzureBlobRequestSigner implements BlobRequestSigner { private final Method createMethod; @Inject - public AzureBlobRequestSigner(RestAnnotationProcessor processor, BlobToAzureBlob blobToBlob, + public AzureBlobRequestSigner(RestAnnotationProcessor.Factory processor, BlobToAzureBlob blobToBlob, BlobToHttpGetOptions blob2HttpGetOptions) throws SecurityException, NoSuchMethodException { - this.processor = checkNotNull(processor, "processor"); + this.processor = checkNotNull(processor, "processor").declaring(AzureBlobAsyncClient.class); this.blobToBlob = checkNotNull(blobToBlob, "blobToBlob"); this.blob2HttpGetOptions = checkNotNull(blob2HttpGetOptions, "blob2HttpGetOptions"); this.getMethod = AzureBlobAsyncClient.class.getMethod("getBlob", String.class, String.class, GetOptions[].class); diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobAsyncClientTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobAsyncClientTest.java index bd6e9cbf14..959cebf4ee 100644 --- a/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobAsyncClientTest.java +++ b/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobAsyncClientTest.java @@ -47,12 +47,10 @@ import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReturnTrueIf2xx; import org.jclouds.http.options.GetOptions; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code AzureBlobAsyncClient} @@ -283,12 +281,6 @@ public class AzureBlobAsyncClientTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override public AzureBlobProviderMetadata createProviderMetadata() { return new AzureBlobProviderMetadata(); diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java index d5f820412a..9d796daf45 100644 --- a/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java +++ b/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java @@ -29,11 +29,9 @@ import org.jclouds.http.HttpRequest; import org.jclouds.io.Payload; import org.jclouds.io.Payloads; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code BindAzureBlobMetadataToRequest} @@ -135,12 +133,6 @@ public class BindAzureBlobMetadataToRequestTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override public AzureBlobProviderMetadata createProviderMetadata() { return new AzureBlobProviderMetadata(); diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java index 6fa09a86cf..88b990bac8 100644 --- a/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java +++ b/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java @@ -33,13 +33,11 @@ import org.jclouds.date.TimeStamp; import org.jclouds.http.HttpRequest; import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Supplier; import com.google.inject.Module; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code AzureBlobRequestSigner} @@ -116,12 +114,6 @@ public class AzureBlobRequestSignerTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected Module createModule() { return new TestAzureBlobRestClientModule(); diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSAsyncApiTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSAsyncApiTest.java index 8f51ddbaf3..cabaa3746b 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSAsyncApiTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSAsyncApiTest.java @@ -24,12 +24,9 @@ import java.util.concurrent.ExecutionException; import org.jclouds.http.HttpRequest; import org.jclouds.providers.ProviderMetadata; import org.jclouds.rest.internal.BaseAsyncApiTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code GleSYSAsyncApi} * @@ -61,12 +58,6 @@ public class GleSYSAsyncApiTest extends BaseAsyncApiTest { assert asyncApi.getArchiveApi() != null; } - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @BeforeClass @Override protected void setupFactory() throws IOException { diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/mock/HttpCommandMock.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/mock/HttpCommandMock.java deleted file mode 100644 index fcb882be97..0000000000 --- a/providers/gogrid/src/main/java/org/jclouds/gogrid/mock/HttpCommandMock.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.gogrid.mock; - -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpRequest; - -/** - * @author Oleksiy Yarmula - */ -public class HttpCommandMock implements HttpCommand { - - @Override - public int incrementRedirectCount() { - return 0; - } - - @Override - public int getRedirectCount() { - return 0; - } - - @Override - public boolean isReplayable() { - return false; - } - - @Override - public int incrementFailureCount() { - return 0; - } - - @Override - public int getFailureCount() { - return 0; - } - - @Override - public HttpRequest getCurrentRequest() { - return HttpRequest.builder().method("GET").endpoint("http://localhost").build(); - } - - @Override - public void setException(Exception exception) { - } - - @Override - public Exception getException() { - return null; - } - - @Override - public void setCurrentRequest(HttpRequest request) { - - } -} diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridAsyncClientTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridAsyncClientTest.java index d0ae7dd554..8f55e4294f 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridAsyncClientTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridAsyncClientTest.java @@ -22,12 +22,9 @@ import java.io.IOException; import java.util.concurrent.ExecutionException; import org.jclouds.gogrid.services.BaseGoGridAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code GoGridAsyncClient} * @@ -58,12 +55,6 @@ public class GoGridAsyncClientTest extends BaseGoGridAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @BeforeClass @Override protected void setupFactory() throws IOException { diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/handlers/GoGridErrorHandlerTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/handlers/GoGridErrorHandlerTest.java index 01807fd409..4e96a8d3e9 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/handlers/GoGridErrorHandlerTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/handlers/GoGridErrorHandlerTest.java @@ -25,8 +25,8 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import org.jclouds.gogrid.mock.HttpCommandMock; import org.jclouds.http.HttpCommand; +import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; import org.jclouds.json.config.GsonModule; import org.testng.TestException; @@ -71,19 +71,7 @@ public class GoGridErrorHandlerTest { } HttpCommand createHttpCommand() { - return new HttpCommandMock() { - private Exception exception; - - @Override - public void setException(Exception exception) { - this.exception = exception; - } - - @Override - public Exception getException() { - return exception; - } - }; + return new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://localhost").build()); } InputStream createInputStreamFromString(String s) { diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridImageAsyncClientTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridImageAsyncClientTest.java index b18343846d..0dd89ce984 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridImageAsyncClientTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridImageAsyncClientTest.java @@ -29,11 +29,9 @@ import org.jclouds.gogrid.functions.ParseImageListFromJsonResponse; import org.jclouds.gogrid.options.GetImageListOptions; import org.jclouds.gogrid.options.SaveImageOptions; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code GridImageAsyncClient} @@ -191,11 +189,4 @@ public class GridImageAsyncClientTest extends BaseGoGridAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridIpAsyncClientTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridIpAsyncClientTest.java index dd7e563859..77eb30f085 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridIpAsyncClientTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridIpAsyncClientTest.java @@ -25,11 +25,9 @@ import org.jclouds.gogrid.domain.IpType; import org.jclouds.gogrid.functions.ParseIpListFromJsonResponse; import org.jclouds.gogrid.options.GetIpListOptions; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code GridIpAsyncClient} @@ -86,10 +84,4 @@ public class GridIpAsyncClientTest extends BaseGoGridAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridJobAsyncClientTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridJobAsyncClientTest.java index 52be3d14d6..630ef4da11 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridJobAsyncClientTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridJobAsyncClientTest.java @@ -29,11 +29,9 @@ import org.jclouds.gogrid.domain.ObjectType; import org.jclouds.gogrid.functions.ParseJobListFromJsonResponse; import org.jclouds.gogrid.options.GetJobListOptions; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code GridJobAsyncClient} @@ -127,11 +125,4 @@ public class GridJobAsyncClientTest extends BaseGoGridAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridLoadBalancerAsyncClientTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridLoadBalancerAsyncClientTest.java index 2f8d826d7c..e2ed74df24 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridLoadBalancerAsyncClientTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridLoadBalancerAsyncClientTest.java @@ -30,12 +30,10 @@ import org.jclouds.gogrid.functions.ParseLoadBalancerFromJsonResponse; import org.jclouds.gogrid.functions.ParseLoadBalancerListFromJsonResponse; import org.jclouds.gogrid.options.AddLoadBalancerOptions; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code GridLoadBalancerAsyncClient} @@ -205,11 +203,4 @@ public class GridLoadBalancerAsyncClientTest extends BaseGoGridAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridServerAsyncClientTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridServerAsyncClientTest.java index eac16228ea..1a5462b2a1 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridServerAsyncClientTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridServerAsyncClientTest.java @@ -28,11 +28,9 @@ import org.jclouds.gogrid.functions.ParseCredentialsFromJsonResponse; import org.jclouds.gogrid.functions.ParseOptionsFromJsonResponse; import org.jclouds.gogrid.options.GetServerListOptions; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code GridServerAsyncClient} @@ -272,11 +270,4 @@ public class GridServerAsyncClientTest extends BaseGoGridAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - } diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSigner.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSigner.java index db67cc68f3..a9d50d157d 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSigner.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSigner.java @@ -32,9 +32,6 @@ import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Singleton; -import com.google.common.base.Supplier; -import com.google.common.base.Throwables; -import com.google.inject.Provider; import org.jclouds.blobstore.BlobRequestSigner; import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.functions.BlobToHttpGetOptions; @@ -52,6 +49,10 @@ import org.jclouds.rest.annotations.Credential; import org.jclouds.rest.annotations.Identity; import org.jclouds.rest.internal.RestAnnotationProcessor; +import com.google.common.base.Supplier; +import com.google.common.base.Throwables; +import com.google.inject.Provider; + /** * Signer for HP's variant of temporary signed URLs. They prefix the signature * with the tenant id. @@ -61,7 +62,7 @@ import org.jclouds.rest.internal.RestAnnotationProcessor; @Singleton public class HPCloudObjectStorageBlobRequestSigner implements BlobRequestSigner { - private final RestAnnotationProcessor processor; + private final RestAnnotationProcessor processor; private final Crypto crypto; private final Provider unixEpochTimestampProvider; @@ -78,13 +79,13 @@ public class HPCloudObjectStorageBlobRequestSigner implements BlobRequestSigner private final Method createMethod; @Inject - public HPCloudObjectStorageBlobRequestSigner(RestAnnotationProcessor processor, BlobToObject blobToObject, + public HPCloudObjectStorageBlobRequestSigner(RestAnnotationProcessor.Factory processor, BlobToObject blobToObject, BlobToHttpGetOptions blob2HttpGetOptions, Crypto crypto, @TimeStamp Provider unixEpochTimestampProvider, Supplier access, @Identity String accessKey, @Credential String secretKey) throws SecurityException, NoSuchMethodException { - this.processor = checkNotNull(processor, "processor"); + this.processor = checkNotNull(processor, "processor").declaring(HPCloudObjectStorageAsyncApi.class); this.crypto = checkNotNull(crypto, "crypto"); this.unixEpochTimestampProvider = checkNotNull(unixEpochTimestampProvider, "unixEpochTimestampProvider"); @@ -141,7 +142,7 @@ public class HPCloudObjectStorageBlobRequestSigner implements BlobRequestSigner } private HttpRequest signForTemporaryAccess(HttpRequest request, long timeInSeconds) { - HttpRequest.Builder builder = request.toBuilder(); + HttpRequest.Builder builder = request.toBuilder(); // HP Cloud does not use X-Auth-Token for temporary signed URLs and // leaking this allows clients arbitrary privileges until token timeout. builder.filters(filter(request.getFilters(), not(instanceOf(AuthenticateRequest.class)))); diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerAsyncClientTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerAsyncClientTest.java index c4d7cccd26..53dcb1d207 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerAsyncClientTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/SoftLayerAsyncClientTest.java @@ -22,13 +22,10 @@ import java.io.IOException; import java.util.concurrent.ExecutionException; import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.softlayer.features.BaseSoftLayerAsyncClientTest; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code SoftLayerAsyncClient} * @@ -53,12 +50,6 @@ public class SoftLayerAsyncClientTest extends BaseSoftLayerAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @BeforeClass @Override protected void setupFactory() throws IOException { diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountAsyncClientTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountAsyncClientTest.java index 5bc0a8acd7..4438e84daf 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountAsyncClientTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountAsyncClientTest.java @@ -24,11 +24,8 @@ import java.lang.reflect.Method; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseJson; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests annotation parsing of {@code AccountAsyncClient} * @@ -54,10 +51,4 @@ public class AccountAsyncClientTest extends BaseSoftLayerAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterAsyncClientTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterAsyncClientTest.java index ac5ee4a51e..293ad5ce08 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterAsyncClientTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterAsyncClientTest.java @@ -25,11 +25,9 @@ import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseJson; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; /** * Tests annotation parsing of {@code DatacenterAsyncClient} @@ -84,10 +82,4 @@ public class DatacenterAsyncClientTest extends BaseSoftLayerAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/ProductPackageAsyncClientTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/ProductPackageAsyncClientTest.java index 28c7fd1cdc..157006d86e 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/ProductPackageAsyncClientTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/ProductPackageAsyncClientTest.java @@ -24,11 +24,8 @@ import java.lang.reflect.Method; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseJson; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests annotation parsing of {@code ProductPackageAsyncClient} * @@ -54,10 +51,4 @@ public class ProductPackageAsyncClientTest extends BaseSoftLayerAsyncClientTest< checkFilters(httpRequest); } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestAsyncClientTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestAsyncClientTest.java index 3d63197c3e..dd4822b0f3 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestAsyncClientTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestAsyncClientTest.java @@ -27,11 +27,9 @@ import org.jclouds.Fallbacks.VoidOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseJson; import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.testng.annotations.Test; import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; /** * Tests annotation parsing of {@code VirtualGuestAsyncClient} @@ -174,10 +172,4 @@ public class VirtualGuestAsyncClientTest extends BaseSoftLayerAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } } diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClientTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClientTest.java index da02c23774..9700ba90ab 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClientTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClientTest.java @@ -32,7 +32,6 @@ import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.rest.ResourceNotFoundException; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.trmk.vcloud_0_8.domain.Protocol; import org.jclouds.trmk.vcloud_0_8.functions.ParseTaskFromLocationHeader; import org.jclouds.trmk.vcloud_0_8.options.AddInternetServiceOptions; @@ -57,7 +56,6 @@ import org.jclouds.util.Strings2; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; -import com.google.inject.TypeLiteral; /** * Tests behavior of {@code TerremarkECloudAsyncClient} @@ -74,12 +72,6 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie ImmutableMap.of(ORG_REF.getName(), ORG_REF).toString()); } - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testNetwork() throws SecurityException, NoSuchMethodException, IOException { Method method = TerremarkECloudAsyncClient.class.getMethod("getNetwork", URI.class); HttpRequest request = processor.createRequest(method, diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsAsyncClientTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsAsyncClientTest.java index 1176c03fa3..55ed50f509 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsAsyncClientTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsAsyncClientTest.java @@ -25,13 +25,10 @@ import java.net.URI; import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.trmk.ecloud.BaseTerremarkECloudAsyncClientTest; import org.jclouds.trmk.vcloud_0_8.xml.DataCentersHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code DataCenterOperationsAsyncClient} * @@ -43,12 +40,6 @@ import com.google.inject.TypeLiteral; public class DataCenterOperationsAsyncClientTest extends BaseTerremarkECloudAsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testlistDataCenters() throws SecurityException, NoSuchMethodException, IOException { Method method = DataCenterOperationsAsyncClient.class.getMethod("listDataCenters", URI.class); HttpRequest request = processor diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsAsyncClientTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsAsyncClientTest.java index 23afc08733..cda95b5d48 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsAsyncClientTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsAsyncClientTest.java @@ -25,13 +25,10 @@ import java.net.URI; import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404; import org.jclouds.http.HttpRequest; import org.jclouds.http.functions.ParseSax; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.trmk.ecloud.BaseTerremarkECloudAsyncClientTest; import org.jclouds.trmk.ecloud.xml.TagNameToUsageCountHandler; import org.testng.annotations.Test; -import com.google.inject.TypeLiteral; - /** * Tests behavior of {@code TagOperationsAsyncClient} * @@ -42,12 +39,6 @@ import com.google.inject.TypeLiteral; @Test(groups = "unit", testName = "TagOperationsAsyncClientTest") public class TagOperationsAsyncClientTest extends BaseTerremarkECloudAsyncClientTest { - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - public void testgetTagNameToUsageCount() throws SecurityException, NoSuchMethodException, IOException { Method method = TagOperationsAsyncClient.class.getMethod("getTagNameToUsageCount", URI.class); HttpRequest request = processor diff --git a/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClientTest.java b/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClientTest.java index 481ebc2587..e67b7c43cb 100644 --- a/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClientTest.java +++ b/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClientTest.java @@ -48,7 +48,6 @@ import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ResourceNotFoundException; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.trmk.vcloud_0_8.domain.Org; import org.jclouds.trmk.vcloud_0_8.domain.Protocol; import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; @@ -608,12 +607,6 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - @Override protected Module createModule() { return new TerremarkVCloudRestClientModuleExtension();