From 2cdf19a6b1fa849dbea5de81e85e1e2c095dcd2a Mon Sep 17 00:00:00 2001 From: adriancole Date: Mon, 8 Apr 2013 20:45:04 -0700 Subject: [PATCH 1/5] removed async expect tests --- .../BaseCloudWatchAsyncApiExpectTest.java | 38 ---- .../FloatingIPAsyncApiExpectTest.java | 197 ------------------ .../internal/BaseNovaAsyncApiExpectTest.java | 39 ---- .../internal/BaseSTSAsyncApiExpectTest.java | 38 ---- 4 files changed, 312 deletions(-) delete mode 100644 apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/internal/BaseCloudWatchAsyncApiExpectTest.java delete mode 100644 apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApiExpectTest.java delete mode 100644 apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaAsyncApiExpectTest.java delete mode 100644 apis/sts/src/test/java/org/jclouds/sts/internal/BaseSTSAsyncApiExpectTest.java diff --git a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/internal/BaseCloudWatchAsyncApiExpectTest.java b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/internal/BaseCloudWatchAsyncApiExpectTest.java deleted file mode 100644 index d549de7dfa..0000000000 --- a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/internal/BaseCloudWatchAsyncApiExpectTest.java +++ /dev/null @@ -1,38 +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.cloudwatch.internal; - -import java.util.Properties; - -import org.jclouds.cloudwatch.CloudWatchAsyncApi; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; - -import com.google.common.base.Function; -import com.google.inject.Module; - -/** - * - * @author Adrian Cole - */ -public class BaseCloudWatchAsyncApiExpectTest extends BaseCloudWatchExpectTest { - public CloudWatchAsyncApi createClient(Function fn, Module module, Properties props) { - return createInjector(fn, module, props).getInstance(CloudWatchAsyncApi.class); - } -} diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApiExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApiExpectTest.java deleted file mode 100644 index 19f9d2da5a..0000000000 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApiExpectTest.java +++ /dev/null @@ -1,197 +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.openstack.nova.v2_0.extensions; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import org.jclouds.openstack.nova.v2_0.NovaAsyncApi; -import org.jclouds.openstack.nova.v2_0.internal.BaseNovaAsyncApiExpectTest; -import org.jclouds.openstack.nova.v2_0.parse.ParseFloatingIPListTest; -import org.jclouds.openstack.nova.v2_0.parse.ParseFloatingIPTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * Tests annotation parsing of {@code FloatingIPAsyncApi} - * - * @author Michael Arnold - */ -@Test(groups = "unit", testName = "FloatingIPAsyncApiExpectTest") -public class FloatingIPAsyncApiExpectTest extends BaseNovaAsyncApiExpectTest { - - public void testWhenNamespaceInExtensionsListFloatingIpPresent() throws Exception { - - NovaAsyncApi apiWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse); - - assertEquals(apiWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1")); - - assertTrue(apiWhenExtensionNotInList.getFloatingIPExtensionForZone("az-1.region-a.geo-1").isPresent()); - - } - - public void testWhenNamespaceNotInExtensionsListFloatingIpNotPresent() throws Exception { - - NovaAsyncApi apiWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, unmatchedExtensionsOfNovaResponse); - - assertEquals(apiWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1")); - - assertFalse(apiWhenExtensionNotInList.getFloatingIPExtensionForZone("az-1.region-a.geo-1").isPresent()); - - } - - public void testListFloatingIPsWhenResponseIs2xx() throws Exception { - HttpRequest list = HttpRequest - .builder() - .method("GET") - .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips") - .addHeader("Accept", "application/json") - .addHeader("X-Auth-Token", authToken).build(); - - HttpResponse listResponse = HttpResponse.builder().statusCode(200) - .payload(payloadFromResource("/floatingip_list.json")).build(); - - NovaAsyncApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse); - - assertEquals(apiWhenFloatingIPsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1")); - - assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().list().get() - .toString(), new ParseFloatingIPListTest().expected().toString()); - } - - public void testListFloatingIPsWhenResponseIs404() throws Exception { - HttpRequest list = HttpRequest - .builder() - .method("GET") - .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips") - .addHeader("Accept", "application/json") - .addHeader("X-Auth-Token", authToken).build(); - - HttpResponse listResponse = HttpResponse.builder().statusCode(404).build(); - - NovaAsyncApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse); - - assertTrue(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().list().get() - .isEmpty()); - } - - public void testGetFloatingIPWhenResponseIs2xx() throws Exception { - HttpRequest get = HttpRequest - .builder() - .method("GET") - .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips/1") - .addHeader("Accept", "application/json") - .addHeader("X-Auth-Token", authToken).build(); - - HttpResponse getResponse = HttpResponse.builder().statusCode(200) - .payload(payloadFromResource("/floatingip_details.json")).build(); - - NovaAsyncApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, get, getResponse); - - assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().get("1").get() - .toString(), new ParseFloatingIPTest().expected().toString()); - } - - public void testGetFloatingIPWhenResponseIs404() throws Exception { - HttpRequest get = HttpRequest - .builder() - .method("GET") - .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips/1") - .addHeader("Accept", "application/json") - .addHeader("X-Auth-Token", authToken).build(); - - HttpResponse getResponse = HttpResponse.builder().statusCode(404).build(); - - NovaAsyncApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, get, getResponse); - - assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().get("1").get()); - } - - public void testAllocateWhenResponseIs2xx() throws Exception { - HttpRequest createFloatingIP = HttpRequest - .builder() - .method("POST") - .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips") - .addHeader("Accept", "application/json") - .addHeader("X-Auth-Token", authToken) - .payload(payloadFromStringWithContentType("{}", "application/json")).build(); - - HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200) - .payload(payloadFromResource("/floatingip_details.json")).build(); - - NovaAsyncApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP, - createFloatingIPResponse); - - assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create().get() - .toString(), new ParseFloatingIPTest().expected().toString()); - - } - - public void testAllocateWhenResponseIs404() throws Exception { - HttpRequest createFloatingIP = HttpRequest - .builder() - .method("POST") - .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips") - .addHeader("Accept", "application/json") - .addHeader("X-Auth-Token", authToken) - .payload(payloadFromStringWithContentType("{}", "application/json")).build(); - - HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(404).build(); - - NovaAsyncApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP, - createFloatingIPResponse); - - assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create().get()); - } - - public void testAllocateWithPoolNameWhenResponseIs2xx() throws Exception { - HttpRequest createFloatingIP = HttpRequest - .builder() - .method("POST") - .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips") - .addHeader("Accept", "application/json") - .addHeader("X-Auth-Token", authToken) - .payload(payloadFromStringWithContentType("{\"pool\":\"myPool\"}", "application/json")).build(); - - HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200) - .payload(payloadFromResource("/floatingip_details.json")).build(); - - NovaAsyncApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP, - createFloatingIPResponse); - - assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().allocateFromPool("myPool") - .get() - .toString(), new ParseFloatingIPTest().expected().toString()); - } - -} diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaAsyncApiExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaAsyncApiExpectTest.java deleted file mode 100644 index 182dfb8945..0000000000 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaAsyncApiExpectTest.java +++ /dev/null @@ -1,39 +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.openstack.nova.v2_0.internal; - -import java.util.Properties; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import org.jclouds.openstack.nova.v2_0.NovaAsyncApi; - -import com.google.common.base.Function; -import com.google.inject.Module; - -/** - * Base class for writing KeyStone Rest Api Expect tests - * - * @author Adrian Cole - */ -public class BaseNovaAsyncApiExpectTest extends BaseNovaExpectTest { - public NovaAsyncApi createClient(Function fn, Module module, Properties props) { - return createInjector(fn, module, props).getInstance(NovaAsyncApi.class); - } -} diff --git a/apis/sts/src/test/java/org/jclouds/sts/internal/BaseSTSAsyncApiExpectTest.java b/apis/sts/src/test/java/org/jclouds/sts/internal/BaseSTSAsyncApiExpectTest.java deleted file mode 100644 index e466fee86c..0000000000 --- a/apis/sts/src/test/java/org/jclouds/sts/internal/BaseSTSAsyncApiExpectTest.java +++ /dev/null @@ -1,38 +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.sts.internal; - -import java.util.Properties; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import org.jclouds.sts.STSAsyncApi; - -import com.google.common.base.Function; -import com.google.inject.Module; - -/** - * - * @author Adrian Cole - */ -public class BaseSTSAsyncApiExpectTest extends BaseSTSExpectTest { - public STSAsyncApi createApi(Function fn, Module module, Properties props) { - return createInjector(fn, module, props).getInstance(STSAsyncApi.class); - } -} From 4d0e6ae699127d34a70a6cef06660535fd761daa Mon Sep 17 00:00:00 2001 From: adriancole Date: Mon, 8 Apr 2013 23:30:30 -0700 Subject: [PATCH 2/5] added type token means for buildApi() as it is in fact used --- .../main/java/org/jclouds/ContextBuilder.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/jclouds/ContextBuilder.java b/core/src/main/java/org/jclouds/ContextBuilder.java index 910afbe3e7..ccdf4eb296 100644 --- a/core/src/main/java/org/jclouds/ContextBuilder.java +++ b/core/src/main/java/org/jclouds/ContextBuilder.java @@ -77,7 +77,6 @@ import org.jclouds.providers.internal.UpdateProviderMetadataFromProperties; import org.jclouds.rest.ConfiguresCredentialStore; import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.RestApiMetadata; -import org.jclouds.rest.RestContext; import org.jclouds.rest.config.CredentialStoreModule; import org.jclouds.rest.config.RestClientModule; import org.jclouds.rest.config.RestModule; @@ -110,14 +109,14 @@ import com.google.inject.TypeLiteral; * that api. * *
- * ex. to build a {@link RestContext} on a particular endpoint using the typed + * ex. to build a {@code Api} on a particular endpoint using the typed * interface * *
- * context = ContextBuilder.newBuilder(new NovaApiMetadata())
- *                         .endpoint("http://10.10.10.10:5000/v2.0")
- *                         .credentials(user, pass)
- *                         .build(NovaApiMetadata.CONTEXT_TOKEN)
+ * api = ContextBuilder.newBuilder(new NovaApiMetadata())
+ *                     .endpoint("http://10.10.10.10:5000/v2.0")
+ *                     .credentials(user, pass)
+ *                     .buildApi(NovaApi.class);
  * 
* *
@@ -623,7 +622,15 @@ public class ContextBuilder { * */ public A buildApi(Class api) { - return buildInjector().getInstance(api); + return buildApi(typeToken(api)); + } + + /** + * like {@link #buildApi(Class)} but permits a type-token for convenience. + */ + @SuppressWarnings("unchecked") + public A buildApi(TypeToken apiType) { + return (A) buildInjector().getInstance(Key.get(TypeLiteral.get(apiType.getType()))); } public ApiMetadata getApiMetadata() { From 8771f75d5055ecd71ac645a3fcd6cbc3b9b2bafa Mon Sep 17 00:00:00 2001 From: adriancole Date: Mon, 8 Apr 2013 23:31:11 -0700 Subject: [PATCH 3/5] added apiVersion field to BaseContextLiveTest so that CloudStack tests don't need to rely on as much injection --- core/src/test/java/org/jclouds/apis/BaseContextLiveTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/org/jclouds/apis/BaseContextLiveTest.java b/core/src/test/java/org/jclouds/apis/BaseContextLiveTest.java index 1cc1dd98d7..955a70394e 100644 --- a/core/src/test/java/org/jclouds/apis/BaseContextLiveTest.java +++ b/core/src/test/java/org/jclouds/apis/BaseContextLiveTest.java @@ -52,6 +52,7 @@ public abstract class BaseContextLiveTest { protected String identity; protected String credential; protected String endpoint; + protected String apiVersion; protected Properties setupProperties() { Properties overrides = new Properties(); @@ -60,7 +61,7 @@ public abstract class BaseContextLiveTest { identity = setIfTestSystemPropertyPresent(overrides, provider + ".identity"); credential = setIfTestSystemPropertyPresent(overrides, provider + ".credential"); endpoint = setIfTestSystemPropertyPresent(overrides, provider + ".endpoint"); - setIfTestSystemPropertyPresent(overrides, provider + ".api-version"); + apiVersion = setIfTestSystemPropertyPresent(overrides, provider + ".api-version"); setIfTestSystemPropertyPresent(overrides, provider + ".build-version"); return overrides; } From 36dd831b84ba1bffa48a9e9482dc6b594110b189 Mon Sep 17 00:00:00 2001 From: adriancole Date: Mon, 8 Apr 2013 23:38:02 -0700 Subject: [PATCH 4/5] moved all code off use of RestContext except CloudStackContext, which will use it until 1.7 --- .../cloudsigma/CloudSigmaClientLiveTest.java | 5 +- .../jclouds/cloudstack/CloudStackContext.java | 21 +- .../internal/CloudStackContextImpl.java | 35 ++- ...oudStackComputeServiceAdapterLiveTest.java | 2 +- .../compute/CloudStackExperimentLiveTest.java | 8 +- .../DomainDomainClientExpectTest.java | 2 +- .../features/NetworkClientLiveTest.java | 2 +- .../features/OfferingClientLiveTest.java | 3 +- .../features/SessionClientLiveTest.java | 2 - .../BaseCloudStackClientLiveTest.java | 38 ++- .../cloudwatch/CloudWatchLiveTest.java | 21 +- .../features/MetricApiLiveTest.java | 2 +- .../internal/BaseCloudWatchApiLiveTest.java | 16 +- .../ec2/features/SubnetApiLiveTest.java | 2 +- .../ec2/features/WindowsApiLiveTest.java | 2 +- .../features/internal/BaseTagApiLiveTest.java | 10 +- .../ec2/internal/BaseEC2ApiLiveTest.java | 16 +- .../ec2/internal/BaseEC2ClientLiveTest.java | 26 -- .../ElasticStackClientLiveTest.java | 4 +- .../VolumeAndSnapshotApiLiveTest.java | 14 +- .../v1/features/VolumeTypeApiLiveTest.java | 12 +- .../v1/internal/BaseCinderApiLiveTest.java | 25 +- .../keystone/v2_0/KeystoneApiLiveTest.java | 2 +- .../v2_0/features/ServiceApiLiveTest.java | 2 +- .../v2_0/features/TenantApiLiveTest.java | 4 +- .../v2_0/features/TokenApiLiveTest.java | 26 +- .../v2_0/features/UserApiLiveTest.java | 10 +- .../internal/BaseKeystoneApiLiveTest.java | 25 +- .../extensions/AdminActionsApiLiveTest.java | 20 +- .../FlavorExtraSpecsApiLiveTest.java | 14 +- .../extensions/FloatingIPApiLiveTest.java | 14 +- .../HostAdministrationApiLiveTest.java | 8 +- .../extensions/HostAggregateApiLiveTest.java | 14 +- .../v2_0/extensions/KeyPairApiLiveTest.java | 12 +- .../v2_0/extensions/QuotaApiLiveTest.java | 8 +- .../extensions/QuotaClassApiLiveTest.java | 8 +- .../extensions/SecurityGroupApiLiveTest.java | 12 +- .../ServerWithSecurityGroupsApiLiveTest.java | 10 +- .../SimpleTenantUsageApiLiveTest.java | 4 +- .../VirtualInterfaceApiLiveTest.java | 10 +- .../v2_0/extensions/VolumeApiLiveTest.java | 14 +- .../VolumeAttachmentApiLiveTest.java | 16 +- .../extensions/VolumeTypeApiLiveTest.java | 12 +- .../v2_0/features/ExtensionApiLiveTest.java | 4 +- .../nova/v2_0/features/FlavorApiLiveTest.java | 6 +- .../nova/v2_0/features/ImageApiLiveTest.java | 10 +- .../nova/v2_0/features/ServerApiLiveTest.java | 6 +- .../v2_0/internal/BaseNovaApiLiveTest.java | 22 +- .../v1/features/AccessRuleApiLiveTest.java | 42 +-- .../v1/features/ConnectionApiLiveTest.java | 40 +-- .../features/ContentCachingApiLiveTest.java | 28 +- .../v1/features/ErrorPageApiLiveTest.java | 32 +- .../v1/features/HealthMonitorApiLiveTest.java | 28 +- .../v1/features/LoadBalancerApiLiveTest.java | 54 ++-- .../v1/features/NodeApiLiveTest.java | 60 ++-- .../v1/features/ReportApiLiveTest.java | 30 +- .../features/SSLTerminationApiLiveTest.java | 28 +- .../SessionPersistenceApiLiveTest.java | 28 +- .../v1/features/VirtualIPApiLiveTest.java | 46 +-- .../BaseCloudLoadBalancersApiLiveTest.java | 24 +- .../jclouds/route53/Route53ApiLiveTest.java | 6 +- .../features/HostedZoneApiLiveTest.java | 2 +- .../ResourceRecordSetApiLiveTest.java | 14 +- .../internal/BaseRoute53ApiLiveTest.java | 20 +- .../java/org/jclouds/s3/S3ClientMockTest.java | 9 +- .../sqs/features/BulkMessageApiLiveTest.java | 10 +- .../sqs/features/MessageApiLiveTest.java | 12 +- .../sqs/features/PermissionApiLiveTest.java | 17 +- .../sqs/features/QueueApiLiveTest.java | 18 +- .../sqs/internal/BaseSQSApiLiveTest.java | 34 +-- .../java/org/jclouds/sts/STSApiLiveTest.java | 10 +- .../sts/internal/BaseSTSApiLiveTest.java | 17 +- .../SwiftContainerIntegrationLiveTest.java | 25 +- .../vcloud_0_8/TerremarkClientLiveTest.java | 273 ++++++++---------- .../internal/BaseTerremarkClientLiveTest.java | 9 +- .../org/jclouds/apis/BaseApiLiveTest.java | 148 ++++++++++ ...CommandExecutorServiceIntegrationTest.java | 5 +- .../java/org/jclouds/http/BaseJettyTest.java | 7 +- .../compute/AWSEC2ComputeServiceLiveTest.java | 14 +- .../AWSEC2ImageExtensionLiveTest.java | 13 +- .../features/TagSecurityGroupLiveTest.java | 2 +- .../aws/s3/config/AWSS3RestClientModule.java | 12 - .../java/org/jclouds/dynect/v3/DynECTApi.java | 4 +- .../org/jclouds/dynect/v3/DynECTAsyncApi.java | 4 +- .../jclouds/dynect/v3/DynectApiMockTest.java | 2 +- .../dynect/v3/features/RecordApiLiveTest.java | 14 +- .../v3/features/SessionApiLiveTest.java | 6 +- .../dynect/v3/features/ZoneApiLiveTest.java | 16 +- .../v3/internal/BaseDynECTApiLiveTest.java | 15 +- .../java/org/jclouds/glesys/GleSYSApi.java | 4 +- .../org/jclouds/glesys/GleSYSAsyncApi.java | 4 +- .../glesys/features/ArchiveApiLiveTest.java | 36 +-- .../glesys/features/DomainApiLiveTest.java | 48 +-- .../features/EmailAccountApiLiveTest.java | 50 ++-- .../glesys/features/IpApiLiveTest.java | 60 ++-- .../glesys/features/ServerApiLiveTest.java | 60 ++-- .../internal/BaseGleSYSApiLiveTest.java | 18 +- .../BaseGleSYSApiWithAServerLiveTest.java | 14 +- .../org/jclouds/gogrid/GoGridAsyncClient.java | 4 +- .../java/org/jclouds/gogrid/GoGridClient.java | 4 +- .../gogrid/GoGridLiveTestDisabled.java | 122 ++++---- .../compute/GoGridComputeServiceLiveTest.java | 18 +- .../services/BaseGoGridClientLiveTest.java | 19 +- .../services/GridImageClientLiveTest.java | 21 +- .../services/GridJobClientLiveTest.java | 4 +- .../softlayer/SoftLayerAsyncClient.java | 4 +- .../jclouds/softlayer/SoftLayerClient.java | 4 +- ...oftLayerComputeServiceAdapterLiveTest.java | 35 ++- .../compute/SoftLayerExperimentLiveTest.java | 59 ---- .../features/AccountClientLiveTest.java | 10 +- .../features/BaseSoftLayerClientLiveTest.java | 17 +- .../features/DatacenterClientLiveTest.java | 20 +- .../ProductPackageClientLiveTest.java | 8 +- .../features/VirtualGuestClientLiveTest.java | 46 +-- .../BaseTerremarkECloudClientLiveTest.java | 7 +- .../ecloud/TerremarkECloudClientLiveTest.java | 4 +- .../ecloud/TerremarkECloudClientMockTest.java | 2 +- ...TerremarkECloudComputeServiceLiveTest.java | 6 +- .../DataCenterOperationsClientLiveTest.java | 6 +- .../features/TagOperationsClientLiveTest.java | 6 +- .../TerremarkVCloudExpressClientLiveTest.java | 4 +- ...rkVCloudExpressComputeServiceLiveTest.java | 6 +- .../jclouds/ultradns/ws/UltraDNSWSApi.java | 4 +- .../ultradns/ws/UltraDNSWSAsyncApi.java | 4 +- .../ultradns/ws/UltraDNSWSApiLiveTest.java | 6 +- .../features/ResourceRecordApiLiveTest.java | 20 +- .../features/RoundRobinPoolApiLiveTest.java | 22 +- .../ultradns/ws/features/TaskApiLiveTest.java | 2 +- .../TrafficControllerPoolApiLiveTest.java | 22 +- .../ultradns/ws/features/ZoneApiLiveTest.java | 8 +- .../internal/BaseUltraDNSWSApiLiveTest.java | 15 +- 131 files changed, 1211 insertions(+), 1361 deletions(-) delete mode 100644 apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ClientLiveTest.java create mode 100644 core/src/test/java/org/jclouds/apis/BaseApiLiveTest.java delete mode 100644 providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerExperimentLiveTest.java diff --git a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java index a36e097ee8..539c1dac8f 100644 --- a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java +++ b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java @@ -47,7 +47,6 @@ import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; import org.jclouds.domain.LoginCredentials; import org.jclouds.predicates.SocketOpen; -import org.jclouds.rest.RestContext; import org.jclouds.ssh.SshClient; import org.jclouds.sshj.config.SshjSshClientModule; import org.testng.annotations.AfterGroups; @@ -78,7 +77,6 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest protected int maxDriveImageTime = 300; protected String vncPassword = "Il0veVNC"; protected CloudSigmaClient client; - protected RestContext cloudSigmaContext; protected Predicate socketTester; protected Predicate driveNotClaimed; @@ -88,9 +86,8 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest @Override public void setupContext() { super.setupContext(); - cloudSigmaContext = view.unwrap(); - client = cloudSigmaContext.getApi(); + client = view.utils().injector().getInstance(CloudSigmaClient.class); driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS); SocketOpen socketOpten = context.utils().injector().getInstance(SocketOpen.class); socketTester = retry(socketOpten, maxDriveImageTime, 1, SECONDS); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java index 376a16b02b..7a4dbac734 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java @@ -20,7 +20,6 @@ package org.jclouds.cloudstack; import org.jclouds.cloudstack.internal.CloudStackContextImpl; import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.rest.RestContext; import com.google.inject.ImplementedBy; @@ -33,8 +32,24 @@ import com.google.inject.ImplementedBy; @ImplementedBy(CloudStackContextImpl.class) public interface CloudStackContext extends ComputeServiceContext { - RestContext getDomainContext(); + CloudStackClient getApi(); - RestContext getGlobalContext(); + /** + * @deprecated please use {@link #getDomainApi()} as + * async interface will be removed in jclouds 1.7. + */ + @Deprecated + org.jclouds.rest.RestContext getDomainContext(); + + CloudStackDomainClient getDomainApi(); + + /** + * @deprecated please use {@link #getGlobalApi()} as + * async interface will be removed in jclouds 1.7. + */ + @Deprecated + org.jclouds.rest.RestContext getGlobalContext(); + + CloudStackGlobalClient getGlobalApi(); } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java index 5bc86587d7..ee34c9a5da 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java @@ -22,6 +22,7 @@ import javax.inject.Inject; import javax.inject.Singleton; import org.jclouds.Context; +import org.jclouds.cloudstack.CloudStackClient; import org.jclouds.cloudstack.CloudStackContext; import org.jclouds.cloudstack.CloudStackDomainAsyncClient; import org.jclouds.cloudstack.CloudStackDomainClient; @@ -31,7 +32,6 @@ import org.jclouds.compute.ComputeService; import org.jclouds.compute.Utils; import org.jclouds.compute.internal.ComputeServiceContextImpl; import org.jclouds.location.Provider; -import org.jclouds.rest.RestContext; import com.google.common.reflect.TypeToken; @@ -40,26 +40,43 @@ import com.google.common.reflect.TypeToken; */ @Singleton public class CloudStackContextImpl extends ComputeServiceContextImpl implements CloudStackContext { - private final RestContext domainContext; - private final RestContext globalContext; + private final CloudStackClient client; + private final org.jclouds.rest.RestContext domainContext; + private final org.jclouds.rest.RestContext globalContext; @Inject - public CloudStackContextImpl(@Provider Context backend, @Provider TypeToken backendType, - ComputeService computeService, Utils utils, - RestContext domainContext, - RestContext globalContext) { + CloudStackContextImpl(@Provider Context backend, @Provider TypeToken backendType, + ComputeService computeService, Utils utils, CloudStackClient client, + org.jclouds.rest.RestContext domainContext, + org.jclouds.rest.RestContext globalContext) { super(backend, backendType, computeService, utils); + this.client = client; this.domainContext = domainContext; this.globalContext = globalContext; } @Override - public RestContext getDomainContext() { + public CloudStackClient getApi() { + return client; + } + + @Override + public CloudStackDomainClient getDomainApi() { + return domainContext.getApi(); + } + + @Override + public CloudStackGlobalClient getGlobalApi() { + return globalContext.getApi(); + } + + @Override + public org.jclouds.rest.RestContext getDomainContext() { return domainContext; } @Override - public RestContext getGlobalContext() { + public org.jclouds.rest.RestContext getGlobalContext() { return globalContext; } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java index ea999fbeda..d5bd38667e 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java @@ -109,7 +109,7 @@ public class CloudStackComputeServiceAdapterLiveTest extends BaseCloudStackClien }).annotatedWith(Memoized.class).to(NetworksForCurrentUser.class).in(Scopes.SINGLETON); bind(new TypeLiteral>() { }).toInstance(credentialStore); - bind(CloudStackClient.class).toInstance(cloudStackContext.getApi()); + bind(CloudStackClient.class).toInstance(client); bind(new TypeLiteral>() {}). toInstance(new CloudStackComputeServiceContextModule().optionsConverters()); bind(String.class).annotatedWith(Names.named(PROPERTY_SESSION_INTERVAL)).toInstance("60"); diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackExperimentLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackExperimentLiveTest.java index f1e581dd44..be6a209e43 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackExperimentLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackExperimentLiveTest.java @@ -51,7 +51,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest { } protected void deleteNetworksInZoneWithVlanId(String zoneId, String vlanId) { - Set networks = domainAdminContext.getApi().getNetworkClient().listNetworks( + Set networks = domainAdminClient.getNetworkClient().listNetworks( ListNetworksOptions.Builder .isDefault(false) .isSystem(false) @@ -63,7 +63,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest { URI broadcastUri = URI.create("vlan://" + vlanId); for (Network net : networks) { if (broadcastUri.equals(net.getBroadcastURI())) { - String jobId = domainAdminContext.getApi().getNetworkClient().deleteNetwork(net.getId()); + String jobId = domainAdminClient.getNetworkClient().deleteNetwork(net.getId()); adminJobComplete.apply(jobId); } } @@ -96,7 +96,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest { cloudStackContext.getApi().getOfferingClient().listNetworkOfferings(specifyVLAN(true).zoneId(zoneId)), 0).getId(); // create an arbitrary network - network = domainAdminContext.getApi() + network = domainAdminClient .getNetworkClient() // startIP/endIP/netmask/gateway must be specified together .createNetworkInZone(zoneId, offeringId, group, group, @@ -117,7 +117,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest { if (nodes != null) view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group)); if (network != null) - domainAdminContext.getApi().getNetworkClient().deleteNetwork(network.getId()); + domainAdminClient.getNetworkClient().deleteNetwork(network.getId()); } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainDomainClientExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainDomainClientExpectTest.java index 7e0f87994c..8899b9e53c 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainDomainClientExpectTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainDomainClientExpectTest.java @@ -155,6 +155,6 @@ public class DomainDomainClientExpectTest extends BaseCloudStackExpectTest cloudStackContext; + protected CloudStackContext cloudStackContext; protected CloudStackClient client; protected CloudStackClient adminClient; protected User user; @@ -171,13 +171,11 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte protected boolean domainAdminEnabled; protected CloudStackContext domainAdminComputeContext; - protected RestContext domainAdminContext; protected CloudStackDomainClient domainAdminClient; protected User domainAdminUser; protected boolean globalAdminEnabled; protected CloudStackContext globalAdminComputeContext; - protected RestContext globalAdminContext; protected CloudStackGlobalClient globalAdminClient; protected User globalAdminUser; @@ -200,26 +198,25 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte public void setupContext() { super.setupContext(); computeClient = view.getComputeService(); - cloudStackContext = view.unwrap(); + cloudStackContext = CloudStackContext.class.cast(view); client = cloudStackContext.getApi(); - user = verifyCurrentUserIsOfType(cloudStackContext, Account.Type.USER); + user = verifyCurrentUserIsOfType(identity, client.getAccountClient(), USER); domainAdminEnabled = setupDomainAdminProperties() != null; if (domainAdminEnabled) { domainAdminComputeContext = createView(setupDomainAdminProperties(), setupModules()); - domainAdminContext = domainAdminComputeContext.getDomainContext(); - domainAdminClient = domainAdminContext.getApi(); - domainAdminUser = verifyCurrentUserIsOfType(domainAdminContext, Account.Type.DOMAIN_ADMIN); - adminClient = domainAdminContext.getApi(); + domainAdminClient = domainAdminComputeContext.getDomainApi(); + domainAdminUser = verifyCurrentUserIsOfType(domainAdminIdentity, domainAdminClient.getAccountClient(), + DOMAIN_ADMIN); + adminClient = domainAdminClient; } globalAdminEnabled = setupGlobalAdminProperties() != null; if (globalAdminEnabled) { globalAdminComputeContext = createView(setupGlobalAdminProperties(), setupModules()); - globalAdminContext = globalAdminComputeContext.getGlobalContext(); - globalAdminClient = globalAdminContext.getApi(); - globalAdminUser = verifyCurrentUserIsOfType(globalAdminContext, Account.Type.ADMIN); - adminClient = globalAdminContext.getApi(); + globalAdminClient = globalAdminComputeContext.getGlobalApi(); + globalAdminUser = verifyCurrentUserIsOfType(globalAdminIdentity, globalAdminClient.getAccountClient(), ADMIN); + adminClient = globalAdminClient; } injector = cloudStackContext.utils().injector(); @@ -250,10 +247,9 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte return new SshjSshClientModule(); } - protected static User verifyCurrentUserIsOfType( - RestContext context, Account.Type type) { - Iterable users = Iterables.concat(context.getApi().getAccountClient().listAccounts()); - Predicate apiKeyMatches = UserPredicates.apiKeyEquals(context.getIdentity()); + private static User verifyCurrentUserIsOfType(String identity, AccountClient accountClient, Account.Type type) { + Iterable users = Iterables.concat(accountClient.listAccounts()); + Predicate apiKeyMatches = UserPredicates.apiKeyEquals(identity); User currentUser; try { currentUser = Iterables.find(users, apiKeyMatches); diff --git a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchLiveTest.java b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchLiveTest.java index c3df3e5e27..0b1994a806 100644 --- a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchLiveTest.java +++ b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchLiveTest.java @@ -25,46 +25,29 @@ import static org.jclouds.util.Predicates2.retry; import java.util.Date; import java.util.Set; -import org.jclouds.apis.BaseContextLiveTest; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.cloudwatch.domain.Dimension; import org.jclouds.cloudwatch.domain.MetricDatum; import org.jclouds.cloudwatch.domain.Unit; import org.jclouds.cloudwatch.options.ListMetricsOptions; -import org.jclouds.rest.RestContext; import org.testng.Assert; -import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Sets; -import com.google.common.reflect.TypeToken; /** * Tests behavior of {@code CloudWatch}. * * @author Jeremy Whitlock */ -public class CloudWatchLiveTest extends BaseContextLiveTest> { +public class CloudWatchLiveTest extends BaseApiLiveTest { public CloudWatchLiveTest() { provider = "cloudwatch"; } - private CloudWatchApi api; - - @Override - @BeforeClass(groups = { "integration", "live" }) - public void setupContext() { - super.setupContext(); - api = context.getApi(); - } - - @Override - protected TypeToken> contextType() { - return CloudWatchApiMetadata.CONTEXT_TOKEN; - } - @Test protected void testCloudWatchListMetrics() { // Just make sure there is at least one metric returned (Much better if the account you use has more than 500) diff --git a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/features/MetricApiLiveTest.java b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/features/MetricApiLiveTest.java index 9bc333dd76..d711ae1f69 100644 --- a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/features/MetricApiLiveTest.java +++ b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/features/MetricApiLiveTest.java @@ -303,6 +303,6 @@ public class MetricApiLiveTest extends BaseCloudWatchApiLiveTest { } protected MetricApi api() { - return context.getApi().getMetricApiForRegion(null); + return api.getMetricApiForRegion(null); } } diff --git a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/internal/BaseCloudWatchApiLiveTest.java b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/internal/BaseCloudWatchApiLiveTest.java index e9653d82b6..f633b67f31 100644 --- a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/internal/BaseCloudWatchApiLiveTest.java +++ b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/internal/BaseCloudWatchApiLiveTest.java @@ -18,29 +18,17 @@ */ package org.jclouds.cloudwatch.internal; -import org.jclouds.apis.BaseContextLiveTest; -import org.jclouds.cloudwatch.CloudWatchApiMetadata; -import org.jclouds.cloudwatch.CloudWatchAsyncApi; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.cloudwatch.CloudWatchApi; -import org.jclouds.rest.RestContext; import org.testng.annotations.Test; -import com.google.common.reflect.TypeToken; - /** * * @author Adrian Cole */ @Test(groups = "live") -public class BaseCloudWatchApiLiveTest extends BaseContextLiveTest> { - +public class BaseCloudWatchApiLiveTest extends BaseApiLiveTest { public BaseCloudWatchApiLiveTest() { provider = "cloudwatch"; } - - @Override - protected TypeToken> contextType() { - return CloudWatchApiMetadata.CONTEXT_TOKEN; - } - } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/features/SubnetApiLiveTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/features/SubnetApiLiveTest.java index 216a009972..050f0030c1 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/features/SubnetApiLiveTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/features/SubnetApiLiveTest.java @@ -77,7 +77,7 @@ public class SubnetApiLiveTest extends BaseEC2ApiLiveTest { } private SubnetApi api() { - Optional subnetOption = context.getApi().getSubnetApi(); + Optional subnetOption = api.getSubnetApi(); if (!subnetOption.isPresent()) throw new SkipException("subnet api not present"); return subnetOption.get(); diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/features/WindowsApiLiveTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/features/WindowsApiLiveTest.java index 02bf23eb69..97a8adc36b 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/features/WindowsApiLiveTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/features/WindowsApiLiveTest.java @@ -31,7 +31,7 @@ import com.google.common.base.Optional; public class WindowsApiLiveTest extends BaseEC2ApiLiveTest { protected WindowsApi api() { - Optional windowsOption = context.getApi().getWindowsApi(); + Optional windowsOption = api.getWindowsApi(); if (!windowsOption.isPresent()) throw new SkipException("windows api not present"); return windowsOption.get(); diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/features/internal/BaseTagApiLiveTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/features/internal/BaseTagApiLiveTest.java index 0d1eb96c3b..3247a071e1 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/features/internal/BaseTagApiLiveTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/features/internal/BaseTagApiLiveTest.java @@ -119,8 +119,8 @@ public abstract class BaseTagApiLiveTest extends BaseEC2ApiLiveTest { @Override @BeforeClass(groups = "live") - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); resource = checkNotNull(createResourceForTagging(System.getProperty("user.name") + "-tag"), "resource"); } @@ -146,16 +146,16 @@ public abstract class BaseTagApiLiveTest extends BaseEC2ApiLiveTest { protected abstract void cleanupResource(Resource resource); protected TagApi api() { - Optional tagOption = context.getApi().getTagApi(); + Optional tagOption = api.getTagApi(); if (!tagOption.isPresent()) throw new SkipException("tag api not present"); return tagOption.get(); } @AfterClass(groups = "live") - protected void tearDownContext() { + protected void tearDown() { if (resource != null) cleanupResource(resource); - super.tearDownContext(); + super.tearDown(); } } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ApiLiveTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ApiLiveTest.java index b968f961a5..3446963c23 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ApiLiveTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ApiLiveTest.java @@ -1,26 +1,14 @@ package org.jclouds.ec2.internal; -import org.jclouds.apis.BaseContextLiveTest; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.ec2.EC2Api; -import org.jclouds.ec2.EC2AsyncApi; -import org.jclouds.rest.RestContext; - -import com.google.common.reflect.TypeToken; /** * * @author Adrian Cole */ -public class BaseEC2ApiLiveTest extends BaseContextLiveTest> { - +public class BaseEC2ApiLiveTest extends BaseApiLiveTest { public BaseEC2ApiLiveTest() { provider = "ec2"; } - - @Override - protected TypeToken> contextType() { - return new TypeToken>() { - }; - } - } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ClientLiveTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ClientLiveTest.java deleted file mode 100644 index d704d94ba9..0000000000 --- a/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ClientLiveTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jclouds.ec2.internal; - -import org.jclouds.apis.BaseContextLiveTest; -import org.jclouds.ec2.EC2ApiMetadata; -import org.jclouds.ec2.EC2AsyncClient; -import org.jclouds.ec2.EC2Client; -import org.jclouds.rest.RestContext; - -import com.google.common.reflect.TypeToken; - -/** - * - * @author Adrian Cole - */ -public class BaseEC2ClientLiveTest extends BaseContextLiveTest> { - - public BaseEC2ClientLiveTest() { - provider = "ec2"; - } - - @Override - protected TypeToken> contextType() { - return EC2ApiMetadata.CONTEXT_TOKEN; - } - -} diff --git a/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackClientLiveTest.java b/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackClientLiveTest.java index e723212bd2..0c5fbe4832 100644 --- a/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackClientLiveTest.java +++ b/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackClientLiveTest.java @@ -44,7 +44,6 @@ import org.jclouds.elasticstack.predicates.DriveClaimed; import org.jclouds.elasticstack.util.Servers; import org.jclouds.io.Payloads; import org.jclouds.predicates.SocketOpen; -import org.jclouds.rest.RestContext; import org.jclouds.ssh.SshClient; import org.jclouds.sshj.config.SshjSshClientModule; import org.jclouds.util.Strings2; @@ -76,7 +75,6 @@ public class ElasticStackClientLiveTest extends BaseComputeServiceContextLiveTes protected int maxDriveImageTime = 360; protected String vncPassword = "Il0veVNC"; protected ElasticStackClient client; - protected RestContext cloudStackContext; protected Predicate socketTester; protected Predicate driveNotClaimed; protected String imageId; @@ -87,7 +85,7 @@ public class ElasticStackClientLiveTest extends BaseComputeServiceContextLiveTes super.setupContext(); imageId = view.getComputeService().templateBuilder().build().getImage().getId(); - client = view.unwrap(ElasticStackApiMetadata.CONTEXT_TOKEN).getApi(); + client = view.utils().injector().getInstance(ElasticStackClient.class); driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS); SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class); socketTester = retry(socketOpen, maxDriveImageTime, 1, SECONDS); diff --git a/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeAndSnapshotApiLiveTest.java b/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeAndSnapshotApiLiveTest.java index 7590a08589..c8c83a93a6 100644 --- a/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeAndSnapshotApiLiveTest.java +++ b/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeAndSnapshotApiLiveTest.java @@ -57,16 +57,16 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest { @BeforeClass(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); - zone = Iterables.getLast(cinder.getApi().getConfiguredZones(), "nova"); - volumeApi = cinder.getApi().getVolumeApiForZone(zone); - snapshotApi = cinder.getApi().getSnapshotApiForZone(zone); + public void setup() { + super.setup(); + zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + volumeApi = api.getVolumeApiForZone(zone); + snapshotApi = api.getSnapshotApiForZone(zone); } @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDownContext() { + protected void tearDown() { if (testSnapshot != null) { assertTrue(snapshotApi.delete(testSnapshot.getId())); assertTrue(SnapshotPredicates.awaitDeleted(snapshotApi).apply(testSnapshot)); @@ -77,7 +77,7 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest { assertTrue(VolumePredicates.awaitDeleted(volumeApi).apply(testVolume)); } - super.tearDownContext(); + super.tearDown(); } public void testCreateVolume() { diff --git a/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeTypeApiLiveTest.java b/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeTypeApiLiveTest.java index ee6af22ba7..74a3a533c3 100644 --- a/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeTypeApiLiveTest.java +++ b/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeTypeApiLiveTest.java @@ -42,16 +42,16 @@ public class VolumeTypeApiLiveTest extends BaseCinderApiLiveTest { @BeforeGroups(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); - zone = Iterables.getLast(cinder.getApi().getConfiguredZones(), "nova"); - volumeTypeApi = cinder.getApi().getVolumeTypeApiForZone(zone); + public void setup() { + super.setup(); + zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + volumeTypeApi = api.getVolumeTypeApiForZone(zone); } @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDownContext() { - super.tearDownContext(); + protected void tearDown() { + super.tearDown(); } public void testListAndGetVolumeTypes() { diff --git a/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/internal/BaseCinderApiLiveTest.java b/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/internal/BaseCinderApiLiveTest.java index f7f852ab03..31baed716c 100644 --- a/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/internal/BaseCinderApiLiveTest.java +++ b/apis/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/internal/BaseCinderApiLiveTest.java @@ -20,46 +20,25 @@ package org.jclouds.openstack.cinder.v1.internal; import java.util.Properties; -import org.jclouds.apis.BaseContextLiveTest; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.openstack.cinder.v1.CinderApi; -import org.jclouds.openstack.cinder.v1.CinderApiMetadata; -import org.jclouds.openstack.cinder.v1.CinderAsyncApi; import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; -import org.jclouds.rest.RestContext; -import org.testng.annotations.BeforeGroups; - -import com.google.common.reflect.TypeToken; /** * Tests behavior of CinderApi * * @author Everett Toews */ -public class BaseCinderApiLiveTest extends BaseContextLiveTest> { +public class BaseCinderApiLiveTest extends BaseApiLiveTest { public BaseCinderApiLiveTest() { provider = "openstack-cinder"; } - protected RestContext cinder; - - @BeforeGroups(groups = { "integration", "live" }) - @Override - public void setupContext() { - super.setupContext(); - cinder = context; - } - @Override protected Properties setupProperties() { Properties props = super.setupProperties(); setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE); return props; } - - @Override - protected TypeToken> contextType() { - return CinderApiMetadata.CONTEXT_TOKEN; - } - } diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiLiveTest.java index 5ab71a049a..eae9c21296 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiLiveTest.java @@ -33,7 +33,7 @@ import org.testng.annotations.Test; public class KeystoneApiLiveTest extends BaseKeystoneApiLiveTest { public void testGetApiMetaData() { - ApiMetadata result = keystoneContext.getApi().getApiMetadata(); + ApiMetadata result = api.getApiMetadata(); assertNotNull(result); assertNotNull(result.getId()); assertNotNull(result.getStatus()); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java index b12c5ae014..5cc242c0ac 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java @@ -36,7 +36,7 @@ import org.testng.annotations.Test; public class ServiceApiLiveTest extends BaseKeystoneApiLiveTest { public void testTenants() { - ServiceApi api = keystoneContext.getApi().getServiceApi(); + ServiceApi api = this.api.getServiceApi(); Set result = api.listTenants(); assertNotNull(result); assertFalse(result.isEmpty()); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java index c5a55a8425..aae85f64ee 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java @@ -37,7 +37,7 @@ import org.testng.annotations.Test; public class TenantApiLiveTest extends BaseKeystoneApiLiveTest { public void testTenants() { - TenantApi api = keystoneContext.getApi().getTenantApi().get(); + TenantApi api = this.api.getTenantApi().get(); Set result = api.list().concat().toSet(); assertNotNull(result); assertFalse(result.isEmpty()); @@ -54,7 +54,7 @@ public class TenantApiLiveTest extends BaseKeystoneApiLiveTest { public void testTenantsByName() { - TenantApi api = keystoneContext.getApi().getTenantApi().get(); + TenantApi api = this.api.getTenantApi().get(); for (Tenant tenant : api.list().concat()) { Tenant aTenant = api.getByName(tenant.getName()); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java index 7328190ef6..04a8f93eca 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java @@ -24,18 +24,21 @@ import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.AssertJUnit.assertTrue; +import java.util.Properties; import java.util.Set; import org.jclouds.http.HttpRequest; +import org.jclouds.openstack.keystone.v2_0.KeystoneApi; import org.jclouds.openstack.keystone.v2_0.domain.Endpoint; import org.jclouds.openstack.keystone.v2_0.domain.Token; import org.jclouds.openstack.keystone.v2_0.domain.User; import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest; import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneApiLiveTest; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.google.common.collect.Iterables; +import com.google.inject.Injector; +import com.google.inject.Module; /** * Tests TokenApi @@ -46,18 +49,23 @@ import com.google.common.collect.Iterables; public class TokenApiLiveTest extends BaseKeystoneApiLiveTest { protected String token; + + @Override + protected KeystoneApi create(Properties props, Iterable modules) { + Injector injector = newBuilder().modules(modules).overrides(props).buildInjector(); + grabToken(injector.getInstance(AuthenticateRequest.class)); + return injector.getInstance(KeystoneApi.class); + } // Get the token currently in use (there's currently no listTokens()) - @BeforeMethod - public void grabToken() { - AuthenticateRequest ar = keystoneContext.getUtils().getInjector().getInstance(AuthenticateRequest.class); - HttpRequest test = ar.filter(HttpRequest.builder().method("GET").endpoint(context.getProviderMetadata().getEndpoint()).build()); + private void grabToken(AuthenticateRequest ar) { + HttpRequest test = ar.filter(HttpRequest.builder().method("GET").endpoint(endpoint).build()); token = Iterables.getOnlyElement(test.getHeaders().get("X-Auth-Token")); } public void testToken() { - TokenApi api = keystoneContext.getApi().getTokenApi().get(); + TokenApi api = this.api.getTokenApi().get(); assertTrue(api.isValid(token)); Token result = api.get(token); assertNotNull(result); @@ -73,7 +81,7 @@ public class TokenApiLiveTest extends BaseKeystoneApiLiveTest { public void testInvalidToken() { - TokenApi api = keystoneContext.getApi().getTokenApi().get(); + TokenApi api = this.api.getTokenApi().get(); assertFalse(api.isValid("thisisnotarealtoken!")); assertNull(api.get("thisisnotarealtoken!")); @@ -81,7 +89,7 @@ public class TokenApiLiveTest extends BaseKeystoneApiLiveTest { public void testTokenEndpoints() { - TokenApi api = keystoneContext.getApi().getTokenApi().get(); + TokenApi api = this.api.getTokenApi().get(); Set endpoints = api.listEndpointsForToken(token); assertNotNull(endpoints); assertFalse(endpoints.isEmpty()); @@ -90,7 +98,7 @@ public class TokenApiLiveTest extends BaseKeystoneApiLiveTest { public void testInvalidTokenEndpoints() { - TokenApi api = keystoneContext.getApi().getTokenApi().get(); + TokenApi api = this.api.getTokenApi().get(); assertTrue(api.listEndpointsForToken("thisisnotarealtoken!").isEmpty()); } diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java index 27dac57370..e4ac7f662a 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java @@ -40,7 +40,7 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest { public void testUsers() { - UserApi api = keystoneContext.getApi().getUserApi().get(); + UserApi api = this.api.getUserApi().get(); Set users = api.list().concat().toSet(); assertNotNull(users); assertFalse(users.isEmpty()); @@ -53,8 +53,8 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest { public void testUserRolesOnTenant() { - UserApi api = keystoneContext.getApi().getUserApi().get(); - Set tenants = keystoneContext.getApi().getTenantApi().get().list().concat().toSet(); + UserApi api = this.api.getUserApi().get(); + Set tenants = this.api.getTenantApi().get().list().concat().toSet(); for (User user : api.list().concat()) { for (Tenant tenant : tenants) { @@ -69,7 +69,7 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest { public void testListRolesOfUser() { - UserApi api = keystoneContext.getApi().getUserApi().get(); + UserApi api = this.api.getUserApi().get(); for (User user : api.list().concat()) { Set roles = api.listRolesOfUser(user.getId()); for (Role role : roles) { @@ -81,7 +81,7 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest { public void testUsersByName() { - UserApi api = keystoneContext.getApi().getUserApi().get(); + UserApi api = this.api.getUserApi().get(); for (User user : api.list().concat()) { User aUser = api.getByName(user.getName()); assertEquals(aUser, user); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeystoneApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeystoneApiLiveTest.java index 2702722947..af94986336 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeystoneApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeystoneApiLiveTest.java @@ -20,48 +20,27 @@ package org.jclouds.openstack.keystone.v2_0.internal; import java.util.Properties; -import org.jclouds.apis.BaseContextLiveTest; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.openstack.keystone.v2_0.KeystoneApi; -import org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata; -import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncApi; import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; -import org.jclouds.rest.RestContext; -import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; -import com.google.common.reflect.TypeToken; - /** * Tests behavior of {@code KeystoneApi} * * @author Adam Lowe */ @Test(groups = "live") -public class BaseKeystoneApiLiveTest extends BaseContextLiveTest> { +public class BaseKeystoneApiLiveTest extends BaseApiLiveTest { public BaseKeystoneApiLiveTest() { provider = "openstack-keystone"; } - protected RestContext keystoneContext; - - @BeforeGroups(groups = { "integration", "live" }) - @Override - public void setupContext() { - super.setupContext(); - keystoneContext = context; - } - @Override protected Properties setupProperties() { Properties props = super.setupProperties(); setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE); return props; } - - @Override - protected TypeToken> contextType() { - return KeystoneApiMetadata.CONTEXT_TOKEN; - } - } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java index 40312f4891..8b597307a3 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java @@ -62,13 +62,13 @@ public class AdminActionsApiLiveTest extends BaseNovaApiLiveTest { @BeforeClass(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); - zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova"); - serverApi = novaContext.getApi().getServerApiForZone(zone); - extensionApi = novaContext.getApi().getExtensionApiForZone(zone); - imageApi = novaContext.getApi().getImageApiForZone(zone); - apiOption = novaContext.getApi().getServerAdminExtensionForZone(zone); + public void setup() { + super.setup(); + zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + serverApi = api.getServerApiForZone(zone); + extensionApi = api.getExtensionApiForZone(zone); + imageApi = api.getImageApiForZone(zone); + apiOption = api.getServerAdminExtensionForZone(zone); if (apiOption.isPresent()) { testServerId = createServerInZone(zone).getId(); } @@ -76,16 +76,16 @@ public class AdminActionsApiLiveTest extends BaseNovaApiLiveTest { @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDownContext() { + protected void tearDown() { if (apiOption.isPresent()) { if (testServerId != null) { - assertTrue(novaContext.getApi().getServerApiForZone(zone).delete(testServerId)); + assertTrue(api.getServerApiForZone(zone).delete(testServerId)); } if (backupImageId != null) { imageApi.delete(backupImageId); } } - super.tearDownContext(); + super.tearDown(); } protected void skipOnAdminExtensionAbsent() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java index 0b24f84d39..c17ee2c834 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java @@ -52,22 +52,22 @@ public class FlavorExtraSpecsApiLiveTest extends BaseNovaApiLiveTest { @BeforeClass(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); - zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova"); - flavorApi = novaContext.getApi().getFlavorApiForZone(zone); - apiOption = novaContext.getApi().getFlavorExtraSpecsExtensionForZone(zone); + public void setup() { + super.setup(); + zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + flavorApi = api.getFlavorApiForZone(zone); + apiOption = api.getFlavorExtraSpecsExtensionForZone(zone); } @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDownContext() { + protected void tearDown() { if (apiOption.isPresent() && testFlavor != null) { for(String key : testSpecs.keySet()) { assertTrue(apiOption.get().deleteMetadataKey(testFlavor.getId(), key)); } } - super.tearDownContext(); + super.tearDown(); } public void testCreateExtraSpecs() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java index ef8911b13a..000e46b335 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java @@ -47,8 +47,8 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest { @Test public void testListFloatingIPs() throws Exception { - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - Optional apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId); + for (String zoneId : api.getConfiguredZones()) { + Optional apiOption = api.getFloatingIPExtensionForZone(zoneId); if (!apiOption.isPresent()) continue; FloatingIPApi api = apiOption.get(); @@ -69,8 +69,8 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest { @Test public void testAllocateAndDecreateFloatingIPs() throws Exception { - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - Optional apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId); + for (String zoneId : api.getConfiguredZones()) { + Optional apiOption = api.getFloatingIPExtensionForZone(zoneId); if (!apiOption.isPresent()) continue; FloatingIPApi api = apiOption.get(); @@ -100,12 +100,12 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest { @Test public void testAddAndRemoveFloatingIp() throws Exception { - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - Optional apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId); + for (String zoneId : api.getConfiguredZones()) { + Optional apiOption = api.getFloatingIPExtensionForZone(zoneId); if (!apiOption.isPresent()) continue; FloatingIPApi api = apiOption.get(); - ServerApi serverApi = novaContext.getApi().getServerApiForZone(zoneId); + ServerApi serverApi = this.api.getServerApiForZone(zoneId); Server server = createServerInZone(zoneId); FloatingIP floatingIP = api.create(); assertNotNull(floatingIP); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java index b29aadd174..876c280ce7 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java @@ -53,12 +53,12 @@ public class HostAdministrationApiLiveTest extends BaseNovaApiLiveTest { @BeforeGroups(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); if (identity.endsWith(":admin")) { - String zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova"); - optApi = novaContext.getApi().getHostAdministrationExtensionForZone(zone); + String zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + optApi = api.getHostAdministrationExtensionForZone(zone); } } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java index 7ab0e4f39a..53b218c9c3 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java @@ -51,20 +51,20 @@ public class HostAggregateApiLiveTest extends BaseNovaApiLiveTest { @BeforeClass(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); - String zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova"); - apiOption = novaContext.getApi().getHostAggregateExtensionForZone(zone); - hostAdminOption = novaContext.getApi().getHostAdministrationExtensionForZone(zone); + public void setup() { + super.setup(); + String zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + apiOption = api.getHostAggregateExtensionForZone(zone); + hostAdminOption = api.getHostAdministrationExtensionForZone(zone); } @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDownContext() { + protected void tearDown() { if (testAggregate != null) { assertTrue(apiOption.get().delete(testAggregate.getId())); } - super.tearDownContext(); + super.tearDown(); } public void testCreateAggregate() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java index 4bb91ef873..9f1f068ecf 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java @@ -35,8 +35,8 @@ import com.google.common.collect.FluentIterable; public class KeyPairApiLiveTest extends BaseNovaApiLiveTest { public void testListKeyPairs() throws Exception { - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - KeyPairApi api = novaContext.getApi().getKeyPairExtensionForZone(zoneId).get(); + for (String zoneId : api.getConfiguredZones()) { + KeyPairApi api = this.api.getKeyPairExtensionForZone(zoneId).get(); FluentIterable keyPairsList = api.list(); assertNotNull(keyPairsList); } @@ -44,8 +44,8 @@ public class KeyPairApiLiveTest extends BaseNovaApiLiveTest { public void testCreateAndDeleteKeyPair() throws Exception { final String KEYPAIR_NAME = "testkp"; - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - KeyPairApi api = novaContext.getApi().getKeyPairExtensionForZone(zoneId).get(); + for (String zoneId : api.getConfiguredZones()) { + KeyPairApi api = this.api.getKeyPairExtensionForZone(zoneId).get(); KeyPair keyPair = null; try { keyPair = api.create(KEYPAIR_NAME); @@ -62,8 +62,8 @@ public class KeyPairApiLiveTest extends BaseNovaApiLiveTest { final String KEYPAIR_NAME = "testkp"; final String PUBLIC_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCrrBREFxz3002l1HuXz0+UOdJQ/mOYD5DiJwwB/TOybwIKQJPOxJWA9gBoo4k9dthTKBTaEYbzrll7iZcp59E80S6mNiAr3mUgi+x5Y8uyXeJ2Ws+h6peVyFVUu9epkwpcTd1GVfdcVWsTajwDz9+lxCDhl0RZKDFoT0scTxbj/w== nova@nv-aw2az2-api0002"; - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - KeyPairApi api = novaContext.getApi().getKeyPairExtensionForZone(zoneId).get(); + for (String zoneId : api.getConfiguredZones()) { + KeyPairApi api = this.api.getKeyPairExtensionForZone(zoneId).get(); KeyPair keyPair = null; try { keyPair = api.createWithPublicKey(KEYPAIR_NAME, PUBLIC_KEY); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java index 2cb2bb2412..926a5d305a 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java @@ -41,11 +41,11 @@ public class QuotaApiLiveTest extends BaseNovaApiLiveTest { @BeforeClass(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); tenant = identity.split(":")[0]; - String zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova"); - apiOption = novaContext.getApi().getQuotaExtensionForZone(zone); + String zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + apiOption = api.getQuotaExtensionForZone(zone); } public void testGetQuotasForCurrentTenant() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java index dd79198298..84c6638daf 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java @@ -41,10 +41,10 @@ public class QuotaClassApiLiveTest extends BaseNovaApiLiveTest { @BeforeClass(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); - zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova"); - apiOption = novaContext.getApi().getQuotaClassExtensionForZone(zone); + public void setup() { + super.setup(); + zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + apiOption = api.getQuotaClassExtensionForZone(zone); } public void testUpdateAndGetQuotaClass() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java index 3147b7604a..eb699df571 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java @@ -42,16 +42,16 @@ public class SecurityGroupApiLiveTest extends BaseNovaApiLiveTest { public static final String SECURITY_GROUP_NAME = "testsg"; public void list() throws Exception { - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - SecurityGroupApi api = novaContext.getApi().getSecurityGroupExtensionForZone(zoneId).get(); + for (String zoneId : api.getConfiguredZones()) { + SecurityGroupApi api = this.api.getSecurityGroupExtensionForZone(zoneId).get(); Set securityGroupsList = api.list().toSet(); assertNotNull(securityGroupsList); } } public void createGetAndDeleteSecurityGroup() throws Exception { - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - SecurityGroupApi api = novaContext.getApi().getSecurityGroupExtensionForZone(zoneId).get(); + for (String zoneId : api.getConfiguredZones()) { + SecurityGroupApi api = this.api.getSecurityGroupExtensionForZone(zoneId).get(); SecurityGroup securityGroup = null; String id; try { @@ -70,8 +70,8 @@ public class SecurityGroupApiLiveTest extends BaseNovaApiLiveTest { } public void createAndDeleteSecurityGroupRule() throws Exception { - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - SecurityGroupApi api = novaContext.getApi().getSecurityGroupExtensionForZone(zoneId).get(); + for (String zoneId : api.getConfiguredZones()) { + SecurityGroupApi api = this.api.getSecurityGroupExtensionForZone(zoneId).get(); SecurityGroup securityGroup = null; try { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java index 4254a1d147..fe907a881e 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java @@ -46,11 +46,11 @@ public class ServerWithSecurityGroupsApiLiveTest extends BaseNovaApiLiveTest { @BeforeGroups(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); - zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova"); - serverApi = novaContext.getApi().getServerApiForZone(zone); - apiOption = novaContext.getApi().getServerWithSecurityGroupsExtensionForZone(zone); + public void setup() { + super.setup(); + zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + serverApi = api.getServerApiForZone(zone); + apiOption = api.getServerWithSecurityGroupsExtensionForZone(zone); } public void testGetServer() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java index f43709eba7..a9e2148802 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java @@ -37,8 +37,8 @@ import com.google.common.base.Optional; public class SimpleTenantUsageApiLiveTest extends BaseNovaApiLiveTest { public void testList() throws Exception { - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - Optional optApi = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId); + for (String zoneId : api.getConfiguredZones()) { + Optional optApi = api.getSimpleTenantUsageExtensionForZone(zoneId); if (optApi.isPresent() && identity.endsWith(":admin")) { SimpleTenantUsageApi api = optApi.get(); Set usages = api.list().toSet(); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java index f1d276d729..4c537f15bc 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java @@ -44,10 +44,10 @@ public class VirtualInterfaceApiLiveTest extends BaseNovaApiLiveTest { @BeforeClass(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); - zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova"); - apiOption = novaContext.getApi().getVirtualInterfaceExtensionForZone(zone); + public void setup() { + super.setup(); + zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + apiOption = api.getVirtualInterfaceExtensionForZone(zone); } public void testListVirtualInterfaces() { @@ -62,7 +62,7 @@ public class VirtualInterfaceApiLiveTest extends BaseNovaApiLiveTest { } } finally { if (testServer != null) { - novaContext.getApi().getServerApiForZone(zone).delete(testServer.getId()); + api.getServerApiForZone(zone).delete(testServer.getId()); } } } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java index 68d69606e6..0606aa02ac 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java @@ -56,15 +56,15 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest { @BeforeClass(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); - zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova"); - volumeOption = novaContext.getApi().getVolumeExtensionForZone(zone); + public void setup() { + super.setup(); + zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + volumeOption = api.getVolumeExtensionForZone(zone); } @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDownContext() { + protected void tearDown() { if (volumeOption.isPresent()) { if (testSnapshot != null) { final String snapshotId = testSnapshot.getId(); @@ -85,7 +85,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest { }, 180 * 1000L).apply(volumeOption.get())); } } - super.tearDownContext(); + super.tearDown(); } public void testCreateVolume() { @@ -268,7 +268,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest { } finally { if (server_id != null) - novaContext.getApi().getServerApiForZone(zone).delete(server_id); + api.getServerApiForZone(zone).delete(server_id); } } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiLiveTest.java index 328ddfe3be..21b42f187c 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAttachmentApiLiveTest.java @@ -54,16 +54,16 @@ public class VolumeAttachmentApiLiveTest extends BaseNovaApiLiveTest { @BeforeClass(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); - zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova"); - volumeApi = novaContext.getApi().getVolumeExtensionForZone(zone); - volumeAttachmentApi = novaContext.getApi().getVolumeAttachmentExtensionForZone(zone); + public void setup() { + super.setup(); + zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + volumeApi = api.getVolumeExtensionForZone(zone); + volumeAttachmentApi = api.getVolumeAttachmentExtensionForZone(zone); } @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDownContext() { + protected void tearDown() { if (volumeApi.isPresent()) { if (testVolume != null) { final String volumeId = testVolume.getId(); @@ -76,7 +76,7 @@ public class VolumeAttachmentApiLiveTest extends BaseNovaApiLiveTest { } } - super.tearDownContext(); + super.tearDown(); } public void testCreateVolume() { @@ -150,7 +150,7 @@ public class VolumeAttachmentApiLiveTest extends BaseNovaApiLiveTest { } finally { if (server_id != null) - novaContext.getApi().getServerApiForZone(zone).delete(server_id); + api.getServerApiForZone(zone).delete(server_id); } } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java index 20ccfe8849..19d20fd1bc 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java @@ -53,16 +53,16 @@ public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest { @BeforeGroups(groups = {"integration", "live"}) @Override - public void setupContext() { - super.setupContext(); - zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova"); - volumeTypeOption = novaContext.getApi().getVolumeTypeExtensionForZone(zone); + public void setup() { + super.setup(); + zone = Iterables.getLast(api.getConfiguredZones(), "nova"); + volumeTypeOption = api.getVolumeTypeExtensionForZone(zone); } @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDownContext() { + protected void tearDown() { if (volumeTypeOption.isPresent()) { if (testVolumeType != null) { final String id = testVolumeType.getId(); @@ -74,7 +74,7 @@ public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest { }, 5 * 1000L).apply(volumeTypeOption.get())); } } - super.tearDownContext(); + super.tearDown(); } public void testCreateVolumeType() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java index 2f1ef50f23..ac9c7bd5e2 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java @@ -45,7 +45,7 @@ public class ExtensionApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/extensions") public void testListExtensions() throws Exception { for (String zoneId : zones) { - ExtensionApi api = novaContext.getApi().getExtensionApiForZone(zoneId); + ExtensionApi api = this.api.getExtensionApiForZone(zoneId); Set response = api.list(); assertNotNull(response); assertFalse(response.isEmpty()); @@ -68,7 +68,7 @@ public class ExtensionApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/extensions/{alias}", dependsOnMethods = { "testListExtensions" }) public void testGetExtensionByAlias() throws Exception { for (String zoneId : zones) { - ExtensionApi api = novaContext.getApi().getExtensionApiForZone(zoneId); + ExtensionApi api = this.api.getExtensionApiForZone(zoneId); Set response = api.list(); for (Extension extension : response) { Extension details = api.get(extension.getId()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java index 23303065f3..d6c1b4bd9b 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java @@ -46,7 +46,7 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/flavors") public void testListFlavors() throws Exception { for (String zoneId : zones) { - FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId); + FlavorApi api = this.api.getFlavorApiForZone(zoneId); Set response = api.list().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); @@ -66,7 +66,7 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/flavors/detail") public void testListFlavorsInDetail() throws Exception { for (String zoneId : zones) { - FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId); + FlavorApi api = this.api.getFlavorApiForZone(zoneId); Set response = api.listInDetail().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); @@ -89,7 +89,7 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/flavors/{id}", dependsOnMethods = { "testListFlavorsInDetail" }) public void testGetFlavorById() throws Exception { for (String zoneId : zones) { - FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId); + FlavorApi api = this.api.getFlavorApiForZone(zoneId); Set response = api.listInDetail().concat().toSet(); for (Flavor flavor : response) { Flavor details = api.get(flavor.getId()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java index 96e30e8880..a821723adf 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java @@ -41,7 +41,7 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/images") public void testListImages() throws Exception { for (String zoneId : zones) { - ImageApi api = novaContext.getApi().getImageApiForZone(zoneId); + ImageApi api = this.api.getImageApiForZone(zoneId); Set response = api.list().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); @@ -55,8 +55,8 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/images/detail") public void testListImagesInDetail() throws Exception { - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - ImageApi api = novaContext.getApi().getImageApiForZone(zoneId); + for (String zoneId : api.getConfiguredZones()) { + ImageApi api = this.api.getImageApiForZone(zoneId); Set response = api.listInDetail().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); @@ -79,8 +79,8 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/images/{id}", dependsOnMethods = { "testListImagesInDetail" }) public void testGetImageById() throws Exception { - for (String zoneId : novaContext.getApi().getConfiguredZones()) { - ImageApi api = novaContext.getApi().getImageApiForZone(zoneId); + for (String zoneId : api.getConfiguredZones()) { + ImageApi api = this.api.getImageApiForZone(zoneId); Set response = api.listInDetail().concat().toSet(); for (Image image : response) { Image details = api.get(image.getId()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java index e02dc437c1..8c5fdbf908 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java @@ -43,7 +43,7 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/servers") public void testListServers() throws Exception { for (String zoneId : zones) { - ServerApi api = novaContext.getApi().getServerApiForZone(zoneId); + ServerApi api = this.api.getServerApiForZone(zoneId); for (Resource server : api.list().concat()) { checkResource(server); } @@ -53,7 +53,7 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/servers/detail") public void testListServersInDetail() throws Exception { for (String zoneId : zones) { - ServerApi api = novaContext.getApi().getServerApiForZone(zoneId); + ServerApi api = this.api.getServerApiForZone(zoneId); for (Server server : api.listInDetail().concat()) { checkServer(server); } @@ -63,7 +63,7 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/servers/{id}", dependsOnMethods = { "testListServersInDetail" }) public void testGetServerById() throws Exception { for (String zoneId : zones) { - ServerApi api = novaContext.getApi().getServerApiForZone(zoneId); + ServerApi api = this.api.getServerApiForZone(zoneId); for (Resource server : api.list().concat()) { Server details = api.get(server.getId()); assertEquals(details.getId(), server.getId()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java index 79bc69ab91..5e08e5e8e5 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java @@ -21,10 +21,9 @@ package org.jclouds.openstack.nova.v2_0.internal; import java.util.Properties; import java.util.Set; -import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; import org.jclouds.openstack.nova.v2_0.NovaApi; -import org.jclouds.openstack.nova.v2_0.NovaAsyncApi; import org.jclouds.openstack.nova.v2_0.config.NovaProperties; import org.jclouds.openstack.nova.v2_0.domain.Flavor; import org.jclouds.openstack.nova.v2_0.domain.Server; @@ -34,7 +33,6 @@ import org.jclouds.openstack.nova.v2_0.features.FlavorApi; import org.jclouds.openstack.nova.v2_0.features.ImageApi; import org.jclouds.openstack.nova.v2_0.features.ServerApi; import org.jclouds.openstack.v2_0.domain.Resource; -import org.jclouds.rest.RestContext; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -49,7 +47,7 @@ import com.google.common.collect.Ordering; * @author Adrian Cole */ @Test(groups = "live") -public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest { +public class BaseNovaApiLiveTest extends BaseApiLiveTest { protected String hostName = System.getProperty("user.name").replace('.','-').toLowerCase(); public BaseNovaApiLiveTest() { @@ -57,16 +55,14 @@ public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest { } protected Set zones; - protected RestContext novaContext; @BeforeClass(groups = { "integration", "live" }) @Override - public void setupContext() { - super.setupContext(); - novaContext = view.unwrap(); - zones = novaContext.getApi().getConfiguredZones(); + public void setup() { + super.setup(); + zones = api.getConfiguredZones(); for (String zone : zones){ - ServerApi api = novaContext.getApi().getServerApiForZone(zone); + ServerApi api = this.api.getServerApiForZone(zone); for (Resource server : api.list().concat()){ if (server.getName().equals(hostName)) api.delete(server.getId()); @@ -83,7 +79,7 @@ public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest { } protected Server createServerInZone(String zoneId) { - ServerApi serverApi = novaContext.getApi().getServerApiForZone(zoneId); + ServerApi serverApi = api.getServerApiForZone(zoneId); ServerCreated server = serverApi.create(hostName, imageIdForZone(zoneId), flavorRefForZone(zoneId)); blockUntilServerInState(server.getId(), serverApi, Status.ACTIVE); return serverApi.get(server.getId()); @@ -108,12 +104,12 @@ public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest { } protected String imageIdForZone(String zoneId) { - ImageApi imageApi = novaContext.getApi().getImageApiForZone(zoneId); + ImageApi imageApi = api.getImageApiForZone(zoneId); return Iterables.getLast(imageApi.list().concat()).getId(); } protected String flavorRefForZone(String zoneId) { - FlavorApi flavorApi = novaContext.getApi().getFlavorApiForZone(zoneId); + FlavorApi flavorApi = api.getFlavorApiForZone(zoneId); return DEFAULT_FLAVOR_ORDERING.min(flavorApi.listInDetail().concat()).getId(); } diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/AccessRuleApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/AccessRuleApiLiveTest.java index 05fc96d8d1..8e59f6682a 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/AccessRuleApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/AccessRuleApiLiveTest.java @@ -56,8 +56,8 @@ public class AccessRuleApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { @Override @BeforeGroups(groups = { "live" }) - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); accessRule1 = AccessRule.deny("206.160.163.21"); accessRule2 = AccessRule.deny("206.160.165.11"); @@ -76,57 +76,57 @@ public class AccessRuleApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { CreateLoadBalancer createLB = CreateLoadBalancer.builder() .name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build(); - zone = "ORD";//Iterables.getFirst(clbApi.getConfiguredZones(), null); - lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB); + zone = "ORD";//Iterables.getFirst(api.getConfiguredZones(), null); + lb = api.getLoadBalancerApiForZone(zone).create(createLB); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); } @Test(dependsOnMethods = "testCreateLoadBalancer") public void testCreateAccessList() throws Exception { - clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).create(accessRules.values()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).create(accessRules.values()); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); assertExpectedAccessRules(accessRules); } @Test(dependsOnMethods = "testCreateAccessList") public void testRemoveSingleAccessRule() throws Exception { - Iterable actualAccessList = clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list(); + Iterable actualAccessList = api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list(); AccessRuleWithId removedAccessRule = Iterables.getFirst(actualAccessList, null); accessRules.remove(removedAccessRule.getAddress()); - assertTrue(clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedAccessRule.getId())); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedAccessRule.getId())); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); assertExpectedAccessRules(accessRules); } @Test(dependsOnMethods = "testRemoveSingleAccessRule") public void testRemoveManyAccessRules() throws Exception { - Iterable actualAccessList = clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list(); + Iterable actualAccessList = api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list(); AccessRuleWithId removedAccessRule1 = Iterables.getFirst(actualAccessList, null); AccessRuleWithId removedAccessRule2 = Iterables.getLast(actualAccessList); List removedAccessRuleIds = ImmutableList. of(removedAccessRule1.getId(), removedAccessRule2.getId()); accessRules.remove(removedAccessRule1.getAddress()); accessRules.remove(removedAccessRule2.getAddress()); - assertTrue(clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedAccessRuleIds)); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedAccessRuleIds)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); assertExpectedAccessRules(accessRules); } @Test(dependsOnMethods = "testRemoveManyAccessRules") public void testRemoveAllAccessRules() throws Exception { - assertTrue(clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).deleteAll()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).deleteAll()); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); assertExpectedAccessRules(new HashMap()); } private void assertExpectedAccessRules(Map expectedAccessList) { - Iterable actualAccessList = clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list(); + Iterable actualAccessList = api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list(); for (AccessRule actualAccessRule: actualAccessList) { assertEquals(expectedAccessList.containsKey(actualAccessRule.getAddress()), true, @@ -136,10 +136,10 @@ public class AccessRuleApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { @Override @AfterGroups(groups = "live") - protected void tearDownContext() { - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId()); - assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - super.tearDownContext(); + protected void tearDown() { + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getLoadBalancerApiForZone(zone).delete(lb.getId()); + assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb)); + super.tearDown(); } } diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ConnectionApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ConnectionApiLiveTest.java index a12c403fce..bfe583b740 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ConnectionApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ConnectionApiLiveTest.java @@ -49,63 +49,63 @@ public class ConnectionApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { CreateLoadBalancer createLB = CreateLoadBalancer.builder() .name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build(); - zone = Iterables.getFirst(clbApi.getConfiguredZones(), null); - lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB); + zone = Iterables.getFirst(api.getConfiguredZones(), null); + lb = api.getLoadBalancerApiForZone(zone).create(createLB); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); } @Test(dependsOnMethods = "testCreateLoadBalancer") public void testCreateAndGetConnectionThrottling() throws Exception { - clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdateConnectionThrottle( + api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdateConnectionThrottle( ConnectionApiExpectTest.getConnectionThrottle()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); ConnectionThrottle connectionThrottle = - clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).getConnectionThrottle(); + api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).getConnectionThrottle(); assertEquals(connectionThrottle, ConnectionApiExpectTest.getConnectionThrottle()); } @Test(dependsOnMethods = "testCreateAndGetConnectionThrottling") public void testRemoveAndGetConnectionThrottle() throws Exception { - assertTrue(clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).deleteConnectionThrottle()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).deleteConnectionThrottle()); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); ConnectionThrottle connectionThrottle = - clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).getConnectionThrottle(); + api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).getConnectionThrottle(); assertNull(connectionThrottle); } @Test(dependsOnMethods = "testRemoveAndGetConnectionThrottle") public void testEnableAndIsConnectionLogging() throws Exception { - clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).enableConnectionLogging(); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).enableConnectionLogging(); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); boolean isConnectionLogging = - clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).isConnectionLogging(); + api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).isConnectionLogging(); assertTrue(isConnectionLogging); } @Test(dependsOnMethods = "testEnableAndIsConnectionLogging") public void testDisableAndIsConnectionLogging() throws Exception { - clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).disableConnectionLogging(); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).disableConnectionLogging(); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); boolean isConnectionLogging = - clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).isConnectionLogging(); + api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).isConnectionLogging(); assertFalse(isConnectionLogging); } @Override @AfterGroups(groups = "live") - protected void tearDownContext() { - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId()); - assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - super.tearDownContext(); + protected void tearDown() { + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getLoadBalancerApiForZone(zone).delete(lb.getId()); + assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb)); + super.tearDown(); } } diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ContentCachingApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ContentCachingApiLiveTest.java index 84b1cdda9c..ec89a10ce9 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ContentCachingApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ContentCachingApiLiveTest.java @@ -46,40 +46,40 @@ public class ContentCachingApiLiveTest extends BaseCloudLoadBalancersApiLiveTest CreateLoadBalancer createLB = CreateLoadBalancer.builder() .name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build(); - zone = Iterables.getFirst(clbApi.getConfiguredZones(), null); - lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB); + zone = Iterables.getFirst(api.getConfiguredZones(), null); + lb = api.getLoadBalancerApiForZone(zone).create(createLB); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); } @Test(dependsOnMethods = "testCreateLoadBalancer") public void testEnableAndIsContentCaching() throws Exception { - clbApi.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).enable(); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).enable(); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); boolean isContentCaching = - clbApi.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).isContentCaching(); + api.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).isContentCaching(); assertTrue(isContentCaching); } @Test(dependsOnMethods = "testEnableAndIsContentCaching") public void testDisableAndIsContentCaching() throws Exception { - clbApi.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).disable(); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).disable(); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); boolean isContentCaching = - clbApi.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).isContentCaching(); + api.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).isContentCaching(); assertFalse(isContentCaching); } @Override @AfterGroups(groups = "live") - protected void tearDownContext() { - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId()); - assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - super.tearDownContext(); + protected void tearDown() { + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getLoadBalancerApiForZone(zone).delete(lb.getId()); + assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb)); + super.tearDown(); } } diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ErrorPageApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ErrorPageApiLiveTest.java index 6aa8b5afff..fd0a91006c 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ErrorPageApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ErrorPageApiLiveTest.java @@ -46,8 +46,8 @@ public class ErrorPageApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { @Override @BeforeGroups(groups = { "live" }) - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); contentExpected = ErrorPageApiExpectTest.getContentExpected(); contentEscaped = ErrorPageApiExpectTest.getContentEscaped(); @@ -58,38 +58,38 @@ public class ErrorPageApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { CreateLoadBalancer createLB = CreateLoadBalancer.builder() .name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build(); - zone = Iterables.getFirst(clbApi.getConfiguredZones(), null); - lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB); + zone = Iterables.getFirst(api.getConfiguredZones(), null); + lb = api.getLoadBalancerApiForZone(zone).create(createLB); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); } @Test(dependsOnMethods = "testCreateLoadBalancer") public void testCreateAndGetErrorPage() throws Exception { - clbApi.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).create(contentEscaped); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).create(contentEscaped); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); - String content = clbApi.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).get(); + String content = api.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).get(); assertEquals(content, contentExpected); } @Test(dependsOnMethods = "testCreateAndGetErrorPage") public void testRemoveAndGetErrorPage() throws Exception { - assertTrue(clbApi.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).delete()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(api.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).delete()); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); - String content = clbApi.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).get(); + String content = api.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).get(); assertTrue(content.contains("Service Unavailable")); } @Override @AfterGroups(groups = "live") - protected void tearDownContext() { - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId()); - assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - super.tearDownContext(); + protected void tearDown() { + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getLoadBalancerApiForZone(zone).delete(lb.getId()); + assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb)); + super.tearDown(); } } diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/HealthMonitorApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/HealthMonitorApiLiveTest.java index 9cc1ac7be6..0e92ef98c2 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/HealthMonitorApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/HealthMonitorApiLiveTest.java @@ -48,41 +48,41 @@ public class HealthMonitorApiLiveTest extends BaseCloudLoadBalancersApiLiveTest CreateLoadBalancer createLB = CreateLoadBalancer.builder() .name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build(); - zone = Iterables.getFirst(clbApi.getConfiguredZones(), null); - lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB); + zone = Iterables.getFirst(api.getConfiguredZones(), null); + lb = api.getLoadBalancerApiForZone(zone).create(createLB); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); } @Test(dependsOnMethods = "testCreateLoadBalancer") public void testCreateAndGetHealthMonitor() throws Exception { - clbApi.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdate( + api.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdate( HealthMonitorApiExpectTest.getConnectHealthMonitor()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); HealthMonitor healthMonitor = - clbApi.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).get(); + api.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).get(); assertEquals(healthMonitor, HealthMonitorApiExpectTest.getConnectHealthMonitor()); } @Test(dependsOnMethods = "testCreateAndGetHealthMonitor") public void testRemoveAndGetHealthMonitor() throws Exception { - assertTrue(clbApi.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).delete()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(api.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).delete()); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); HealthMonitor healthMonitor = - clbApi.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).get(); + api.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).get(); assertNull(healthMonitor); } @Override @AfterGroups(groups = "live") - protected void tearDownContext() { - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId()); - assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - super.tearDownContext(); + protected void tearDown() { + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getLoadBalancerApiForZone(zone).delete(lb.getId()); + assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb)); + super.tearDown(); } } diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/LoadBalancerApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/LoadBalancerApiLiveTest.java index 0b3a58fbd0..89b7c31732 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/LoadBalancerApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/LoadBalancerApiLiveTest.java @@ -53,20 +53,20 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { @Override @AfterGroups(groups = "live") - protected void tearDownContext() { + protected void tearDown() { for (LoadBalancer lb: lbs) { - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); - clbApi.getLoadBalancerApiForZone(lb.getRegion()).delete(lb.getId()); - assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + api.getLoadBalancerApiForZone(lb.getRegion()).delete(lb.getId()); + assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); } - super.tearDownContext(); + super.tearDown(); } public void testCreateLoadBalancer() throws Exception { - for (String zone: clbApi.getConfiguredZones()) { + for (String zone: api.getConfiguredZones()) { Logger.getAnonymousLogger().info("starting lb in region " + zone); - LoadBalancer lb = clbApi.getLoadBalancerApiForZone(zone).create( + LoadBalancer lb = api.getLoadBalancerApiForZone(zone).create( CreateLoadBalancer.builder() .name(prefix + "-" + zone) .protocol("HTTP") @@ -83,9 +83,9 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { lbs.add(lb); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); - LoadBalancer newLb = clbApi.getLoadBalancerApiForZone(zone).get(lb.getId()); + LoadBalancer newLb = api.getLoadBalancerApiForZone(zone).get(lb.getId()); checkLBInRegion(zone, newLb, prefix + "-" + zone); assertEquals(newLb.getStatus(), LoadBalancer.Status.ACTIVE); @@ -95,12 +95,12 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { @Test(dependsOnMethods = "testCreateLoadBalancer") public void testUpdateLoadBalancer() throws Exception { for (LoadBalancer lb: lbs) { - clbApi.getLoadBalancerApiForZone(lb.getRegion()).update(lb.getId(), + api.getLoadBalancerApiForZone(lb.getRegion()).update(lb.getId(), UpdateLoadBalancer.builder().name("foo" + "-" + lb.getRegion()).build()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); - LoadBalancer newLb = clbApi.getLoadBalancerApiForZone(lb.getRegion()).get(lb.getId()); + LoadBalancer newLb = api.getLoadBalancerApiForZone(lb.getRegion()).get(lb.getId()); checkLBInRegion(newLb.getRegion(), newLb, "foo" + "-" + lb.getRegion()); assertEquals(newLb.getStatus(), LoadBalancer.Status.ACTIVE); @@ -109,9 +109,9 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { @Test(dependsOnMethods = "testUpdateLoadBalancer") public void testListLoadBalancers() throws Exception { - for (String zone: clbApi.getConfiguredZones()) { + for (String zone: api.getConfiguredZones()) { - Set response = clbApi.getLoadBalancerApiForZone(zone).list().concat().toSet(); + Set response = api.getLoadBalancerApiForZone(zone).list().concat().toSet(); assertNotNull(response); assertTrue(response.size() >= 0); @@ -131,7 +131,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { // node info not available during list; assert lb.getNodes().size() == 0 : lb; - LoadBalancer getDetails = clbApi.getLoadBalancerApiForZone(zone).get(lb.getId()); + LoadBalancer getDetails = api.getLoadBalancerApiForZone(zone).get(lb.getId()); try { assertEquals(getDetails.getRegion(), lb.getRegion()); @@ -160,27 +160,27 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { "key2", "value2", "key3", "value3"); - Metadata metadata = clbApi.getLoadBalancerApiForZone(lb.getRegion()).createMetadata(lb.getId(), metadataMap); + Metadata metadata = api.getLoadBalancerApiForZone(lb.getRegion()).createMetadata(lb.getId(), metadataMap); assertEquals(metadata, getExpectedMetadata()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); - metadata = clbApi.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId()); + metadata = api.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId()); assertEquals(metadata, getExpectedMetadata()); - assertTrue(clbApi.getLoadBalancerApiForZone(lb.getRegion()).updateMetadatum(lb.getId(), metadata.getId("key1"), "key1-updated")); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); - metadata = clbApi.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId()); + assertTrue(api.getLoadBalancerApiForZone(lb.getRegion()).updateMetadatum(lb.getId(), metadata.getId("key1"), "key1-updated")); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + metadata = api.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId()); assertEquals(metadata.get("key1"), "key1-updated"); - assertTrue(clbApi.getLoadBalancerApiForZone(lb.getRegion()).deleteMetadatum(lb.getId(), metadata.getId("key1"))); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); - metadata = clbApi.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId()); + assertTrue(api.getLoadBalancerApiForZone(lb.getRegion()).deleteMetadatum(lb.getId(), metadata.getId("key1"))); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + metadata = api.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId()); assertNull(metadata.get("key1")); - assertTrue(clbApi.getLoadBalancerApiForZone(lb.getRegion()).deleteMetadata(lb.getId(), + assertTrue(api.getLoadBalancerApiForZone(lb.getRegion()).deleteMetadata(lb.getId(), ImmutableList. of(metadata.getId("key2"), metadata.getId("key3")))); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); - metadata = clbApi.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId()); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + metadata = api.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId()); assertEquals(metadata.size(), 0); } } diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/NodeApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/NodeApiLiveTest.java index b3fb63a20b..4fcd11697c 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/NodeApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/NodeApiLiveTest.java @@ -57,16 +57,16 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { private Map> nodes = Maps.newHashMap(); public void testCreateLoadBalancers() { - assertTrue(clbApi.getConfiguredZones().size() > 0, "Need to have some zones!"); - Logger.getAnonymousLogger().info("running against zones " + clbApi.getConfiguredZones()); - for (String zone : clbApi.getConfiguredZones()) { + assertTrue(api.getConfiguredZones().size() > 0, "Need to have some zones!"); + Logger.getAnonymousLogger().info("running against zones " + api.getConfiguredZones()); + for (String zone : api.getConfiguredZones()) { Logger.getAnonymousLogger().info("starting lb in zone " + zone); - LoadBalancer lb = clbApi.getLoadBalancerApiForZone(zone).create( + LoadBalancer lb = api.getLoadBalancerApiForZone(zone).create( CreateLoadBalancer.builder().name(prefix + "-" + zone).protocol("HTTP").port(80).virtualIPType( Type.PUBLIC).node(AddNode.builder().address("192.168.1.1").port(8080).build()).build()); nodes.put(lb, new HashSet()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); } } @@ -77,17 +77,17 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { Set nodeSet = entry.getValue(); String region = lb.getRegion(); Logger.getAnonymousLogger().info("starting node on loadbalancer " + lb.getId() + " in region " + region); - Set newNodes = clbApi.getNodeApiForZoneAndLoadBalancer(region, lb.getId()).add( + Set newNodes = api.getNodeApiForZoneAndLoadBalancer(region, lb.getId()).add( ImmutableSet. of(AddNode.builder().address("192.168.1.2").port(8080).build())); for (Node n : newNodes) { assertEquals(n.getStatus(), Node.Status.ONLINE); nodeSet.add(n); - assertEquals(clbApi.getNodeApiForZoneAndLoadBalancer(region, lb.getId()).get(n.getId()).getStatus(), + assertEquals(api.getNodeApiForZoneAndLoadBalancer(region, lb.getId()).get(n.getId()).getStatus(), Node.Status.ONLINE); } - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); } } @@ -96,12 +96,12 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { for (Entry> entry : nodes.entrySet()) { for (Node n : entry.getValue()) { String region = entry.getKey().getRegion(); - clbApi.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).update(n.getId(), + api.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).update(n.getId(), UpdateNode.builder().weight(23).build()); - assertEquals(clbApi.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).get(n.getId()) + assertEquals(api.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).get(n.getId()) .getStatus(), Node.Status.ONLINE); - Node newNode = clbApi.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).get(n.getId()); + Node newNode = api.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).get(n.getId()); assertEquals(newNode.getStatus(), Node.Status.ONLINE); assertEquals(newNode.getWeight(), (Integer) 23); } @@ -111,7 +111,7 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { @Test(dependsOnMethods = "testModifyNode") public void testListNodes() throws Exception { for (LoadBalancer lb : nodes.keySet()) { - Set response = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).list().concat().toSet(); + Set response = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).list().concat().toSet(); assert null != response; assertTrue(response.size() >= 0); for (Node n : response) { @@ -123,7 +123,7 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { assert !Arrays.asList(LoadBalancer.WEIGHTED_ALGORITHMS).contains(lb.getAlgorithm()) || n.getWeight() != null : n; - Node getDetails = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).get(n.getId()); + Node getDetails = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).get(n.getId()); try { assertEquals(getDetails.getId(), n.getId()); @@ -151,45 +151,45 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { "key2", "value2", "key3", "value3"); - Metadata metadata = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).createMetadata(node.getId(), metadataMap); + Metadata metadata = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).createMetadata(node.getId(), metadataMap); assertEquals(metadata, getExpectedMetadata()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); - metadata = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId()); + metadata = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId()); assertEquals(metadata, getExpectedMetadata()); - assertTrue(clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).updateMetadatum(node.getId(), metadata.getId("key1"), "key1-updated")); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); - metadata = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId()); + assertTrue(api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).updateMetadatum(node.getId(), metadata.getId("key1"), "key1-updated")); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + metadata = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId()); assertEquals(metadata.get("key1"), "key1-updated"); - assertTrue(clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).deleteMetadatum(node.getId(), metadata.getId("key1"))); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); - metadata = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId()); + assertTrue(api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).deleteMetadatum(node.getId(), metadata.getId("key1"))); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + metadata = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId()); assertNull(metadata.get("key1")); - assertTrue(clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).deleteMetadata(node.getId(), + assertTrue(api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).deleteMetadata(node.getId(), ImmutableList. of(metadata.getId("key2"), metadata.getId("key3")))); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); - metadata = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId()); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + metadata = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId()); assertEquals(metadata.size(), 0); } } @Override @AfterGroups(groups = "live") - protected void tearDownContext() { + protected void tearDown() { for (Entry> entry : nodes.entrySet()) { LoadBalancer lb = entry.getKey(); - LoadBalancerApi lbClient = clbApi.getLoadBalancerApiForZone(lb.getRegion()); + LoadBalancerApi lbClient = api.getLoadBalancerApiForZone(lb.getRegion()); if (lbClient.get(lb.getId()).getStatus() != Status.DELETED) { - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); lbClient.delete(lb.getId()); } - assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); + assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb)); } - super.tearDownContext(); + super.tearDown(); } private Metadata getExpectedMetadata() { diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ReportApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ReportApiLiveTest.java index d2d8537cfc..68215c559d 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ReportApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/ReportApiLiveTest.java @@ -56,10 +56,10 @@ public class ReportApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { CreateLoadBalancer createLB = CreateLoadBalancer.builder() .name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build(); - zone = Iterables.getFirst(clbApi.getConfiguredZones(), null); - lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB); + zone = Iterables.getFirst(api.getConfiguredZones(), null); + lb = api.getLoadBalancerApiForZone(zone).create(createLB); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); } @Test(dependsOnMethods = "testCreateLoadBalancer") @@ -69,20 +69,20 @@ public class ReportApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { Date yesterday = calendar.getTime(); Date today = new Date(); - FluentIterable loadBalancers = clbApi.getReportApiForZone(zone).listBillableLoadBalancers(yesterday, today).concat(); + FluentIterable loadBalancers = api.getReportApiForZone(zone).listBillableLoadBalancers(yesterday, today).concat(); assertNotNull(loadBalancers); - HistoricalUsage historicalUsage = clbApi.getReportApiForZone(zone).getHistoricalUsage(yesterday, today); + HistoricalUsage historicalUsage = api.getReportApiForZone(zone).getHistoricalUsage(yesterday, today); assertNotEquals(historicalUsage.getAccountId(), 0); - FluentIterable loadBalancerUsages = clbApi.getReportApiForZone(zone).listLoadBalancerUsage(lb.getId(), yesterday, today).concat(); + FluentIterable loadBalancerUsages = api.getReportApiForZone(zone).listLoadBalancerUsage(lb.getId(), yesterday, today).concat(); assertNotNull(loadBalancerUsages); - loadBalancerUsages = clbApi.getReportApiForZone(zone).listCurrentLoadBalancerUsage(lb.getId()).concat(); + loadBalancerUsages = api.getReportApiForZone(zone).listCurrentLoadBalancerUsage(lb.getId()).concat(); assertNotNull(loadBalancerUsages); try { - LoadBalancerStats loadBalancerStats = clbApi.getReportApiForZone(zone).getLoadBalancerStats(lb.getId()); + LoadBalancerStats loadBalancerStats = api.getReportApiForZone(zone).getLoadBalancerStats(lb.getId()); assertNotNull(loadBalancerStats); } catch (HttpResponseException e) { @@ -92,19 +92,19 @@ public class ReportApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { } } - Iterable protocols = clbApi.getReportApiForZone(zone).listProtocols(); + Iterable protocols = api.getReportApiForZone(zone).listProtocols(); assertTrue(!Iterables.isEmpty(protocols)); - Iterable algorithms = clbApi.getReportApiForZone(zone).listAlgorithms(); + Iterable algorithms = api.getReportApiForZone(zone).listAlgorithms(); assertTrue(!Iterables.isEmpty(algorithms)); } @Override @AfterGroups(groups = "live") - protected void tearDownContext() { - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId()); - assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - super.tearDownContext(); + protected void tearDown() { + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getLoadBalancerApiForZone(zone).delete(lb.getId()); + assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb)); + super.tearDown(); } } diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/SSLTerminationApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/SSLTerminationApiLiveTest.java index aa7c8a393b..0291d788d3 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/SSLTerminationApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/SSLTerminationApiLiveTest.java @@ -48,41 +48,41 @@ public class SSLTerminationApiLiveTest extends BaseCloudLoadBalancersApiLiveTest CreateLoadBalancer createLB = CreateLoadBalancer.builder() .name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build(); - zone = Iterables.getFirst(clbApi.getConfiguredZones(), null); - lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB); + zone = Iterables.getFirst(api.getConfiguredZones(), null); + lb = api.getLoadBalancerApiForZone(zone).create(createLB); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); } @Test(dependsOnMethods = "testCreateLoadBalancer") public void testCreateAndGetSSLTermination() throws Exception { - clbApi.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdate( + api.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdate( SSLTerminationApiExpectTest.getSSLTermination()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); SSLTermination sslTermination = - clbApi.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).get(); + api.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).get(); assertEquals(sslTermination, SSLTerminationApiExpectTest.getSSLTermination()); } @Test(dependsOnMethods = "testCreateAndGetSSLTermination") public void testRemoveAndGetSSLTermination() throws Exception { - assertTrue(clbApi.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).delete()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(api.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).delete()); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); SSLTermination sslTermination = - clbApi.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).get(); + api.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).get(); assertNull(sslTermination); } @Override @AfterGroups(groups = "live") - protected void tearDownContext() { - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId()); - assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - super.tearDownContext(); + protected void tearDown() { + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getLoadBalancerApiForZone(zone).delete(lb.getId()); + assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb)); + super.tearDown(); } } diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/SessionPersistenceApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/SessionPersistenceApiLiveTest.java index 96a1db6a2a..f2352a65f2 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/SessionPersistenceApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/SessionPersistenceApiLiveTest.java @@ -48,40 +48,40 @@ public class SessionPersistenceApiLiveTest extends BaseCloudLoadBalancersApiLive CreateLoadBalancer createLB = CreateLoadBalancer.builder() .name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build(); - zone = Iterables.getFirst(clbApi.getConfiguredZones(), null); - lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB); + zone = Iterables.getFirst(api.getConfiguredZones(), null); + lb = api.getLoadBalancerApiForZone(zone).create(createLB); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); } @Test(dependsOnMethods = "testCreateLoadBalancer") public void testCreateAndGetSessionPersistence() throws Exception { - clbApi.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).create(SessionPersistence.HTTP_COOKIE); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).create(SessionPersistence.HTTP_COOKIE); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); SessionPersistence sessionPersistence = - clbApi.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).get(); + api.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).get(); assertEquals(sessionPersistence, SessionPersistence.HTTP_COOKIE); } @Test(dependsOnMethods = "testCreateAndGetSessionPersistence") public void testRemoveAndGetSessionPersistence() throws Exception { - clbApi.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).delete(); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).delete(); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); SessionPersistence sessionPersistence = - clbApi.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).get(); + api.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).get(); assertNull(sessionPersistence); } @Override @AfterGroups(groups = "live") - protected void tearDownContext() { - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId()); - assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - super.tearDownContext(); + protected void tearDown() { + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getLoadBalancerApiForZone(zone).delete(lb.getId()); + assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb)); + super.tearDown(); } } diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/VirtualIPApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/VirtualIPApiLiveTest.java index e4854c387f..dc3a533567 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/VirtualIPApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/VirtualIPApiLiveTest.java @@ -52,60 +52,60 @@ public class VirtualIPApiLiveTest extends BaseCloudLoadBalancersApiLiveTest { CreateLoadBalancer createLB = CreateLoadBalancer.builder() .name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build(); - zone = Iterables.getFirst(clbApi.getConfiguredZones(), null); - lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB); + zone = Iterables.getFirst(api.getConfiguredZones(), null); + lb = api.getLoadBalancerApiForZone(zone).create(createLB); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); } @Test(dependsOnMethods = "testCreateLoadBalancer") public void testCreateVirtualIPs() throws Exception { - clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6()); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6()); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6()); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6()); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); - Iterable actualVirtualIPs = clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list(); + Iterable actualVirtualIPs = api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list(); assertEquals(Iterators.size(actualVirtualIPs.iterator()), 5); } @Test(dependsOnMethods = "testCreateVirtualIPs") public void testRemoveSingleVirtualIP() throws Exception { - Iterable actualVirtualIPs = clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list(); + Iterable actualVirtualIPs = api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list(); VirtualIPWithId removedVirtualIP = Iterables.getFirst(actualVirtualIPs, null); - assertTrue(clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedVirtualIP.getId())); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedVirtualIP.getId())); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); - actualVirtualIPs = clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list(); + actualVirtualIPs = api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list(); assertEquals(Iterators.size(actualVirtualIPs.iterator()), 4); } @Test(dependsOnMethods = "testRemoveSingleVirtualIP") public void testRemoveManyVirtualIPs() throws Exception { - Iterable actualVirtualIPs = clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list(); + Iterable actualVirtualIPs = api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list(); VirtualIPWithId removedVirtualIP1 = Iterables.getFirst(actualVirtualIPs, null); VirtualIPWithId removedVirtualIP2 = Iterables.getLast(actualVirtualIPs); List removedVirtualIPIds = ImmutableList. of(removedVirtualIP1.getId(), removedVirtualIP2.getId()); - assertTrue(clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedVirtualIPIds)); - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); + assertTrue(api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedVirtualIPIds)); + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); - actualVirtualIPs = clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list(); + actualVirtualIPs = api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list(); assertEquals(Iterators.size(actualVirtualIPs.iterator()), 2); } @Override @AfterGroups(groups = "live") - protected void tearDownContext() { - assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId()); - assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb)); - super.tearDownContext(); + protected void tearDown() { + assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); + api.getLoadBalancerApiForZone(zone).delete(lb.getId()); + assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb)); + super.tearDown(); } } diff --git a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/internal/BaseCloudLoadBalancersApiLiveTest.java b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/internal/BaseCloudLoadBalancersApiLiveTest.java index 0534ce3426..58a3211680 100644 --- a/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/internal/BaseCloudLoadBalancersApiLiveTest.java +++ b/apis/rackspace-cloudloadbalancers/src/test/java/org/jclouds/rackspace/cloudloadbalancers/v1/internal/BaseCloudLoadBalancersApiLiveTest.java @@ -21,22 +21,16 @@ package org.jclouds.rackspace.cloudloadbalancers.v1.internal; import java.util.Properties; import java.util.logging.Logger; -import org.jclouds.apis.BaseContextLiveTest; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApi; -import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApiMetadata; -import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersAsyncApi; -import org.jclouds.rest.RestContext; import org.testng.annotations.BeforeGroups; -import com.google.common.reflect.TypeToken; - /** * * @author Adrian Cole */ -public class BaseCloudLoadBalancersApiLiveTest extends BaseContextLiveTest> { - protected CloudLoadBalancersApi clbApi; +public class BaseCloudLoadBalancersApiLiveTest extends BaseApiLiveTest { public BaseCloudLoadBalancersApiLiveTest() { provider = "rackspace-cloudloadbalancers"; @@ -44,12 +38,9 @@ public class BaseCloudLoadBalancersApiLiveTest extends BaseContextLiveTest> contextType() { - return CloudLoadBalancersApiMetadata.CONTEXT_TOKEN; - } } diff --git a/apis/route53/src/test/java/org/jclouds/route53/Route53ApiLiveTest.java b/apis/route53/src/test/java/org/jclouds/route53/Route53ApiLiveTest.java index 65d0ffb6ea..ca12c03565 100644 --- a/apis/route53/src/test/java/org/jclouds/route53/Route53ApiLiveTest.java +++ b/apis/route53/src/test/java/org/jclouds/route53/Route53ApiLiveTest.java @@ -31,10 +31,6 @@ public class Route53ApiLiveTest extends BaseRoute53ApiLiveTest { @Test protected void testGetChangeReturnsNullOnNotFound() { - assertNull(api().getChange("FOOOBAR")); - } - - protected Route53Api api() { - return context.getApi(); + assertNull(api.getChange("FOOOBAR")); } } diff --git a/apis/route53/src/test/java/org/jclouds/route53/features/HostedZoneApiLiveTest.java b/apis/route53/src/test/java/org/jclouds/route53/features/HostedZoneApiLiveTest.java index 822bcf61b9..644071bc45 100644 --- a/apis/route53/src/test/java/org/jclouds/route53/features/HostedZoneApiLiveTest.java +++ b/apis/route53/src/test/java/org/jclouds/route53/features/HostedZoneApiLiveTest.java @@ -95,6 +95,6 @@ public class HostedZoneApiLiveTest extends BaseRoute53ApiLiveTest { } protected HostedZoneApi api() { - return context.getApi().getHostedZoneApi(); + return api.getHostedZoneApi(); } } diff --git a/apis/route53/src/test/java/org/jclouds/route53/features/ResourceRecordSetApiLiveTest.java b/apis/route53/src/test/java/org/jclouds/route53/features/ResourceRecordSetApiLiveTest.java index bbcfc8d79a..b6bf3fefa0 100644 --- a/apis/route53/src/test/java/org/jclouds/route53/features/ResourceRecordSetApiLiveTest.java +++ b/apis/route53/src/test/java/org/jclouds/route53/features/ResourceRecordSetApiLiveTest.java @@ -94,7 +94,7 @@ public class ResourceRecordSetApiLiveTest extends BaseRoute53ApiLiveTest { } private void checkAllRRs(String zoneId) { - HostedZone zone = context.getApi().getHostedZoneApi().get(zoneId).getZone(); + HostedZone zone = api.getHostedZoneApi().get(zoneId).getZone(); List records = api(zone.getId()).list().concat().toList(); assertEquals(zone.getResourceRecordSetCount(), records.size()); @@ -171,7 +171,7 @@ public class ResourceRecordSetApiLiveTest extends BaseRoute53ApiLiveTest { clearAndDeleteHostedZonesNamed(name); String nonce = name + " @ " + new Date(); String comment = name + " for " + JcloudsVersion.get(); - NewHostedZone newHostedZone = context.getApi().getHostedZoneApi() + NewHostedZone newHostedZone = api.getHostedZoneApi() .createWithReferenceAndComment(name, nonce, comment); getAnonymousLogger().info("created zone: " + newHostedZone); assertTrue(inSync.apply(newHostedZone.getChange()), "zone didn't sync " + newHostedZone); @@ -191,12 +191,12 @@ public class ResourceRecordSetApiLiveTest extends BaseRoute53ApiLiveTest { } private void clearAndDeleteHostedZonesNamed(String name) { - for (HostedZone zone : context.getApi().getHostedZoneApi().list().concat().filter(nameEquals(name))) { + for (HostedZone zone : api.getHostedZoneApi().list().concat().filter(nameEquals(name))) { getAnonymousLogger().info("clearing and deleting zone: " + zone); Set remaining = refresh(zone.getId()).concat().filter(not(requiredRRTypes)).toSet(); if (!remaining.isEmpty()) sync(api(zone.getId()).apply(deleteAll(remaining))); - sync(context.getApi().getHostedZoneApi().delete(zone.getId())); + sync(api.getHostedZoneApi().delete(zone.getId())); } } @@ -209,13 +209,13 @@ public class ResourceRecordSetApiLiveTest extends BaseRoute53ApiLiveTest { } private PagedIterable zones() { - PagedIterable zones = context.getApi().getHostedZoneApi().list(); + PagedIterable zones = api.getHostedZoneApi().list(); if (zones.get(0).isEmpty()) - throw new SkipException("no zones in context: " + context); + throw new SkipException("no zones in context: " + identity); return zones; } private ResourceRecordSetApi api(String zoneId) { - return context.getApi().getResourceRecordSetApiForHostedZone(zoneId); + return api.getResourceRecordSetApiForHostedZone(zoneId); } } diff --git a/apis/route53/src/test/java/org/jclouds/route53/internal/BaseRoute53ApiLiveTest.java b/apis/route53/src/test/java/org/jclouds/route53/internal/BaseRoute53ApiLiveTest.java index 9deebc1e87..d26a64ae3d 100644 --- a/apis/route53/src/test/java/org/jclouds/route53/internal/BaseRoute53ApiLiveTest.java +++ b/apis/route53/src/test/java/org/jclouds/route53/internal/BaseRoute53ApiLiveTest.java @@ -22,25 +22,20 @@ import static java.util.concurrent.TimeUnit.SECONDS; import static org.jclouds.route53.domain.Change.Status.INSYNC; import static org.jclouds.util.Predicates2.retry; -import org.jclouds.apis.BaseContextLiveTest; -import org.jclouds.route53.Route53ApiMetadata; -import org.jclouds.route53.Route53AsyncApi; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.route53.Route53Api; import org.jclouds.route53.domain.Change; -import org.jclouds.rest.RestContext; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Predicate; -import com.google.common.reflect.TypeToken; /** * * @author Adrian Cole */ @Test(groups = "live") -public class BaseRoute53ApiLiveTest extends - BaseContextLiveTest> { +public class BaseRoute53ApiLiveTest extends BaseApiLiveTest { public BaseRoute53ApiLiveTest() { provider = "route53"; @@ -50,17 +45,12 @@ public class BaseRoute53ApiLiveTest extends @BeforeClass(groups = "live") @Override - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); inSync = retry(new Predicate() { public boolean apply(Change input) { - return context.getApi().getChange(input.getId()).getStatus() == INSYNC; + return api.getChange(input.getId()).getStatus() == INSYNC; } }, 600, 1, 5, SECONDS); } - - @Override - protected TypeToken> contextType() { - return Route53ApiMetadata.CONTEXT_TOKEN; - } } diff --git a/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java b/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java index 49633c4a2f..81ef01db17 100644 --- a/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java +++ b/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java @@ -34,7 +34,6 @@ import java.util.Set; import org.jclouds.ContextBuilder; import org.jclouds.concurrent.config.ExecutorServiceModule; -import org.jclouds.rest.RestContext; import org.jclouds.s3.domain.S3Object; import org.testng.annotations.Test; @@ -55,7 +54,7 @@ public class S3ClientMockTest { private static final Set modules = ImmutableSet. of( new ExecutorServiceModule(sameThreadExecutor(), sameThreadExecutor())); - static RestContext getContext(URL server) { + static S3Client getS3Client(URL server) { Properties overrides = new Properties(); overrides.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "false"); // prevent expect-100 bug http://code.google.com/p/mockwebserver/issues/detail?id=6 @@ -66,7 +65,7 @@ public class S3ClientMockTest { .endpoint(server.toString()) .modules(modules) .overrides(overrides) - .build(S3ApiMetadata.CONTEXT_TOKEN); + .buildApi(S3Client.class); } public void testZeroLengthPutHasContentLengthHeader() throws IOException, InterruptedException { @@ -74,7 +73,7 @@ public class S3ClientMockTest { server.enqueue(new MockResponse().setBody("").addHeader(ETAG, "ABCDEF")); server.play(); - S3Client client = getContext(server.getUrl("/")).getApi(); + S3Client client = getS3Client(server.getUrl("/")); S3Object nada = client.newS3Object(); nada.getMetadata().setKey("object"); nada.setPayload(new byte[] {}); @@ -94,7 +93,7 @@ public class S3ClientMockTest { server.enqueue(new MockResponse().setBody("").addHeader(ETAG, "ABCDEF")); server.play(); - S3Client client = getContext(server.getUrl("/")).getApi(); + S3Client client = getS3Client(server.getUrl("/")); S3Object fileInDir = client.newS3Object(); fileInDir.getMetadata().setKey("someDir/fileName"); fileInDir.setPayload(new byte[] { 1, 2, 3, 4 }); diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/features/BulkMessageApiLiveTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/features/BulkMessageApiLiveTest.java index d09a0f5f8b..86d4e229c4 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/features/BulkMessageApiLiveTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/features/BulkMessageApiLiveTest.java @@ -63,14 +63,14 @@ public class BulkMessageApiLiveTest extends BaseSQSApiLiveTest { @BeforeClass(groups = { "integration", "live" }) @Override - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); recreateQueueInRegion(prefix, null); } public void testSendMessages() { for (URI queue : queues) { - BatchResult acks = api().getMessageApiForQueue(queue).send(idPayload); + BatchResult acks = api.getMessageApiForQueue(queue).send(idPayload); assertEquals(acks.size(), idPayload.size(), "error sending " + acks); assertEquals(acks.keySet(), idPayload.keySet()); @@ -87,7 +87,7 @@ public class BulkMessageApiLiveTest extends BaseSQSApiLiveTest { @Test(dependsOnMethods = "testSendMessages") public void testChangeMessageVisibility() { for (URI queue : queues) { - MessageApi api = api().getMessageApiForQueue(queue); + MessageApi api = this.api.getMessageApiForQueue(queue); Set messages = collectMessages(api); @@ -117,7 +117,7 @@ public class BulkMessageApiLiveTest extends BaseSQSApiLiveTest { @Test(dependsOnMethods = "testChangeMessageVisibility") public void testDeleteMessage() throws InterruptedException { for (URI queue : queues) { - BatchResult acks = api().getMessageApiForQueue(queue).delete(receiptHandles); + BatchResult acks = api.getMessageApiForQueue(queue).delete(receiptHandles); assertEquals(acks.size(), Iterables.size(receiptHandles), "error deleting messages " + acks); assertNoMessages(queue); } diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/features/MessageApiLiveTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/features/MessageApiLiveTest.java index 0e2a3ea77c..7c076cf917 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/features/MessageApiLiveTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/features/MessageApiLiveTest.java @@ -45,8 +45,8 @@ public class MessageApiLiveTest extends BaseSQSApiLiveTest { @BeforeClass(groups = { "integration", "live" }) @Override - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); recreateQueueInRegion(prefix, null); } @@ -55,14 +55,14 @@ public class MessageApiLiveTest extends BaseSQSApiLiveTest { public void testSendMessage() { for (URI queue : queues) { - assertEquals(api().getMessageApiForQueue(queue).send(message).getMD5(), md5); + assertEquals(api.getMessageApiForQueue(queue).send(message).getMD5(), md5); } } @Test(dependsOnMethods = "testSendMessage") public void testReceiveMessageWithoutHidingMessage() { for (URI queue : queues) { - assertEquals(api().getMessageApiForQueue(queue).receive(attribute("All").visibilityTimeout(0)).getMD5(), md5); + assertEquals(api.getMessageApiForQueue(queue).receive(attribute("All").visibilityTimeout(0)).getMD5(), md5); } } @@ -71,7 +71,7 @@ public class MessageApiLiveTest extends BaseSQSApiLiveTest { @Test(dependsOnMethods = "testReceiveMessageWithoutHidingMessage") public void testChangeMessageVisibility() { for (URI queue : queues) { - MessageApi api = api().getMessageApiForQueue(queue); + MessageApi api = this.api.getMessageApiForQueue(queue); // start hiding it at 5 seconds receiptHandle = api.receive(attribute("None").visibilityTimeout(5)).getReceiptHandle(); // hidden message, so we can't see it @@ -86,7 +86,7 @@ public class MessageApiLiveTest extends BaseSQSApiLiveTest { @Test(dependsOnMethods = "testChangeMessageVisibility") public void testDeleteMessage() throws InterruptedException { for (URI queue : queues) { - api().getMessageApiForQueue(queue).delete(receiptHandle); + api.getMessageApiForQueue(queue).delete(receiptHandle); assertNoMessages(queue); } } diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java index 25594ae0b6..88ce769b34 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java @@ -58,8 +58,8 @@ public class PermissionApiLiveTest extends BaseSQSApiLiveTest { @BeforeClass(groups = { "integration", "live" }) @Override - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); recreateQueueInRegion(prefix, null); } @@ -77,17 +77,17 @@ public class PermissionApiLiveTest extends BaseSQSApiLiveTest { public void testAddAnonymousPermission() throws InterruptedException { for (URI queue : queues) { - QueueAttributes attributes = api().getQueueApi().getAttributes(queue); + QueueAttributes attributes = api.getQueueApi().getAttributes(queue); assertNoPermissions(queue); String accountToAuthorize = getOwner(queue); - api().getPermissionApiForQueue(queue).addPermissionToAccount("fubar", Action.GET_QUEUE_ATTRIBUTES, + api.getPermissionApiForQueue(queue).addPermissionToAccount("fubar", Action.GET_QUEUE_ATTRIBUTES, accountToAuthorize); String policyForAuthorizationByAccount = assertPolicyPresent(queue); String policyForAnonymous = policyForAuthorizationByAccount.replace("\"" + accountToAuthorize + "\"", "\"*\""); - api().getQueueApi().setAttribute(queue, "Policy", policyForAnonymous); + api.getQueueApi().setAttribute(queue, "Policy", policyForAnonymous); assertEquals(getAnonymousAttributesApi(queue).getQueueArn(), attributes.getQueueArn()); } @@ -96,18 +96,17 @@ public class PermissionApiLiveTest extends BaseSQSApiLiveTest { @Test(dependsOnMethods = "testAddAnonymousPermission") public void testRemovePermission() throws InterruptedException { for (URI queue : queues) { - api().getPermissionApiForQueue(queue).remove("fubar"); + api.getPermissionApiForQueue(queue).remove("fubar"); assertNoPermissions(queue); } } private AnonymousAttributesApi getAnonymousAttributesApi(URI queue) { - return ContextBuilder - .newBuilder( + return ContextBuilder.newBuilder( forClientMappedToAsyncClientOnEndpoint(AnonymousAttributesApi.class, AnonymousAttributesAsyncApi.class, queue.toASCIIString())) .modules(ImmutableSet. of(new ExecutorServiceModule(sameThreadExecutor(), sameThreadExecutor()))) - .buildInjector().getInstance(AnonymousAttributesApi.class); + .buildApi(AnonymousAttributesApi.class); } } diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/features/QueueApiLiveTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/features/QueueApiLiveTest.java index 0d98c06c2a..cbbc6a6f03 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/features/QueueApiLiveTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/features/QueueApiLiveTest.java @@ -50,7 +50,7 @@ public class QueueApiLiveTest extends BaseSQSApiLiveTest { } protected void listQueuesInRegion(String region) throws InterruptedException { - FluentIterable allResults = api().getQueueApiForRegion(region).list(); + FluentIterable allResults = api.getQueueApiForRegion(region).list(); assertNotNull(allResults); if (allResults.size() >= 1) { URI queue = getLast(allResults); @@ -60,7 +60,7 @@ public class QueueApiLiveTest extends BaseSQSApiLiveTest { @Test public void testGracefulNoQueue() throws InterruptedException { - assertNull(api().getQueueApi().get(UUID.randomUUID().toString())); + assertNull(api.getQueueApi().get(UUID.randomUUID().toString())); } @Test @@ -72,37 +72,37 @@ public class QueueApiLiveTest extends BaseSQSApiLiveTest { @Test(dependsOnMethods = "testCanRecreateQueueGracefully") public void testCreateQueueWhenAlreadyExistsReturnsURI() { for (URI queue : queues) { - assertEquals(api().getQueueApi().create(prefix), queue); + assertEquals(api.getQueueApi().create(prefix), queue); } } @Test(dependsOnMethods = "testCanRecreateQueueGracefully") public void testGet() { for (URI queue : queues) { - assertEquals(api().getQueueApi().get(prefix), queue); + assertEquals(api.getQueueApi().get(prefix), queue); } } @Test(dependsOnMethods = "testCanRecreateQueueGracefully") public void testGetInAccount() { for (URI queue : queues) { - assertEquals(api().getQueueApi().getInAccount(prefix, getOwner(queue)), queue); + assertEquals(api.getQueueApi().getInAccount(prefix, getOwner(queue)), queue); } } @Test(dependsOnMethods = "testCanRecreateQueueGracefully") public void testGetQueueAttributes() { for (URI queue : queues) { - Map attributes = api().getQueueApi().getAttributes(queue, ImmutableSet.of("All")); - assertEquals(api().getQueueApi().getAttributes(queue, attributes.keySet()), attributes); + Map attributes = api.getQueueApi().getAttributes(queue, ImmutableSet.of("All")); + assertEquals(api.getQueueApi().getAttributes(queue, attributes.keySet()), attributes); } } @Test(dependsOnMethods = "testGetQueueAttributes") public void testSetQueueAttribute() { for (URI queue : queues) { - api().getQueueApi().setAttribute(queue, "MaximumMessageSize", "1024"); - assertEquals(api().getQueueApi().getAttributes(queue).getMaximumMessageSize(), 1024); + api.getQueueApi().setAttribute(queue, "MaximumMessageSize", "1024"); + assertEquals(api.getQueueApi().getAttributes(queue).getMaximumMessageSize(), 1024); } } } diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/internal/BaseSQSApiLiveTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/internal/BaseSQSApiLiveTest.java index 71ec931b5b..f31a1bca87 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/internal/BaseSQSApiLiveTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/internal/BaseSQSApiLiveTest.java @@ -28,11 +28,8 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import org.jclouds.apis.BaseContextLiveTest; -import org.jclouds.rest.RestContext; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.sqs.SQSApi; -import org.jclouds.sqs.SQSApiMetadata; -import org.jclouds.sqs.SQSAsyncApi; import org.jclouds.sqs.domain.Message; import org.jclouds.sqs.features.QueueApi; import org.testng.annotations.AfterClass; @@ -41,7 +38,6 @@ import org.testng.annotations.Test; import com.google.common.base.Splitter; import com.google.common.collect.FluentIterable; import com.google.common.collect.Sets; -import com.google.common.reflect.TypeToken; import com.google.common.util.concurrent.Atomics; import com.google.common.util.concurrent.Uninterruptibles; @@ -50,7 +46,7 @@ import com.google.common.util.concurrent.Uninterruptibles; * @author Adrian Cole */ @Test(groups = "live") -public class BaseSQSApiLiveTest extends BaseContextLiveTest> { +public class BaseSQSApiLiveTest extends BaseApiLiveTest { protected String prefix = System.getProperty("user.name") + "-sqs"; @@ -65,7 +61,7 @@ public class BaseSQSApiLiveTest extends BaseContextLiveTest> contextType() { - return SQSApiMetadata.CONTEXT_TOKEN; - } - protected String assertPolicyPresent(final URI queue) { final AtomicReference policy = Atomics.newReference(); assertEventually(new Runnable() { public void run() { - String policyForAuthorizationByAccount = api().getQueueApi().getAttribute(queue, "Policy"); + String policyForAuthorizationByAccount = api.getQueueApi().getAttribute(queue, "Policy"); assertNotNull(policyForAuthorizationByAccount); policy.set(policyForAuthorizationByAccount); @@ -97,7 +88,7 @@ public class BaseSQSApiLiveTest extends BaseContextLiveTest result = api().getQueueApiForRegion(region).list(); + FluentIterable result = api.getQueueApiForRegion(region).list(); assertNotNull(result); assert result.size() >= 1 : result; assertTrue(result.contains(finalQ), finalQ + " not in " + result); @@ -152,15 +143,10 @@ public class BaseSQSApiLiveTest extends BaseContextLiveTest> { - +public class BaseSTSApiLiveTest extends BaseApiLiveTest { public BaseSTSApiLiveTest() { provider = "sts"; } - - @Override - protected TypeToken> contextType() { - return STSApiMetadata.CONTEXT_TOKEN; - } - } diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java index 25de62589d..73a6a2b721 100644 --- a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java +++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java @@ -23,14 +23,11 @@ import static org.testng.Assert.assertTrue; import java.util.Properties; -import org.jclouds.blobstore.BlobStore; import org.jclouds.blobstore.integration.internal.BaseContainerIntegrationTest; import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; -import org.jclouds.openstack.swift.CommonSwiftAsyncClient; import org.jclouds.openstack.swift.CommonSwiftClient; import org.jclouds.openstack.swift.domain.ContainerMetadata; import org.jclouds.openstack.swift.options.CreateContainerOptions; -import org.jclouds.rest.RestContext; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; @@ -56,19 +53,19 @@ public class SwiftContainerIntegrationLiveTest extends BaseContainerIntegrationT @Test(groups = "live") public void testSetGetContainerMetadata() throws InterruptedException { - BlobStore blobStore = view.getBlobStore(); - RestContext swift = blobStore.getContext().unwrap(); + CommonSwiftClient swift = view.utils().injector().getInstance(CommonSwiftClient.class); + String containerName = getContainerName(); - assertTrue(swift.getApi().createContainer(containerName)); + assertTrue(swift.createContainer(containerName)); ImmutableMap metadata = ImmutableMap. of( "key1", "value1", "key2", "value2"); - assertTrue(swift.getApi().setContainerMetadata(containerName, metadata)); + assertTrue(swift.setContainerMetadata(containerName, metadata)); - ContainerMetadata containerMetadata = swift.getApi().getContainerMetadata(containerName); + ContainerMetadata containerMetadata = swift.getContainerMetadata(containerName); assertEquals(containerMetadata.getMetadata().get("key1"), "value1"); assertEquals(containerMetadata.getMetadata().get("key2"), "value2"); @@ -76,8 +73,8 @@ public class SwiftContainerIntegrationLiveTest extends BaseContainerIntegrationT @Test(groups = "live") public void testCreateDeleteContainerMetadata() throws InterruptedException { - BlobStore blobStore = view.getBlobStore(); - RestContext swift = blobStore.getContext().unwrap(); + CommonSwiftClient swift = view.utils().injector().getInstance(CommonSwiftClient.class); + String containerName = getContainerName(); CreateContainerOptions options = CreateContainerOptions.Builder .withPublicAccess() @@ -86,18 +83,18 @@ public class SwiftContainerIntegrationLiveTest extends BaseContainerIntegrationT "key2", "value2", "key3", "value3")); - assertTrue(swift.getApi().createContainer(containerName, options)); + assertTrue(swift.createContainer(containerName, options)); - ContainerMetadata containerMetadata = swift.getApi().getContainerMetadata(containerName); + ContainerMetadata containerMetadata = swift.getContainerMetadata(containerName); assertEquals(containerMetadata.getMetadata().size(), 3); assertEquals(containerMetadata.getMetadata().get("key1"), "value1"); assertEquals(containerMetadata.getMetadata().get("key2"), "value2"); assertEquals(containerMetadata.getMetadata().get("key3"), "value3"); - assertTrue(swift.getApi().deleteContainerMetadata(containerName, ImmutableList. of("key2","key3"))); + assertTrue(swift.deleteContainerMetadata(containerName, ImmutableList. of("key2","key3"))); - containerMetadata = swift.getApi().getContainerMetadata(containerName); + containerMetadata = swift.getContainerMetadata(containerName); assertEquals(containerMetadata.getMetadata().size(), 1); assertEquals(containerMetadata.getMetadata().get("key1"), "value1"); diff --git a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/TerremarkClientLiveTest.java b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/TerremarkClientLiveTest.java index 58b5ee5630..61dc890391 100644 --- a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/TerremarkClientLiveTest.java +++ b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/TerremarkClientLiveTest.java @@ -22,11 +22,11 @@ import static com.google.common.collect.Iterables.filter; import static com.google.common.collect.Iterables.find; import static com.google.common.collect.Iterables.size; import static java.util.concurrent.TimeUnit.SECONDS; -import static org.jclouds.util.Predicates2.retry; import static org.jclouds.trmk.vcloud_0_8.domain.VAppConfiguration.Builder.changeNameTo; import static org.jclouds.trmk.vcloud_0_8.domain.VAppConfiguration.Builder.deleteDiskWithAddressOnParent; import static org.jclouds.trmk.vcloud_0_8.options.CloneVAppOptions.Builder.deploy; import static org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions.Builder.processorCount; +import static org.jclouds.util.Predicates2.retry; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.fail; @@ -41,13 +41,12 @@ import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.cim.CIMPredicates; import org.jclouds.cim.ResourceAllocationSettingData; import org.jclouds.cim.ResourceAllocationSettingData.ResourceType; -import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; import org.jclouds.predicates.SocketOpen; import org.jclouds.rest.AuthorizationException; -import org.jclouds.rest.RestContext; import org.jclouds.ssh.SshClient; import org.jclouds.ssh.SshClient.Factory; import org.jclouds.ssh.SshException; @@ -74,12 +73,12 @@ import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions; import org.jclouds.trmk.vcloud_0_8.predicates.TaskSuccess; import org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants; import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.net.HostAndPort; @@ -87,7 +86,7 @@ import com.google.inject.Injector; import com.google.inject.Module; @Test(groups = "live", singleThreaded = true) -public abstract class TerremarkClientLiveTest extends BaseComputeServiceContextLiveTest { +public abstract class TerremarkClientLiveTest extends BaseApiLiveTest { protected String expectedOs = "Ubuntu Linux (64-bit)"; protected String itemName = "Ubuntu JeOS 9.10 (64-bit)"; @@ -105,7 +104,6 @@ public abstract class TerremarkClientLiveTest response = vCloudExpressClient.listKeyPairsInOrg(org.getHref()); assertNotNull(response); } @@ -130,8 +128,8 @@ public abstract class TerremarkClientLiveTest publicIpAddresses = connection.getPublicIpsAssociatedWithVDC(vdc.getHref()); + Set publicIpAddresses = api.getPublicIpsAssociatedWithVDC(vdc.getHref()); PublicIpAddress publicIp = publicIpAddresses.iterator().next(); - InternetService service = connection.addInternetServiceToExistingIp(publicIp.getId(), PREFIX + InternetService service = api.addInternetServiceToExistingIp(publicIp.getId(), PREFIX + "-no-monitoring", Protocol.TCP, 1234, AddInternetServiceOptions.Builder.monitorDisabled()); - connection.deleteInternetService(service.getId()); + api.deleteInternetService(service.getId()); } } } @@ -154,9 +152,9 @@ public abstract class TerremarkClientLiveTest getNewInternetServiceAndIpForSSH(VApp vApp); @@ -288,7 +286,7 @@ public abstract class TerremarkClientLiveTest disks = Lists.newArrayList(filter(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE))); // delete the second disk - task = connection.configureVApp(vApp, + task = api.configureVApp(vApp, deleteDiskWithAddressOnParent(Integer.parseInt(disks.get(1).getAddressOnParent()))); assert successTester.apply(task.getHref()); - assert successTester.apply(connection.powerOnVApp(vApp.getHref()).getHref()); + assert successTester.apply(api.powerOnVApp(vApp.getHref()).getHref()); loopAndCheckPass(); } @@ -457,47 +455,42 @@ public abstract class TerremarkClientLiveTest modules) { + Injector injector = newBuilder().modules(modules).overrides(props).buildInjector(); sshFactory = injector.getInstance(SshClient.Factory.class); // longer than default internet service timeout socketTester = retry(injector.getInstance(SocketOpen.class), 300, 10, SECONDS); successTester = retry(injector.getInstance(TaskSuccess.class), 650, 10, SECONDS); - connection = (S) RestContext.class.cast(view.unwrap()).getApi(); + api = injector.getInstance(TerremarkVCloudClient.class); orgs = listOrgs(); + return api; } - @Test public void testOrg() throws Exception { for (Org org : orgs) { @@ -506,21 +499,21 @@ public abstract class TerremarkClientLiveTest= 1; assert org.getTasksLists().size() >= 1; assert org.getVDCs().size() >= 1; - assertEquals(connection.findOrgNamed(org.getName()), org); + assertEquals(api.findOrgNamed(org.getName()), org); } } @Test public void testPropertiesCanOverrideDefaultOrg() throws Exception { for (Org org : orgs) { - RestContext newContext = null; + TerremarkVCloudClient newApi = null; try { - newContext = createView( + newApi = create( overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName())), - setupModules()).unwrap(); - assertEquals(newContext.getApi().findOrgNamed(null), org); + setupModules()); + assertEquals(newApi.findOrgNamed(null), org); } finally { - newContext.close(); + newApi.close(); } } } @@ -535,11 +528,11 @@ public abstract class TerremarkClientLiveTest newContext = null; + TerremarkVCloudClient newApi = null; try { - newContext = createView( + newApi = create( overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(), - VCloudConstants.PROPERTY_VCLOUD_DEFAULT_CATALOG, cat.getName())), setupModules()) - .unwrap(); - assertEquals(newContext.getApi().findCatalogInOrgNamed(null, null), connection.getCatalog(cat.getHref())); + VCloudConstants.PROPERTY_VCLOUD_DEFAULT_CATALOG, cat.getName())), setupModules()); + assertEquals(newApi.findCatalogInOrgNamed(null, null), api.getCatalog(cat.getHref())); } finally { - newContext.close(); + newApi.close(); } } } @@ -566,16 +558,16 @@ public abstract class TerremarkClientLiveTest newContext = null; + TerremarkVCloudClient newApi = null; try { - newContext = createView( + newApi = create( overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(), VCloudConstants.PROPERTY_VCLOUD_DEFAULT_VDC, vdc.getName(), - VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK, net.getName())), setupModules()) - .unwrap(); - assertEquals(newContext.getApi().findNetworkInOrgVDCNamed(null, null, net.getName()), - connection.getNetwork(net.getHref())); + VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK, net.getName())), setupModules()); + assertEquals(newApi.findNetworkInOrgVDCNamed(null, null, net.getName()), + api.getNetwork(net.getHref())); } finally { - newContext.close(); + newApi.close(); } } } @@ -612,10 +603,10 @@ public abstract class TerremarkClientLiveTest newContext = null; + TerremarkVCloudClient newApi = null; try { - newContext = createView( + newApi = create( overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(), - VCloudConstants.PROPERTY_VCLOUD_DEFAULT_VDC, vdc.getName())), setupModules()) - .unwrap(); - assertEquals(newContext.getApi().findVDCInOrgNamed(null, null), connection.getVDC(vdc.getHref())); + VCloudConstants.PROPERTY_VCLOUD_DEFAULT_VDC, vdc.getName())), setupModules()); + assertEquals(newApi.findVDCInOrgNamed(null, null), api.getVDC(vdc.getHref())); } finally { - newContext.close(); + newApi.close(); } } } @@ -688,12 +678,12 @@ public abstract class TerremarkClientLiveTest newContext = null; + TerremarkVCloudClient newApi = null; try { - newContext = createView( + newApi = create( overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(), - VCloudConstants.PROPERTY_VCLOUD_DEFAULT_TASKSLIST, tasksList.getName())), setupModules()) - .unwrap(); - assertEquals(newContext.getApi().findTasksListInOrgNamed(null, null), - connection.getTasksList(tasksList.getHref())); + VCloudConstants.PROPERTY_VCLOUD_DEFAULT_TASKSLIST, tasksList.getName())), setupModules()); + assertEquals(newApi.findTasksListInOrgNamed(null, null), + api.getTasksList(tasksList.getHref())); } finally { - newContext.close(); + newApi.close(); } } } @@ -721,14 +710,14 @@ public abstract class TerremarkClientLiveTest 0) { Task task = response.getTasks().last(); - assertEquals(connection.getTask(task.getHref()).getHref(), task.getHref()); + assertEquals(api.getTask(task.getHref()).getHref(), task.getHref()); } } } @@ -736,17 +725,12 @@ public abstract class TerremarkClientLiveTest orgs; - @AfterGroups(groups = { "live" }) - public void teardownClient() { - view.close(); - } - protected Iterable listOrgs() { - return Iterables.transform(connection.listOrgs().values(), new Function() { + return Iterables.transform(api.listOrgs().values(), new Function() { @Override public Org apply(ReferenceType arg0) { - return connection.getOrg(arg0.getHref()); + return api.getOrg(arg0.getHref()); } }); @@ -756,12 +740,12 @@ public abstract class TerremarkClientLiveTest setupModules() { + return ImmutableSet. of(getLoggingModule(), new SshjSshClientModule()); + } } diff --git a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/BaseTerremarkClientLiveTest.java b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/BaseTerremarkClientLiveTest.java index 95ce36e4ad..96482dbf71 100644 --- a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/BaseTerremarkClientLiveTest.java +++ b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/BaseTerremarkClientLiveTest.java @@ -24,10 +24,8 @@ import static org.jclouds.util.Predicates2.retry; import org.jclouds.compute.ComputeService; import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; import org.jclouds.predicates.SocketOpen; -import org.jclouds.rest.RestContext; import org.jclouds.ssh.SshClient.Factory; import org.jclouds.sshj.config.SshjSshClientModule; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -42,7 +40,7 @@ import com.google.inject.Module; * @author Adrian Cole */ @Test(groups = "live", enabled = true, singleThreaded = true) -public abstract class BaseTerremarkClientLiveTest extends BaseComputeServiceContextLiveTest { +public abstract class BaseTerremarkClientLiveTest extends BaseComputeServiceContextLiveTest { protected String prefix = System.getProperty("user.name"); @@ -54,9 +52,8 @@ public abstract class BaseTerremarkClientLiveTest socketTester; protected Factory sshFactory; - protected S connection; + protected TerremarkVCloudClient api; - @SuppressWarnings("unchecked") @Override @BeforeClass(groups = { "integration", "live" }) public void setupContext() { @@ -65,7 +62,7 @@ public abstract class BaseTerremarkClientLiveTest { + protected String prefix = System.getProperty("user.name"); + protected String provider; + + protected volatile A api; + + protected String identity; + protected String credential; + protected String endpoint; + protected String apiVersion; + + protected Properties setupProperties() { + Properties overrides = new Properties(); + overrides.setProperty(PROPERTY_TRUST_ALL_CERTS, "true"); + overrides.setProperty(PROPERTY_RELAX_HOSTNAME, "true"); + identity = setIfTestSystemPropertyPresent(overrides, provider + ".identity"); + credential = setIfTestSystemPropertyPresent(overrides, provider + ".credential"); + endpoint = setIfTestSystemPropertyPresent(overrides, provider + ".endpoint"); + apiVersion = setIfTestSystemPropertyPresent(overrides, provider + ".api-version"); + setIfTestSystemPropertyPresent(overrides, provider + ".build-version"); + return overrides; + } + + protected String setIfTestSystemPropertyPresent(Properties overrides, String key) { + if (System.getProperties().containsKey("test." + key)) { + String val = System.getProperty("test." + key); + overrides.setProperty(key, val); + return val; + } + return null; + } + + @BeforeClass(groups = { "integration", "live" }) + public void setup() { + initialize(); + } + + protected void initialize() { + closeQuietly(api); + api = create(setupProperties(), setupModules()); + } + + protected Iterable setupModules() { + return ImmutableSet. of(getLoggingModule()); + } + + protected LoggingModule getLoggingModule() { + return LoggingModules.firstOrJDKLoggingModule(); + } + + /** + * @see org.jclouds.providers.Providers#withId + */ + protected ProviderMetadata createProviderMetadata() { + try { + return Providers.withId(provider); + } catch (NoSuchElementException e) { + return null; + } + } + + /** + * @see org.jclouds.apis.Apis#withId + */ + protected ApiMetadata createApiMetadata() { + try { + return Apis.withId(provider); + } catch (NoSuchElementException e) { + return null; + } + } + + @SuppressWarnings("serial") + protected A create(Properties props, Iterable modules) { + return newBuilder().modules(modules).overrides(props).buildApi(new TypeToken(getClass()) { + }); + } + + protected ContextBuilder newBuilder() { + if (provider != null) + try { + return ContextBuilder.newBuilder(provider); + } catch (NoSuchElementException e){ + Logger.getAnonymousLogger() + .warning("provider [" + + provider + + "] is not setup as META-INF/services/org.jclouds.apis.ApiMetadata or META-INF/services/org.jclouds.providers.ProviderMetadata"); + } + + ProviderMetadata pm = createProviderMetadata(); + + ContextBuilder builder = pm != null ? ContextBuilder.newBuilder(pm) : ContextBuilder + .newBuilder(ApiMetadata.class.cast(checkNotNull(createApiMetadata(), + "either createApiMetadata or createProviderMetadata must be overridden"))); + return builder; + } + + @AfterClass(groups = { "integration", "live" }) + protected void tearDown() { + closeQuietly(api); + } +} diff --git a/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java b/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java index 607dcff8b4..20ce698fac 100644 --- a/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java +++ b/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java @@ -33,6 +33,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.Writer; +import java.net.MalformedURLException; import java.net.URI; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -140,9 +141,9 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base }.hash(md5()).asBytes()), md5); } - private InputStream getConsitution() { + private InputStream getConsitution() throws MalformedURLException, IOException { URI constitutionUri = URI.create(format("http://localhost:%d/101constitutions", testPort)); - return context.utils().http().get(constitutionUri); + return constitutionUri.toURL().openStream(); } /** diff --git a/core/src/test/java/org/jclouds/http/BaseJettyTest.java b/core/src/test/java/org/jclouds/http/BaseJettyTest.java index 0c5e8b814b..3419afe7ba 100644 --- a/core/src/test/java/org/jclouds/http/BaseJettyTest.java +++ b/core/src/test/java/org/jclouds/http/BaseJettyTest.java @@ -61,7 +61,6 @@ import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.jclouds.ContextBuilder; import org.jclouds.providers.AnonymousProviderMetadata; -import org.jclouds.rest.RestContext; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Optional; @@ -87,7 +86,6 @@ public abstract class BaseJettyTest { protected Injector injector; private AtomicInteger cycle = new AtomicInteger(0); private Server server2; - protected RestContext context; protected int testPort; protected String md5; static final Pattern actionPattern = Pattern.compile("/objects/(.*)/action/([a-z]*);?(.*)"); @@ -170,8 +168,7 @@ public abstract class BaseJettyTest { Properties properties = new Properties(); addConnectionProperties(properties); - context = newBuilder(testPort, properties, createConnectionModule()).build(); - client = context.getApi(); + client = newBuilder(testPort, properties, createConnectionModule()).buildApi(IntegrationTestClient.class); assert client != null; assert client.newStringBuilder() != null; @@ -279,7 +276,7 @@ public abstract class BaseJettyTest { @AfterClass public void tearDownJetty() throws Exception { - closeQuietly(context); + closeQuietly(client); if (server2 != null) server2.stop(); server.stop(); diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java index 7f4824cbfd..9b600cdeaf 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java @@ -37,7 +37,6 @@ import org.jclouds.aws.ec2.domain.AWSRunningInstance; import org.jclouds.aws.ec2.domain.MonitoringState; import org.jclouds.aws.ec2.services.AWSSecurityGroupClient; import org.jclouds.cloudwatch.CloudWatchApi; -import org.jclouds.cloudwatch.CloudWatchAsyncApi; import org.jclouds.cloudwatch.domain.Dimension; import org.jclouds.cloudwatch.domain.EC2Constants; import org.jclouds.cloudwatch.domain.GetMetricStatistics; @@ -56,7 +55,6 @@ import org.jclouds.ec2.domain.KeyPair; import org.jclouds.ec2.domain.SecurityGroup; import org.jclouds.ec2.services.InstanceClient; import org.jclouds.ec2.services.KeyPairClient; -import org.jclouds.rest.RestContext; import org.jclouds.scriptbuilder.domain.Statements; import org.testng.annotations.Test; @@ -157,13 +155,13 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest { // stop the spinner future.cancel(true); - RestContext monitoringContext = ContextBuilder - .newBuilder(new AWSCloudWatchProviderMetadata()) - .credentials(identity, credential) - .modules(setupModules()).build(); + CloudWatchApi monitoringApi = ContextBuilder.newBuilder(new AWSCloudWatchProviderMetadata()) + .credentials(identity, credential) + .modules(setupModules()) + .buildApi(CloudWatchApi.class); try { - GetMetricStatisticsResponse datapoints = monitoringContext.getApi().getMetricApiForRegion(instance.getRegion()) + GetMetricStatisticsResponse datapoints = monitoringApi.getMetricApiForRegion(instance.getRegion()) .getMetricStatistics(GetMetricStatistics.builder() .dimension(new Dimension(EC2Constants.Dimension.INSTANCE_ID, instance.getId())) .unit(Unit.PERCENT) @@ -176,7 +174,7 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest { .build()); assert (datapoints.size() > 0) : instance; } finally { - monitoringContext.close(); + monitoringApi.close(); } // make sure we made our dummy group and also let in the user's group diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/extensions/AWSEC2ImageExtensionLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/extensions/AWSEC2ImageExtensionLiveTest.java index aba41dfe74..7c4163ed27 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/extensions/AWSEC2ImageExtensionLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/extensions/AWSEC2ImageExtensionLiveTest.java @@ -19,7 +19,8 @@ package org.jclouds.aws.ec2.compute.extensions; -import org.jclouds.aws.ec2.AWSEC2AsyncClient; +import static com.google.common.collect.Iterables.transform; + import org.jclouds.aws.ec2.AWSEC2Client; import org.jclouds.aws.util.AWSUtils; import org.jclouds.compute.domain.Image; @@ -27,11 +28,9 @@ import org.jclouds.compute.extensions.ImageExtension; import org.jclouds.compute.extensions.internal.BaseImageExtensionLiveTest; import org.jclouds.ec2.compute.functions.EC2ImageParser; import org.jclouds.ec2.options.DescribeImagesOptions; -import org.jclouds.rest.RestContext; import org.jclouds.sshj.config.SshjSshClientModule; import org.testng.annotations.Test; -import com.google.common.collect.Iterables; import com.google.inject.Module; /** @@ -49,14 +48,14 @@ public class AWSEC2ImageExtensionLiveTest extends BaseImageExtensionLiveTest { @Override protected Iterable listImages() { - RestContext unwrapped = view.unwrap(); + AWSEC2Client client = view.utils().getInjector().getInstance(AWSEC2Client.class); String[] parts = AWSUtils.parseHandle(imageId); String region = parts[0]; String imageId = parts[1]; EC2ImageParser parser = view.utils().getInjector().getInstance(EC2ImageParser.class); - return Iterables.transform( - unwrapped.getApi().getAMIServices() - .describeImagesInRegion(region, new DescribeImagesOptions().imageIds(imageId)), parser); + return transform( + client.getAMIServices().describeImagesInRegion(region, new DescribeImagesOptions().imageIds(imageId)), + parser); } @Override diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/TagSecurityGroupLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/TagSecurityGroupLiveTest.java index 31f9446b16..d15249958b 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/TagSecurityGroupLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/TagSecurityGroupLiveTest.java @@ -54,6 +54,6 @@ public class TagSecurityGroupLiveTest extends BaseTagApiLiveTest { } private AWSSecurityGroupClient securityGroupApi() { - return AWSEC2Client.class.cast(context.getApi()).getSecurityGroupServices(); + return AWSEC2Client.class.cast(api).getSecurityGroupServices(); } } diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3RestClientModule.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3RestClientModule.java index 13dd7959f1..5eadfa944b 100644 --- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3RestClientModule.java +++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3RestClientModule.java @@ -28,7 +28,6 @@ import org.jclouds.aws.s3.AWSS3Client; import org.jclouds.aws.s3.predicates.validators.AWSS3BucketNameValidator; import org.jclouds.location.Region; import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.RestContext; import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.S3Client; import org.jclouds.s3.config.S3RestClientModule; @@ -72,15 +71,4 @@ public class AWSS3RestClientModule extends S3RestClientModule - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Singleton - @Provides - RestContext provideBaseContext(RestContext in) { - return (RestContext) in; - } - } diff --git a/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTApi.java b/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTApi.java index 488447a04b..fcf67780fb 100644 --- a/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTApi.java +++ b/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTApi.java @@ -18,6 +18,8 @@ */ package org.jclouds.dynect.v3; +import java.io.Closeable; + import javax.ws.rs.PathParam; import org.jclouds.dynect.v3.domain.Job; @@ -36,7 +38,7 @@ import org.jclouds.rest.annotations.Delegate; * /> * @author Adrian Cole */ -public interface DynECTApi { +public interface DynECTApi extends Closeable { /** * returns the current status of a job. * diff --git a/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTAsyncApi.java b/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTAsyncApi.java index 22f0c5500d..1c66e71ce9 100644 --- a/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTAsyncApi.java +++ b/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTAsyncApi.java @@ -20,6 +20,8 @@ package org.jclouds.dynect.v3; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; +import java.io.Closeable; + import javax.inject.Named; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -48,7 +50,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -public interface DynECTAsyncApi { +public interface DynECTAsyncApi extends Closeable { /** * @see DynECTApi#getJob */ diff --git a/providers/dynect/src/test/java/org/jclouds/dynect/v3/DynectApiMockTest.java b/providers/dynect/src/test/java/org/jclouds/dynect/v3/DynectApiMockTest.java index 7efee8299a..d6066cec3a 100644 --- a/providers/dynect/src/test/java/org/jclouds/dynect/v3/DynectApiMockTest.java +++ b/providers/dynect/src/test/java/org/jclouds/dynect/v3/DynectApiMockTest.java @@ -54,7 +54,7 @@ public class DynectApiMockTest { .endpoint(uri) .overrides(overrides) .modules(modules) - .build(DynECTApiMetadata.CONTEXT_TOKEN).getApi(); + .buildApi(DynECTApi.class); } String session = "{\"status\": \"success\", \"data\": {\"token\": \"FFFFFFFFFF\", \"version\": \"3.3.8\"}, \"job_id\": 254417252, \"msgs\": [{\"INFO\": \"login: Login successful\", \"SOURCE\": \"BLL\", \"ERR_CD\": null, \"LVL\": \"INFO\"}]}"; diff --git a/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/RecordApiLiveTest.java b/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/RecordApiLiveTest.java index 3f1d4d952e..9d3363f6ab 100644 --- a/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/RecordApiLiveTest.java +++ b/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/RecordApiLiveTest.java @@ -199,7 +199,7 @@ public class RecordApiLiveTest extends BaseDynECTApiLiveTest { checkNotNull(job, "unable to create zone %s", zoneFQDN); getAnonymousLogger().info("created zone: " + job); assertEquals(job.getStatus(), Status.SUCCESS); - assertEquals(context.getApi().getJob(job.getId()), job); + assertEquals(api.getJob(job.getId()), job); Zone zone = zoneApi().publish(zoneFQDN); checkNotNull(zone, "unable to publish zone %s", zoneFQDN); getAnonymousLogger().info("published zone: " + zone); @@ -229,7 +229,7 @@ public class RecordApiLiveTest extends BaseDynECTApiLiveTest { checkNotNull(job, "unable to create record %s", record); getAnonymousLogger().info("created record: " + job); assertEquals(job.getStatus(), Status.SUCCESS); - assertEquals(context.getApi().getJob(job.getId()), job); + assertEquals(api.getJob(job.getId()), job); zoneApi().publish(zoneFQDN); } @@ -265,22 +265,22 @@ public class RecordApiLiveTest extends BaseDynECTApiLiveTest { checkNotNull(job, "unable to delete record %s", id); getAnonymousLogger().info("deleted record: " + job); assertEquals(job.getStatus(), Status.SUCCESS); - assertEquals(context.getApi().getJob(job.getId()), job); + assertEquals(api.getJob(job.getId()), job); zoneApi().publish(zoneFQDN); } protected RecordApi api(String zoneFQDN) { - return context.getApi().getRecordApiForZone(zoneFQDN); + return api.getRecordApiForZone(zoneFQDN); } protected ZoneApi zoneApi() { - return context.getApi().getZoneApi(); + return api.getZoneApi(); } @Override @AfterClass(groups = "live", alwaysRun = true) - protected void tearDownContext() { + protected void tearDown() { zoneApi().delete(zoneFQDN); - super.tearDownContext(); + super.tearDown(); } } diff --git a/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/SessionApiLiveTest.java b/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/SessionApiLiveTest.java index ab44ac23a7..bb6d618efb 100644 --- a/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/SessionApiLiveTest.java +++ b/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/SessionApiLiveTest.java @@ -50,14 +50,14 @@ public class SessionApiLiveTest extends BaseDynECTApiLiveTest { } protected SessionApi api() { - return context.getApi().getSessionApi(); + return api.getSessionApi(); } @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDownContext() { + protected void tearDown() { if (session != null) api().logout(session.getToken()); - super.tearDownContext(); + super.tearDown(); } } diff --git a/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/ZoneApiLiveTest.java b/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/ZoneApiLiveTest.java index afd39847ea..d870a51cd8 100644 --- a/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/ZoneApiLiveTest.java +++ b/providers/dynect/src/test/java/org/jclouds/dynect/v3/features/ZoneApiLiveTest.java @@ -75,7 +75,7 @@ public class ZoneApiLiveTest extends BaseDynECTApiLiveTest { checkNotNull(job, "unable to create zone %s", fqdn); getAnonymousLogger().info("created zone: " + job); assertEquals(job.getStatus(), Status.SUCCESS); - assertEquals(context.getApi().getJob(job.getId()), job); + assertEquals(api.getJob(job.getId()), job); } @Test(dependsOnMethods = "testCreateZone") @@ -90,7 +90,7 @@ public class ZoneApiLiveTest extends BaseDynECTApiLiveTest { public void testFreezeZone() { Job job = api().freeze(fqdn); assertEquals(job.getStatus(), Status.SUCCESS); - assertEquals(context.getApi().getJob(job.getId()), job); + assertEquals(api.getJob(job.getId()), job); // TODO: determine how to prove it is frozen } @@ -98,7 +98,7 @@ public class ZoneApiLiveTest extends BaseDynECTApiLiveTest { public void testThawZone() { Job job = api().thaw(fqdn); assertEquals(job.getStatus(), Status.SUCCESS); - assertEquals(context.getApi().getJob(job.getId()), job); + assertEquals(api.getJob(job.getId()), job); // TODO: determine how to prove it is thawed } @@ -106,25 +106,25 @@ public class ZoneApiLiveTest extends BaseDynECTApiLiveTest { public void testDeleteZoneChanges() { Job job = api().deleteChanges(fqdn); assertEquals(job.getStatus(), Status.SUCCESS); - assertEquals(context.getApi().getJob(job.getId()), job); + assertEquals(api.getJob(job.getId()), job); } @Test(dependsOnMethods = "testDeleteZoneChanges") public void testDeleteZone() { Job job = api().delete(fqdn); assertEquals(job.getStatus(), Status.SUCCESS); - assertEquals(context.getApi().getJob(job.getId()), job); + assertEquals(api.getJob(job.getId()), job); assertNull(api().get(fqdn), "job " + job + " didn't delete zone" + fqdn); } protected ZoneApi api() { - return context.getApi().getZoneApi(); + return api.getZoneApi(); } @Override @AfterClass(groups = "live", alwaysRun = true) - protected void tearDownContext() { + protected void tearDown() { api().delete(fqdn); - super.tearDownContext(); + super.tearDown(); } } diff --git a/providers/dynect/src/test/java/org/jclouds/dynect/v3/internal/BaseDynECTApiLiveTest.java b/providers/dynect/src/test/java/org/jclouds/dynect/v3/internal/BaseDynECTApiLiveTest.java index c8bed8f663..57fbd589e4 100644 --- a/providers/dynect/src/test/java/org/jclouds/dynect/v3/internal/BaseDynECTApiLiveTest.java +++ b/providers/dynect/src/test/java/org/jclouds/dynect/v3/internal/BaseDynECTApiLiveTest.java @@ -18,24 +18,13 @@ */ package org.jclouds.dynect.v3.internal; -import org.jclouds.apis.BaseContextLiveTest; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.dynect.v3.DynECTApi; -import org.jclouds.dynect.v3.DynECTApiMetadata; -import org.jclouds.dynect.v3.DynECTAsyncApi; -import org.jclouds.rest.RestContext; import org.testng.annotations.Test; -import com.google.common.reflect.TypeToken; - @Test(groups = "live") -public class BaseDynECTApiLiveTest extends BaseContextLiveTest> { - +public class BaseDynECTApiLiveTest extends BaseApiLiveTest { public BaseDynECTApiLiveTest() { provider = "dynect"; } - - @Override - protected TypeToken> contextType() { - return DynECTApiMetadata.CONTEXT_TOKEN; - } } diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApi.java index 56379df996..f42ca1b0fb 100644 --- a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApi.java +++ b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApi.java @@ -18,6 +18,8 @@ */ package org.jclouds.glesys; +import java.io.Closeable; + import org.jclouds.glesys.features.ArchiveApi; import org.jclouds.glesys.features.DomainApi; import org.jclouds.glesys.features.EmailAccountApi; @@ -33,7 +35,7 @@ import org.jclouds.rest.annotations.Delegate; * @see * @author Adrian Cole */ -public interface GleSYSApi { +public interface GleSYSApi extends Closeable { /** * Provides synchronous access to Server features. diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java index fd341eb104..68ee031c53 100644 --- a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java +++ b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java @@ -18,6 +18,8 @@ */ package org.jclouds.glesys; +import java.io.Closeable; + import org.jclouds.glesys.features.ArchiveAsyncApi; import org.jclouds.glesys.features.DomainAsyncApi; import org.jclouds.glesys.features.EmailAccountAsyncApi; @@ -33,7 +35,7 @@ import org.jclouds.rest.annotations.Delegate; * @see * @author Adrian Cole */ -public interface GleSYSAsyncApi { +public interface GleSYSAsyncApi extends Closeable { /** * Provides asynchronous access to Server features. diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/features/ArchiveApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/features/ArchiveApiLiveTest.java index 29fd99898f..d6fc7d12ca 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/features/ArchiveApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/features/ArchiveApiLiveTest.java @@ -42,34 +42,34 @@ import com.google.common.base.Predicate; public class ArchiveApiLiveTest extends BaseGleSYSApiLiveTest { @BeforeClass(groups = { "integration", "live" }) - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); - api = gleContext.getApi().getArchiveApi(); - archiveUser = gleContext.getIdentity().toLowerCase() + "_test9"; + archiveApi = api.getArchiveApi(); + archiveUser = identity.toLowerCase() + "_test9"; archiveCounter = retry(new Predicate() { public boolean apply(Integer value) { - return api.list().size() == value; + return archiveApi.list().size() == value; } }, 30, 1, SECONDS); } @AfterClass(groups = { "integration", "live" }) - protected void tearDownContext() { - int before = api.list().size(); - api.delete(archiveUser); + protected void tearDown() { + int before = archiveApi.list().size(); + archiveApi.delete(archiveUser); assertTrue(archiveCounter.apply(before - 1)); - super.tearDownContext(); + super.tearDown(); } - private ArchiveApi api; + private ArchiveApi archiveApi; private String archiveUser; private Predicate archiveCounter; @Test public void testAllowedArguments() throws Exception { - ArchiveAllowedArguments args = api.getAllowedArguments(); + ArchiveAllowedArguments args = archiveApi.getAllowedArguments(); assertNotNull(args); assertNotNull(args.getSizes()); assertTrue(args.getSizes().size() > 0); @@ -82,36 +82,36 @@ public class ArchiveApiLiveTest extends BaseGleSYSApiLiveTest { @Test public void testCreateArchive() throws Exception { try { - api.delete(archiveUser); + archiveApi.delete(archiveUser); } catch(Exception ex) { } - int before = api.list().size(); + int before = archiveApi.list().size(); - api.createWithCredentialsAndSize(archiveUser, "password", 10); + archiveApi.createWithCredentialsAndSize(archiveUser, "password", 10); assertTrue(archiveCounter.apply(before + 1)); } @Test(dependsOnMethods = "testCreateArchive") public void testArchiveDetails() throws Exception { - Archive details = api.get(archiveUser); + Archive details = archiveApi.get(archiveUser); assertEquals(details.getUsername(), archiveUser); } @Test(dependsOnMethods = "testCreateArchive") public void testChangePassword() throws Exception { - api.changePassword(archiveUser, "newpassword"); + archiveApi.changePassword(archiveUser, "newpassword"); // TODO assert something useful! } @Test(dependsOnMethods = "testCreateArchive") public void testResizeArchive() throws Exception { - api.resize(archiveUser, 20); + archiveApi.resize(archiveUser, 20); assertTrue(retry(new Predicate() { public boolean apply(String value) { - return api.get(archiveUser) != null && value.equals(api.get(archiveUser).getTotalSize()); + return archiveApi.get(archiveUser) != null && value.equals(archiveApi.get(archiveUser).getTotalSize()); } }, 30, 1, SECONDS).apply("20 GB")); } diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/features/DomainApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/features/DomainApiLiveTest.java index 7a0f7d9549..5738036c5c 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/features/DomainApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/features/DomainApiLiveTest.java @@ -47,23 +47,23 @@ public class DomainApiLiveTest extends BaseGleSYSApiLiveTest { public String testDomain; @BeforeClass(groups = { "integration", "live" }) - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); testDomain = identity.toLowerCase() + "-domain.jclouds.org"; - api = gleContext.getApi().getDomainApi(); + domainApi = api.getDomainApi(); domainCounter = retry(new Predicate() { public boolean apply(Integer value) { - return api.list().size() == value; + return domainApi.list().size() == value; } }, 30, 1, SECONDS); recordCounter = retry(new Predicate() { public boolean apply(Integer value) { - return api.listRecords(testDomain).size() == value; + return domainApi.listRecords(testDomain).size() == value; } }, 30, 1, SECONDS); try { - api.delete(testDomain); + domainApi.delete(testDomain); } catch (Exception ex) { } @@ -71,21 +71,21 @@ public class DomainApiLiveTest extends BaseGleSYSApiLiveTest { } @AfterClass(groups = { "integration", "live" }) - public void tearDownContext() { - int before = api.list().size(); - api.delete(testDomain); + public void tearDown() { + int before = domainApi.list().size(); + domainApi.delete(testDomain); assertTrue(domainCounter.apply(before - 1)); - super.tearDownContext(); + super.tearDown(); } - private DomainApi api; + private DomainApi domainApi; private Predicate domainCounter; private Predicate recordCounter; @Test public void testGetDomain() throws Exception { - Domain domain = api.get(testDomain); + Domain domain = domainApi.get(testDomain); assertNotNull(domain); assertEquals(domain.getName(), testDomain); assertNotNull(domain.getCreateTime()); @@ -93,20 +93,20 @@ public class DomainApiLiveTest extends BaseGleSYSApiLiveTest { @Test public void testUpdateDomain() throws Exception { - api.update(testDomain, DomainOptions.Builder.responsiblePerson("another-tester.jclouds.org.")); - Domain domain = api.get(testDomain); + domainApi.update(testDomain, DomainOptions.Builder.responsiblePerson("another-tester.jclouds.org.")); + Domain domain = domainApi.get(testDomain); assertEquals(domain.getResponsiblePerson(), "another-tester.jclouds.org."); } @Test public void testCreateRecord() throws Exception { - int before = api.listRecords(testDomain).size(); + int before = domainApi.listRecords(testDomain).size(); - api.createRecord(testDomain, "test", "A", "127.0.0.1"); + domainApi.createRecord(testDomain, "test", "A", "127.0.0.1"); assertTrue(recordCounter.apply(before + 1)); - for(DomainRecord record : api.listRecords(testDomain)) { + for(DomainRecord record : domainApi.listRecords(testDomain)) { if ("test".equals(record.getHost())) { assertEquals(record.getType(), "A"); assertEquals(record.getData(), "127.0.0.1"); @@ -116,14 +116,14 @@ public class DomainApiLiveTest extends BaseGleSYSApiLiveTest { @Test public void testUpdateRecord() throws Exception { - int before = api.listRecords(testDomain).size(); + int before = domainApi.listRecords(testDomain).size(); - api.createRecord(testDomain, "testeditbefore", "A", "127.0.0.1"); + domainApi.createRecord(testDomain, "testeditbefore", "A", "127.0.0.1"); assertTrue(recordCounter.apply(before + 1)); String recordId = null; - for(DomainRecord record : api.listRecords(testDomain)) { + for(DomainRecord record : domainApi.listRecords(testDomain)) { if ("testeditbefore".equals(record.getHost())) { assertEquals(record.getType(), "A"); assertEquals(record.getData(), "127.0.0.1"); @@ -133,10 +133,10 @@ public class DomainApiLiveTest extends BaseGleSYSApiLiveTest { assertNotNull(recordId); - api.updateRecord(recordId, UpdateRecordOptions.Builder.host("testeditafter")); + domainApi.updateRecord(recordId, UpdateRecordOptions.Builder.host("testeditafter")); boolean found = false; - for(DomainRecord record : api.listRecords(testDomain)) { + for(DomainRecord record : domainApi.listRecords(testDomain)) { if (recordId.equals(record.getId())) { assertEquals(record.getHost(), "testeditafter"); assertEquals(record.getType(), "A"); @@ -149,11 +149,11 @@ public class DomainApiLiveTest extends BaseGleSYSApiLiveTest { @Test public void testDeleteRecord() throws Exception { - Set domainRecords = api.listRecords(testDomain); + Set domainRecords = domainApi.listRecords(testDomain); int before = domainRecords.size(); - api.deleteRecord(domainRecords.iterator().next().getId()); + domainApi.deleteRecord(domainRecords.iterator().next().getId()); assertTrue(recordCounter.apply(before - 1)); } diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java index fd0c97b09a..417459a3b0 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java @@ -53,17 +53,17 @@ public class EmailAccountApiLiveTest extends BaseGleSYSApiLiveTest { @BeforeClass(groups = { "integration", "live" }) @Override - public void setupContext() { - super.setupContext(); + public void setup() { + super.setup(); testDomain = hostName + ".test.jclouds.org"; - api = gleContext.getApi().getEmailAccountApi(); + emailAccountApi = api.getEmailAccountApi(); deleteAll(); createDomain(testDomain); emailAccountCounter = retry(new Predicate() { public boolean apply(Integer value) { - return api.listDomain(testDomain).size() == value; + return emailAccountApi.listDomain(testDomain).size() == value; } }, 180, 5, SECONDS); @@ -73,61 +73,61 @@ public class EmailAccountApiLiveTest extends BaseGleSYSApiLiveTest { @AfterClass(groups = { "integration", "live" }) @Override - public void tearDownContext() { + public void tearDown() { deleteAll(); - super.tearDownContext(); + super.tearDown(); } private void deleteAll() { - api.delete("test@" + testDomain); - api.delete("test1@" + testDomain); + emailAccountApi.delete("test@" + testDomain); + emailAccountApi.delete("test1@" + testDomain); } - private EmailAccountApi api; + private EmailAccountApi emailAccountApi; private String testDomain; private Predicate emailAccountCounter; @Test public void testCreateEmail() { - api.createWithPassword("test@" + testDomain, "password", CreateAccountOptions.Builder.antiVirus(true) + emailAccountApi.createWithPassword("test@" + testDomain, "password", CreateAccountOptions.Builder.antiVirus(true) .autorespond(true).autorespondMessage("out of office")); assertTrue(emailAccountCounter.apply(1)); - api.createWithPassword("test1@" + testDomain, "password"); + emailAccountApi.createWithPassword("test1@" + testDomain, "password"); assertTrue(emailAccountCounter.apply(2)); } @Test(dependsOnMethods = "testCreateEmail") public void testAliases() { - assertTrue(api.listAliasesInDomain(testDomain).isEmpty()); + assertTrue(emailAccountApi.listAliasesInDomain(testDomain).isEmpty()); - EmailAlias alias = api.createAlias("test2@" + testDomain, "test@" + testDomain); + EmailAlias alias = emailAccountApi.createAlias("test2@" + testDomain, "test@" + testDomain); assertEquals(alias.getAlias(), "test2@" + testDomain); assertEquals(alias.getForwardTo(), "test@" + testDomain); - EmailAlias aliasFromList = Iterables.getOnlyElement(api.listAliasesInDomain(testDomain)); + EmailAlias aliasFromList = Iterables.getOnlyElement(emailAccountApi.listAliasesInDomain(testDomain)); assertEquals(aliasFromList, alias); - EmailOverview overview = api.getOverview(); + EmailOverview overview = emailAccountApi.getOverview(); assertEquals(1, overview.getSummary().getAliases()); - alias = api.updateAlias("test2@" + testDomain, "test1@" + testDomain); - overview = api.getOverview(); + alias = emailAccountApi.updateAlias("test2@" + testDomain, "test1@" + testDomain); + overview = emailAccountApi.getOverview(); assertEquals(1, overview.getSummary().getAliases()); - aliasFromList = Iterables.getOnlyElement(api.listAliasesInDomain(testDomain)); + aliasFromList = Iterables.getOnlyElement(emailAccountApi.listAliasesInDomain(testDomain)); assertEquals(aliasFromList, alias); - api.delete("test2@" + testDomain); - overview = api.getOverview(); + emailAccountApi.delete("test2@" + testDomain); + overview = emailAccountApi.getOverview(); assertEquals(0, overview.getSummary().getAliases()); } @Test(dependsOnMethods = "testCreateEmail") public void testOverview() throws Exception { - EmailOverview overview = api.getOverview(); + EmailOverview overview = emailAccountApi.getOverview(); assertNotNull(overview.getSummary()); assertTrue(overview.getSummary().getAccounts() > 0); assertTrue(overview.getSummary().getAliases() > -1); @@ -142,22 +142,22 @@ public class EmailAccountApiLiveTest extends BaseGleSYSApiLiveTest { @Test(dependsOnMethods = "testCreateEmail") public void testListAccounts() throws Exception { - FluentIterable accounts = api.listDomain(testDomain); + FluentIterable accounts = emailAccountApi.listDomain(testDomain); assertTrue(accounts.size() >= 1); } @Test(dependsOnMethods = "testCreateEmail") public void testUpdateAccount() throws Exception { - FluentIterable accounts = api.listDomain(testDomain); + FluentIterable accounts = emailAccountApi.listDomain(testDomain); for (EmailAccount account : accounts) { if (account.getAccount().equals("test@" + testDomain)) { assertTrue(account.isAntiVirus()); } } - api.update("test@" + testDomain, UpdateAccountOptions.Builder.antiVirus(false)); + emailAccountApi.update("test@" + testDomain, UpdateAccountOptions.Builder.antiVirus(false)); - accounts = api.listDomain(testDomain); + accounts = emailAccountApi.listDomain(testDomain); for (EmailAccount account : accounts) { if (account.getAccount().equals("test@" + testDomain)) { assertFalse(account.isAntiVirus()); diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/features/IpApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/features/IpApiLiveTest.java index aa6c5c359c..99897c7981 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/features/IpApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/features/IpApiLiveTest.java @@ -50,41 +50,41 @@ public class IpApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { @BeforeClass(groups = { "integration", "live" }) @Override - public void setupContext() { - super.setupContext(); - api = gleContext.getApi().getIpApi(); + public void setup() { + super.setup(); + ipApi = api.getIpApi(); } @AfterClass(groups = { "integration", "live" }) @Override - public void tearDownContext() { + public void tearDown() { if (reservedIp != null) { - api.release(reservedIp.getAddress()); + ipApi.release(reservedIp.getAddress()); } - super.tearDownContext(); + super.tearDown(); } - private IpApi api; + private IpApi ipApi; private IpDetails reservedIp; @Test public void testListFree() throws Exception { - FluentIterable freeIps = api.listFree(4, "Falkenberg", "Xen"); + FluentIterable freeIps = ipApi.listFree(4, "Falkenberg", "Xen"); assertFalse(freeIps.isEmpty()); } @Test public void reserveIp() throws Exception { - FluentIterable openVzIps = api.listFree(4, "Falkenberg", "OpenVZ"); + FluentIterable openVzIps = ipApi.listFree(4, "Falkenberg", "OpenVZ"); assertFalse(openVzIps.isEmpty()); - reservedIp = api.take(Iterables.get(openVzIps, 0)); + reservedIp = ipApi.take(Iterables.get(openVzIps, 0)); assertTrue(reservedIp.isReserved()); checkOpenVZDefailsInFalkenberg(reservedIp); } @Test(dependsOnMethods = "reserveIp") public void reserveAndReleaseIp() throws Exception { - IpDetails details = api.release(reservedIp.getAddress()); + IpDetails details = ipApi.release(reservedIp.getAddress()); assertEquals(details.getAddress(), reservedIp.getAddress()); assertFalse(details.isReserved()); @@ -94,21 +94,21 @@ public class IpApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { @Test(dependsOnMethods = "reserveIp") public void testList() throws Exception { - FluentIterable ownIps = api.list(); + FluentIterable ownIps = ipApi.list(); assertTrue(ownIps.contains(reservedIp)); - ownIps = api.list(ListIpOptions.Builder.datacenter(reservedIp.getDatacenter())); + ownIps = ipApi.list(ListIpOptions.Builder.datacenter(reservedIp.getDatacenter())); assertTrue(ownIps.contains(reservedIp)); - ownIps = api.list(ListIpOptions.Builder.platform(reservedIp.getPlatform())); + ownIps = ipApi.list(ListIpOptions.Builder.platform(reservedIp.getPlatform())); assertTrue(ownIps.contains(reservedIp)); - ownIps = api.list(ListIpOptions.Builder.ipVersion(reservedIp.getVersion())); + ownIps = ipApi.list(ListIpOptions.Builder.ipVersion(reservedIp.getVersion())); assertTrue(ownIps.contains(reservedIp)); - ownIps = api.list(ListIpOptions.Builder.datacenter(reservedIp.getDatacenter()), + ownIps = ipApi.list(ListIpOptions.Builder.datacenter(reservedIp.getDatacenter()), ListIpOptions.Builder.platform(reservedIp.getPlatform()), ListIpOptions.Builder.ipVersion(reservedIp.getVersion())); assertTrue(ownIps.contains(reservedIp)); - ownIps = api.list(ListIpOptions.Builder.serverId("xmthisisnotaserverid")); + ownIps = ipApi.list(ListIpOptions.Builder.serverId("xmthisisnotaserverid")); assertTrue(ownIps.isEmpty()); } @@ -123,20 +123,20 @@ public class IpApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { @Test public void testGetOpenVZDetails() throws Exception { - FluentIterable openVzIps = api.listFree(4, "Falkenberg", "OpenVZ"); + FluentIterable openVzIps = ipApi.listFree(4, "Falkenberg", "OpenVZ"); assertFalse(openVzIps.isEmpty()); String openVzIp = openVzIps.iterator().next(); - IpDetails ipDetails = api.get(openVzIp); + IpDetails ipDetails = ipApi.get(openVzIp); checkOpenVZDefailsInFalkenberg(ipDetails); assertEquals(ipDetails.getAddress(), openVzIp); } @Test public void testGetXenDetails() throws Exception { - FluentIterable xenVzIps = api.listFree(4, "Falkenberg", "Xen"); + FluentIterable xenVzIps = ipApi.listFree(4, "Falkenberg", "Xen"); assertFalse(xenVzIps.isEmpty()); String xenIp = xenVzIps.iterator().next(); - IpDetails ipDetails = api.get(xenIp); + IpDetails ipDetails = ipApi.get(xenIp); assertEquals(ipDetails.getDatacenter(), "Falkenberg"); assertEquals(ipDetails.getPlatform(), "Xen"); assertEquals(ipDetails.getVersion(), 4); @@ -152,42 +152,42 @@ public class IpApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { public void testPtrSetReset() throws Exception { IpDetails original = reservedIp; - IpDetails modified = api.setPtr(reservedIp.getAddress(), "wibble."); - IpDetails modified2 = api.get(reservedIp.getAddress()); + IpDetails modified = ipApi.setPtr(reservedIp.getAddress(), "wibble."); + IpDetails modified2 = ipApi.get(reservedIp.getAddress()); assertEquals(modified.getPtr(), "wibble."); assertEquals(modified2, modified); - reservedIp = api.resetPtr(reservedIp.getAddress()); + reservedIp = ipApi.resetPtr(reservedIp.getAddress()); assertEquals(reservedIp, original); } @Test(dependsOnMethods = "reserveIp") public void testAddRemove() throws Exception { - IpDetails added = api.addToServer(reservedIp.getAddress(), serverId); + IpDetails added = ipApi.addToServer(reservedIp.getAddress(), serverId); assertEquals(added.getAddress(), reservedIp.getAddress()); assertEquals(added.getPtr(), reservedIp.getPtr()); assertEquals(added.getServerId(), serverId); - IpDetails again = api.get(reservedIp.getAddress()); + IpDetails again = ipApi.get(reservedIp.getAddress()); assertEquals(again, added); - IpDetails removed = api.removeFromServer(reservedIp.getAddress(), serverId); + IpDetails removed = ipApi.removeFromServer(reservedIp.getAddress(), serverId); assertEquals(removed, added.toBuilder().serverId(null).build()); assertEquals(removed, reservedIp); - Set openVzIps = Sets.newHashSet(api.listFree(4, "Falkenberg", "OpenVZ")); + Set openVzIps = Sets.newHashSet(ipApi.listFree(4, "Falkenberg", "OpenVZ")); openVzIps.remove(reservedIp.getAddress()); assertFalse(openVzIps.isEmpty()); - added = api.addToServer(reservedIp.getAddress(), serverId); + added = ipApi.addToServer(reservedIp.getAddress(), serverId); assertEquals(added.getServerId(), serverId); - removed = api.removeFromServerAndRelease(reservedIp.getAddress(), serverId); + removed = ipApi.removeFromServerAndRelease(reservedIp.getAddress(), serverId); assertNull(removed.getServerId()); assertFalse(removed.isReserved()); diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiLiveTest.java index da9911a485..4a55697123 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiLiveTest.java @@ -61,22 +61,22 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { @BeforeClass(groups = { "integration", "live" }) @Override - public void setupContext() { + public void setup() { hostName = hostName + "-server"; - super.setupContext(); - api = gleContext.getApi().getServerApi(); + super.setup(); + serverApi = api.getServerApi(); } @AfterClass(groups = { "integration", "live" }) @Override - public void tearDownContext() { + public void tearDown() { if (testServerId2 != null) { - api.destroy(testServerId2, DestroyServerOptions.Builder.discardIp()); + serverApi.destroy(testServerId2, DestroyServerOptions.Builder.discardIp()); } - super.tearDownContext(); + super.tearDown(); } - private ServerApi api; + private ServerApi serverApi; private String testServerId2; @BeforeMethod @@ -86,7 +86,7 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { @Test public void testAllowedArguments() throws Exception { - Map templates = api.getAllowedArgumentsForCreateByPlatform(); + Map templates = serverApi.getAllowedArgumentsForCreateByPlatform(); assertTrue(templates.containsKey("OpenVZ")); assertTrue(templates.containsKey("Xen")); @@ -108,7 +108,7 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { } public void testListTemplates() throws Exception { - FluentIterable oSTemplates = api.listTemplates(); + FluentIterable oSTemplates = serverApi.listTemplates(); for(OSTemplate oSTemplate : oSTemplates) { checkTemplate(oSTemplate); @@ -126,12 +126,12 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { } public void testListServers() throws Exception { - FluentIterable response = api.list(); + FluentIterable response = serverApi.list(); assertNotNull(response); assertTrue(response.size() > 0); for (Server server : response) { - ServerDetails newDetails = api.get(server.getId()); + ServerDetails newDetails = serverApi.get(server.getId()); assertEquals(newDetails.getId(), server.getId()); assertEquals(newDetails.getHostname(), server.getHostname()); assertEquals(newDetails.getPlatform(), server.getPlatform()); @@ -141,7 +141,7 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { } public void testServerDetails() throws Exception { - ServerDetails details = api.get(serverId); + ServerDetails details = serverApi.get(serverId); checkServer(details); assertEquals("Ubuntu 10.04 LTS 32-bit", details.getTemplateName()); assertEquals("Falkenberg", details.getDatacenter()); @@ -153,22 +153,22 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { } public void testServerStatus() throws Exception { - ServerStatus newStatus = api.getStatus(serverId); + ServerStatus newStatus = serverApi.getStatus(serverId); checkStatus(newStatus); } public void testUpdateServer() throws Exception { - ServerDetails edited = api.update(serverId, UpdateServerOptions.Builder.description("this is a different description!")); + ServerDetails edited = serverApi.update(serverId, UpdateServerOptions.Builder.description("this is a different description!")); assertEquals(edited.getDescription(), "this is a different description!"); - edited = api.update(serverId, UpdateServerOptions.Builder.description("another description!").hostname("host-name1")); + edited = serverApi.update(serverId, UpdateServerOptions.Builder.description("another description!").hostname("host-name1")); assertEquals(edited.getDescription(), "another description!"); assertEquals(edited.getHostname(), "host-name1"); - edited = api.resetPassword(serverId, "anotherpass"); + edited = serverApi.resetPassword(serverId, "anotherpass"); assertEquals(edited.getHostname(), "host-name1"); - edited = api.update(serverId, UpdateServerOptions.Builder.hostname(hostName)); + edited = serverApi.update(serverId, UpdateServerOptions.Builder.hostname(hostName)); assertEquals(edited.getHostname(), hostName); } @@ -176,7 +176,7 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { public void testRebootServer() throws Exception { assertTrue(serverStatusChecker.apply(Server.State.RUNNING)); - api.reboot(serverId); + serverApi.reboot(serverId); assertTrue(serverStatusChecker.apply(Server.State.RUNNING)); } @@ -185,17 +185,17 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { public void testStopAndStartServer() throws Exception { assertTrue(serverStatusChecker.apply(Server.State.RUNNING)); - api.stop(serverId); + serverApi.stop(serverId); assertTrue(serverStatusChecker.apply(Server.State.STOPPED)); - api.start(serverId); + serverApi.start(serverId); assertTrue(serverStatusChecker.apply(Server.State.RUNNING)); } public void testServerLimits() throws Exception { - Map limits = api.getLimits(serverId); + Map limits = serverApi.getLimits(serverId); assertNotNull(limits); for (Map.Entry entry : limits.entrySet()) { assertNotNull(entry.getKey()); @@ -211,16 +211,16 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { public void testResourceUsage() throws Exception { // test server has only been in existence for less than a minute - check all servers - for (Server server : api.list()) { + for (Server server : serverApi.list()) { try { - ResourceUsage usage = api.getResourceUsage(server.getId(), "diskioread", "minute"); + ResourceUsage usage = serverApi.getResourceUsage(server.getId(), "diskioread", "minute"); assertEquals(usage.getInfo().getResource(), "diskioread"); assertEquals(usage.getInfo().getResolution(), "minute"); } catch (UnsupportedOperationException e) { } try { - ResourceUsage usage = api.getResourceUsage(server.getId(), "cpuusage", "minute"); + ResourceUsage usage = serverApi.getResourceUsage(server.getId(), "cpuusage", "minute"); assertEquals(usage.getInfo().getResource(), "cpuusage"); assertEquals(usage.getInfo().getResolution(), "minute"); } catch (UnsupportedOperationException e) { @@ -230,7 +230,7 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { } public void testConsole() throws Exception { - Console console = api.getConsole(serverId); + Console console = serverApi.getConsole(serverId); assertNotNull(console); assertNotNull(console.getHost()); assertTrue(console.getPort() > 0 && console.getPort() < 65537); @@ -240,7 +240,7 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { // takes a few minutes and requires an extra server (used 1 already) @Test(enabled=false) public void testCloneServer() throws Exception { - ServerDetails testServer2 = api.clone(serverId, testHostName2, CloneServerOptions.Builder.cpucores(1)); + ServerDetails testServer2 = serverApi.clone(serverId, testHostName2, CloneServerOptions.Builder.cpucores(1)); assertNotNull(testServer2.getId()); assertEquals(testServer2.getHostname(), "jclouds-test2"); @@ -248,19 +248,19 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { testServerId2 = testServer2.getId(); - Predicate cloneChecker = statusChecker(api, testServerId2); + Predicate cloneChecker = statusChecker(serverApi, testServerId2); assertTrue(cloneChecker.apply(Server.State.STOPPED)); - api.start(testServer2.getId()); + serverApi.start(testServer2.getId()); // TODO ServerStatus==STOPPED suggests the previous call to start should have worked cloneChecker = retry(new Predicate() { public boolean apply(Server.State value) { - ServerStatus status = api.getStatus(testServerId2, ServerStatusOptions.Builder.state()); + ServerStatus status = serverApi.getStatus(testServerId2, ServerStatusOptions.Builder.state()); if (status.getState() == value) { return true; } - api.start(testServerId2); + serverApi.start(testServerId2); return false; } }, 600, 30, SECONDS); diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiLiveTest.java index 0a769ed8fa..3ee1cc7efa 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiLiveTest.java @@ -22,12 +22,9 @@ import static java.util.concurrent.TimeUnit.SECONDS; import static org.jclouds.util.Predicates2.retry; import static org.testng.Assert.assertTrue; -import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.glesys.GleSYSApi; -import org.jclouds.glesys.GleSYSAsyncApi; import org.jclouds.glesys.features.DomainApi; -import org.jclouds.rest.RestContext; -import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Predicate; @@ -38,24 +35,15 @@ import com.google.common.base.Predicate; * @author Adrian Cole, Adam Lowe */ @Test(groups = "live") -public class BaseGleSYSApiLiveTest extends BaseComputeServiceContextLiveTest { +public class BaseGleSYSApiLiveTest extends BaseApiLiveTest { protected String hostName = System.getProperty("user.name").replace('.','-').toLowerCase(); - protected RestContext gleContext; - public BaseGleSYSApiLiveTest() { provider = "glesys"; } - @BeforeClass(groups = { "integration", "live" }) - @Override - public void setupContext() { - super.setupContext(); - gleContext = view.unwrap(); - } - protected void createDomain(String domain) { - final DomainApi api = gleContext.getApi().getDomainApi(); + final DomainApi api = this.api.getDomainApi(); int before = api.list().size(); api.create(domain); diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiWithAServerLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiWithAServerLiveTest.java index 43257e901d..4f50a2a9df 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiWithAServerLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiWithAServerLiveTest.java @@ -60,21 +60,21 @@ public class BaseGleSYSApiWithAServerLiveTest extends BaseGleSYSApiLiveTest { @BeforeClass(groups = { "integration", "live" }) @Override - public void setupContext() { + public void setup() { assertNull(serverId, "This method should be called EXACTLY once per run"); - super.setupContext(); + super.setup(); serverStatusChecker = createServer(hostName); } @AfterClass(groups = { "integration", "live" }) @Override - public void tearDownContext() { - gleContext.getApi().getServerApi().destroy(serverId, DestroyServerOptions.Builder.discardIp()); - super.tearDownContext(); + public void tearDown() { + api.getServerApi().destroy(serverId, DestroyServerOptions.Builder.discardIp()); + super.tearDown(); } protected void createDomain(String domain) { - final DomainApi api = gleContext.getApi().getDomainApi(); + final DomainApi api = this.api.getDomainApi(); int before = api.list().size(); api.create(domain); Predicate result = retry(new Predicate() { @@ -86,7 +86,7 @@ public class BaseGleSYSApiWithAServerLiveTest extends BaseGleSYSApiLiveTest { } protected Predicate createServer(String hostName) { - final ServerApi api = gleContext.getApi().getServerApi(); + final ServerApi api = this.api.getServerApi(); ServerDetails testServer = api.createWithHostnameAndRootPassword( ServerSpec.builder().datacenter("Falkenberg").platform("OpenVZ").templateName("Ubuntu 10.04 LTS 32-bit") diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.java index a3ad958832..ae118fc1f3 100644 --- a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.java +++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.java @@ -18,6 +18,8 @@ */ package org.jclouds.gogrid; +import java.io.Closeable; + import org.jclouds.gogrid.services.GridImageAsyncClient; import org.jclouds.gogrid.services.GridIpAsyncClient; import org.jclouds.gogrid.services.GridJobAsyncClient; @@ -28,7 +30,7 @@ import org.jclouds.rest.annotations.Delegate; /** * @author Oleksiy Yarmula */ -public interface GoGridAsyncClient { +public interface GoGridAsyncClient extends Closeable { public static final String VERSION = "1.5"; /** diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridClient.java index 4002061396..ca670dc6b4 100644 --- a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridClient.java +++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridClient.java @@ -18,6 +18,8 @@ */ package org.jclouds.gogrid; +import java.io.Closeable; + import org.jclouds.gogrid.services.GridImageClient; import org.jclouds.gogrid.services.GridIpClient; import org.jclouds.gogrid.services.GridJobClient; @@ -28,7 +30,7 @@ import org.jclouds.rest.annotations.Delegate; /** * @author Oleksiy Yarmula */ -public interface GoGridClient { +public interface GoGridClient extends Closeable { /** * Services with methods, related to managing servers diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridLiveTestDisabled.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridLiveTestDisabled.java index 5e5b54a5a5..dcf6a1ca4d 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridLiveTestDisabled.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/GoGridLiveTestDisabled.java @@ -34,7 +34,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.domain.Credentials; import org.jclouds.domain.LoginCredentials; import org.jclouds.gogrid.domain.Ip; @@ -54,8 +54,6 @@ import org.jclouds.gogrid.predicates.LoadBalancerLatestJobCompleted; import org.jclouds.gogrid.predicates.ServerLatestJobCompleted; import org.jclouds.javax.annotation.Nullable; import org.jclouds.predicates.SocketOpen; -import org.jclouds.rest.RestContext; -import org.jclouds.ssh.SshClient; import org.testng.SkipException; import org.testng.TestException; import org.testng.annotations.AfterTest; @@ -66,6 +64,7 @@ import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.net.HostAndPort; +import com.google.inject.Guice; /** * End to end live test for GoGrid @@ -75,14 +74,12 @@ import com.google.common.net.HostAndPort; * @author Oleksiy Yarmula */ @Test(enabled = false, groups = "live", singleThreaded = true, testName = "GoGridLiveTestDisabled") -public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { +public class GoGridLiveTestDisabled extends BaseApiLiveTest { public GoGridLiveTestDisabled() { provider = "gogrid"; } - private GoGridClient client; - private Predicate serverLatestJobCompleted; private Predicate loadBalancerLatestJobCompleted; /** @@ -91,17 +88,13 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { private List serversToDeleteAfterTheTests = Lists.newArrayList(); private List loadBalancersToDeleteAfterTest = Lists.newArrayList(); - private RestContext gocontext; @BeforeGroups(groups = { "integration", "live" }) @Override - public void setupContext() { - super.setupContext(); - gocontext = view.unwrap(); - - client = gocontext.getApi(); - serverLatestJobCompleted = retry(new ServerLatestJobCompleted(client.getJobServices()), 800, 20, SECONDS); - loadBalancerLatestJobCompleted = retry(new LoadBalancerLatestJobCompleted(client.getJobServices()), 800, 20, + public void setup() { + super.setup(); + serverLatestJobCompleted = retry(new ServerLatestJobCompleted(api.getJobServices()), 800, 20, SECONDS); + loadBalancerLatestJobCompleted = retry(new LoadBalancerLatestJobCompleted(api.getJobServices()), 800, 20, SECONDS); } @@ -110,10 +103,10 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { final String nameOfServer = "Description" + String.valueOf(new Date().getTime()).substring(6); serversToDeleteAfterTheTests.add(nameOfServer); - Set availableIps = client.getIpServices().getUnassignedPublicIpList(); + Set availableIps = api.getIpServices().getUnassignedPublicIpList(); Ip availableIp = Iterables.getLast(availableIps); - String ram = Iterables.get(client.getServerServices().getRamSizes(), 0).getName(); + String ram = Iterables.get(api.getServerServices().getRamSizes(), 0).getName(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < 500; i++) @@ -121,13 +114,13 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { String description = builder.toString(); - Server createdServer = client.getServerServices().addServer(nameOfServer, + Server createdServer = api.getServerServices().addServer(nameOfServer, "GSI-f8979644-e646-4711-ad58-d98a5fa3612c", ram, availableIp.getIp(), new AddServerOptions().withDescription(description)); assertNotNull(createdServer); assert serverLatestJobCompleted.apply(createdServer); - assertEquals(Iterables.getLast(client.getServerServices().getServersByName(nameOfServer)).getDescription(), + assertEquals(Iterables.getLast(api.getServerServices().getServersByName(nameOfServer)).getDescription(), description); } @@ -137,49 +130,49 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { */ @Test(enabled = true) public void testServerLifecycle() { - int serverCountBeforeTest = client.getServerServices().getServerList().size(); + int serverCountBeforeTest = api.getServerServices().getServerList().size(); final String nameOfServer = "Server" + String.valueOf(new Date().getTime()).substring(6); serversToDeleteAfterTheTests.add(nameOfServer); - Set availableIps = client.getIpServices().getUnassignedPublicIpList(); + Set availableIps = api.getIpServices().getUnassignedPublicIpList(); Ip availableIp = Iterables.getLast(availableIps); - String ram = Iterables.get(client.getServerServices().getRamSizes(), 0).getName(); + String ram = Iterables.get(api.getServerServices().getRamSizes(), 0).getName(); - Server createdServer = client.getServerServices().addServer(nameOfServer, + Server createdServer = api.getServerServices().addServer(nameOfServer, "GSI-f8979644-e646-4711-ad58-d98a5fa3612c", ram, availableIp.getIp()); assertNotNull(createdServer); assert serverLatestJobCompleted.apply(createdServer); // get server by name - Set response = client.getServerServices().getServersByName(nameOfServer); + Set response = api.getServerServices().getServersByName(nameOfServer); assert (response.size() == 1); // restart the server - client.getServerServices().power(nameOfServer, PowerCommand.RESTART); + api.getServerServices().power(nameOfServer, PowerCommand.RESTART); - Set jobs = client.getJobServices().getJobsForObjectName(nameOfServer); + Set jobs = api.getJobServices().getJobsForObjectName(nameOfServer); assert ("RestartVirtualServer".equals(Iterables.getLast(jobs).getCommand().getName())); assert serverLatestJobCompleted.apply(createdServer); - int serverCountAfterAddingOneServer = client.getServerServices().getServerList().size(); + int serverCountAfterAddingOneServer = api.getServerServices().getServerList().size(); assert serverCountAfterAddingOneServer == serverCountBeforeTest + 1 : "There should be +1 increase in the number of servers since the test started"; // delete the server - client.getServerServices().deleteByName(nameOfServer); + api.getServerServices().deleteByName(nameOfServer); - jobs = client.getJobServices().getJobsForObjectName(nameOfServer); + jobs = api.getJobServices().getJobsForObjectName(nameOfServer); assert ("DeleteVirtualServer".equals(Iterables.getLast(jobs).getCommand().getName())); assert serverLatestJobCompleted.apply(createdServer); - int serverCountAfterDeletingTheServer = client.getServerServices().getServerList().size(); + int serverCountAfterDeletingTheServer = api.getServerServices().getServerList().size(); assert serverCountAfterDeletingTheServer == serverCountBeforeTest : "There should be the same # of servers as since the test started"; // make sure that IP is put back to "unassigned" - assert client.getIpServices().getUnassignedIpList().contains(availableIp); + assert api.getIpServices().getUnassignedIpList().contains(availableIp); } /** @@ -191,24 +184,24 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { final String nameOfServer = "Server" + String.valueOf(new Date().getTime()).substring(6); serversToDeleteAfterTheTests.add(nameOfServer); - Set availableIps = client.getIpServices().getUnassignedPublicIpList(); + Set availableIps = api.getIpServices().getUnassignedPublicIpList(); - String ram = Iterables.get(client.getServerServices().getRamSizes(), 0).getName(); + String ram = Iterables.get(api.getServerServices().getRamSizes(), 0).getName(); - Server createdServer = client.getServerServices().addServer(nameOfServer, + Server createdServer = api.getServerServices().addServer(nameOfServer, "GSI-f8979644-e646-4711-ad58-d98a5fa3612c", ram, Iterables.getLast(availableIps).getIp()); assert serverLatestJobCompleted.apply(createdServer); // restart the server - client.getServerServices().power(nameOfServer, PowerCommand.RESTART); + api.getServerServices().power(nameOfServer, PowerCommand.RESTART); - Set jobs = client.getJobServices().getJobsForObjectName(nameOfServer); + Set jobs = api.getJobServices().getJobsForObjectName(nameOfServer); Job latestJob = Iterables.getLast(jobs); Long latestJobId = latestJob.getId(); - Job latestJobFetched = Iterables.getOnlyElement(client.getJobServices().getJobsById(latestJobId)); + Job latestJobFetched = Iterables.getOnlyElement(api.getJobServices().getJobsById(latestJobId)); assert latestJob.equals(latestJobFetched) : "Job and its representation found by ID don't match"; @@ -218,13 +211,13 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { idsOfAllJobs[i++] = job.getId(); } - Set jobsFetched = client.getJobServices().getJobsById(idsOfAllJobs); + Set jobsFetched = api.getJobServices().getJobsById(idsOfAllJobs); assert jobsFetched.size() == jobs.size() : format( "Number of jobs fetched by ids doesn't match the number of jobs " + "requested. Requested/expected: %d. Found: %d.", jobs.size(), jobsFetched.size()); // delete the server - client.getServerServices().deleteByName(nameOfServer); + api.getServerServices().deleteByName(nameOfServer); } /** @@ -232,12 +225,12 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { */ @Test(enabled = true) public void testLoadBalancerLifecycle() { - int lbCountBeforeTest = client.getLoadBalancerServices().getLoadBalancerList().size(); + int lbCountBeforeTest = api.getLoadBalancerServices().getLoadBalancerList().size(); final String nameOfLoadBalancer = "LoadBalancer" + String.valueOf(new Date().getTime()).substring(6); loadBalancersToDeleteAfterTest.add(nameOfLoadBalancer); - Set availableIps = client.getIpServices().getUnassignedPublicIpList(); + Set availableIps = api.getIpServices().getUnassignedPublicIpList(); if (availableIps.size() < 4) throw new SkipException("Not enough available IPs (4 needed) to run the test"); @@ -249,7 +242,7 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { AddLoadBalancerOptions options = new AddLoadBalancerOptions.Builder().create(LoadBalancerType.LEAST_CONNECTED, LoadBalancerPersistenceType.SOURCE_ADDRESS); - LoadBalancer createdLoadBalancer = client.getLoadBalancerServices().addLoadBalancer(nameOfLoadBalancer, + LoadBalancer createdLoadBalancer = api.getLoadBalancerServices().addLoadBalancer(nameOfLoadBalancer, IpPortPair.builder().ip(vip).port(80).build(), Arrays.asList(IpPortPair.builder().ip(realIp1).port(80).build(), IpPortPair.builder().ip(realIp2).port(80).build()), options); @@ -257,7 +250,7 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { assert loadBalancerLatestJobCompleted.apply(createdLoadBalancer); // get load balancer by name - Set response = client.getLoadBalancerServices().getLoadBalancersByName(nameOfLoadBalancer); + Set response = api.getLoadBalancerServices().getLoadBalancersByName(nameOfLoadBalancer); assert (response.size() == 1); createdLoadBalancer = Iterables.getOnlyElement(response); assertNotNull(createdLoadBalancer.getRealIpList()); @@ -265,25 +258,25 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { assertNotNull(createdLoadBalancer.getVirtualIp()); assertEquals(createdLoadBalancer.getVirtualIp().getIp().getIp(), vip.getIp()); - LoadBalancer editedLoadBalancer = client.getLoadBalancerServices().editLoadBalancerNamed(nameOfLoadBalancer, + LoadBalancer editedLoadBalancer = api.getLoadBalancerServices().editLoadBalancerNamed(nameOfLoadBalancer, Arrays.asList(IpPortPair.builder().ip(realIp3).port(8181).build())); assert loadBalancerLatestJobCompleted.apply(editedLoadBalancer); assertNotNull(editedLoadBalancer.getRealIpList()); assertEquals(editedLoadBalancer.getRealIpList().size(), 1); assertEquals(Iterables.getOnlyElement(editedLoadBalancer.getRealIpList()).getIp().getIp(), realIp3.getIp()); - int lbCountAfterAddingOneServer = client.getLoadBalancerServices().getLoadBalancerList().size(); + int lbCountAfterAddingOneServer = api.getLoadBalancerServices().getLoadBalancerList().size(); assert lbCountAfterAddingOneServer == lbCountBeforeTest + 1 : "There should be +1 increase in the number of load balancers since the test started"; // delete the load balancer - client.getLoadBalancerServices().deleteByName(nameOfLoadBalancer); + api.getLoadBalancerServices().deleteByName(nameOfLoadBalancer); - Set jobs = client.getJobServices().getJobsForObjectName(nameOfLoadBalancer); + Set jobs = api.getJobServices().getJobsForObjectName(nameOfLoadBalancer); assert ("DeleteLoadBalancer".equals(Iterables.getLast(jobs).getCommand().getName())); assert loadBalancerLatestJobCompleted.apply(createdLoadBalancer); - int lbCountAfterDeletingTheServer = client.getLoadBalancerServices().getLoadBalancerList().size(); + int lbCountAfterDeletingTheServer = api.getLoadBalancerServices().getLoadBalancerList().size(); assert lbCountAfterDeletingTheServer == lbCountBeforeTest : "There should be the same # of load balancers as since the test started"; } @@ -293,7 +286,7 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { @Test(enabled = true) public void testImageLifecycle() { GetImageListOptions options = GetImageListOptions.Builder.publicDatabaseServers(); - Set images = client.getImageServices().getImageList(options); + Set images = api.getImageServices().getImageList(options); Predicate isDatabaseServer = new Predicate() { @Override @@ -306,11 +299,11 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { ServerImage image = Iterables.getLast(images); ServerImage imageFromServer = Iterables - .getOnlyElement(client.getImageServices().getImagesByName(image.getName())); + .getOnlyElement(api.getImageServices().getImagesByName(image.getName())); assertEquals(image, imageFromServer); try { - client.getImageServices().editImageDescription(image.getName(), "newDescription"); + api.getImageServices().editImageDescription(image.getName(), "newDescription"); throw new TestException("An exception hasn't been thrown where expected; expected GoGridResponseException"); } catch (GoGridResponseException e) { // expected situation - check and proceed @@ -324,46 +317,39 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { final String nameOfServer = "Server" + String.valueOf(new Date().getTime()).substring(6); serversToDeleteAfterTheTests.add(nameOfServer); - Set availableIps = client.getIpServices().getUnassignedIpList(); + Set availableIps = api.getIpServices().getUnassignedIpList(); Ip availableIp = Iterables.getLast(availableIps); - Server createdServer = client.getServerServices().addServer(nameOfServer, + Server createdServer = api.getServerServices().addServer(nameOfServer, "GSI-f8979644-e646-4711-ad58-d98a5fa3612c", "1", availableIp.getIp()); assertNotNull(createdServer); assert serverLatestJobCompleted.apply(createdServer); // get server by name - Set response = client.getServerServices().getServersByName(nameOfServer); + Set response = api.getServerServices().getServersByName(nameOfServer); assert (response.size() == 1); createdServer = Iterables.getOnlyElement(response); - Map credsMap = client.getServerServices().getServerCredentialsList(); + Map credsMap = api.getServerServices().getServerCredentialsList(); LoginCredentials instanceCredentials = LoginCredentials.fromCredentials(credsMap.get(createdServer.getName())); assertNotNull(instanceCredentials); HostAndPort socket = HostAndPort.fromParts(createdServer.getIp().getIp(), 22); - SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class); + SocketOpen socketOpen = Guice.createInjector().getInstance(SocketOpen.class); Predicate socketTester = retry(socketOpen, 180, 5, SECONDS); socketTester.apply(socket); - SshClient sshClient = gocontext.utils().injector().getInstance(SshClient.Factory.class).create(socket, instanceCredentials); - sshClient.connect(); - String output = sshClient.exec("df").getOutput(); - assertTrue(output.contains("Filesystem"), - "The output should've contained filesystem information, but it didn't. Output: " + output); - sshClient.disconnect(); - // check that the get credentials call is the same as this - assertEquals(client.getServerServices().getServerCredentials(createdServer.getId()), instanceCredentials); + assertEquals(api.getServerServices().getServerCredentials(createdServer.getId()), instanceCredentials); try { - assertEquals(client.getServerServices().getServerCredentials(Long.MAX_VALUE), null); + assertEquals(api.getServerServices().getServerCredentials(Long.MAX_VALUE), null); } catch (AssertionError e) { e.printStackTrace(); } // delete the server - client.getServerServices().deleteByName(nameOfServer); + api.getServerServices().deleteByName(nameOfServer); } /** @@ -373,19 +359,17 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest { public void cleanup() { for (String serverName : serversToDeleteAfterTheTests) { try { - client.getServerServices().deleteByName(serverName); + api.getServerServices().deleteByName(serverName); } catch (Exception e) { // it's already been deleted - proceed } } for (String loadBalancerName : loadBalancersToDeleteAfterTest) { try { - client.getLoadBalancerServices().deleteByName(loadBalancerName); + api.getLoadBalancerServices().deleteByName(loadBalancerName); } catch (Exception e) { // it's already been deleted - proceed } } - } - } diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/compute/GoGridComputeServiceLiveTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/compute/GoGridComputeServiceLiveTest.java index 2210cb523c..3bbeb08f65 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/compute/GoGridComputeServiceLiveTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/compute/GoGridComputeServiceLiveTest.java @@ -18,6 +18,8 @@ */ package org.jclouds.gogrid.compute; +import static com.google.common.collect.Iterables.get; +import static com.google.common.collect.Iterables.getLast; import static com.google.common.collect.Iterables.getOnlyElement; import static java.util.concurrent.TimeUnit.SECONDS; import static org.jclouds.compute.predicates.NodePredicates.inGroup; @@ -28,17 +30,14 @@ import static org.testng.Assert.assertNotNull; import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.internal.BaseComputeServiceLiveTest; -import org.jclouds.gogrid.GoGridAsyncClient; import org.jclouds.gogrid.GoGridClient; import org.jclouds.gogrid.domain.Server; import org.jclouds.gogrid.predicates.ServerLatestJobCompleted; -import org.jclouds.rest.RestContext; import org.jclouds.sshj.config.SshjSshClientModule; import org.testng.annotations.Test; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; import com.google.inject.Module; /** @@ -71,26 +70,25 @@ public class GoGridComputeServiceLiveTest extends BaseComputeServiceLiveTest { public void testResizeRam() throws Exception { String group = this.group + "ram"; - RestContext providerContext = view.unwrap(); + GoGridClient api = view.utils().injector().getInstance(GoGridClient.class); try { client.destroyNodesMatching(inGroup(group)); } catch (Exception e) { } - Predicate serverLatestJobCompleted = retry(new ServerLatestJobCompleted(providerContext.getApi() + Predicate serverLatestJobCompleted = retry(new ServerLatestJobCompleted(api .getJobServices()), 800, 20, SECONDS); - String ram = Iterables.get(providerContext.getApi().getServerServices().getRamSizes(), 1).getName(); + String ram = get(api.getServerServices().getRamSizes(), 1).getName(); try { NodeMetadata node = getOnlyElement(client.createNodesInGroup(group, 1)); - Server updatedServer = providerContext.getApi().getServerServices().editServerRam(Long.valueOf(node.getId()), ram); + Server updatedServer = api.getServerServices().editServerRam(Long.valueOf(node.getId()), ram); assertNotNull(updatedServer); assert serverLatestJobCompleted.apply(updatedServer); - assertEquals( - Iterables.getLast(providerContext.getApi().getServerServices().getServersById(Long.valueOf(node.getId()))) - .getRam().getName(), ram); + assertEquals(getLast(api.getServerServices().getServersById(Long.valueOf(node.getId()))).getRam().getName(), + ram); } finally { client.destroyNodesMatching(inGroup(group)); diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/BaseGoGridClientLiveTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/BaseGoGridClientLiveTest.java index 78f8e32141..a36fa5df61 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/BaseGoGridClientLiveTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/BaseGoGridClientLiveTest.java @@ -18,11 +18,8 @@ */ package org.jclouds.gogrid.services; -import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; -import org.jclouds.gogrid.GoGridAsyncClient; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.gogrid.GoGridClient; -import org.jclouds.rest.RestContext; -import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; /** @@ -31,20 +28,8 @@ import org.testng.annotations.Test; * @author Adrian Cole */ @Test(groups = "live", singleThreaded = true, testName = "BaseGoGridClientLiveTest") -public class BaseGoGridClientLiveTest extends BaseComputeServiceContextLiveTest { - +public class BaseGoGridClientLiveTest extends BaseApiLiveTest { public BaseGoGridClientLiveTest() { provider = "gogrid"; } - - protected RestContext restContext; - - @BeforeGroups(groups = { "integration", "live" }) - @Override - public void setupContext() { - super.setupContext(); - restContext = view.unwrap(); - } - - } diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridImageClientLiveTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridImageClientLiveTest.java index bd3152a4a7..78cad67f1e 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridImageClientLiveTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridImageClientLiveTest.java @@ -51,13 +51,13 @@ import com.google.common.collect.Iterables; public class GridImageClientLiveTest extends BaseGoGridClientLiveTest { public void testListImages() throws Exception { - Set response = restContext.getApi().getImageServices().getImageList(); + Set response = api.getImageServices().getImageList(); assert null != response; for (ServerImage image : response) { assert image.getId() >= 0 : image; checkImage(image); - ServerImage query = Iterables.getOnlyElement(restContext.getApi().getImageServices() + ServerImage query = Iterables.getOnlyElement(api.getImageServices() .getImagesById(image.getId())); assertEquals(query.getId(), image.getId()); @@ -86,21 +86,20 @@ public class GridImageClientLiveTest extends BaseGoGridClientLiveTest { @Test public void testSaveServerToImage() throws IOException { - Predicate serverLatestJobCompleted = retry(new ServerLatestJobCompleted(restContext.getApi() + Predicate serverLatestJobCompleted = retry(new ServerLatestJobCompleted(api .getJobServices()), 800, 20, SECONDS); final String nameOfServer = "Server" + String.valueOf(new Date().getTime()).substring(6); ServerImage image = null; try { - Set availableIps = restContext.getApi().getIpServices().getUnassignedPublicIpList(); + Set availableIps = api.getIpServices().getUnassignedPublicIpList(); Ip availableIp = Iterables.getLast(availableIps); - Server createdServer = restContext.getApi().getServerServices() + Server createdServer = api.getServerServices() .addServer(nameOfServer, "5489", "1", availableIp.getIp()); assertNotNull(createdServer); assert serverLatestJobCompleted.apply(createdServer); - image = restContext - .getApi() + image = api .getImageServices() .saveImageFromServer("friendlyName", createdServer.getName(), SaveImageOptions.Builder.withDescription("description")); @@ -111,7 +110,7 @@ public class GridImageClientLiveTest extends BaseGoGridClientLiveTest { assertEventuallyImageStateEquals(image, ServerImageState.AVAILABLE); - restContext.getApi().getImageServices().deleteById(image.getId()); + api.getImageServices().deleteById(image.getId()); assertEventuallyImageStateEquals(image, ServerImageState.TRASH); @@ -119,13 +118,13 @@ public class GridImageClientLiveTest extends BaseGoGridClientLiveTest { } finally { if (image != null) try { - restContext.getApi().getImageServices().deleteById(image.getId()); + api.getImageServices().deleteById(image.getId()); } catch (Exception e) { // not failing so that we can ensure server below deletes e.printStackTrace(); } // delete the server - restContext.getApi().getServerServices().deleteByName(nameOfServer); + api.getServerServices().deleteByName(nameOfServer); } } @@ -133,7 +132,7 @@ public class GridImageClientLiveTest extends BaseGoGridClientLiveTest { protected void assertEventuallyImageStateEquals(ServerImage image, final ServerImageState state) { assertTrue(retry(new Predicate() { public boolean apply(ServerImage input) { - return Iterables.getOnlyElement(restContext.getApi().getImageServices().getImagesById(input.getId())) + return Iterables.getOnlyElement(api.getImageServices().getImagesById(input.getId())) .getState() == state; } }, 600, 1, SECONDS).apply(image)); diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridJobClientLiveTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridJobClientLiveTest.java index 1f807aeed7..a05b25171b 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridJobClientLiveTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/services/GridJobClientLiveTest.java @@ -37,14 +37,14 @@ import com.google.common.collect.Iterables; public class GridJobClientLiveTest extends BaseGoGridClientLiveTest { public void testListJobs() throws Exception { - Set response = restContext.getApi().getJobServices().getJobList(GetJobListOptions.Builder.maxItems(10)); + Set response = api.getJobServices().getJobList(GetJobListOptions.Builder.maxItems(10)); assert null != response; assert response.size() <= 10 : response; for (Job job : response) { assert job.getId() >= 0 : job; checkJob(job); - Job query = Iterables.getOnlyElement(restContext.getApi().getJobServices().getJobsById(job.getId())); + Job query = Iterables.getOnlyElement(api.getJobServices().getJobsById(job.getId())); assertEquals(query.getId(), job.getId()); checkJob(query); diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.java index c301977b7a..dec8a607b9 100644 --- a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.java +++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.java @@ -18,6 +18,8 @@ */ package org.jclouds.softlayer; +import java.io.Closeable; + import org.jclouds.rest.annotations.Delegate; import org.jclouds.softlayer.features.AccountAsyncClient; import org.jclouds.softlayer.features.DatacenterAsyncClient; @@ -32,7 +34,7 @@ import org.jclouds.softlayer.features.VirtualGuestAsyncClient; * @see * @author Adrian Cole */ -public interface SoftLayerAsyncClient { +public interface SoftLayerAsyncClient extends Closeable { /** * Provides asynchronous access to VirtualGuest features. diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerClient.java index b7cc842267..4c0921937f 100644 --- a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerClient.java +++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerClient.java @@ -18,6 +18,8 @@ */ package org.jclouds.softlayer; +import java.io.Closeable; + import org.jclouds.rest.annotations.Delegate; import org.jclouds.softlayer.features.AccountClient; import org.jclouds.softlayer.features.DatacenterClient; @@ -32,7 +34,7 @@ import org.jclouds.softlayer.features.VirtualGuestClient; * @see * @author Adrian Cole */ -public interface SoftLayerClient { +public interface SoftLayerClient extends Closeable { /** * Provides synchronous access to VirtualGuest features. diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceAdapterLiveTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceAdapterLiveTest.java index 6f868a454c..1f23277f16 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceAdapterLiveTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceAdapterLiveTest.java @@ -21,38 +21,50 @@ package org.jclouds.softlayer.compute; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import java.util.Properties; import java.util.Random; import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials; import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.Template; +import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials; import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate; import org.jclouds.domain.LoginCredentials; +import org.jclouds.softlayer.SoftLayerClient; import org.jclouds.softlayer.compute.options.SoftLayerTemplateOptions; import org.jclouds.softlayer.compute.strategy.SoftLayerComputeServiceAdapter; import org.jclouds.softlayer.domain.ProductItem; import org.jclouds.softlayer.domain.VirtualGuest; import org.jclouds.softlayer.features.BaseSoftLayerClientLiveTest; import org.jclouds.ssh.SshClient; +import org.jclouds.ssh.SshClient.Factory; +import org.jclouds.sshj.config.SshjSshClientModule; import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.net.HostAndPort; import com.google.common.net.InetAddresses; +import com.google.inject.Injector; +import com.google.inject.Module; @Test(groups = "live", singleThreaded = true, testName = "SoftLayerComputeServiceAdapterLiveTest") public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerClientLiveTest { private SoftLayerComputeServiceAdapter adapter; + private TemplateBuilder templateBuilder; + private Factory sshFactory; private NodeAndInitialCredentials guest; - @BeforeGroups(groups = { "live" }) - public void setupContext() { - super.setupContext(); - adapter = view.utils().injector().getInstance(SoftLayerComputeServiceAdapter.class); + @Override + protected SoftLayerClient create(Properties props, Iterable modules) { + Injector injector = newBuilder().modules(modules).overrides(props).buildInjector(); + adapter = injector.getInstance(SoftLayerComputeServiceAdapter.class); + templateBuilder = injector.getInstance(TemplateBuilder.class); + sshFactory = injector.getInstance(SshClient.Factory.class); + return injector.getInstance(SoftLayerClient.class); } @Test @@ -67,8 +79,8 @@ public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerClientL public void testCreateNodeWithGroupEncodedIntoNameThenStoreCredentials() { String group = "foo"; String name = "node" + new Random().nextInt(); - Template template = view.getComputeService().templateBuilder().build(); + Template template = templateBuilder.build(); // test passing custom options template.getOptions().as(SoftLayerTemplateOptions.class).domainName("me.org"); @@ -82,7 +94,7 @@ public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerClientL } protected void doConnectViaSsh(VirtualGuest guest, LoginCredentials creds) { - SshClient ssh = view.utils().sshFactory().create(HostAndPort.fromParts(guest.getPrimaryIpAddress(), 22), creds); + SshClient ssh = sshFactory.create(HostAndPort.fromParts(guest.getPrimaryIpAddress(), 22), creds); try { ssh.connect(); ExecResponse hello = ssh.exec("echo hello"); @@ -108,9 +120,14 @@ public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerClientL } @AfterGroups(groups = "live") - protected void tearDownContext() { + protected void tearDown() { if (guest != null) adapter.destroyNode(guest.getNodeId() + ""); - super.tearDownContext(); + super.tearDown(); + } + + @Override + protected Iterable setupModules() { + return ImmutableSet. of(getLoggingModule(), new SshjSshClientModule()); } } diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerExperimentLiveTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerExperimentLiveTest.java deleted file mode 100644 index f7501654d0..0000000000 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerExperimentLiveTest.java +++ /dev/null @@ -1,59 +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.softlayer.compute; - -import static org.testng.Assert.assertEquals; - -import org.jclouds.ContextBuilder; -import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; -import org.jclouds.softlayer.SoftLayerProviderMetadata; -import org.testng.annotations.Test; - -import com.google.common.io.Closeables; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "SoftLayerExperimentLiveTest") -public class SoftLayerExperimentLiveTest extends BaseComputeServiceContextLiveTest { - - public SoftLayerExperimentLiveTest() { - provider = "softlayer"; - } - - @Test - public void testAndExperiment() { - ComputeServiceContext context = null; - try { - - context = ContextBuilder - .newBuilder(new SoftLayerProviderMetadata()) - .overrides(setupProperties()) - .modules(setupModules()).build(ComputeServiceContext.class); - - assertEquals(context.getComputeService().listAssignableLocations().size(), 6); - - } finally { - Closeables.closeQuietly(context); - } - } - -} diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountClientLiveTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountClientLiveTest.java index fa533d87ce..0c6f689095 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountClientLiveTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/AccountClientLiveTest.java @@ -23,7 +23,6 @@ import static org.testng.Assert.assertTrue; import java.util.Set; import org.jclouds.softlayer.domain.ProductPackage; -import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; /** @@ -33,17 +32,10 @@ import org.testng.annotations.Test; */ @Test(groups = "live") public class AccountClientLiveTest extends BaseSoftLayerClientLiveTest { - @BeforeGroups(groups = { "live" }) - public void setupContext() { - super.setupContext(); - client = socontext.getApi().getAccountClient(); - } - - private AccountClient client; @Test public void testGetActivePackages() { - Set response = client.getActivePackages(); + Set response = api.getAccountClient().getActivePackages(); assert null != response; assertTrue(response.size() >= 0); diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/BaseSoftLayerClientLiveTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/BaseSoftLayerClientLiveTest.java index 8732b7a540..5f9b097800 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/BaseSoftLayerClientLiveTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/BaseSoftLayerClientLiveTest.java @@ -18,11 +18,8 @@ */ package org.jclouds.softlayer.features; -import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; -import org.jclouds.rest.RestContext; -import org.jclouds.softlayer.SoftLayerAsyncClient; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.softlayer.SoftLayerClient; -import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; /** @@ -31,19 +28,9 @@ import org.testng.annotations.Test; * @author Adrian Cole */ @Test(groups = "live") -public class BaseSoftLayerClientLiveTest extends BaseComputeServiceContextLiveTest { +public class BaseSoftLayerClientLiveTest extends BaseApiLiveTest { public BaseSoftLayerClientLiveTest() { this.provider = "softlayer"; } - - protected RestContext socontext; - - @BeforeGroups(groups = { "integration", "live" }) - @Override - public void setupContext() { - super.setupContext(); - socontext = view.unwrap(); - } - } diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterClientLiveTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterClientLiveTest.java index c9045b4a23..372205c057 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterClientLiveTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterClientLiveTest.java @@ -26,7 +26,6 @@ import java.util.Set; import org.jclouds.softlayer.domain.Address; import org.jclouds.softlayer.domain.Datacenter; import org.jclouds.softlayer.domain.Region; -import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; @@ -39,21 +38,14 @@ import com.google.common.collect.ImmutableSet.Builder; */ @Test(groups = "live") public class DatacenterClientLiveTest extends BaseSoftLayerClientLiveTest { - @BeforeGroups(groups = { "live" }) - public void setupContext() { - super.setupContext(); - client = socontext.getApi().getDatacenterClient(); - } - - private DatacenterClient client; @Test public void testListDatacenters() { - Set response = client.listDatacenters(); + Set response = api().listDatacenters(); assert null != response; assertTrue(response.size() >= 0); for (Datacenter vg : response) { - Datacenter newDetails = client.getDatacenter(vg.getId()); + Datacenter newDetails = api().getDatacenter(vg.getId()); assertEquals(vg.getId(), newDetails.getId()); checkDatacenter(newDetails); } @@ -77,18 +69,22 @@ public class DatacenterClientLiveTest extends BaseSoftLayerClientLiveTest { builder.add(Datacenter.builder().id(142775).name("hou02").longName("Houston 2").build()); builder.add(Datacenter.builder().id(142776).name("dal07").longName("Dallas 7").build()); builder.add(Datacenter.builder().id(154820).name("dal06").longName("Dallas 6").build()); - Set response = client.listDatacenters(); + Set response = api().listDatacenters(); Set expected = builder.build(); assertEquals(response.size(),expected.size()); assertTrue(response.containsAll(expected)); - for( Datacenter datacenter: response) { + for(Datacenter datacenter: response) { Address address = datacenter.getLocationAddress(); if(address!=null) checkAddress(address); } } + private DatacenterClient api() { + return api.getDatacenterClient(); + } + private void checkDatacenter(Datacenter dc) { assert dc.getId() > 0 : dc; assert dc.getName() != null : dc; diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/ProductPackageClientLiveTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/ProductPackageClientLiveTest.java index 9972a4510e..281ada2b28 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/ProductPackageClientLiveTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/ProductPackageClientLiveTest.java @@ -62,10 +62,10 @@ public class ProductPackageClientLiveTest extends BaseSoftLayerClientLiveTest { public static final String CLOUD_SERVER_PACKAGE_NAME = "Cloud Server"; @BeforeGroups(groups = { "live" }) - public void setupContext() { - super.setupContext(); - client = socontext.getApi().getProductPackageClient(); - accountClient = socontext.getApi().getAccountClient(); + public void setup() { + super.setup(); + client = api.getProductPackageClient(); + accountClient = api.getAccountClient(); // This is used several times, so cache to speed up the test. cloudServerPackageId = Iterables.find(accountClient.getActivePackages(), named(CLOUD_SERVER_PACKAGE_NAME)) diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestClientLiveTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestClientLiveTest.java index d280e3e714..eedaafe7f1 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestClientLiveTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestClientLiveTest.java @@ -27,9 +27,11 @@ import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import java.util.Map; +import java.util.Properties; import java.util.Random; import java.util.Set; +import org.jclouds.softlayer.SoftLayerClient; import org.jclouds.softlayer.compute.functions.ProductItems; import org.jclouds.softlayer.domain.ProductItem; import org.jclouds.softlayer.domain.ProductItemPrice; @@ -37,7 +39,6 @@ import org.jclouds.softlayer.domain.ProductOrder; import org.jclouds.softlayer.domain.ProductOrderReceipt; import org.jclouds.softlayer.domain.ProductPackage; import org.jclouds.softlayer.domain.VirtualGuest; -import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; import com.google.common.base.Predicates; @@ -45,7 +46,9 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; +import com.google.inject.Injector; import com.google.inject.Key; +import com.google.inject.Module; import com.google.inject.TypeLiteral; /** @@ -58,21 +61,13 @@ public class VirtualGuestClientLiveTest extends BaseSoftLayerClientLiveTest { private static final String TEST_HOSTNAME_PREFIX = "livetest"; - @BeforeGroups(groups = { "live" }) - public void setupContext() { - super.setupContext(); - client = socontext.getApi().getVirtualGuestClient(); - } - - private VirtualGuestClient client; - @Test public void testListVirtualGuests() throws Exception { - Set response = client.listVirtualGuests(); + Set response = api().listVirtualGuests(); assert null != response; assertTrue(response.size() >= 0); for (VirtualGuest vg : response) { - VirtualGuest newDetails = client.getVirtualGuest(vg.getId()); + VirtualGuest newDetails = api().getVirtualGuest(vg.getId()); assertEquals(vg.getId(), newDetails.getId()); checkVirtualGuest(vg); } @@ -85,17 +80,17 @@ public class VirtualGuestClientLiveTest extends BaseSoftLayerClientLiveTest { // TODO: Should also check if there are active transactions before trying to cancel. // objectMask: virtualGuests.activeTransaction - for (VirtualGuest guest : client.listVirtualGuests()) { + for (VirtualGuest guest : api().listVirtualGuests()) { if (guest.getHostname().startsWith(TEST_HOSTNAME_PREFIX)) { if (guest.getBillingItemId() != -1) { - client.cancelService(guest.getBillingItemId()); + api().cancelService(guest.getBillingItemId()); } } } - int pkgId = Iterables.find(socontext.getApi().getAccountClient().getActivePackages(), + int pkgId = Iterables.find(api.getAccountClient().getActivePackages(), named(ProductPackageClientLiveTest.CLOUD_SERVER_PACKAGE_NAME)).getId(); - ProductPackage productPackage = socontext.getApi().getProductPackageClient().getProductPackage(pkgId); + ProductPackage productPackage = api.getProductPackageClient().getProductPackage(pkgId); Iterable ramItems = Iterables.filter(productPackage.getItems(), Predicates.and(categoryCode("ram"), capacity(2.0f))); @@ -116,8 +111,7 @@ public class VirtualGuestClientLiveTest extends BaseSoftLayerClientLiveTest { osToProductItem.get("Ubuntu Linux 8 LTS Hardy Heron - Minimal Install (64 bit)")); Builder prices = ImmutableSet.builder(); - prices.addAll(view.utils().injector().getInstance(Key.get(new TypeLiteral>() { - }))); + prices.addAll(defaultPrices); prices.add(ramPrice); prices.add(cpuPrice); prices.add(osPrice); @@ -128,16 +122,30 @@ public class VirtualGuestClientLiveTest extends BaseSoftLayerClientLiveTest { ProductOrder order = ProductOrder.builder().packageId(pkgId).quantity(1).useHourlyPricing(true).prices( prices.build()).virtualGuests(guest).build(); - ProductOrderReceipt receipt = socontext.getApi().getVirtualGuestClient().orderVirtualGuest(order); + ProductOrderReceipt receipt = api().orderVirtualGuest(order); ProductOrder order2 = receipt.getOrderDetails(); VirtualGuest result = Iterables.get(order2.getVirtualGuests(), 0); - ProductOrder order3 = socontext.getApi().getVirtualGuestClient().getOrderTemplate(result.getId()); + ProductOrder order3 = api().getOrderTemplate(result.getId()); assertEquals(order.getPrices(), order3.getPrices()); assertNotNull(receipt); } + private Iterable defaultPrices; + + @Override + protected SoftLayerClient create(Properties props, Iterable modules) { + Injector injector = newBuilder().modules(modules).overrides(props).buildInjector(); + defaultPrices = injector.getInstance(Key.get(new TypeLiteral>() { + })); + return injector.getInstance(SoftLayerClient.class); + } + + private VirtualGuestClient api() { + return api.getVirtualGuestClient(); + } + private void checkVirtualGuest(VirtualGuest vg) { if (vg.getBillingItemId() == -1) return;// Quotes and shutting down guests diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudClientLiveTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudClientLiveTest.java index 5e9f77ccdd..cf8c64733c 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudClientLiveTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudClientLiveTest.java @@ -28,8 +28,7 @@ import org.testng.annotations.Test; * @author Adrian Cole */ @Test(groups = "live", enabled = true, singleThreaded = true) -public class BaseTerremarkECloudClientLiveTest extends - BaseTerremarkClientLiveTest { +public class BaseTerremarkECloudClientLiveTest extends BaseTerremarkClientLiveTest { @Override protected Properties setupProperties() { Properties props = super.setupProperties(); @@ -37,4 +36,8 @@ public class BaseTerremarkECloudClientLiveTest extends ".* - " + System.getProperty("test.trmk-ecloud.datacenter", "MIA")); return props; } + + protected TerremarkECloudClient api() { + return TerremarkECloudClient.class.cast(api); + } } diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudClientLiveTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudClientLiveTest.java index e16e914873..de4245698f 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudClientLiveTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudClientLiveTest.java @@ -40,7 +40,7 @@ import com.google.common.net.HostAndPort; * @author Adrian Cole */ @Test(groups = "live", enabled = true, singleThreaded = true, testName = "TerremarkECloudClientLiveTest") -public class TerremarkECloudClientLiveTest extends TerremarkClientLiveTest { +public class TerremarkECloudClientLiveTest extends TerremarkClientLiveTest { public TerremarkECloudClientLiveTest() { this.provider = "trmk-ecloud"; @@ -64,7 +64,7 @@ public class TerremarkECloudClientLiveTest extends TerremarkClientLiveTest getNewInternetServiceAndIpForSSH(VApp vApp) { - return new TerremarkECloudInternetServiceAndPublicIpAddressSupplier(TerremarkECloudClient.class.cast(connection)) + return new TerremarkECloudInternetServiceAndPublicIpAddressSupplier(TerremarkECloudClient.class.cast(api)) .getNewInternetServiceAndIp(vApp, 22, Protocol.TCP); } diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudClientMockTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudClientMockTest.java index 8da4e8f29f..4900b8e784 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudClientMockTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudClientMockTest.java @@ -93,7 +93,7 @@ public class TerremarkECloudClientMockTest { } /** - * there's no built-in way to defer evaluation of a response body, hence this + * there's no built-in way to defer evaluation of a response header, hence this * method, which allows us to send back links to the mock server. */ private AtomicReference setURLReplacingDispatcher(MockWebServer server) { diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/compute/TerremarkECloudComputeServiceLiveTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/compute/TerremarkECloudComputeServiceLiveTest.java index 9f9ab67efe..695971681f 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/compute/TerremarkECloudComputeServiceLiveTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/compute/TerremarkECloudComputeServiceLiveTest.java @@ -30,9 +30,7 @@ import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.internal.BaseComputeServiceLiveTest; -import org.jclouds.rest.RestContext; import org.jclouds.sshj.config.SshjSshClientModule; -import org.jclouds.trmk.ecloud.TerremarkECloudAsyncClient; import org.jclouds.trmk.ecloud.TerremarkECloudClient; import org.jclouds.trmk.vcloud_0_8.domain.VApp; import org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants; @@ -104,8 +102,8 @@ public class TerremarkECloudComputeServiceLiveTest extends BaseComputeServiceLiv assert node.getLocation() != null; assertEquals(node.getType(), ComputeType.NODE); NodeMetadata allData = client.getNodeMetadata(node.getId()); - RestContext tmContext = view.unwrap(); - VApp vApp = tmContext.getApi().findVAppInOrgVDCNamed(allData.getLocation().getParent().getDescription(), + TerremarkECloudClient api = view.utils().injector().getInstance(TerremarkECloudClient.class); + VApp vApp = api.findVAppInOrgVDCNamed(allData.getLocation().getParent().getDescription(), allData.getLocation().getDescription(), allData.getName()); assertEquals(vApp.getName(), allData.getName()); } diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsClientLiveTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsClientLiveTest.java index c1b44cec9c..399322d4f7 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsClientLiveTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsClientLiveTest.java @@ -33,12 +33,12 @@ import org.testng.annotations.Test; public class DataCenterOperationsClientLiveTest extends BaseTerremarkECloudClientLiveTest { @Test public void testListDataCentersInOrg() throws Exception { - for (ReferenceType response : connection.listOrgs().values()) { - ECloudOrg org = connection.getOrg(response.getHref()); + for (ReferenceType response : api().listOrgs().values()) { + ECloudOrg org = api().getOrg(response.getHref()); assertNotNull(response); assertNotNull(response.getName()); assertNotNull(response.getHref()); - assertEquals(connection.getDataCenterOperationsClient().listDataCentersInOrg(org.getHref()), connection + assertEquals(api().getDataCenterOperationsClient().listDataCentersInOrg(org.getHref()), api() .getDataCenterOperationsClient().listDataCenters(org.getDataCenters().getHref())); } } diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsClientLiveTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsClientLiveTest.java index aa77c305aa..c01c13a395 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsClientLiveTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsClientLiveTest.java @@ -33,12 +33,12 @@ import org.testng.annotations.Test; public class TagOperationsClientLiveTest extends BaseTerremarkECloudClientLiveTest { @Test public void testListTagsInOrg() throws Exception { - for (ReferenceType response : connection.listOrgs().values()) { - ECloudOrg org = connection.getOrg(response.getHref()); + for (ReferenceType response : api().listOrgs().values()) { + ECloudOrg org = api().getOrg(response.getHref()); assertNotNull(response); assertNotNull(response.getName()); assertNotNull(response.getHref()); - assertEquals(connection.getTagOperationsClient().getTagNameToUsageCountInOrg(org.getHref()), connection + assertEquals(api().getTagOperationsClient().getTagNameToUsageCountInOrg(org.getHref()), api() .getTagOperationsClient().getTagNameToUsageCount(org.getTags().getHref())); } } diff --git a/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressClientLiveTest.java b/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressClientLiveTest.java index 1dcd73b42d..4ab2482e03 100644 --- a/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressClientLiveTest.java +++ b/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressClientLiveTest.java @@ -38,7 +38,7 @@ import com.google.common.net.HostAndPort; * @author Adrian Cole */ @Test(groups = "live", singleThreaded = true, testName = "TerremarkVCloudExpressClientLiveTest") -public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTest { +public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTest { @Override protected SshClient getConnectionFor(HostAndPort socket) { @@ -49,6 +49,6 @@ public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTes @Override protected Entry getNewInternetServiceAndIpForSSH(VApp vApp) { return new TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier( - TerremarkVCloudExpressClient.class.cast(connection)).getNewInternetServiceAndIp(vApp, 22, Protocol.TCP); + TerremarkVCloudExpressClient.class.cast(api)).getNewInternetServiceAndIp(vApp, 22, Protocol.TCP); } } diff --git a/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/compute/TerremarkVCloudExpressComputeServiceLiveTest.java b/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/compute/TerremarkVCloudExpressComputeServiceLiveTest.java index e6f4d1e74b..6a96f9ea81 100644 --- a/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/compute/TerremarkVCloudExpressComputeServiceLiveTest.java +++ b/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/compute/TerremarkVCloudExpressComputeServiceLiveTest.java @@ -29,10 +29,8 @@ import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.internal.BaseComputeServiceLiveTest; import org.jclouds.domain.Credentials; -import org.jclouds.rest.RestContext; import org.jclouds.sshj.config.SshjSshClientModule; import org.jclouds.trmk.vcloud_0_8.domain.VApp; -import org.jclouds.trmk.vcloudexpress.TerremarkVCloudExpressAsyncClient; import org.jclouds.trmk.vcloudexpress.TerremarkVCloudExpressClient; import org.testng.annotations.Test; @@ -96,8 +94,8 @@ public class TerremarkVCloudExpressComputeServiceLiveTest extends BaseComputeSer assertEquals(node.getType(), ComputeType.NODE); NodeMetadata allData = client.getNodeMetadata(node.getId()); System.out.println(allData.getHardware()); - RestContext tmContext = view.unwrap(); - VApp vApp = tmContext.getApi().findVAppInOrgVDCNamed(null, null, allData.getName()); + TerremarkVCloudExpressClient api = view.utils().injector().getInstance(TerremarkVCloudExpressClient.class); + VApp vApp = api.findVAppInOrgVDCNamed(null, null, allData.getName()); assertEquals(vApp.getName(), allData.getName()); } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java index 1ca04b6a42..4109cad821 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java @@ -18,6 +18,8 @@ */ package org.jclouds.ultradns.ws; +import java.io.Closeable; + import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.PayloadParam; import org.jclouds.ultradns.ws.domain.Account; @@ -35,7 +37,7 @@ import org.jclouds.ultradns.ws.features.ZoneApi; * @see * @author Adrian Cole */ -public interface UltraDNSWSApi { +public interface UltraDNSWSApi extends Closeable { /** * Returns the account of the current user. */ diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java index 0dea677ef8..3d56acc85e 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java @@ -18,6 +18,8 @@ */ package org.jclouds.ultradns.ws; +import java.io.Closeable; + import javax.inject.Named; import javax.ws.rs.POST; @@ -48,7 +50,7 @@ import com.google.common.util.concurrent.ListenableFuture; */ @RequestFilters(SOAPWrapWithPasswordAuth.class) @VirtualHost -public interface UltraDNSWSAsyncApi { +public interface UltraDNSWSAsyncApi extends Closeable { /** * @see UltraDNSWSApi#getCurrentAccount() diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java index 9225c689c5..bfc2f492a6 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java @@ -32,7 +32,7 @@ public class UltraDNSWSApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Test protected void testGetCurrentAccount() { - Account account = api().getCurrentAccount(); + Account account = api.getCurrentAccount(); checkAccount(account); } @@ -40,8 +40,4 @@ public class UltraDNSWSApiLiveTest extends BaseUltraDNSWSApiLiveTest { assertNotNull(account.getId(), "Id cannot be null for " + account); assertNotNull(account.getName(), "Name cannot be null for " + account); } - - protected UltraDNSWSApi api() { - return context.getApi(); - } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java index 71adfeb7a6..ea8f08e309 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java @@ -57,18 +57,18 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Override @BeforeClass(groups = { "integration", "live" }) - public void setupContext() { - super.setupContext(); - context.getApi().getZoneApi().delete(zoneName); - account = context.getApi().getCurrentAccount(); - context.getApi().getZoneApi().createInAccount(zoneName, account.getId()); + public void setup() { + super.setup(); + api.getZoneApi().delete(zoneName); + account = api.getCurrentAccount(); + api.getZoneApi().createInAccount(zoneName, account.getId()); } @Override @AfterClass(groups = { "integration", "live" }) - protected void tearDownContext() { - context.getApi().getZoneApi().delete(zoneName); - super.tearDownContext(); + protected void tearDown() { + api.getZoneApi().delete(zoneName); + super.tearDown(); } static void checkResourceRecord(ResourceRecord rr) { @@ -93,7 +93,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Test public void testListResourceRecords() { - for (Zone zone : context.getApi().getZoneApi().listByAccount(account.getId())) { + for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { zones.incrementAndGet(); for (ResourceRecordMetadata rr : api(zone.getName()).list()) { recordTypeCounts.getUnchecked(rr.getRecord().getType()).incrementAndGet(); @@ -189,6 +189,6 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest { } private ResourceRecordApi api(String zoneName) { - return context.getApi().getResourceRecordApiForZone(zoneName); + return api.getResourceRecordApiForZone(zoneName); } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java index f7f09767f6..29ee70a8a3 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java @@ -54,11 +54,11 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Override @BeforeClass(groups = { "integration", "live" }) - public void setupContext() { - super.setupContext(); - context.getApi().getZoneApi().delete(zoneName); - account = context.getApi().getCurrentAccount(); - context.getApi().getZoneApi().createInAccount(zoneName, account.getId()); + public void setup() { + super.setup(); + api.getZoneApi().delete(zoneName); + account = api.getCurrentAccount(); + api.getZoneApi().createInAccount(zoneName, account.getId()); } private void checkRRPool(RoundRobinPool pool) { @@ -70,7 +70,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Test public void testListRRPools() { - for (Zone zone : context.getApi().getZoneApi().listByAccount(account.getId())) { + for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (RoundRobinPool pool : api(zone.getName()).list()) { checkRRPool(pool); } @@ -79,7 +79,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Test public void testListRRPoolRecords() { - for (Zone zone : context.getApi().getZoneApi().listByAccount(account.getId())) { + for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (RoundRobinPool pool : api(zone.getName()).list()) { for (ResourceRecordMetadata record : api(zone.getName()).listRecords(pool.getId())) { ResourceRecordApiLiveTest.checkResourceRecordMetadata(record); @@ -239,17 +239,17 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { } private RoundRobinPoolApi api(String zoneName) { - return context.getApi().getRoundRobinPoolApiForZone(zoneName); + return api.getRoundRobinPoolApiForZone(zoneName); } @Override @AfterClass(groups = { "integration", "live" }) - protected void tearDownContext() { + protected void tearDown() { if (aPoolId != null) api(zoneName).delete(aPoolId); if (aaaaPoolId != null) api(zoneName).delete(aaaaPoolId); - context.getApi().getZoneApi().delete(zoneName); - super.tearDownContext(); + api.getZoneApi().delete(zoneName); + super.tearDown(); } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TaskApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TaskApiLiveTest.java index 341d55086c..e20afc930b 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TaskApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TaskApiLiveTest.java @@ -76,6 +76,6 @@ public class TaskApiLiveTest extends BaseUltraDNSWSApiLiveTest { } protected TaskApi api() { - return context.getApi().getTaskApi(); + return api.getTaskApi(); } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java index eebb0cb2b3..f0480698c9 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java @@ -57,11 +57,11 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest @Override @BeforeClass(groups = { "integration", "live" }) - public void setupContext() { - super.setupContext(); - context.getApi().getZoneApi().delete(zoneName); - account = context.getApi().getCurrentAccount(); - context.getApi().getZoneApi().createInAccount(zoneName, account.getId()); + public void setup() { + super.setup(); + api.getZoneApi().delete(zoneName); + account = api.getCurrentAccount(); + api.getZoneApi().createInAccount(zoneName, account.getId()); } private void checkTCPool(TrafficControllerPool pool) { @@ -74,7 +74,7 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest @Test public void testListTCPools() { - for (Zone zone : context.getApi().getZoneApi().listByAccount(account.getId())) { + for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (TrafficControllerPool pool : api(zone.getName()).list()) { checkTCPool(pool); } @@ -83,7 +83,7 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest @Test public void testListTCPoolRecords() { - for (Zone zone : context.getApi().getZoneApi().listByAccount(account.getId())) { + for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (TrafficControllerPool pool : api(zone.getName()).list()) { for (TrafficControllerPoolRecord record : api(zone.getName()).listRecords(pool.getId())) { checkPoolRecordConsistent(zone.getName(), record); @@ -276,15 +276,15 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest } private TrafficControllerPoolApi api(String zoneName) { - return context.getApi().getTrafficControllerPoolApiForZone(zoneName); + return api.getTrafficControllerPoolApiForZone(zoneName); } @Override @AfterClass(groups = { "integration", "live" }) - protected void tearDownContext() { + protected void tearDown() { if (poolId != null) api(zoneName).delete(poolId); - context.getApi().getZoneApi().delete(zoneName); - super.tearDownContext(); + api.getZoneApi().delete(zoneName); + super.tearDown(); } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ZoneApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ZoneApiLiveTest.java index cc07630995..3c4df6aa61 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ZoneApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ZoneApiLiveTest.java @@ -49,9 +49,9 @@ public class ZoneApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Override @BeforeClass(groups = { "integration", "live" }) - public void setupContext() { - super.setupContext(); - account = context.getApi().getCurrentAccount(); + public void setup() { + super.setup(); + account = api.getCurrentAccount(); } private void checkZone(Zone zone) { @@ -141,6 +141,6 @@ public class ZoneApiLiveTest extends BaseUltraDNSWSApiLiveTest { } protected ZoneApi api() { - return context.getApi().getZoneApi(); + return api.getZoneApi(); } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/internal/BaseUltraDNSWSApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/internal/BaseUltraDNSWSApiLiveTest.java index 7884b4c9ba..9dbc33f823 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/internal/BaseUltraDNSWSApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/internal/BaseUltraDNSWSApiLiveTest.java @@ -18,28 +18,17 @@ */ package org.jclouds.ultradns.ws.internal; -import org.jclouds.apis.BaseContextLiveTest; -import org.jclouds.ultradns.ws.UltraDNSWSApiMetadata; -import org.jclouds.ultradns.ws.UltraDNSWSAsyncApi; +import org.jclouds.apis.BaseApiLiveTest; import org.jclouds.ultradns.ws.UltraDNSWSApi; -import org.jclouds.rest.RestContext; import org.testng.annotations.Test; -import com.google.common.reflect.TypeToken; - /** * * @author Adrian Cole */ @Test(groups = "live") -public class BaseUltraDNSWSApiLiveTest extends BaseContextLiveTest> { - +public class BaseUltraDNSWSApiLiveTest extends BaseApiLiveTest { public BaseUltraDNSWSApiLiveTest() { provider = "ultradns-ws"; } - - @Override - protected TypeToken> contextType() { - return UltraDNSWSApiMetadata.CONTEXT_TOKEN; - } } From 053197fe615b2fc936575e24e0522e7c5ff7ffe9 Mon Sep 17 00:00:00 2001 From: adriancole Date: Tue, 9 Apr 2013 00:40:19 -0700 Subject: [PATCH 5/5] deprecated all top-level Async apis and clients --- .../org/jclouds/atmos/AtmosApiMetadata.java | 9 +++++-- .../org/jclouds/atmos/AtmosAsyncClient.java | 4 +++ .../cloudfiles/CloudFilesApiMetadata.java | 9 +++++-- .../cloudfiles/CloudFilesAsyncClient.java | 3 +++ .../cloudservers/CloudServersApiMetadata.java | 9 +++++-- .../cloudservers/CloudServersAsyncClient.java | 3 +++ .../cloudsigma/CloudSigmaApiMetadata.java | 9 +++++-- .../cloudsigma/CloudSigmaAsyncClient.java | 3 +++ .../cloudstack/CloudStackApiMetadata.java | 9 +++++-- .../cloudstack/CloudStackAsyncClient.java | 3 +++ .../CloudStackDomainAsyncClient.java | 3 +++ .../CloudStackGlobalAsyncClient.java | 5 +++- .../cloudwatch/CloudWatchApiMetadata.java | 9 +++++-- .../cloudwatch/CloudWatchAsyncApi.java | 3 +++ .../java/org/jclouds/ec2/EC2ApiMetadata.java | 13 +++++++--- .../java/org/jclouds/ec2/EC2AsyncClient.java | 4 ++- .../elasticstack/ElasticStackApiMetadata.java | 9 +++++-- .../elasticstack/ElasticStackAsyncClient.java | 3 +++ .../cinder/v1/CinderApiMetadata.java | 9 +++++-- .../openstack/cinder/v1/CinderAsyncApi.java | 3 +++ .../keystone/v2_0/KeystoneApiMetadata.java | 9 +++++-- .../keystone/v2_0/KeystoneAsyncApi.java | 3 +++ .../v2_0/features/ServiceApiLiveTest.java | 3 +-- .../v2_0/features/TenantApiLiveTest.java | 12 ++++----- .../v2_0/features/TokenApiLiveTest.java | 22 ++++++++-------- .../v2_0/features/UserApiLiveTest.java | 26 +++++++++---------- .../nova/ec2/NovaEC2ApiMetadata.java | 9 +++++-- .../nova/ec2/NovaEC2AsyncClient.java | 3 +++ .../openstack/nova/v2_0/NovaApiMetadata.java | 9 +++++-- .../openstack/nova/v2_0/NovaAsyncApi.java | 3 +++ .../v2_0/extensions/KeyPairApiLiveTest.java | 16 ++++++------ .../extensions/SecurityGroupApiLiveTest.java | 24 ++++++++--------- .../v2_0/features/ExtensionApiLiveTest.java | 10 +++---- .../nova/v2_0/features/FlavorApiLiveTest.java | 14 +++++----- .../nova/v2_0/features/ImageApiLiveTest.java | 14 +++++----- .../nova/v2_0/features/ServerApiLiveTest.java | 14 +++++----- .../v2_0/internal/BaseNovaApiLiveTest.java | 6 ++--- .../v2_0/CloudIdentityApiMetadata.java | 9 +++++-- .../v1/CloudLoadBalancersApiMetadata.java | 10 ++++--- .../v1/CloudLoadBalancersAsyncApi.java | 3 +++ .../jclouds/route53/Route53ApiMetadata.java | 9 +++++-- .../org/jclouds/route53/Route53AsyncApi.java | 3 +++ .../java/org/jclouds/s3/S3ApiMetadata.java | 13 ++++++---- .../java/org/jclouds/s3/S3AsyncClient.java | 6 ++++- .../java/org/jclouds/sqs/SQSApiMetadata.java | 9 +++++-- .../java/org/jclouds/sqs/SQSAsyncApi.java | 3 +++ .../sqs/features/BulkMessageApiLiveTest.java | 10 +++---- .../sqs/features/MessageApiLiveTest.java | 19 ++++++++------ .../sqs/internal/BaseSQSApiLiveTest.java | 8 +++--- .../java/org/jclouds/sts/STSApiMetadata.java | 9 +++++-- .../java/org/jclouds/sts/STSAsyncApi.java | 3 +++ .../swift/CommonSwiftAsyncClient.java | 3 +++ .../openstack/swift/SwiftApiMetadata.java | 9 +++++-- .../openstack/swift/SwiftAsyncClient.java | 3 +++ .../swift/SwiftKeystoneApiMetadata.java | 8 ++++-- .../swift/SwiftKeystoneAsyncClient.java | 3 +++ .../org/jclouds/vcloud/VCloudApiMetadata.java | 9 +++++-- .../org/jclouds/vcloud/VCloudAsyncClient.java | 3 +++ .../java/org/jclouds/rest/RestContext.java | 6 +++++ .../rest/internal/RestContextImpl.java | 3 +++ .../jclouds/aws/ec2/AWSEC2ApiMetadata.java | 13 +++++++--- .../jclouds/aws/ec2/AWSEC2AsyncClient.java | 6 ++++- .../org/jclouds/aws/s3/AWSS3ApiMetadata.java | 9 +++++-- .../org/jclouds/aws/s3/AWSS3AsyncClient.java | 3 +++ .../azureblob/AzureBlobApiMetadata.java | 9 +++++-- .../azureblob/AzureBlobAsyncClient.java | 3 +++ .../jclouds/dynect/v3/DynECTApiMetadata.java | 6 ----- .../org/jclouds/dynect/v3/DynECTAsyncApi.java | 3 +++ .../org/jclouds/glesys/GleSYSApiMetadata.java | 9 +++++-- .../org/jclouds/glesys/GleSYSAsyncApi.java | 3 +++ .../glesys/features/ArchiveApiLiveTest.java | 2 +- .../glesys/features/DomainApiLiveTest.java | 4 +-- .../features/EmailAccountApiLiveTest.java | 2 +- .../internal/BaseGleSYSApiLiveTest.java | 8 +++--- .../BaseGleSYSApiWithAServerLiveTest.java | 14 +++++----- .../org/jclouds/gogrid/GoGridApiMetadata.java | 11 +++++--- .../org/jclouds/gogrid/GoGridAsyncClient.java | 4 ++- .../gogrid/GoGridProviderMetadata.java | 2 -- .../gogrid/services/GridImageAsyncClient.java | 3 +-- .../gogrid/services/GridIpAsyncClient.java | 3 +-- .../gogrid/services/GridJobAsyncClient.java | 3 +-- .../services/GridLoadBalancerAsyncClient.java | 3 +-- .../HPCloudObjectStorageApiMetadata.java | 9 +++++-- .../HPCloudObjectStorageAsyncApi.java | 3 +++ .../softlayer/SoftLayerApiMetadata.java | 9 +++++-- .../softlayer/SoftLayerAsyncClient.java | 3 +++ .../ecloud/TerremarkECloudApiMetadata.java | 9 +++++-- .../ecloud/TerremarkECloudAsyncClient.java | 3 +++ .../TerremarkVCloudExpressApiMetadata.java | 9 +++++-- .../TerremarkVCloudExpressAsyncClient.java | 3 +++ .../ultradns/ws/UltraDNSWSApiMetadata.java | 7 ----- .../ultradns/ws/UltraDNSWSAsyncApi.java | 3 +++ 92 files changed, 451 insertions(+), 210 deletions(-) diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java index 0cab440b52..8cdc9e5f45 100644 --- a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java +++ b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java @@ -28,7 +28,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.atmos.blobstore.config.AtmosBlobStoreContextModule; import org.jclouds.atmos.config.AtmosRestClientModule; import org.jclouds.blobstore.BlobStoreContext; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -42,7 +41,12 @@ import com.google.inject.Module; */ public class AtmosApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AtmosClient.class)} as + * {@link AtmosAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -71,6 +75,7 @@ public class AtmosApiMetadata extends BaseRestApiMetadata { } public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(AtmosClient.class, AtmosAsyncClient.class); id("atmos") diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java index 6436c7a92a..62ce574570 100644 --- a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java +++ b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java @@ -75,7 +75,11 @@ import com.google.inject.Provides; * @see AtmosClient * @see * @author Adrian Cole + * + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AtmosClient.class)} as + * {@link AtmosAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(SignRequest.class) @Path("/rest/namespace") public interface AtmosAsyncClient extends Closeable { diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java index 6f92156004..c35b3e0ac3 100644 --- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java +++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java @@ -29,7 +29,6 @@ import org.jclouds.cloudfiles.config.CloudFilesRestClientModule.StorageAndCDNMan import org.jclouds.openstack.swift.SwiftApiMetadata; import org.jclouds.openstack.swift.blobstore.SwiftBlobSigner; import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule; -import org.jclouds.rest.RestContext; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; @@ -43,7 +42,12 @@ import com.google.inject.TypeLiteral; */ public class CloudFilesApiMetadata extends SwiftApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudFilesClient.class)} as + * {@link CloudFilesAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -66,6 +70,7 @@ public class CloudFilesApiMetadata extends SwiftApiMetadata { } public static class Builder extends SwiftApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder(){ super(CloudFilesClient.class, CloudFilesAsyncClient.class); id("cloudfiles") diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java index c9cf47fe3b..ba73846789 100644 --- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java +++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java @@ -64,7 +64,10 @@ import com.google.common.util.concurrent.ListenableFuture; * @see CloudFilesClient * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudFilesClient.class)} as + * {@link CloudFilesAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(AuthenticateRequest.class) @Endpoint(Storage.class) public interface CloudFilesAsyncClient extends SwiftAsyncClient { diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java index 6c93fdb6f8..f81cd37316 100644 --- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java +++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java @@ -27,7 +27,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.cloudservers.compute.config.CloudServersComputeServiceContextModule; import org.jclouds.cloudservers.config.CloudServersRestClientModule; import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -41,7 +40,12 @@ import com.google.inject.Module; */ public class CloudServersApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudServersClient.class)} as + * {@link CloudServersAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -65,6 +69,7 @@ public class CloudServersApiMetadata extends BaseRestApiMetadata { public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(CloudServersClient.class, CloudServersAsyncClient.class); id("cloudservers") diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java index 742a9fa67d..7042ebd735 100644 --- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java +++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java @@ -74,7 +74,10 @@ import com.google.common.util.concurrent.ListenableFuture; * @see CloudServersClient * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudServersClient.class)} as + * {@link CloudServersAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class }) @Endpoint(Compute.class) public interface CloudServersAsyncClient extends Closeable { diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java index b4eb5d82ad..c3e5c13f87 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java @@ -28,7 +28,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.cloudsigma.compute.config.CloudSigmaComputeServiceContextModule; import org.jclouds.cloudsigma.config.CloudSigmaRestClientModule; import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -42,7 +41,12 @@ import com.google.inject.Module; */ public class CloudSigmaApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudSigmaClient.class)} as + * {@link CloudSigmaAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -72,6 +76,7 @@ public class CloudSigmaApiMetadata extends BaseRestApiMetadata { public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(CloudSigmaClient.class, CloudSigmaAsyncClient.class); id("cloudsigma") diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaAsyncClient.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaAsyncClient.java index 0d5b0a877f..e52b77057c 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaAsyncClient.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaAsyncClient.java @@ -73,7 +73,10 @@ import com.google.common.util.concurrent.ListenableFuture; * @see CloudSigmaClient * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudSigmaClient.class)} as + * {@link CloudSigmaAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(BasicAuthentication.class) @Consumes(MediaType.TEXT_PLAIN) public interface CloudSigmaAsyncClient extends Closeable { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackApiMetadata.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackApiMetadata.java index fd543c2afb..d052822f61 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackApiMetadata.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackApiMetadata.java @@ -26,7 +26,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.cloudstack.compute.config.CloudStackComputeServiceContextModule; import org.jclouds.cloudstack.config.CloudStackParserModule; import org.jclouds.cloudstack.config.CloudStackRestClientModule; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -39,7 +38,12 @@ import com.google.inject.Module; */ public class CloudStackApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudStackClient.class)} as + * {@link CloudStackAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -65,6 +69,7 @@ public class CloudStackApiMetadata extends BaseRestApiMetadata { public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(CloudStackClient.class, CloudStackAsyncClient.class); id("cloudstack") diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackAsyncClient.java index 0a983f7e41..2d37938a61 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackAsyncClient.java @@ -50,7 +50,10 @@ import org.jclouds.rest.annotations.Delegate; * @author Adrian Cole * @see CloudStackClient * @see + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudStackClient.class)} as + * {@link CloudStackAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated public interface CloudStackAsyncClient { /** diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackDomainAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackDomainAsyncClient.java index 941ee5515e..bf561269fe 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackDomainAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackDomainAsyncClient.java @@ -33,7 +33,10 @@ import org.jclouds.rest.annotations.Delegate; * @see + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudStackDomainClient.class)} as + * {@link CloudStackDomainAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated public interface CloudStackDomainAsyncClient extends CloudStackAsyncClient { /** diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackGlobalAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackGlobalAsyncClient.java index 3c7d9a39ba..980e219114 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackGlobalAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackGlobalAsyncClient.java @@ -38,11 +38,14 @@ import org.jclouds.rest.annotations.Delegate; *

* * @author Adrian Cole - * @see CloudStackDomainClient + * @see CloudStackGlobalClient * @see + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudStackGlobalClient.class)} as + * {@link CloudStackGlobalAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated public interface CloudStackGlobalAsyncClient extends CloudStackDomainAsyncClient { /** diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchApiMetadata.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchApiMetadata.java index 6215411bbf..77495a8767 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchApiMetadata.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchApiMetadata.java @@ -26,7 +26,6 @@ import java.util.Properties; import org.jclouds.apis.ApiMetadata; import org.jclouds.cloudwatch.config.CloudWatchRestClientModule; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.reflect.TypeToken; @@ -38,7 +37,12 @@ import com.google.common.reflect.TypeToken; */ public class CloudWatchApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudWatchApi.class)} as + * {@link CloudWatchAsyncApi} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -47,6 +51,7 @@ public class CloudWatchApiMetadata extends BaseRestApiMetadata { return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this); } + @SuppressWarnings("deprecation") public CloudWatchApiMetadata() { this(new Builder(CloudWatchApi.class, CloudWatchAsyncApi.class)); } diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncApi.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncApi.java index b98745132b..eddb4b636e 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncApi.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncApi.java @@ -38,7 +38,10 @@ import com.google.inject.Provides; * href="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference" * /> * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudWatchApi.class)} as + * {@link CloudWatchAsyncApi} interface will be removed in jclouds 1.7. */ +@Deprecated public interface CloudWatchAsyncApi extends Closeable { /** * diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java b/apis/ec2/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java index f4db47ba8b..826ad24059 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java @@ -34,7 +34,6 @@ import org.jclouds.ec2.compute.EC2ComputeServiceContext; import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule; import org.jclouds.ec2.compute.config.EC2ResolveImagesModule; import org.jclouds.ec2.config.EC2RestClientModule; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -59,8 +58,13 @@ import com.google.inject.Module; * @author Adrian Cole */ public class EC2ApiMetadata extends BaseRestApiMetadata { - - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(EC2Client.class)} as + * {@link EC2AsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -90,6 +94,7 @@ public class EC2ApiMetadata extends BaseRestApiMetadata { } public static abstract class Builder> extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { this(EC2Client.class, EC2AsyncClient.class); } @@ -102,7 +107,7 @@ public class EC2ApiMetadata extends BaseRestApiMetadata { .credentialName("Secret Access Key") .defaultEndpoint("https://ec2.us-east-1.amazonaws.com") .documentation(URI.create("http://docs.amazonwebservices.com/AWSEC2/latest/APIReference")) - .version(EC2AsyncClient.VERSION) + .version("2010-06-15") .defaultProperties(EC2ApiMetadata.defaultProperties()) .context(CONTEXT_TOKEN) .view(EC2ComputeServiceContext.class) diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/EC2AsyncClient.java b/apis/ec2/src/main/java/org/jclouds/ec2/EC2AsyncClient.java index cd780b54ec..c60614d8e0 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/EC2AsyncClient.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/EC2AsyncClient.java @@ -32,9 +32,11 @@ import org.jclouds.rest.annotations.Delegate; * Provides asynchronous access to EC2 services. * * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(EC2Client.class)} as + * {@link EC2AsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated public interface EC2AsyncClient extends EC2AsyncApi { - public static final String VERSION = "2010-06-15"; /** * Provides asynchronous access to AMI services. diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackApiMetadata.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackApiMetadata.java index 6b5565a486..aee1abb631 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackApiMetadata.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackApiMetadata.java @@ -28,7 +28,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.compute.ComputeServiceContext; import org.jclouds.elasticstack.compute.config.ElasticStackComputeServiceContextModule; import org.jclouds.elasticstack.config.ElasticStackRestClientModule; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -42,7 +41,12 @@ import com.google.inject.Module; */ public class ElasticStackApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(ElasticStackClient.class)} as + * {@link ElasticStackAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -71,6 +75,7 @@ public class ElasticStackApiMetadata extends BaseRestApiMetadata { public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(ElasticStackClient.class, ElasticStackAsyncClient.class); id("elasticstack") diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackAsyncClient.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackAsyncClient.java index cdda738e9e..684eac6dfd 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackAsyncClient.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackAsyncClient.java @@ -62,7 +62,10 @@ import com.google.common.util.concurrent.ListenableFuture; * @see ElasticStackClient * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(ElasticStackClient.class)} as + * {@link ElasticStackAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(BasicAuthentication.class) @Consumes(MediaType.TEXT_PLAIN) public interface ElasticStackAsyncClient extends Closeable { diff --git a/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderApiMetadata.java b/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderApiMetadata.java index 6c47ddb262..581eaf6506 100644 --- a/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderApiMetadata.java +++ b/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderApiMetadata.java @@ -31,7 +31,6 @@ import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule; import org.jclouds.openstack.v2_0.ServiceType; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -45,7 +44,12 @@ import com.google.inject.Module; */ public class CinderApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CinderApi.class)} as + * {@link CinderAsyncApi} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -71,6 +75,7 @@ public class CinderApiMetadata extends BaseRestApiMetadata { public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(CinderApi.class, CinderAsyncApi.class); id("openstack-cinder") diff --git a/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderAsyncApi.java b/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderAsyncApi.java index 4b1ab3bdcf..a7096afa3a 100644 --- a/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderAsyncApi.java +++ b/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderAsyncApi.java @@ -39,7 +39,10 @@ import com.google.inject.Provides; * @see CinderApi * @see API Doc * @author Everett Toews + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CinderApi.class)} as + * {@link CinderAsyncApi} interface will be removed in jclouds 1.7. */ +@Deprecated public interface CinderAsyncApi extends Closeable { /** * @return the Zone codes configured diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java index 687e86bdeb..003be876e8 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java @@ -30,7 +30,6 @@ import org.jclouds.openstack.keystone.v2_0.config.KeystoneParserModule; import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule; import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule.KeystoneAdminURLModule; import org.jclouds.openstack.v2_0.ServiceType; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -44,7 +43,12 @@ import com.google.inject.Module; */ public class KeystoneApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(KeystoneApi.class)} as + * {@link KeystoneAsyncApi} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -69,6 +73,7 @@ public class KeystoneApiMetadata extends BaseRestApiMetadata { } public static abstract class Builder> extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { this(KeystoneApi.class, KeystoneAsyncApi.class); } diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java index be6573d072..ab46e874ca 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java @@ -45,7 +45,10 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adam Lowe * @see * @see KeystoneApi + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(KeystoneApi.class)} as + * {@link KeystoneAsyncApi} interface will be removed in jclouds 1.7. */ +@Deprecated public interface KeystoneAsyncApi extends Closeable { /** diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java index 5cc242c0ac..417e599ef4 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java @@ -36,8 +36,7 @@ import org.testng.annotations.Test; public class ServiceApiLiveTest extends BaseKeystoneApiLiveTest { public void testTenants() { - ServiceApi api = this.api.getServiceApi(); - Set result = api.listTenants(); + Set result = api.getServiceApi().listTenants(); assertNotNull(result); assertFalse(result.isEmpty()); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java index aae85f64ee..402789a865 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java @@ -37,15 +37,15 @@ import org.testng.annotations.Test; public class TenantApiLiveTest extends BaseKeystoneApiLiveTest { public void testTenants() { - TenantApi api = this.api.getTenantApi().get(); - Set result = api.list().concat().toSet(); + TenantApi tenantApi = api.getTenantApi().get(); + Set result = tenantApi.list().concat().toSet(); assertNotNull(result); assertFalse(result.isEmpty()); for (Tenant tenant : result) { assertNotNull(tenant.getId()); - Tenant aTenant = api.get(tenant.getId()); + Tenant aTenant = tenantApi.get(tenant.getId()); assertNotNull(aTenant, "get returned null for tenant: " + tenant); assertEquals(aTenant, tenant); @@ -54,10 +54,10 @@ public class TenantApiLiveTest extends BaseKeystoneApiLiveTest { public void testTenantsByName() { - TenantApi api = this.api.getTenantApi().get(); + TenantApi tenantApi = api.getTenantApi().get(); - for (Tenant tenant : api.list().concat()) { - Tenant aTenant = api.getByName(tenant.getName()); + for (Tenant tenant : tenantApi.list().concat()) { + Tenant aTenant = tenantApi.getByName(tenant.getName()); assertNotNull(aTenant, "get returned null for tenant: " + tenant); assertEquals(aTenant, tenant); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java index 04a8f93eca..5a86960b81 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java @@ -65,14 +65,14 @@ public class TokenApiLiveTest extends BaseKeystoneApiLiveTest { public void testToken() { - TokenApi api = this.api.getTokenApi().get(); - assertTrue(api.isValid(token)); - Token result = api.get(token); + TokenApi tokenApi = api.getTokenApi().get(); + assertTrue(tokenApi.isValid(token)); + Token result = tokenApi.get(token); assertNotNull(result); assertEquals(result.getId(), token); assertNotNull(result.getTenant()); - User user = api.getUserOfToken(token); + User user = tokenApi.getUserOfToken(token); assertNotNull(user); assertNotNull(user.getId()); assertNotNull(user.getName()); @@ -81,16 +81,16 @@ public class TokenApiLiveTest extends BaseKeystoneApiLiveTest { public void testInvalidToken() { - TokenApi api = this.api.getTokenApi().get(); - assertFalse(api.isValid("thisisnotarealtoken!")); - assertNull(api.get("thisisnotarealtoken!")); + TokenApi tokenApi = api.getTokenApi().get(); + assertFalse(tokenApi.isValid("thisisnotarealtoken!")); + assertNull(tokenApi.get("thisisnotarealtoken!")); } public void testTokenEndpoints() { - TokenApi api = this.api.getTokenApi().get(); - Set endpoints = api.listEndpointsForToken(token); + TokenApi tokenApi = api.getTokenApi().get(); + Set endpoints = tokenApi.listEndpointsForToken(token); assertNotNull(endpoints); assertFalse(endpoints.isEmpty()); @@ -98,8 +98,8 @@ public class TokenApiLiveTest extends BaseKeystoneApiLiveTest { public void testInvalidTokenEndpoints() { - TokenApi api = this.api.getTokenApi().get(); - assertTrue(api.listEndpointsForToken("thisisnotarealtoken!").isEmpty()); + TokenApi tokenApi = api.getTokenApi().get(); + assertTrue(tokenApi.listEndpointsForToken("thisisnotarealtoken!").isEmpty()); } } diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java index e4ac7f662a..df48aed032 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java @@ -40,12 +40,12 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest { public void testUsers() { - UserApi api = this.api.getUserApi().get(); - Set users = api.list().concat().toSet(); + UserApi userApi = api.getUserApi().get(); + Set users = userApi.list().concat().toSet(); assertNotNull(users); assertFalse(users.isEmpty()); for (User user : users) { - User aUser = api.get(user.getId()); + User aUser = userApi.get(user.getId()); assertEquals(aUser, user); } @@ -53,12 +53,12 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest { public void testUserRolesOnTenant() { - UserApi api = this.api.getUserApi().get(); - Set tenants = this.api.getTenantApi().get().list().concat().toSet(); + UserApi userApi = api.getUserApi().get(); + Set tenants = api.getTenantApi().get().list().concat().toSet(); - for (User user : api.list().concat()) { + for (User user : userApi.list().concat()) { for (Tenant tenant : tenants) { - Set roles = api.listRolesOfUserOnTenant(user.getId(), tenant.getId()); + Set roles = userApi.listRolesOfUserOnTenant(user.getId(), tenant.getId()); for (Role role : roles) { assertNotNull(role.getId()); } @@ -69,9 +69,9 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest { public void testListRolesOfUser() { - UserApi api = this.api.getUserApi().get(); - for (User user : api.list().concat()) { - Set roles = api.listRolesOfUser(user.getId()); + UserApi userApi = api.getUserApi().get(); + for (User user : userApi.list().concat()) { + Set roles = userApi.listRolesOfUser(user.getId()); for (Role role : roles) { assertNotNull(role.getId()); } @@ -81,9 +81,9 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest { public void testUsersByName() { - UserApi api = this.api.getUserApi().get(); - for (User user : api.list().concat()) { - User aUser = api.getByName(user.getName()); + UserApi userApi = api.getUserApi().get(); + for (User user : userApi.list().concat()) { + User aUser = userApi.getByName(user.getName()); assertEquals(aUser, user); } diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2ApiMetadata.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2ApiMetadata.java index 3e6ca14e47..aa20f170fb 100644 --- a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2ApiMetadata.java +++ b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2ApiMetadata.java @@ -33,7 +33,6 @@ import org.jclouds.ec2.compute.config.EC2ResolveImagesModule; import org.jclouds.openstack.nova.ec2.config.HyphenToNullIso8601Module; import org.jclouds.openstack.nova.ec2.config.NovaEC2ComputeServiceContextModule; import org.jclouds.openstack.nova.ec2.config.NovaEC2RestClientModule; -import org.jclouds.rest.RestContext; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; @@ -46,7 +45,12 @@ import com.google.inject.Module; */ public class NovaEC2ApiMetadata extends EC2ApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaEC2Client.class)} as + * {@link NovaEC2AsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -81,6 +85,7 @@ public class NovaEC2ApiMetadata extends EC2ApiMetadata { } public static class Builder extends EC2ApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder(){ super(NovaEC2Client.class, NovaEC2AsyncClient.class); id("openstack-nova-ec2") diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2AsyncClient.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2AsyncClient.java index 7d09a25f04..6bc1680f4f 100644 --- a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2AsyncClient.java +++ b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2AsyncClient.java @@ -26,7 +26,10 @@ import org.jclouds.rest.annotations.Delegate; * Provides asynchronous access to EC2 services. * * @author Adam Lowe + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaEC2Client.class)} as + * {@link NovaEC2AsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated public interface NovaEC2AsyncClient extends EC2AsyncClient { /** * {@inheritDoc} diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java index e832962941..f5a8a92aee 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java @@ -38,7 +38,6 @@ import org.jclouds.openstack.nova.v2_0.compute.config.NovaComputeServiceContextM import org.jclouds.openstack.nova.v2_0.config.NovaParserModule; import org.jclouds.openstack.nova.v2_0.config.NovaRestClientModule; import org.jclouds.openstack.v2_0.ServiceType; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -52,7 +51,12 @@ import com.google.inject.Module; */ public class NovaApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaApi.class)} as + * {@link NovaAsyncApi} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -88,6 +92,7 @@ public class NovaApiMetadata extends BaseRestApiMetadata { public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(NovaApi.class, NovaAsyncApi.class); id("openstack-nova") diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java index 60804b0fef..e8348446a5 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java @@ -57,7 +57,10 @@ import com.google.inject.Provides; * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaApi.class)} as + * {@link NovaAsyncApi} interface will be removed in jclouds 1.7. */ +@Deprecated public interface NovaAsyncApi extends Closeable { /** diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java index 9f1f068ecf..84bd2e3aad 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java @@ -36,8 +36,8 @@ public class KeyPairApiLiveTest extends BaseNovaApiLiveTest { public void testListKeyPairs() throws Exception { for (String zoneId : api.getConfiguredZones()) { - KeyPairApi api = this.api.getKeyPairExtensionForZone(zoneId).get(); - FluentIterable keyPairsList = api.list(); + KeyPairApi keyPairApi = api.getKeyPairExtensionForZone(zoneId).get(); + FluentIterable keyPairsList = keyPairApi.list(); assertNotNull(keyPairsList); } } @@ -45,14 +45,14 @@ public class KeyPairApiLiveTest extends BaseNovaApiLiveTest { public void testCreateAndDeleteKeyPair() throws Exception { final String KEYPAIR_NAME = "testkp"; for (String zoneId : api.getConfiguredZones()) { - KeyPairApi api = this.api.getKeyPairExtensionForZone(zoneId).get(); + KeyPairApi keyPairApi = api.getKeyPairExtensionForZone(zoneId).get(); KeyPair keyPair = null; try { - keyPair = api.create(KEYPAIR_NAME); + keyPair = keyPairApi.create(KEYPAIR_NAME); assertNotNull(keyPair); } finally { if (keyPair != null) { - api.delete(KEYPAIR_NAME); + keyPairApi.delete(KEYPAIR_NAME); } } } @@ -63,14 +63,14 @@ public class KeyPairApiLiveTest extends BaseNovaApiLiveTest { final String PUBLIC_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCrrBREFxz3002l1HuXz0+UOdJQ/mOYD5DiJwwB/TOybwIKQJPOxJWA9gBoo4k9dthTKBTaEYbzrll7iZcp59E80S6mNiAr3mUgi+x5Y8uyXeJ2Ws+h6peVyFVUu9epkwpcTd1GVfdcVWsTajwDz9+lxCDhl0RZKDFoT0scTxbj/w== nova@nv-aw2az2-api0002"; for (String zoneId : api.getConfiguredZones()) { - KeyPairApi api = this.api.getKeyPairExtensionForZone(zoneId).get(); + KeyPairApi keyPairApi = api.getKeyPairExtensionForZone(zoneId).get(); KeyPair keyPair = null; try { - keyPair = api.createWithPublicKey(KEYPAIR_NAME, PUBLIC_KEY); + keyPair = keyPairApi.createWithPublicKey(KEYPAIR_NAME, PUBLIC_KEY); assertNotNull(keyPair); } finally { if (keyPair != null) { - api.delete(KEYPAIR_NAME); + keyPairApi.delete(KEYPAIR_NAME); } } } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java index eb699df571..8358afae99 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java @@ -43,27 +43,27 @@ public class SecurityGroupApiLiveTest extends BaseNovaApiLiveTest { public void list() throws Exception { for (String zoneId : api.getConfiguredZones()) { - SecurityGroupApi api = this.api.getSecurityGroupExtensionForZone(zoneId).get(); - Set securityGroupsList = api.list().toSet(); + SecurityGroupApi securityGroupApi = api.getSecurityGroupExtensionForZone(zoneId).get(); + Set securityGroupsList = securityGroupApi.list().toSet(); assertNotNull(securityGroupsList); } } public void createGetAndDeleteSecurityGroup() throws Exception { for (String zoneId : api.getConfiguredZones()) { - SecurityGroupApi api = this.api.getSecurityGroupExtensionForZone(zoneId).get(); + SecurityGroupApi securityGroupApi = api.getSecurityGroupExtensionForZone(zoneId).get(); SecurityGroup securityGroup = null; String id; try { - securityGroup = api + securityGroup = securityGroupApi .createWithDescription(SECURITY_GROUP_NAME, "test security group"); assertNotNull(securityGroup); id = securityGroup.getId(); - SecurityGroup theGroup = api.get(id); + SecurityGroup theGroup = securityGroupApi.get(id); assertNotNull(theGroup); } finally { if (securityGroup != null) { - api.delete(securityGroup.getId()); + securityGroupApi.delete(securityGroup.getId()); } } } @@ -71,29 +71,29 @@ public class SecurityGroupApiLiveTest extends BaseNovaApiLiveTest { public void createAndDeleteSecurityGroupRule() throws Exception { for (String zoneId : api.getConfiguredZones()) { - SecurityGroupApi api = this.api.getSecurityGroupExtensionForZone(zoneId).get(); + SecurityGroupApi securityGroupApi = api.getSecurityGroupExtensionForZone(zoneId).get(); SecurityGroup securityGroup = null; try { - securityGroup = api.createWithDescription(SECURITY_GROUP_NAME, "test security group"); + securityGroup = securityGroupApi.createWithDescription(SECURITY_GROUP_NAME, "test security group"); assertNotNull(securityGroup); for (int port : ImmutableSet.of(22, 8080)) { - SecurityGroupRule rule = api.createRuleAllowingCidrBlock(securityGroup.getId(), Ingress + SecurityGroupRule rule = securityGroupApi.createRuleAllowingCidrBlock(securityGroup.getId(), Ingress .builder().ipProtocol(IpProtocol.TCP).fromPort(port).toPort(port).build(), "0.0.0.0/0"); assertNotNull(rule); - SecurityGroupRule rule2 = api.createRuleAllowingSecurityGroupId(securityGroup.getId(), + SecurityGroupRule rule2 = securityGroupApi.createRuleAllowingSecurityGroupId(securityGroup.getId(), Ingress.builder().ipProtocol(IpProtocol.TCP).fromPort(port).toPort(port).build(), securityGroup .getId()); assertNotNull(rule2); } - securityGroup = api.get(securityGroup.getId()); + securityGroup = securityGroupApi.get(securityGroup.getId()); } finally { if (securityGroup != null) { - api.delete(securityGroup.getId()); + securityGroupApi.delete(securityGroup.getId()); } } } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java index ac9c7bd5e2..04b3433241 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java @@ -45,8 +45,8 @@ public class ExtensionApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/extensions") public void testListExtensions() throws Exception { for (String zoneId : zones) { - ExtensionApi api = this.api.getExtensionApiForZone(zoneId); - Set response = api.list(); + ExtensionApi extensionApi = api.getExtensionApiForZone(zoneId); + Set response = extensionApi.list(); assertNotNull(response); assertFalse(response.isEmpty()); for (Extension extension : response) { @@ -68,10 +68,10 @@ public class ExtensionApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/extensions/{alias}", dependsOnMethods = { "testListExtensions" }) public void testGetExtensionByAlias() throws Exception { for (String zoneId : zones) { - ExtensionApi api = this.api.getExtensionApiForZone(zoneId); - Set response = api.list(); + ExtensionApi extensionApi = api.getExtensionApiForZone(zoneId); + Set response = extensionApi.list(); for (Extension extension : response) { - Extension details = api.get(extension.getId()); + Extension details = extensionApi.get(extension.getId()); assertNotNull(details); assertEquals(details.getId(), extension.getId()); assertEquals(details.getName(), extension.getName()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java index d6c1b4bd9b..1122d4d396 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java @@ -46,8 +46,8 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/flavors") public void testListFlavors() throws Exception { for (String zoneId : zones) { - FlavorApi api = this.api.getFlavorApiForZone(zoneId); - Set response = api.list().concat().toSet(); + FlavorApi flavorApi = api.getFlavorApiForZone(zoneId); + Set response = flavorApi.list().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); for (Resource flavor : response) { @@ -66,8 +66,8 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/flavors/detail") public void testListFlavorsInDetail() throws Exception { for (String zoneId : zones) { - FlavorApi api = this.api.getFlavorApiForZone(zoneId); - Set response = api.listInDetail().concat().toSet(); + FlavorApi flavorApi = api.getFlavorApiForZone(zoneId); + Set response = flavorApi.listInDetail().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); for (Flavor flavor : response) { @@ -89,10 +89,10 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/flavors/{id}", dependsOnMethods = { "testListFlavorsInDetail" }) public void testGetFlavorById() throws Exception { for (String zoneId : zones) { - FlavorApi api = this.api.getFlavorApiForZone(zoneId); - Set response = api.listInDetail().concat().toSet(); + FlavorApi flavorApi = api.getFlavorApiForZone(zoneId); + Set response = flavorApi.listInDetail().concat().toSet(); for (Flavor flavor : response) { - Flavor details = api.get(flavor.getId()); + Flavor details = flavorApi.get(flavor.getId()); assertNotNull(details); assertEquals(details.getId(), flavor.getId()); assertEquals(details.getName(), flavor.getName()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java index a821723adf..90586a7463 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java @@ -41,8 +41,8 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/images") public void testListImages() throws Exception { for (String zoneId : zones) { - ImageApi api = this.api.getImageApiForZone(zoneId); - Set response = api.list().concat().toSet(); + ImageApi imageApi = api.getImageApiForZone(zoneId); + Set response = imageApi.list().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); for (Resource image : response) { @@ -56,8 +56,8 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/images/detail") public void testListImagesInDetail() throws Exception { for (String zoneId : api.getConfiguredZones()) { - ImageApi api = this.api.getImageApiForZone(zoneId); - Set response = api.listInDetail().concat().toSet(); + ImageApi imageApi = api.getImageApiForZone(zoneId); + Set response = imageApi.listInDetail().concat().toSet(); assertNotNull(response); assertFalse(response.isEmpty()); for (Image image : response) { @@ -80,10 +80,10 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/images/{id}", dependsOnMethods = { "testListImagesInDetail" }) public void testGetImageById() throws Exception { for (String zoneId : api.getConfiguredZones()) { - ImageApi api = this.api.getImageApiForZone(zoneId); - Set response = api.listInDetail().concat().toSet(); + ImageApi imageApi = api.getImageApiForZone(zoneId); + Set response = imageApi.listInDetail().concat().toSet(); for (Image image : response) { - Image details = api.get(image.getId()); + Image details = imageApi.get(image.getId()); assertNotNull(details); assertEquals(details.getId(), image.getId()); assertEquals(details.getName(), image.getName()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java index 8c5fdbf908..190aa42665 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java @@ -43,8 +43,8 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/servers") public void testListServers() throws Exception { for (String zoneId : zones) { - ServerApi api = this.api.getServerApiForZone(zoneId); - for (Resource server : api.list().concat()) { + ServerApi serverApi = api.getServerApiForZone(zoneId); + for (Resource server : serverApi.list().concat()) { checkResource(server); } } @@ -53,8 +53,8 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/servers/detail") public void testListServersInDetail() throws Exception { for (String zoneId : zones) { - ServerApi api = this.api.getServerApiForZone(zoneId); - for (Server server : api.listInDetail().concat()) { + ServerApi serverApi = api.getServerApiForZone(zoneId); + for (Server server : serverApi.listInDetail().concat()) { checkServer(server); } } @@ -63,9 +63,9 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest { @Test(description = "GET /v${apiVersion}/{tenantId}/servers/{id}", dependsOnMethods = { "testListServersInDetail" }) public void testGetServerById() throws Exception { for (String zoneId : zones) { - ServerApi api = this.api.getServerApiForZone(zoneId); - for (Resource server : api.list().concat()) { - Server details = api.get(server.getId()); + ServerApi serverApi = api.getServerApiForZone(zoneId); + for (Resource server : serverApi.list().concat()) { + Server details = serverApi.get(server.getId()); assertEquals(details.getId(), server.getId()); assertEquals(details.getName(), server.getName()); assertEquals(details.getLinks(), server.getLinks()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java index 5e08e5e8e5..670fd8cc25 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java @@ -62,10 +62,10 @@ public class BaseNovaApiLiveTest extends BaseApiLiveTest { super.setup(); zones = api.getConfiguredZones(); for (String zone : zones){ - ServerApi api = this.api.getServerApiForZone(zone); - for (Resource server : api.list().concat()){ + ServerApi serverApi = api.getServerApiForZone(zone); + for (Resource server : serverApi.list().concat()){ if (server.getName().equals(hostName)) - api.delete(server.getId()); + serverApi.delete(server.getId()); } } } diff --git a/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityApiMetadata.java b/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityApiMetadata.java index 6c1b2823c5..edf8f4d40d 100644 --- a/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityApiMetadata.java +++ b/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityApiMetadata.java @@ -33,7 +33,6 @@ import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule; import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule.KeystoneAdminURLModule; import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule; import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes; -import org.jclouds.rest.RestContext; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; @@ -46,7 +45,12 @@ import com.google.inject.Module; */ public class CloudIdentityApiMetadata extends KeystoneApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(KeystoneApi.class)} as + * {@link KeystoneAsyncApi} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -70,6 +74,7 @@ public class CloudIdentityApiMetadata extends KeystoneApiMetadata { } public static class Builder extends KeystoneApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder(){ super(KeystoneApi.class, KeystoneAsyncApi.class); id("rackspace-cloudidentity") diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersApiMetadata.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersApiMetadata.java index 2a0a1b5e72..64a33638f8 100644 --- a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersApiMetadata.java +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersApiMetadata.java @@ -32,7 +32,6 @@ import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticati import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes; import org.jclouds.rackspace.cloudloadbalancers.v1.config.CloudLoadBalancersRestClientModule; import org.jclouds.rackspace.cloudloadbalancers.v1.loadbalancer.config.CloudLoadBalancersLoadBalancerContextModule; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -45,8 +44,12 @@ import com.google.inject.Module; */ public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = - new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudLoadBalancersApi.class)} as + * {@link CloudLoadBalancersAsyncApi} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -72,6 +75,7 @@ public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata { public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(CloudLoadBalancersApi.class, CloudLoadBalancersAsyncApi.class); id("rackspace-cloudloadbalancers") diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersAsyncApi.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersAsyncApi.java index 2dc9886661..dca10a6602 100644 --- a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersAsyncApi.java +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersAsyncApi.java @@ -49,7 +49,10 @@ import com.google.inject.Provides; * * @see CloudLoadBalancersApi * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudLoadBalancersApi.class)} as + * {@link CloudLoadBalancersAsyncApi} interface will be removed in jclouds 1.7. */ +@Deprecated public interface CloudLoadBalancersAsyncApi extends Closeable { /** * @return the Zone codes configured diff --git a/apis/route53/src/main/java/org/jclouds/route53/Route53ApiMetadata.java b/apis/route53/src/main/java/org/jclouds/route53/Route53ApiMetadata.java index 8fe759a984..f64443c835 100644 --- a/apis/route53/src/main/java/org/jclouds/route53/Route53ApiMetadata.java +++ b/apis/route53/src/main/java/org/jclouds/route53/Route53ApiMetadata.java @@ -25,7 +25,6 @@ import java.net.URI; import java.util.Properties; import org.jclouds.apis.ApiMetadata; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import org.jclouds.route53.config.Route53RestClientModule; @@ -38,7 +37,12 @@ import com.google.common.reflect.TypeToken; */ public class Route53ApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(Route53Api.class)} as + * {@link Route53AsyncApi} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -47,6 +51,7 @@ public class Route53ApiMetadata extends BaseRestApiMetadata { return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this); } + @SuppressWarnings("deprecation") public Route53ApiMetadata() { this(new Builder(Route53Api.class, Route53AsyncApi.class)); } diff --git a/apis/route53/src/main/java/org/jclouds/route53/Route53AsyncApi.java b/apis/route53/src/main/java/org/jclouds/route53/Route53AsyncApi.java index e991bda41b..fac0d408f5 100644 --- a/apis/route53/src/main/java/org/jclouds/route53/Route53AsyncApi.java +++ b/apis/route53/src/main/java/org/jclouds/route53/Route53AsyncApi.java @@ -46,7 +46,10 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(Route53Api.class)} as + * {@link Route53AsyncApi} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(RestAuthentication.class) @VirtualHost @Path("/{jclouds.api-version}") diff --git a/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java b/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java index 17a8508250..884030c4e8 100644 --- a/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java +++ b/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java @@ -18,7 +18,6 @@ */ package org.jclouds.s3; -import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_RELAX_HOSTNAME; import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG; import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG; @@ -32,7 +31,6 @@ import java.net.URI; import java.util.Properties; import org.jclouds.apis.ApiMetadata; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import org.jclouds.s3.blobstore.S3BlobStoreContext; import org.jclouds.s3.blobstore.config.S3BlobStoreContextModule; @@ -62,7 +60,12 @@ import com.google.inject.Module; */ public class S3ApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildClient(S3Client.class)} as + * {@link S3AsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -81,7 +84,6 @@ public class S3ApiMetadata extends BaseRestApiMetadata { public static Properties defaultProperties() { Properties properties = BaseRestApiMetadata.defaultProperties(); - properties.setProperty(PROPERTY_API_VERSION, S3AsyncClient.VERSION); properties.setProperty(PROPERTY_AUTH_TAG, "AWS"); properties.setProperty(PROPERTY_HEADER_TAG, S3Headers.DEFAULT_AMAZON_HEADERTAG); properties.setProperty(PROPERTY_S3_SERVICE_PATH, "/"); @@ -93,6 +95,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata { } public static abstract class Builder> extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { this(S3Client.class, S3AsyncClient.class); } @@ -105,7 +108,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata { .credentialName("Secret Access Key") .defaultEndpoint("https://s3.amazonaws.com") .documentation(URI.create("http://docs.amazonwebservices.com/AmazonS3/latest/API")) - .version(S3AsyncClient.VERSION) + .version("2006-03-01") .defaultProperties(S3ApiMetadata.defaultProperties()) .context(CONTEXT_TOKEN) .view(typeToken(S3BlobStoreContext.class)) diff --git a/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java b/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java index 8a2677f252..664539004c 100644 --- a/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java +++ b/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java @@ -104,9 +104,13 @@ import com.google.inject.Provides; * * @author Adrian Cole * @author James Murty - * @see S3Client + * @see AWSS3Client * @see + * @deprecated please use + * {@code org.jclouds.ContextBuilder#buildApi(S3Client.class)} + * as {@link S3AsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(RequestAuthorizeSignature.class) @BlobScope(CONTAINER) public interface S3AsyncClient extends Closeable { diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/SQSApiMetadata.java b/apis/sqs/src/main/java/org/jclouds/sqs/SQSApiMetadata.java index 24b78ceb70..aed5f2687b 100644 --- a/apis/sqs/src/main/java/org/jclouds/sqs/SQSApiMetadata.java +++ b/apis/sqs/src/main/java/org/jclouds/sqs/SQSApiMetadata.java @@ -27,7 +27,6 @@ import java.net.URI; import java.util.Properties; import org.jclouds.apis.ApiMetadata; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import org.jclouds.sqs.config.SQSRestClientModule; @@ -42,7 +41,12 @@ import com.google.inject.Module; */ public class SQSApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SQSApi.class)} as + * {@link SQSAsyncApi} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -51,6 +55,7 @@ public class SQSApiMetadata extends BaseRestApiMetadata { return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this); } + @SuppressWarnings("deprecation") public SQSApiMetadata() { this(new Builder(SQSApi.class, SQSAsyncApi.class)); } diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/SQSAsyncApi.java b/apis/sqs/src/main/java/org/jclouds/sqs/SQSAsyncApi.java index 94cb518e30..82b08f942a 100644 --- a/apis/sqs/src/main/java/org/jclouds/sqs/SQSAsyncApi.java +++ b/apis/sqs/src/main/java/org/jclouds/sqs/SQSAsyncApi.java @@ -45,7 +45,10 @@ import com.google.inject.Provides; * href="http://docs.amazonwebservices.com/AWSSimpleQueueService/2011-10-01/APIReference/Welcome.html">SQS * documentation * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SQSApi.class)} as + * {@link SQSAsyncApi} interface will be removed in jclouds 1.7. */ +@Deprecated @Beta @RequestFilters(FormSigner.class) @VirtualHost diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/features/BulkMessageApiLiveTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/features/BulkMessageApiLiveTest.java index 86d4e229c4..b028021388 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/features/BulkMessageApiLiveTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/features/BulkMessageApiLiveTest.java @@ -87,9 +87,9 @@ public class BulkMessageApiLiveTest extends BaseSQSApiLiveTest { @Test(dependsOnMethods = "testSendMessages") public void testChangeMessageVisibility() { for (URI queue : queues) { - MessageApi api = this.api.getMessageApiForQueue(queue); + MessageApi messageApi = api.getMessageApiForQueue(queue); - Set messages = collectMessages(api); + Set messages = collectMessages(messageApi); receiptHandles = Iterables.transform(messages, new Function() { @Override @@ -99,14 +99,14 @@ public class BulkMessageApiLiveTest extends BaseSQSApiLiveTest { }); // hidden message, so we can't see it - assertNull(api.receive()); + assertNull(messageApi.receive()); // this should unhide it - BatchResult acks = api.changeVisibility(receiptHandles, 0); + BatchResult acks = messageApi.changeVisibility(receiptHandles, 0); assertEquals(acks.size(), messages.size(), "error changing visibility " + acks); // so we can see it again - assertEquals(collectMessages(api).size(), messages.size()); + assertEquals(collectMessages(messageApi).size(), messages.size()); } } diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/features/MessageApiLiveTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/features/MessageApiLiveTest.java index 7c076cf917..743bfd9181 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/features/MessageApiLiveTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/features/MessageApiLiveTest.java @@ -55,14 +55,14 @@ public class MessageApiLiveTest extends BaseSQSApiLiveTest { public void testSendMessage() { for (URI queue : queues) { - assertEquals(api.getMessageApiForQueue(queue).send(message).getMD5(), md5); + assertEquals(api(queue).send(message).getMD5(), md5); } } @Test(dependsOnMethods = "testSendMessage") public void testReceiveMessageWithoutHidingMessage() { for (URI queue : queues) { - assertEquals(api.getMessageApiForQueue(queue).receive(attribute("All").visibilityTimeout(0)).getMD5(), md5); + assertEquals(api(queue).receive(attribute("All").visibilityTimeout(0)).getMD5(), md5); } } @@ -71,24 +71,27 @@ public class MessageApiLiveTest extends BaseSQSApiLiveTest { @Test(dependsOnMethods = "testReceiveMessageWithoutHidingMessage") public void testChangeMessageVisibility() { for (URI queue : queues) { - MessageApi api = this.api.getMessageApiForQueue(queue); + MessageApi messageApi = api(queue); // start hiding it at 5 seconds - receiptHandle = api.receive(attribute("None").visibilityTimeout(5)).getReceiptHandle(); + receiptHandle = messageApi.receive(attribute("None").visibilityTimeout(5)).getReceiptHandle(); // hidden message, so we can't see it - assertNull(api.receive()); + assertNull(messageApi.receive()); // this should unhide it - api.changeVisibility(receiptHandle, 0); + messageApi.changeVisibility(receiptHandle, 0); // so we can see it again - assertEquals(api.receive(attribute("All").visibilityTimeout(0)).getMD5(), md5); + assertEquals(messageApi.receive(attribute("All").visibilityTimeout(0)).getMD5(), md5); } } @Test(dependsOnMethods = "testChangeMessageVisibility") public void testDeleteMessage() throws InterruptedException { for (URI queue : queues) { - api.getMessageApiForQueue(queue).delete(receiptHandle); + api(queue).delete(receiptHandle); assertNoMessages(queue); } } + private MessageApi api(URI queue) { + return api.getMessageApiForQueue(queue); + } } diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/internal/BaseSQSApiLiveTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/internal/BaseSQSApiLiveTest.java index f31a1bca87..23ddbc4a6a 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/internal/BaseSQSApiLiveTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/internal/BaseSQSApiLiveTest.java @@ -61,12 +61,12 @@ public class BaseSQSApiLiveTest extends BaseApiLiveTest { } protected String recreateQueueInRegion(String queueName, String region) { - QueueApi api = this.api.getQueueApiForRegion(region); - URI result = api.get(queueName); + QueueApi queueApi = api.getQueueApiForRegion(region); + URI result = queueApi.get(queueName); if (result != null) { - api.delete(result); + queueApi.delete(result); } - URI queue = api.create(queueName); + URI queue = queueApi.create(queueName); assertQueueInList(region, queue); queues.add(queue); return queueName; diff --git a/apis/sts/src/main/java/org/jclouds/sts/STSApiMetadata.java b/apis/sts/src/main/java/org/jclouds/sts/STSApiMetadata.java index d13192bb11..9fc653a480 100644 --- a/apis/sts/src/main/java/org/jclouds/sts/STSApiMetadata.java +++ b/apis/sts/src/main/java/org/jclouds/sts/STSApiMetadata.java @@ -25,7 +25,6 @@ import java.net.URI; import java.util.Properties; import org.jclouds.apis.ApiMetadata; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import org.jclouds.sts.config.STSRestClientModule; @@ -38,7 +37,12 @@ import com.google.common.reflect.TypeToken; */ public class STSApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(STSApi.class)} as + * {@link STSAsyncApi} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -47,6 +51,7 @@ public class STSApiMetadata extends BaseRestApiMetadata { return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this); } + @SuppressWarnings("deprecation") public STSApiMetadata() { this(new Builder(STSApi.class, STSAsyncApi.class)); } diff --git a/apis/sts/src/main/java/org/jclouds/sts/STSAsyncApi.java b/apis/sts/src/main/java/org/jclouds/sts/STSAsyncApi.java index b841100107..fdeed7519e 100644 --- a/apis/sts/src/main/java/org/jclouds/sts/STSAsyncApi.java +++ b/apis/sts/src/main/java/org/jclouds/sts/STSAsyncApi.java @@ -46,7 +46,10 @@ import com.google.common.util.concurrent.ListenableFuture; * * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(STSApi.class)} as + * {@link STSAsyncApi} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(FormSigner.class) @VirtualHost public interface STSAsyncApi extends Closeable { diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java index e7c744ceaf..0bc53dccd7 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java @@ -79,7 +79,10 @@ import com.google.inject.Provides; * @see CommonSwiftClient * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CommonSwiftClient.class)} as + * {@link CommonSwiftAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated public interface CommonSwiftAsyncClient extends Closeable { @Provides SwiftObject newSwiftObject(); diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftApiMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftApiMetadata.java index 86690aa254..78c16ee208 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftApiMetadata.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftApiMetadata.java @@ -32,7 +32,6 @@ import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule; import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule.SwiftTemporaryUrlExtensionModule; import org.jclouds.openstack.swift.config.SwiftRestClientModule; import org.jclouds.openstack.swift.config.SwiftRestClientModule.StorageEndpointModule; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -46,7 +45,12 @@ import com.google.inject.Module; */ public class SwiftApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SwiftClient.class)} as + * {@link SwiftAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -75,6 +79,7 @@ public class SwiftApiMetadata extends BaseRestApiMetadata { } public static abstract class Builder> extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { this(SwiftClient.class, SwiftAsyncClient.class); } diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftAsyncClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftAsyncClient.java index a870308818..f20a6fc368 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftAsyncClient.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftAsyncClient.java @@ -26,7 +26,10 @@ import org.jclouds.rest.annotations.RequestFilters; * Functionality that's in Swift, and not in CloudFiles. * * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SwiftClient.class)} as + * {@link SwiftAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(AuthenticateRequest.class) @Endpoint(Storage.class) public interface SwiftAsyncClient extends CommonSwiftAsyncClient { diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java index c8939979f5..f547168a16 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java @@ -32,7 +32,6 @@ import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule; import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule.SwiftKeystoneTemporaryUrlExtensionModule; import org.jclouds.openstack.swift.config.SwiftKeystoneRestClientModule; import org.jclouds.openstack.swift.config.SwiftRestClientModule.KeystoneStorageEndpointModule; -import org.jclouds.rest.RestContext; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; @@ -45,7 +44,12 @@ import com.google.inject.Module; */ public class SwiftKeystoneApiMetadata extends SwiftApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SwiftKeystoneClient.class)} as + * {@link SwiftKeystoneAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneAsyncClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneAsyncClient.java index cd89cc4bb2..06a1bb0e7c 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneAsyncClient.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneAsyncClient.java @@ -26,7 +26,10 @@ import org.jclouds.rest.annotations.RequestFilters; * Functionality that's in Swift, and not in CloudFiles. * * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SwiftKeystoneClient.class)} as + * {@link SwiftKeystoneAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(AuthenticateRequest.class) @Endpoint(Storage.class) public interface SwiftKeystoneAsyncClient extends SwiftAsyncClient { diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java index 978167de9e..e8f4ba8030 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java @@ -31,7 +31,6 @@ import java.util.Properties; import org.jclouds.apis.ApiMetadata; import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule; import org.jclouds.vcloud.config.VCloudRestClientModule; @@ -48,7 +47,12 @@ import com.google.inject.Module; */ public class VCloudApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(VCloudClient.class)} as + * {@link VCloudAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -87,6 +91,7 @@ public class VCloudApiMetadata extends BaseRestApiMetadata { public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(VCloudClient.class, VCloudAsyncClient.class); id("vcloud") diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudAsyncClient.java index a9f81865ec..fb032ef295 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudAsyncClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudAsyncClient.java @@ -39,7 +39,10 @@ import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(VCloudClient.class)} as + * {@link VCloudAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) public interface VCloudAsyncClient extends Closeable { diff --git a/core/src/main/java/org/jclouds/rest/RestContext.java b/core/src/main/java/org/jclouds/rest/RestContext.java index fe1569980c..b4df730195 100644 --- a/core/src/main/java/org/jclouds/rest/RestContext.java +++ b/core/src/main/java/org/jclouds/rest/RestContext.java @@ -32,7 +32,10 @@ import com.google.inject.ImplementedBy; * * @author Adrian Cole * + * @deprecated please use {@link org.jclouds.ContextBuilder#buildApi()} as + * async interface will be removed in jclouds 1.7. */ +@Deprecated @ImplementedBy(RestContextImpl.class) public interface RestContext extends Context { @@ -40,7 +43,10 @@ public interface RestContext extends Context { * low-level api to the cloud. Threadsafe implementations will return a singleton. * * @return a connection to the cloud where all methods return {@link Future}s + * @deprecated please use {@link org.jclouds.ContextBuilder#buildApi()} as + * async interface will be removed in jclouds 1.7. */ + @Deprecated A getAsyncApi(); /** diff --git a/core/src/main/java/org/jclouds/rest/internal/RestContextImpl.java b/core/src/main/java/org/jclouds/rest/internal/RestContextImpl.java index 84085b4ea5..3698ad1a7f 100644 --- a/core/src/main/java/org/jclouds/rest/internal/RestContextImpl.java +++ b/core/src/main/java/org/jclouds/rest/internal/RestContextImpl.java @@ -39,7 +39,10 @@ import com.google.inject.TypeLiteral; /** * @author Adrian Cole + * @deprecated please use {@link org.jclouds.ContextBuilder#buildApi()} as + * async interface will be removed in jclouds 1.7. */ +@Deprecated @Singleton public class RestContextImpl extends ContextImpl implements RestContext { diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2ApiMetadata.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2ApiMetadata.java index bc31ff3d96..d66eaa2b21 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2ApiMetadata.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2ApiMetadata.java @@ -28,7 +28,6 @@ import org.jclouds.aws.ec2.compute.config.AWSEC2ComputeServiceContextModule; import org.jclouds.aws.ec2.config.AWSEC2RestClientModule; import org.jclouds.ec2.EC2ApiMetadata; import org.jclouds.ec2.compute.config.EC2ResolveImagesModule; -import org.jclouds.rest.RestContext; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; @@ -40,8 +39,13 @@ import com.google.inject.Module; * @author Adrian Cole */ public class AWSEC2ApiMetadata extends EC2ApiMetadata { - - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AWSEC2Client.class)} as + * {@link AWSEC2AsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -69,10 +73,11 @@ public class AWSEC2ApiMetadata extends EC2ApiMetadata { } public static class Builder extends EC2ApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder(){ super(AWSEC2Client.class, AWSEC2AsyncClient.class); id("aws-ec2") - .version(AWSEC2AsyncClient.VERSION) + .version("2012-06-01") .name("Amazon-specific EC2 API") .view(AWSEC2ComputeServiceContext.class) .context(CONTEXT_TOKEN) diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2AsyncClient.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2AsyncClient.java index a20a5dc599..54b48aee9a 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2AsyncClient.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2AsyncClient.java @@ -32,9 +32,13 @@ import org.jclouds.rest.annotations.Delegate; * Provides asynchronous access to EC2 services. * * @author Adrian Cole + * + * @deprecated please use + * {@code org.jclouds.ContextBuilder#buildApi(AWSEC2Client.class)} + * as {@link AWSEC2AsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated public interface AWSEC2AsyncClient extends EC2AsyncClient { - public static final String VERSION = "2012-06-01"; /** * {@inheritDoc} diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ApiMetadata.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ApiMetadata.java index 1a503b8153..05681964a7 100644 --- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ApiMetadata.java +++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ApiMetadata.java @@ -26,7 +26,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.aws.s3.blobstore.AWSS3BlobStoreContext; import org.jclouds.aws.s3.blobstore.config.AWSS3BlobStoreContextModule; import org.jclouds.aws.s3.config.AWSS3RestClientModule; -import org.jclouds.rest.RestContext; import org.jclouds.s3.S3ApiMetadata; import com.google.common.collect.ImmutableSet; @@ -40,7 +39,12 @@ import com.google.inject.Module; */ public class AWSS3ApiMetadata extends S3ApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AWSS3Client.class)} as + * {@link AWSS3AsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -63,6 +67,7 @@ public class AWSS3ApiMetadata extends S3ApiMetadata { } public static class Builder extends S3ApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder(){ super(AWSS3Client.class, AWSS3AsyncClient.class); id("aws-s3") diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3AsyncClient.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3AsyncClient.java index a8241e30b0..ede4bd0885 100644 --- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3AsyncClient.java +++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3AsyncClient.java @@ -66,6 +66,9 @@ import com.google.common.util.concurrent.ListenableFuture; * Provides access to amazon-specific S3 features * * @author Adrian Cole, Jeremy Whitlock + * @deprecated please use + * {@code org.jclouds.ContextBuilder#buildApi(AWSS3Client.class)} + * as {@link AWSS3AsyncClient} interface will be removed in jclouds 1.7. */ @RequestFilters(RequestAuthorizeSignature.class) @BlobScope(CONTAINER) diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobApiMetadata.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobApiMetadata.java index 12c8ba1cbe..fc8a2dad39 100644 --- a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobApiMetadata.java +++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobApiMetadata.java @@ -28,7 +28,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.azureblob.blobstore.config.AzureBlobStoreContextModule; import org.jclouds.azureblob.config.AzureBlobRestClientModule; import org.jclouds.blobstore.BlobStoreContext; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -42,7 +41,12 @@ import com.google.inject.Module; */ public class AzureBlobApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AzureBlobClient.class)} as + * {@link AzureBlobAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -70,6 +74,7 @@ public class AzureBlobApiMetadata extends BaseRestApiMetadata { } public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder(){ super(AzureBlobClient.class, AzureBlobAsyncClient.class); id("azureblob") diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobAsyncClient.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobAsyncClient.java index a6e7b231ca..c18ea4e77d 100644 --- a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobAsyncClient.java +++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobAsyncClient.java @@ -84,7 +84,10 @@ import com.google.inject.Provides; * @see * @see AzureBlobClient * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AzureBlobClient.class)} as + * {@link AzureBlobAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(SharedKeyLiteAuthentication.class) @Headers(keys = AzureStorageHeaders.VERSION, values = "2009-09-19") @SkipEncoding({ '/', '$' }) diff --git a/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTApiMetadata.java b/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTApiMetadata.java index 40920e8ec2..89be1afb5b 100644 --- a/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTApiMetadata.java +++ b/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTApiMetadata.java @@ -24,11 +24,9 @@ import java.util.Properties; import org.jclouds.apis.ApiMetadata; import org.jclouds.dynect.v3.config.DynECTParserModule; import org.jclouds.dynect.v3.config.DynECTRestClientModule; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; import com.google.inject.Module; /** @@ -40,10 +38,6 @@ public class DynECTApiMetadata extends BaseRestApiMetadata { public static final String ANONYMOUS_IDENTITY = "ANONYMOUS"; - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { - private static final long serialVersionUID = 1L; - }; - @Override public Builder toBuilder() { return new Builder().fromApiMetadata(this); diff --git a/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTAsyncApi.java b/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTAsyncApi.java index 1c66e71ce9..14f86b234f 100644 --- a/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTAsyncApi.java +++ b/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTAsyncApi.java @@ -49,7 +49,10 @@ import com.google.common.util.concurrent.ListenableFuture; * @see DynECTApi * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(DynECTApi.class)} as + * {@link DynECTAsyncApi} interface will be removed in jclouds 1.7. */ + public interface DynECTAsyncApi extends Closeable { /** * @see DynECTApi#getJob diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApiMetadata.java b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApiMetadata.java index 26ec7c4929..7719c35734 100644 --- a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApiMetadata.java +++ b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSApiMetadata.java @@ -27,7 +27,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.compute.ComputeServiceContext; import org.jclouds.glesys.compute.config.GleSYSComputeServiceContextModule; import org.jclouds.glesys.config.GleSYSRestClientModule; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -41,7 +40,12 @@ import com.google.inject.Module; */ public class GleSYSApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(GleSYSApi.class)} as + * {@link GleSYSAsyncApi} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -67,6 +71,7 @@ public class GleSYSApiMetadata extends BaseRestApiMetadata { public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(GleSYSApi.class, GleSYSAsyncApi.class); id("glesys") diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java index 68ee031c53..0cb738cd60 100644 --- a/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java +++ b/providers/glesys/src/main/java/org/jclouds/glesys/GleSYSAsyncApi.java @@ -34,7 +34,10 @@ import org.jclouds.rest.annotations.Delegate; * @see GleSYSApi * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(GleSYSApi.class)} as + * {@link GleSYSAsyncApi} interface will be removed in jclouds 1.7. */ +@Deprecated public interface GleSYSAsyncApi extends Closeable { /** diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/features/ArchiveApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/features/ArchiveApiLiveTest.java index d6fc7d12ca..9ac1808bc5 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/features/ArchiveApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/features/ArchiveApiLiveTest.java @@ -49,7 +49,7 @@ public class ArchiveApiLiveTest extends BaseGleSYSApiLiveTest { archiveUser = identity.toLowerCase() + "_test9"; archiveCounter = retry(new Predicate() { public boolean apply(Integer value) { - return archiveApi.list().size() == value; + return archiveApi.list().size() == value.intValue(); } }, 30, 1, SECONDS); } diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/features/DomainApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/features/DomainApiLiveTest.java index 5738036c5c..852722cf48 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/features/DomainApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/features/DomainApiLiveTest.java @@ -53,12 +53,12 @@ public class DomainApiLiveTest extends BaseGleSYSApiLiveTest { domainApi = api.getDomainApi(); domainCounter = retry(new Predicate() { public boolean apply(Integer value) { - return domainApi.list().size() == value; + return domainApi.list().size() == value.intValue(); } }, 30, 1, SECONDS); recordCounter = retry(new Predicate() { public boolean apply(Integer value) { - return domainApi.listRecords(testDomain).size() == value; + return domainApi.listRecords(testDomain).size() == value.intValue(); } }, 30, 1, SECONDS); diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java index 417459a3b0..fa90347f93 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java @@ -63,7 +63,7 @@ public class EmailAccountApiLiveTest extends BaseGleSYSApiLiveTest { emailAccountCounter = retry(new Predicate() { public boolean apply(Integer value) { - return emailAccountApi.listDomain(testDomain).size() == value; + return emailAccountApi.listDomain(testDomain).size() == value.intValue(); } }, 180, 5, SECONDS); diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiLiveTest.java index 3ee1cc7efa..cb390940b3 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiLiveTest.java @@ -43,13 +43,13 @@ public class BaseGleSYSApiLiveTest extends BaseApiLiveTest { } protected void createDomain(String domain) { - final DomainApi api = this.api.getDomainApi(); - int before = api.list().size(); - api.create(domain); + final DomainApi domainApi = api.getDomainApi(); + int before = domainApi.list().size(); + domainApi.create(domain); Predicate result = retry(new Predicate() { public boolean apply(Integer value) { - return api.list().size() == value; + return domainApi.list().size() == value.intValue(); } }, 30, 1, SECONDS); diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiWithAServerLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiWithAServerLiveTest.java index 4f50a2a9df..28b8d87222 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiWithAServerLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/internal/BaseGleSYSApiWithAServerLiveTest.java @@ -74,21 +74,21 @@ public class BaseGleSYSApiWithAServerLiveTest extends BaseGleSYSApiLiveTest { } protected void createDomain(String domain) { - final DomainApi api = this.api.getDomainApi(); - int before = api.list().size(); - api.create(domain); + final DomainApi domainApi = api.getDomainApi(); + int before = domainApi.list().size(); + domainApi.create(domain); Predicate result = retry(new Predicate() { public boolean apply(Integer value) { - return api.list().size() == value; + return domainApi.list().size() == value.intValue(); } }, 30, 1, SECONDS); assertTrue(result.apply(before + 1)); } protected Predicate createServer(String hostName) { - final ServerApi api = this.api.getServerApi(); + final ServerApi serverApi = api.getServerApi(); - ServerDetails testServer = api.createWithHostnameAndRootPassword( + ServerDetails testServer = serverApi.createWithHostnameAndRootPassword( ServerSpec.builder().datacenter("Falkenberg").platform("OpenVZ").templateName("Ubuntu 10.04 LTS 32-bit") .diskSizeGB(5).memorySizeMB(512).cpuCores(1).transferGB(50).build(), hostName, UUID.randomUUID() .toString().replace("-","")); @@ -97,7 +97,7 @@ public class BaseGleSYSApiWithAServerLiveTest extends BaseGleSYSApiLiveTest { assertEquals(testServer.getHostname(), hostName); assertFalse(testServer.getIps().isEmpty()); - Predicate statusChecker = statusChecker(api, testServer.getId()); + Predicate statusChecker = statusChecker(serverApi, testServer.getId()); assertTrue(statusChecker.apply(Server.State.RUNNING)); serverId = testServer.getId(); return statusChecker; diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApiMetadata.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApiMetadata.java index 2630ff8e0b..1318780c9a 100644 --- a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApiMetadata.java +++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridApiMetadata.java @@ -27,7 +27,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.compute.ComputeServiceContext; import org.jclouds.gogrid.compute.config.GoGridComputeServiceContextModule; import org.jclouds.gogrid.config.GoGridRestClientModule; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import com.google.common.collect.ImmutableSet; @@ -41,7 +40,12 @@ import com.google.inject.Module; */ public class GoGridApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(GoGridClient.class)} as + * {@link GoGridAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -67,6 +71,7 @@ public class GoGridApiMetadata extends BaseRestApiMetadata { public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(GoGridClient.class, GoGridAsyncClient.class); id("gogrid") @@ -74,7 +79,7 @@ public class GoGridApiMetadata extends BaseRestApiMetadata { .identityName("API Key") .credentialName("Shared Secret") .documentation(URI.create("https://wiki.gogrid.com/wiki/index.php/API")) - .version(GoGridAsyncClient.VERSION) + .version("1.5") .defaultEndpoint("https://api.gogrid.com/api") .defaultProperties(GoGridApiMetadata.defaultProperties()) .view(typeToken(ComputeServiceContext.class)) diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.java index ae118fc1f3..d27c80a931 100644 --- a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.java +++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridAsyncClient.java @@ -29,9 +29,11 @@ import org.jclouds.rest.annotations.Delegate; /** * @author Oleksiy Yarmula + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(GoGridClient.class)} as + * {@link GoGridAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated public interface GoGridAsyncClient extends Closeable { - public static final String VERSION = "1.5"; /** * @see GoGridClient#getServerServices() diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridProviderMetadata.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridProviderMetadata.java index b371746a58..804069ace7 100644 --- a/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridProviderMetadata.java +++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/GoGridProviderMetadata.java @@ -18,7 +18,6 @@ */ package org.jclouds.gogrid; -import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE; import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES; import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE; @@ -59,7 +58,6 @@ public class GoGridProviderMetadata extends BaseProviderMetadata { properties.setProperty(PROPERTY_ZONE + ".1." + ISO3166_CODES, "US-CA"); properties.setProperty(PROPERTY_ZONE + ".2." + ISO3166_CODES, "US-VA"); properties.setProperty(PROPERTY_ZONE + ".3." + ISO3166_CODES, "NL-NH"); - properties.setProperty(PROPERTY_API_VERSION, GoGridAsyncClient.VERSION); properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[012].[01][04],imageNameMatches=.*w/ None.*,locationId=1"); return properties; } diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageAsyncClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageAsyncClient.java index d689705262..96323565bf 100644 --- a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageAsyncClient.java +++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridImageAsyncClient.java @@ -33,7 +33,6 @@ import javax.ws.rs.Path; import javax.ws.rs.QueryParam; import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.gogrid.GoGridAsyncClient; import org.jclouds.gogrid.binders.BindIdsToQueryParams; import org.jclouds.gogrid.binders.BindNamesToQueryParams; import org.jclouds.gogrid.domain.Option; @@ -56,7 +55,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Oleksiy Yarmula */ @RequestFilters(SharedKeyLiteAuthentication.class) -@QueryParams(keys = VERSION, values = GoGridAsyncClient.VERSION) +@QueryParams(keys = VERSION, values = "{jclouds.api-version}") public interface GridImageAsyncClient { /** diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpAsyncClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpAsyncClient.java index ed2c826d10..bd5d282330 100644 --- a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpAsyncClient.java +++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridIpAsyncClient.java @@ -28,7 +28,6 @@ import java.util.Set; import javax.ws.rs.GET; import javax.ws.rs.Path; -import org.jclouds.gogrid.GoGridAsyncClient; import org.jclouds.gogrid.domain.Ip; import org.jclouds.gogrid.domain.Option; import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication; @@ -47,7 +46,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Oleksiy Yarmula */ @RequestFilters(SharedKeyLiteAuthentication.class) -@QueryParams(keys = VERSION, values = GoGridAsyncClient.VERSION) +@QueryParams(keys = VERSION, values = "{jclouds.api-version}") public interface GridIpAsyncClient { /** diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobAsyncClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobAsyncClient.java index b387ddc2ab..c4f881807a 100644 --- a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobAsyncClient.java +++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridJobAsyncClient.java @@ -25,7 +25,6 @@ import java.util.Set; import javax.ws.rs.GET; import javax.ws.rs.Path; -import org.jclouds.gogrid.GoGridAsyncClient; import org.jclouds.gogrid.binders.BindIdsToQueryParams; import org.jclouds.gogrid.binders.BindObjectNameToGetJobsRequestQueryParams; import org.jclouds.gogrid.domain.Job; @@ -43,7 +42,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Oleksiy Yarmula */ @RequestFilters(SharedKeyLiteAuthentication.class) -@QueryParams(keys = VERSION, values = GoGridAsyncClient.VERSION) +@QueryParams(keys = VERSION, values = "{jclouds.api-version}") public interface GridJobAsyncClient { /** diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridLoadBalancerAsyncClient.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridLoadBalancerAsyncClient.java index c2bcc5d6b7..3ad9c779d0 100644 --- a/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridLoadBalancerAsyncClient.java +++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/services/GridLoadBalancerAsyncClient.java @@ -30,7 +30,6 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; -import org.jclouds.gogrid.GoGridAsyncClient; import org.jclouds.gogrid.binders.BindIdsToQueryParams; import org.jclouds.gogrid.binders.BindNamesToQueryParams; import org.jclouds.gogrid.binders.BindRealIpPortPairsToQueryParams; @@ -54,7 +53,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Oleksiy Yarmula */ @RequestFilters(SharedKeyLiteAuthentication.class) -@QueryParams(keys = VERSION, values = GoGridAsyncClient.VERSION) +@QueryParams(keys = VERSION, values = "{jclouds.api-version}") public interface GridLoadBalancerAsyncClient { /** diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java index ac028f59ed..4aa072e1e7 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java @@ -33,7 +33,6 @@ import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule; import org.jclouds.openstack.swift.config.SwiftRestClientModule.KeystoneStorageEndpointModule; import org.jclouds.openstack.swift.extensions.KeystoneTemporaryUrlKeyAsyncApi; import org.jclouds.openstack.swift.extensions.TemporaryUrlKeyApi; -import org.jclouds.rest.RestContext; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; @@ -45,7 +44,12 @@ import com.google.inject.Module; */ public class HPCloudObjectStorageApiMetadata extends SwiftKeystoneApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(HPCloudObjectStorageApi.class)} as + * {@link HPCloudObjectStorageAsyncApi} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -68,6 +72,7 @@ public class HPCloudObjectStorageApiMetadata extends SwiftKeystoneApiMetadata { } public static class Builder extends SwiftKeystoneApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder(){ super(HPCloudObjectStorageApi.class, HPCloudObjectStorageAsyncApi.class); id("hpcloud-objectstorage") diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageAsyncApi.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageAsyncApi.java index fdb2d53d74..273cc42e6f 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageAsyncApi.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageAsyncApi.java @@ -60,7 +60,10 @@ import com.google.inject.Provides; * href="https://api-docs.hpcloud.com/hpcloud-object-storage/1.0/content/ch_object-storage-dev-overview.html">HP * Cloud Object Storage API * @author Jeremy Daggett + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(HPCloudObjectStorageApi.class)} as + * {@link HPCloudObjectStorageAsyncApi} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(AuthenticateRequest.class) @Endpoint(Storage.class) public interface HPCloudObjectStorageAsyncApi extends CommonSwiftAsyncClient { diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApiMetadata.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApiMetadata.java index 33a3d99de7..9badca3be7 100644 --- a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApiMetadata.java +++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerApiMetadata.java @@ -25,7 +25,6 @@ import java.util.Properties; import org.jclouds.apis.ApiMetadata; import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import org.jclouds.softlayer.compute.config.SoftLayerComputeServiceContextModule; import org.jclouds.softlayer.config.SoftLayerRestClientModule; @@ -41,7 +40,12 @@ import com.google.inject.Module; */ public class SoftLayerApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SoftLayerClient.class)} as + * {@link SoftLayerAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -67,6 +71,7 @@ public class SoftLayerApiMetadata extends BaseRestApiMetadata { public static class Builder extends BaseRestApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(SoftLayerClient.class, SoftLayerAsyncClient.class); id("softlayer") diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.java index dec8a607b9..5df44c98f0 100644 --- a/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.java +++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/SoftLayerAsyncClient.java @@ -33,7 +33,10 @@ import org.jclouds.softlayer.features.VirtualGuestAsyncClient; * @see SoftLayerClient * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SoftLayerClient.class)} as + * {@link SoftLayerAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated public interface SoftLayerAsyncClient extends Closeable { /** diff --git a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudApiMetadata.java b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudApiMetadata.java index 41a10f16e3..f11d62eb36 100644 --- a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudApiMetadata.java +++ b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudApiMetadata.java @@ -7,7 +7,6 @@ import java.net.URI; import java.util.Properties; import org.jclouds.apis.ApiMetadata; -import org.jclouds.rest.RestContext; import org.jclouds.trmk.ecloud.compute.config.TerremarkECloudComputeServiceContextModule; import org.jclouds.trmk.ecloud.config.TerremarkECloudRestClientModule; import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudApiMetadata; @@ -23,7 +22,12 @@ import com.google.inject.Module; */ public class TerremarkECloudApiMetadata extends TerremarkVCloudApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(TerremarkECloudClient.class)} as + * {@link TerremarkECloudAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -49,6 +53,7 @@ public class TerremarkECloudApiMetadata extends TerremarkVCloudApiMetadata { public static class Builder extends TerremarkVCloudApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(TerremarkECloudClient.class, TerremarkECloudAsyncClient.class); id("trmk-ecloud") diff --git a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClient.java b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClient.java index cb7aaa11a0..bd5b765fe0 100644 --- a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClient.java +++ b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClient.java @@ -91,7 +91,10 @@ import com.google.common.util.concurrent.ListenableFuture; * "http://support.theenterprisecloud.com/kb/default.asp?id=645&Lang=1&SID=" * /> * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(TerremarkECloudClient.class)} as + * {@link TerremarkECloudAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(SetVCloudTokenCookie.class) public interface TerremarkECloudAsyncClient extends TerremarkVCloudAsyncClient { /** diff --git a/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressApiMetadata.java b/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressApiMetadata.java index 871ffab6e7..f1ef3b5718 100644 --- a/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressApiMetadata.java +++ b/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressApiMetadata.java @@ -25,7 +25,6 @@ import java.net.URI; import java.util.Properties; import org.jclouds.apis.ApiMetadata; -import org.jclouds.rest.RestContext; import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudApiMetadata; import org.jclouds.trmk.vcloudexpress.compute.TerremarkVCloudExpressComputeServiceContextModule; import org.jclouds.trmk.vcloudexpress.config.TerremarkVCloudExpressRestClientModule; @@ -41,7 +40,12 @@ import com.google.inject.Module; */ public class TerremarkVCloudExpressApiMetadata extends TerremarkVCloudApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + /** + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(TerremarkVCloudExpressClient.class)} as + * {@link TerremarkVCloudExpressAsyncClient} interface will be removed in jclouds 1.7. + */ + @Deprecated + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { private static final long serialVersionUID = 1L; }; @@ -67,6 +71,7 @@ public class TerremarkVCloudExpressApiMetadata extends TerremarkVCloudApiMetadat public static class Builder extends TerremarkVCloudApiMetadata.Builder { + @SuppressWarnings("deprecation") protected Builder() { super(TerremarkVCloudExpressClient.class, TerremarkVCloudExpressAsyncClient.class); id("trmk-vcloudexpress") diff --git a/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClient.java b/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClient.java index 6b4c117aaa..036aba9d99 100644 --- a/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClient.java +++ b/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClient.java @@ -63,7 +63,10 @@ import com.google.common.util.concurrent.ListenableFuture; * * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(TerremarkVCloudExpressClient.class)} as + * {@link TerremarkVCloudExpressAsyncClient} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(SetVCloudTokenCookie.class) public interface TerremarkVCloudExpressAsyncClient extends TerremarkVCloudAsyncClient { /** diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApiMetadata.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApiMetadata.java index 65237b7336..de7127e3a7 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApiMetadata.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApiMetadata.java @@ -22,12 +22,9 @@ import java.net.URI; import java.util.Properties; import org.jclouds.apis.ApiMetadata; -import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; import org.jclouds.ultradns.ws.config.UltraDNSWSRestClientModule; -import com.google.common.reflect.TypeToken; - /** * Implementation of {@link ApiMetadata} for Neustar's UltraDNSWS api. * @@ -35,10 +32,6 @@ import com.google.common.reflect.TypeToken; */ public class UltraDNSWSApiMetadata extends BaseRestApiMetadata { - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { - private static final long serialVersionUID = 1L; - }; - @Override public Builder toBuilder() { return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this); diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java index 3d56acc85e..fea3f8d684 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java @@ -47,7 +47,10 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @see * @author Adrian Cole + * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(UltraDNSWSApi.class)} as + * {@link UltraDNSWSAsyncApi} interface will be removed in jclouds 1.7. */ +@Deprecated @RequestFilters(SOAPWrapWithPasswordAuth.class) @VirtualHost public interface UltraDNSWSAsyncApi extends Closeable {