diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApi.java similarity index 67% rename from apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudClient.java rename to apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApi.java index b37e1b1b5b..5ecef9c14b 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApi.java @@ -19,14 +19,16 @@ package org.jclouds.vcloud; import java.io.Closeable; import org.jclouds.rest.annotations.Delegate; -import org.jclouds.vcloud.features.CatalogClient; -import org.jclouds.vcloud.features.NetworkClient; -import org.jclouds.vcloud.features.OrgClient; -import org.jclouds.vcloud.features.TaskClient; -import org.jclouds.vcloud.features.VAppClient; -import org.jclouds.vcloud.features.VAppTemplateClient; -import org.jclouds.vcloud.features.VDCClient; -import org.jclouds.vcloud.features.VmClient; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.vcloud.features.CatalogApi; +import org.jclouds.vcloud.features.NetworkApi; +import org.jclouds.vcloud.features.OrgApi; +import org.jclouds.vcloud.features.TaskApi; +import org.jclouds.vcloud.features.VAppApi; +import org.jclouds.vcloud.features.VAppTemplateApi; +import org.jclouds.vcloud.features.VDCApi; +import org.jclouds.vcloud.features.VmApi; +import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; /** * Provides access to VCloud resources via their REST API. @@ -35,54 +37,55 @@ import org.jclouds.vcloud.features.VmClient; * @see * @author Adrian Cole */ -public interface VCloudClient extends Closeable { +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) +public interface VCloudApi extends Closeable { /** * Provides asynchronous access to VApp Template features. * */ @Delegate - VAppTemplateClient getVAppTemplateClient(); + VAppTemplateApi getVAppTemplateClient(); /** * Provides synchronous access to VApp features. */ @Delegate - VAppClient getVAppClient(); + VAppApi getVAppClient(); /** * Provides synchronous access to Vm features. */ @Delegate - VmClient getVmClient(); + VmApi getVmClient(); /** * Provides synchronous access to Catalog features. */ @Delegate - CatalogClient getCatalogClient(); + CatalogApi getCatalogClient(); /** * Provides synchronous access to Task features. */ @Delegate - TaskClient getTaskClient(); + TaskApi getTaskClient(); /** * Provides synchronous access to VDC features. */ @Delegate - VDCClient getVDCClient(); + VDCApi getVDCClient(); /** * Provides synchronous access to Network features. */ @Delegate - NetworkClient getNetworkClient(); + NetworkApi getNetworkClient(); /** * Provides synchronous access to Org features. */ @Delegate - OrgClient getOrgClient(); + OrgApi getOrgClient(); } 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 3991316067..bd60ef9ff7 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java @@ -29,13 +29,12 @@ import java.util.Properties; import org.jclouds.apis.ApiMetadata; import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.rest.internal.BaseRestApiMetadata; +import org.jclouds.rest.internal.BaseHttpApiMetadata; import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule; -import org.jclouds.vcloud.config.VCloudRestClientModule; +import org.jclouds.vcloud.config.VCloudHttpApiModule; import org.jclouds.vcloud.domain.network.FenceMode; import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; import com.google.inject.Module; /** @@ -43,17 +42,9 @@ import com.google.inject.Module; * * @author Adrian Cole */ -public class VCloudApiMetadata extends BaseRestApiMetadata { +public class VCloudApiMetadata extends BaseHttpApiMetadata { + - /** - * @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; - }; - @Override public Builder toBuilder() { return new Builder().fromApiMetadata(this); @@ -68,7 +59,7 @@ public class VCloudApiMetadata extends BaseRestApiMetadata { } public static Properties defaultProperties() { - Properties properties = BaseRestApiMetadata.defaultProperties(); + Properties properties = BaseHttpApiMetadata.defaultProperties(); properties.setProperty(PROPERTY_VCLOUD_VERSION_SCHEMA, "1"); properties.setProperty(PROPERTY_VCLOUD_XML_NAMESPACE, String.format("http://www.vmware.com/vcloud/v${%s}", PROPERTY_VCLOUD_VERSION_SCHEMA)); @@ -87,11 +78,8 @@ public class VCloudApiMetadata extends BaseRestApiMetadata { return properties; } - public static class Builder extends BaseRestApiMetadata.Builder { - - @SuppressWarnings("deprecation") + public static class Builder extends BaseHttpApiMetadata.Builder { protected Builder() { - super(VCloudClient.class, VCloudAsyncClient.class); id("vcloud") .name("VCloud 1.0 API") .identityName("User at Organization (user@org)") @@ -100,7 +88,7 @@ public class VCloudApiMetadata extends BaseRestApiMetadata { .version("1.0") .defaultProperties(VCloudApiMetadata.defaultProperties()) .view(typeToken(ComputeServiceContext.class)) - .defaultModules(ImmutableSet.>of(VCloudRestClientModule.class, VCloudComputeServiceContextModule.class)); + .defaultModules(ImmutableSet.>of(VCloudHttpApiModule.class, VCloudComputeServiceContextModule.class)); } @Override diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudAsyncClient.java deleted file mode 100644 index 4820d8e680..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudAsyncClient.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud; - -import java.io.Closeable; - -import org.jclouds.rest.annotations.Delegate; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.vcloud.features.CatalogAsyncClient; -import org.jclouds.vcloud.features.NetworkAsyncClient; -import org.jclouds.vcloud.features.OrgAsyncClient; -import org.jclouds.vcloud.features.TaskAsyncClient; -import org.jclouds.vcloud.features.VAppAsyncClient; -import org.jclouds.vcloud.features.VAppTemplateAsyncClient; -import org.jclouds.vcloud.features.VDCAsyncClient; -import org.jclouds.vcloud.features.VmAsyncClient; -import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; - -/** - * Provides access to VCloud resources via their REST API. - *

- * - * @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 { - - /** - * Provides asynchronous access to VApp Template features. - * - * @see VCloudClient#getVAppTemplateClient - * - */ - @Delegate - VAppTemplateAsyncClient getVAppTemplateClient(); - - /** - * Provides asynchronous access to VApp features. - * - * @see VCloudClient#getVAppClient - * - */ - @Delegate - VAppAsyncClient getVAppClient(); - - /** - * Provides asynchronous access to Vm features. - * - * @see VCloudClient#getVmClient - * - */ - @Delegate - VmAsyncClient getVmClient(); - - /** - * Provides asynchronous access to Catalog features. - * - * @see VCloudClient#getCatalogClient - * - */ - @Delegate - CatalogAsyncClient getCatalogClient(); - - /** - * Provides asynchronous access to Task features. - * - * @see VCloudClient#getTaskClient - * - */ - @Delegate - TaskAsyncClient getTaskClient(); - - /** - * Provides asynchronous access to VDC features. - * - * @see VCloudClient#getVDCClient - * - */ - @Delegate - VDCAsyncClient getVDCClient(); - - /** - * Provides asynchronous access to Network features. - * - * @see VCloudClient#getNetworkClient - * - */ - @Delegate - NetworkAsyncClient getNetworkClient(); - - /** - * Provides asynchronous access to Org features. - * - * @see VCloudClient#getOrgClient - * - */ - @Delegate - OrgAsyncClient getOrgClient(); - -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java similarity index 76% rename from apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsClient.java rename to apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java index 17a210c138..01ec0459cf 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java @@ -19,7 +19,17 @@ package org.jclouds.vcloud; import java.io.Closeable; import java.net.URI; import java.util.SortedMap; -public interface VCloudVersionsClient extends Closeable { +import javax.ws.rs.GET; +import javax.ws.rs.Path; + +import org.jclouds.rest.annotations.XMLResponseParser; +import org.jclouds.vcloud.xml.SupportedVersionsHandler; + +public interface VCloudVersionsApi extends Closeable { + + @GET + @XMLResponseParser(SupportedVersionsHandler.class) + @Path("/versions") SortedMap getSupportedVersions(); } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsAsyncClient.java deleted file mode 100644 index 53212c9cea..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsAsyncClient.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud; - -import java.io.Closeable; -import java.net.URI; -import java.util.SortedMap; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; - -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.vcloud.xml.SupportedVersionsHandler; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Establishes a context with a VCloud endpoint. - *

- * - * @see - * @author Adrian Cole - */ -public interface VCloudVersionsAsyncClient extends Closeable { - - /** - * Retrieve information for supported versions - */ - @GET - @XMLResponseParser(SupportedVersionsHandler.class) - @Path("/versions") - ListenableFuture> getSupportedVersions(); -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java index 64da5738f1..e9da2e0a1a 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java @@ -42,7 +42,7 @@ import org.jclouds.ovf.Network; import org.jclouds.predicates.validators.DnsNameValidator; import org.jclouds.rest.annotations.BuildVersion; import org.jclouds.vcloud.TaskStillRunningException; -import org.jclouds.vcloud.VCloudClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.compute.options.VCloudTemplateOptions; import org.jclouds.vcloud.domain.GuestCustomizationSection; import org.jclouds.vcloud.domain.NetworkConnection; @@ -71,7 +71,7 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA @Named(ComputeServiceConstants.COMPUTE_LOGGER) protected Logger logger = Logger.NULL; - protected final VCloudClient client; + protected final VCloudApi client; protected final Predicate successTester; protected final LoadingCache vAppTemplates; protected final NetworkConfigurationForNetworkAndOptions networkConfigurationForNetworkAndOptions; @@ -79,7 +79,7 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA @Inject - protected InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn(VCloudClient client, + protected InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn(VCloudApi client, Predicate successTester, LoadingCache vAppTemplates, NetworkConfigurationForNetworkAndOptions networkConfigurationForNetworkAndOptions, @BuildVersion String buildVersion) { this.client = client; diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java index 6627c47893..efa8e3ae0a 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java @@ -38,7 +38,7 @@ import org.jclouds.ovf.Envelope; import org.jclouds.util.Throwables2; import org.jclouds.vcloud.TaskInErrorStateException; import org.jclouds.vcloud.TaskStillRunningException; -import org.jclouds.vcloud.VCloudClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.ReferenceType; @@ -54,10 +54,9 @@ import com.google.common.base.Predicate; import com.google.common.base.Supplier; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; -import com.google.common.collect.Iterables; /** - * defines the connection between the {@link VCloudClient} implementation and the jclouds + * defines the connection between the {@link org.jclouds.vcloud.VCloudApi} implementation and the jclouds * {@link ComputeService} * */ @@ -68,7 +67,7 @@ public class VCloudComputeServiceAdapter implements ComputeServiceAdapter successTester; protected final InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn booter; protected final Supplier> nameToOrg; @@ -76,7 +75,7 @@ public class VCloudComputeServiceAdapter implements ComputeServiceAdapter templateToEnvelope; @Inject - protected VCloudComputeServiceAdapter(VCloudClient client, Predicate successTester, + protected VCloudComputeServiceAdapter(VCloudApi client, Predicate successTester, InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn booter, Supplier> nameToOrg, VAppTemplatesSupplier templates, Function templateToEnvelope) { diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudRestClientModule.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java similarity index 89% rename from apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudRestClientModule.java rename to apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java index 71af24d7e3..d60d311cd9 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudRestClientModule.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java @@ -26,7 +26,7 @@ import static com.google.common.collect.Iterables.transform; import static com.google.common.collect.Maps.transformValues; import static com.google.common.collect.Maps.uniqueIndex; import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL; -import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi; +import static org.jclouds.rest.config.BinderUtils.bindHttpApi; import static org.jclouds.util.Predicates2.retry; import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE; import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED; @@ -52,15 +52,13 @@ import org.jclouds.location.suppliers.ImplicitLocationSupplier; import org.jclouds.location.suppliers.LocationsSupplier; import org.jclouds.ovf.Envelope; import org.jclouds.rest.AuthorizationException; -import org.jclouds.rest.ConfiguresRestClient; +import org.jclouds.rest.ConfiguresHttpApi; import org.jclouds.rest.annotations.ApiVersion; -import org.jclouds.rest.config.RestClientModule; +import org.jclouds.rest.config.HttpApiModule; import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier; -import org.jclouds.vcloud.VCloudAsyncClient; -import org.jclouds.vcloud.VCloudClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.VCloudToken; -import org.jclouds.vcloud.VCloudVersionsAsyncClient; -import org.jclouds.vcloud.VCloudVersionsClient; +import org.jclouds.vcloud.VCloudVersionsApi; import org.jclouds.vcloud.compute.functions.FindLocationForResource; import org.jclouds.vcloud.compute.functions.ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException; import org.jclouds.vcloud.domain.Catalog; @@ -73,22 +71,6 @@ import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.domain.network.FenceMode; import org.jclouds.vcloud.endpoints.Network; import org.jclouds.vcloud.endpoints.OrgList; -import org.jclouds.vcloud.features.CatalogAsyncClient; -import org.jclouds.vcloud.features.CatalogClient; -import org.jclouds.vcloud.features.NetworkAsyncClient; -import org.jclouds.vcloud.features.NetworkClient; -import org.jclouds.vcloud.features.OrgAsyncClient; -import org.jclouds.vcloud.features.OrgClient; -import org.jclouds.vcloud.features.TaskAsyncClient; -import org.jclouds.vcloud.features.TaskClient; -import org.jclouds.vcloud.features.VAppAsyncClient; -import org.jclouds.vcloud.features.VAppClient; -import org.jclouds.vcloud.features.VAppTemplateAsyncClient; -import org.jclouds.vcloud.features.VAppTemplateClient; -import org.jclouds.vcloud.features.VDCAsyncClient; -import org.jclouds.vcloud.features.VDCClient; -import org.jclouds.vcloud.features.VmAsyncClient; -import org.jclouds.vcloud.features.VmClient; import org.jclouds.vcloud.functions.CatalogItemsInCatalog; import org.jclouds.vcloud.functions.CatalogItemsInOrg; import org.jclouds.vcloud.functions.CatalogsInOrg; @@ -98,8 +80,7 @@ import org.jclouds.vcloud.functions.OrgsForNames; import org.jclouds.vcloud.functions.VAppTemplatesForCatalogItems; import org.jclouds.vcloud.functions.VDCsInOrg; import org.jclouds.vcloud.handlers.ParseVCloudErrorFromHttpResponse; -import org.jclouds.vcloud.internal.VCloudLoginAsyncClient; -import org.jclouds.vcloud.internal.VCloudLoginClient; +import org.jclouds.vcloud.internal.VCloudLoginApi; import org.jclouds.vcloud.loaders.OVFLoader; import org.jclouds.vcloud.loaders.VAppTemplateLoader; import org.jclouds.vcloud.location.DefaultVDC; @@ -128,28 +109,14 @@ import com.google.inject.TypeLiteral; * * @author Adrian Cole */ -@ConfiguresRestClient -public class VCloudRestClientModule extends RestClientModule { +@ConfiguresHttpApi +public class VCloudHttpApiModule extends HttpApiModule { - public static final Map, Class> DELEGATE_MAP = ImmutableMap., Class> builder()// - .put(VAppTemplateClient.class, VAppTemplateAsyncClient.class)// - .put(VAppClient.class, VAppAsyncClient.class)// - .put(VmClient.class, VmAsyncClient.class)// - .put(CatalogClient.class, CatalogAsyncClient.class)// - .put(TaskClient.class, TaskAsyncClient.class)// - .put(VDCClient.class, VDCAsyncClient.class)// - .put(NetworkClient.class, NetworkAsyncClient.class)// - .put(OrgClient.class, OrgAsyncClient.class)// - .build(); - - public VCloudRestClientModule() { - super(DELEGATE_MAP); - } @Provides @Singleton protected Supplier provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds, - AtomicReference authException, final VCloudLoginClient login) { + AtomicReference authException, final VCloudLoginApi login) { return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, new Supplier() { @@ -204,8 +171,9 @@ public class VCloudRestClientModule extends RestClientModule>() { }).to(new TypeLiteral() { }); - bindSyncToAsyncHttpApi(binder(), VCloudVersionsClient.class, VCloudVersionsAsyncClient.class); - bindSyncToAsyncHttpApi(binder(), VCloudLoginClient.class, VCloudLoginAsyncClient.class); + bindHttpApi(binder(), VCloudApi.class); + bindHttpApi(binder(), VCloudVersionsApi.class); + bindHttpApi(binder(), VCloudLoginApi.class); } protected void bindCacheLoaders() { @@ -389,7 +357,7 @@ public class VCloudRestClientModule extends RestClientModule provideAuthenticationURI(final VCloudVersionsClient versionService, + protected Supplier provideAuthenticationURI(final VCloudVersionsApi versionService, @ApiVersion final String version) { return new Supplier() { diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/CatalogApi.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/CatalogApi.java new file mode 100644 index 0000000000..0828c293be --- /dev/null +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/CatalogApi.java @@ -0,0 +1,145 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.vcloud.features; + +import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML; +import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.jclouds.Fallbacks; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.rest.annotations.EndpointParam; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.XMLResponseParser; +import org.jclouds.vcloud.binders.BindCatalogItemToXmlPayload; +import org.jclouds.vcloud.binders.OrgNameAndCatalogNameToEndpoint; +import org.jclouds.vcloud.binders.OrgNameCatalogNameItemNameToEndpoint; +import org.jclouds.vcloud.domain.Catalog; +import org.jclouds.vcloud.domain.CatalogItem; +import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.options.CatalogItemOptions; +import org.jclouds.vcloud.xml.CatalogHandler; +import org.jclouds.vcloud.xml.CatalogItemHandler; + +import com.google.common.util.concurrent.ListenableFuture; + +/** + * Provides access to Catalog functionality in vCloud + *

+ * + * @see + * @author Adrian Cole + */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) +public interface CatalogApi { + + @GET + @XMLResponseParser(CatalogHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(CATALOG_XML) + Catalog getCatalog(@EndpointParam URI catalogId); + + /** + * returns the catalog in the organization associated with the specified name. Note that both + * parameters can be null to choose default. + * + * @param orgName + * organization name, or null for the default + * @param catalogName + * catalog name, or null for the default + * @throws NoSuchElementException + * if you specified an org or catalog name that isn't present + */ + @GET + @XMLResponseParser(CatalogHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(CATALOG_XML) + @MapBinder(OrgNameAndCatalogNameToEndpoint.class) + Catalog findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("catalogName") String catalogName); + + @GET + @Consumes(CATALOGITEM_XML) + @XMLResponseParser(CatalogItemHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + CatalogItem getCatalogItem(@EndpointParam URI catalogItem); + + /** + * returns the catalog item in the catalog associated with the specified name. Note that the org + * and catalog parameters can be null to choose default. + * + * @param orgName + * organization name, or null for the default + * @param catalogName + * catalog name, or null for the default + * @param itemName + * item you wish to lookup + * + * @throws NoSuchElementException + * if you specified an org, catalog, or catalog item name that isn't present + */ + @GET + @Consumes(CATALOGITEM_XML) + @XMLResponseParser(CatalogItemHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @MapBinder(OrgNameCatalogNameItemNameToEndpoint.class) + CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("catalogName") String catalogName, + @PayloadParam("itemName") String itemName); + + /** + * A catalog can contain references to vApp templates and media images that have been uploaded to + * any vDC in an organization. A vApp template or media image can be listed in at most one + * catalog. + * + * @param entity + * the reference to the vApp templates and media image + * @param catalog + * URI of the catalog to add the resourceEntity from + * @param name + * name of the entry in the catalog + * + * @param options + * options such as description or properties + * @return the new catalog item + */ + @POST + @Path("/catalogItems") + @Consumes(CATALOGITEM_XML) + @Produces(CATALOGITEM_XML) + @MapBinder(BindCatalogItemToXmlPayload.class) + @XMLResponseParser(CatalogItemHandler.class) + CatalogItem addVAppTemplateOrMediaImageToCatalogAndNameItem(@PayloadParam("Entity") URI entity, + @EndpointParam URI catalog, + @PayloadParam("name") String name, + CatalogItemOptions... options); + + @DELETE + @Fallback(Fallbacks.VoidOnNotFoundOr404.class) + void deleteCatalogItem(@EndpointParam URI href); +} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/CatalogAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/CatalogAsyncClient.java deleted file mode 100644 index 05682c4cfe..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/CatalogAsyncClient.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud.features; - -import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML; -import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML; - -import java.net.URI; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.vcloud.binders.BindCatalogItemToXmlPayload; -import org.jclouds.vcloud.binders.OrgNameAndCatalogNameToEndpoint; -import org.jclouds.vcloud.binders.OrgNameCatalogNameItemNameToEndpoint; -import org.jclouds.vcloud.domain.Catalog; -import org.jclouds.vcloud.domain.CatalogItem; -import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; -import org.jclouds.vcloud.options.CatalogItemOptions; -import org.jclouds.vcloud.xml.CatalogHandler; -import org.jclouds.vcloud.xml.CatalogItemHandler; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides access to Catalog functionality in vCloud - *

- * - * @author Adrian Cole - */ -@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface CatalogAsyncClient { - - /** - * @see CatalogClient#getCatalog - */ - @GET - @XMLResponseParser(CatalogHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @Consumes(CATALOG_XML) - ListenableFuture getCatalog(@EndpointParam URI catalogId); - - /** - * @see CatalogClient#findCatalogInOrgNamed - */ - @GET - @XMLResponseParser(CatalogHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @Consumes(CATALOG_XML) - @MapBinder(OrgNameAndCatalogNameToEndpoint.class) - ListenableFuture findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("catalogName") String catalogName); - - /** - * @see CatalogClient#getCatalogItem - */ - @GET - @Consumes(CATALOGITEM_XML) - @XMLResponseParser(CatalogItemHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getCatalogItem(@EndpointParam URI catalogItem); - - /** - * @see CatalogClient#getCatalogItemInOrg - */ - @GET - @Consumes(CATALOGITEM_XML) - @XMLResponseParser(CatalogItemHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @MapBinder(OrgNameCatalogNameItemNameToEndpoint.class) - ListenableFuture findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName); - - /** - * @see CatalogClient#addVAppTemplateOrMediaImageToCatalog - */ - @POST - @Path("/catalogItems") - @Consumes(CATALOGITEM_XML) - @Produces(CATALOGITEM_XML) - @MapBinder(BindCatalogItemToXmlPayload.class) - @XMLResponseParser(CatalogItemHandler.class) - ListenableFuture addVAppTemplateOrMediaImageToCatalogAndNameItem(@PayloadParam("Entity") URI entity, - @EndpointParam URI catalog, @PayloadParam("name") String name, CatalogItemOptions... options); - - - /** - * @see CatalogClient#deleteCatalogItem - */ - @DELETE - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture deleteCatalogItem(@EndpointParam URI href); - -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/CatalogClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/CatalogClient.java deleted file mode 100644 index 0e234a3400..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/CatalogClient.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud.features; - -import java.net.URI; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.vcloud.domain.Catalog; -import org.jclouds.vcloud.domain.CatalogItem; -import org.jclouds.vcloud.options.CatalogItemOptions; - -/** - * Provides access to Catalog functionality in vCloud - *

- * - * @see - * @author Adrian Cole - */ -public interface CatalogClient { - - Catalog getCatalog(URI catalogId); - - /** - * returns the catalog in the organization associated with the specified name. Note that both - * parameters can be null to choose default. - * - * @param orgName - * organization name, or null for the default - * @param catalogName - * catalog name, or null for the default - * @throws NoSuchElementException - * if you specified an org or catalog name that isn't present - */ - Catalog findCatalogInOrgNamed(@Nullable String orgName, @Nullable String catalogName); - - CatalogItem getCatalogItem(URI catalogItem); - - /** - * returns the catalog item in the catalog associated with the specified name. Note that the org - * and catalog parameters can be null to choose default. - * - * @param orgName - * organization name, or null for the default - * @param catalogName - * catalog name, or null for the default - * @param itemName - * item you wish to lookup - * - * @throws NoSuchElementException - * if you specified an org, catalog, or catalog item name that isn't present - */ - CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName, String itemName); - - /** - * A catalog can contain references to vApp templates and media images that have been uploaded to - * any vDC in an organization. A vApp template or media image can be listed in at most one - * catalog. - * - * @param entity - * the reference to the vApp templates and media image - * @param catalog - * URI of the catalog to add the resourceEntity from - * @param name - * name of the entry in the catalog - * - * @param options - * options such as description or properties - * @return the new catalog item - */ - CatalogItem addVAppTemplateOrMediaImageToCatalogAndNameItem(URI entity, URI catalog, String name, CatalogItemOptions... options); - - void deleteCatalogItem(URI href); -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/NetworkAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/NetworkApi.java similarity index 75% rename from apis/vcloud/src/main/java/org/jclouds/vcloud/features/NetworkAsyncClient.java rename to apis/vcloud/src/main/java/org/jclouds/vcloud/features/NetworkApi.java index 4045e5d15c..f2a97b0a24 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/NetworkAsyncClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/NetworkApi.java @@ -23,7 +23,7 @@ import java.net.URI; import javax.ws.rs.Consumes; import javax.ws.rs.GET; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; +import org.jclouds.Fallbacks; import org.jclouds.javax.annotation.Nullable; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; @@ -36,35 +36,26 @@ import org.jclouds.vcloud.domain.network.OrgNetwork; import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.xml.OrgNetworkHandler; -import com.google.common.util.concurrent.ListenableFuture; - /** * Provides access to Network functionality in vCloud *

- * * @author Adrian Cole */ @RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface NetworkAsyncClient { +public interface NetworkApi { - /** - * @see NetworkClient#findNetworkInOrgVDCNamed - */ @GET @Consumes(NETWORK_XML) @XMLResponseParser(OrgNetworkHandler.class) - @Fallback(NullOnNotFoundOr404.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) @MapBinder(OrgNameVDCNameNetworkNameToEndpoint.class) - ListenableFuture findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String networkName); + OrgNetwork findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("vdcName") String vdcName, + @PayloadParam("resourceName") String networkName); - /** - * @see NetworkClient#getNetwork - */ @GET @Consumes(NETWORK_XML) @XMLResponseParser(OrgNetworkHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getNetwork(@EndpointParam URI network); - + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + OrgNetwork getNetwork(@EndpointParam URI network); } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/NetworkClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/NetworkClient.java deleted file mode 100644 index 2890c81adb..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/NetworkClient.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud.features; - -import java.net.URI; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.vcloud.domain.network.OrgNetwork; - -/** - * Provides access to Network functionality in vCloud - *

- * @author Adrian Cole - */ -public interface NetworkClient { - - OrgNetwork findNetworkInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String networkName); - - OrgNetwork getNetwork(URI network); -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/OrgAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/OrgApi.java similarity index 73% rename from apis/vcloud/src/main/java/org/jclouds/vcloud/features/OrgAsyncClient.java rename to apis/vcloud/src/main/java/org/jclouds/vcloud/features/OrgApi.java index cc69b742e7..44d3bdebd2 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/OrgAsyncClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/OrgApi.java @@ -24,7 +24,7 @@ import java.util.Map; import javax.ws.rs.Consumes; import javax.ws.rs.GET; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; +import org.jclouds.Fallbacks; import org.jclouds.javax.annotation.Nullable; import org.jclouds.rest.annotations.Endpoint; import org.jclouds.rest.annotations.EndpointParam; @@ -49,34 +49,39 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adrian Cole */ @RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface OrgAsyncClient { +public interface OrgApi { /** + * The response to a login request includes a list of the organizations to which the + * authenticated user has access. * - * @see OrgClient#listOrgs + * @return organizations indexed by name */ @GET @Endpoint(OrgList.class) @XMLResponseParser(OrgListHandler.class) @Consumes(VCloudMediaType.ORGLIST_XML) - ListenableFuture> listOrgs(); + Map listOrgs(); + + @GET + @XMLResponseParser(OrgHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(ORG_XML) + Org getOrg(@EndpointParam URI orgId); /** - * @see OrgClient#getOrg + * This call returns a list of all vCloud Data Centers (vdcs), catalogs, and task lists within + * the organization. + * + * @param name + * organization name, or null for the default + * @throws NoSuchElementException + * if you specified an org name that isn't present */ @GET @XMLResponseParser(OrgHandler.class) - @Fallback(NullOnNotFoundOr404.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) @Consumes(ORG_XML) - ListenableFuture getOrg(@EndpointParam URI orgId); + Org findOrgNamed(@Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName); - /** - * @see OrgClient#getOrgNamed - */ - @GET - @XMLResponseParser(OrgHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @Consumes(ORG_XML) - ListenableFuture findOrgNamed( - @Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName); } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/OrgClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/OrgClient.java deleted file mode 100644 index 356a70c1d5..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/OrgClient.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud.features; - -import java.net.URI; -import java.util.Map; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.vcloud.domain.Org; -import org.jclouds.vcloud.domain.ReferenceType; - -/** - * Provides access to Org functionality in vCloud - *

- * - * @author Adrian Cole - */ -public interface OrgClient { - - /** - * The response to a login request includes a list of the organizations to which the - * authenticated user has access. - * - * @return organizations indexed by name - */ - Map listOrgs(); - - Org getOrg(URI orgId); - - /** - * This call returns a list of all vCloud Data Centers (vdcs), catalogs, and task lists within - * the organization. - * - * @param name - * organization name, or null for the default - * @throws NoSuchElementException - * if you specified an org name that isn't present - */ - Org findOrgNamed(@Nullable String name); - -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/TaskAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/TaskApi.java similarity index 64% rename from apis/vcloud/src/main/java/org/jclouds/vcloud/features/TaskAsyncClient.java rename to apis/vcloud/src/main/java/org/jclouds/vcloud/features/TaskApi.java index 375f113ce6..4fe232ed84 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/TaskAsyncClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/TaskApi.java @@ -26,7 +26,7 @@ import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; +import org.jclouds.Fallbacks; import org.jclouds.javax.annotation.Nullable; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; @@ -39,8 +39,6 @@ import org.jclouds.vcloud.functions.OrgNameToTasksListEndpoint; import org.jclouds.vcloud.xml.TaskHandler; import org.jclouds.vcloud.xml.TasksListHandler; -import com.google.common.util.concurrent.ListenableFuture; - /** * Provides access to Task functionality in vCloud *

@@ -48,41 +46,37 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adrian Cole */ @RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface TaskAsyncClient { +public interface TaskApi { - /** - * @see TaskClient#getTasksList - */ @GET @Consumes(TASKSLIST_XML) @XMLResponseParser(TasksListHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getTasksList(@EndpointParam URI tasksListId); + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + TasksList getTasksList(@EndpointParam URI tasksListId); - /** - * @see TaskClient#findTasksListInOrgNamed - */ @GET @Consumes(TASKSLIST_XML) @XMLResponseParser(TasksListHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture findTasksListInOrgNamed( - @Nullable @EndpointParam(parser = OrgNameToTasksListEndpoint.class) String orgName); + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + TasksList findTasksListInOrgNamed(@Nullable @EndpointParam(parser = OrgNameToTasksListEndpoint.class) String orgName); /** - * @see TaskClient#getTask + * Whenever the result of a request cannot be returned immediately, the server creates a Task + * object and includes it in the response, as a member of the Tasks container in the response + * body. Each Task has an href value, which is a URL that the client can use to retrieve the Task + * element alone, without the rest of the response in which it was contained. All information + * about the task is included in the Task element when it is returned in the response’s Tasks + * container, so a client does not need to make an additional request to the Task URL unless it + * wants to follow the progress of a task that was incomplete. */ @GET @Consumes(TASK_XML) @XMLResponseParser(TaskHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getTask(@EndpointParam URI taskId); + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Task getTask(@EndpointParam URI taskId); - /** - * @see TaskClient#cancelTask - */ @POST @Path("/action/cancel") - ListenableFuture cancelTask(@EndpointParam URI taskId); + void cancelTask(@EndpointParam URI taskId); } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/TaskClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/TaskClient.java deleted file mode 100644 index 67c9743e6c..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/TaskClient.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud.features; - -import java.net.URI; -import org.jclouds.vcloud.domain.Task; -import org.jclouds.vcloud.domain.TasksList; - -/** - * Provides access to Task functionality in vCloud - *

- * - * @author Adrian Cole - */ -public interface TaskClient { - - TasksList getTasksList(URI tasksListId); - - TasksList findTasksListInOrgNamed(String orgName); - - /** - * Whenever the result of a request cannot be returned immediately, the server creates a Task - * object and includes it in the response, as a member of the Tasks container in the response - * body. Each Task has an href value, which is a URL that the client can use to retrieve the Task - * element alone, without the rest of the response in which it was contained. All information - * about the task is included in the Task element when it is returned in the response’s Tasks - * container, so a client does not need to make an additional request to the Task URL unless it - * wants to follow the progress of a task that was incomplete. - */ - Task getTask(URI taskId); - - void cancelTask(URI taskId); - -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppApi.java similarity index 50% rename from apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppClient.java rename to apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppApi.java index 98204cddd1..d1d51f838e 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppApi.java @@ -16,11 +16,43 @@ */ package org.jclouds.vcloud.features; +import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML; +import static org.jclouds.vcloud.VCloudMediaType.TASK_XML; +import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML; +import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML; + import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.jclouds.Fallbacks; import org.jclouds.javax.annotation.Nullable; +import org.jclouds.predicates.validators.DnsNameValidator; +import org.jclouds.rest.annotations.EndpointParam; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.ParamValidators; +import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.PayloadParams; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.XMLResponseParser; +import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload; +import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload; +import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload; +import org.jclouds.vcloud.binders.OrgNameVDCNameResourceEntityNameToEndpoint; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VApp; +import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; import org.jclouds.vcloud.options.CloneVAppOptions; +import org.jclouds.vcloud.xml.TaskHandler; +import org.jclouds.vcloud.xml.VAppHandler; + +import com.google.common.util.concurrent.ListenableFuture; /** * Provides access to VApp functionality in vCloud @@ -29,14 +61,42 @@ import org.jclouds.vcloud.options.CloneVAppOptions; * @see * @author Adrian Cole */ -public interface VAppClient { - VApp findVAppInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String vAppName); +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) +public interface VAppApi { + @GET + @Consumes(VAPP_XML) + @XMLResponseParser(VAppHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class) + VApp findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName); - Task copyVAppToVDCAndName(URI sourceVApp, URI vDC, String newName, CloneVAppOptions... options); + @POST + @Path("/action/cloneVApp") + @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml") + @Consumes(TASK_XML) + @XMLResponseParser(TaskHandler.class) + @MapBinder(BindCloneVAppParamsToXmlPayload.class) + Task copyVAppToVDCAndName(@PayloadParam("Source") URI sourceVApp, + @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName, + CloneVAppOptions... options); - Task moveVAppToVDCAndRename(URI sourceVApp, URI vDC, String newName, CloneVAppOptions... options); + @POST + @Path("/action/cloneVApp") + @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml") + @Consumes(TASK_XML) + @XMLResponseParser(TaskHandler.class) + @PayloadParams(keys = "IsSourceDelete", values = "true") + @MapBinder(BindCloneVAppParamsToXmlPayload.class) + Task moveVAppToVDCAndRename(@PayloadParam("Source") URI sourceVApp, + @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName, + CloneVAppOptions... options); - VApp getVApp(URI vApp); + @GET + @Consumes(VAPP_XML) + @XMLResponseParser(VAppHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + VApp getVApp(@EndpointParam URI href); /** * To deploy a vApp, the client makes a request to its action/deploy URL. Deploying a vApp @@ -45,13 +105,26 @@ public interface VAppClient { *

* Deploying a Vm implicitly deploys the parent vApp if that vApp is not already deployed. */ - Task deployVApp(URI href); + @POST + @Consumes(TASK_XML) + @Produces(DEPLOYVAPPPARAMS_XML) + @Path("/action/deploy") + @MapBinder(BindDeployVAppParamsToXmlPayload.class) + @XMLResponseParser(TaskHandler.class) + Task deployVApp(@EndpointParam URI href); /** * like {@link #deployVApp(URI)}, except deploy transitions to power on state * */ - Task deployAndPowerOnVApp(URI href); + @POST + @Consumes(TASK_XML) + @Produces(DEPLOYVAPPPARAMS_XML) + @Path("/action/deploy") + @MapBinder(BindDeployVAppParamsToXmlPayload.class) + @PayloadParams(keys = "powerOn", values = "true") + @XMLResponseParser(TaskHandler.class) + Task deployAndPowerOnVApp(@EndpointParam URI href); /** * Undeploying a vApp powers off or suspends any running virtual machines it contains, then frees @@ -66,14 +139,27 @@ public interface VAppClient { * {@link #undeployAndSaveStateOf} * */ - Task undeployVApp(URI href); + @POST + @Consumes(TASK_XML) + @Produces(UNDEPLOYVAPPPARAMS_XML) + @Path("/action/undeploy") + @MapBinder(BindUndeployVAppParamsToXmlPayload.class) + @XMLResponseParser(TaskHandler.class) + Task undeployVApp(@EndpointParam URI href); /** * like {@link #undeployVApp(URI)}, where the undeployed virtual machines are suspended and their * suspend state saved * */ - Task undeployAndSaveStateOfVApp(URI href); + @POST + @Consumes(TASK_XML) + @Produces(UNDEPLOYVAPPPARAMS_XML) + @Path("/action/undeploy") + @MapBinder(BindUndeployVAppParamsToXmlPayload.class) + @PayloadParams(keys = "saveState", values = "true") + @XMLResponseParser(TaskHandler.class) + Task undeployAndSaveStateOfVApp(@EndpointParam URI href); /** * A powerOn request to a vApp URL powers on all of the virtual machines in the vApp, as @@ -85,7 +171,11 @@ public interface VAppClient { *

NOTE

A powerOn request to a vApp or virtual machine that is undeployed forces * deployment. */ - Task powerOnVApp(URI href); + @POST + @Consumes(TASK_XML) + @Path("/power/action/powerOn") + @XMLResponseParser(TaskHandler.class) + Task powerOnVApp(@EndpointParam URI href); /** * A powerOff request to a vApp URL powers off all of the virtual machines in the vApp, as @@ -93,7 +183,11 @@ public interface VAppClient { *

* A powerOff request to a virtual machine URL powers off the specified virtual machine. */ - Task powerOffVApp(URI href); + @POST + @Consumes(TASK_XML) + @Path("/power/action/powerOff") + @XMLResponseParser(TaskHandler.class) + Task powerOffVApp(@EndpointParam URI href); /** * A shutdown request to a vApp URL shuts down all of the virtual machines in the vApp, as @@ -104,7 +198,9 @@ public interface VAppClient { *

NOTE * A reset request to a virtual machine URL resets the specified virtual machine. */ - Task resetVApp(URI href); + @POST + @Consumes(TASK_XML) + @Path("/power/action/reset") + @XMLResponseParser(TaskHandler.class) + Task resetVApp(@EndpointParam URI href); /** * A reboot request to a vApp URL reboots all of the virtual machines in the vApp, as specified @@ -123,7 +223,9 @@ public interface VAppClient { *

NOTE

Because this request sends a signal to the guest OS, the vCloud API cannot track * the progress or verify the result of the requested operation. Hence, void is returned */ - void rebootVApp(URI href); + @POST + @Path("/power/action/reboot") + void rebootVApp(@EndpointParam URI href); /** * A suspend request to a vApp URL suspends all of the virtual machines in the vApp, as specified @@ -131,7 +233,11 @@ public interface VAppClient { *

* A suspend request to a virtual machine URL suspends the specified virtual machine. */ - Task suspendVApp(URI href); + @POST + @Consumes(TASK_XML) + @Path("/power/action/suspend") + @XMLResponseParser(TaskHandler.class) + Task suspendVApp(@EndpointParam URI href); /** * delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any @@ -148,5 +254,9 @@ public interface VAppClient { * href of the vApp * @return task of the operation in progress */ - Task deleteVApp(URI href); + @DELETE + @Consumes(TASK_XML) + @Fallback(Fallbacks.VoidOnNotFoundOr404.class) + @XMLResponseParser(TaskHandler.class) + Task deleteVApp(@EndpointParam URI href); } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppAsyncClient.java deleted file mode 100644 index bd332d6f7f..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppAsyncClient.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud.features; - -import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML; -import static org.jclouds.vcloud.VCloudMediaType.TASK_XML; -import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML; -import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML; - -import java.net.URI; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.predicates.validators.DnsNameValidator; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.ParamValidators; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.PayloadParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload; -import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload; -import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload; -import org.jclouds.vcloud.binders.OrgNameVDCNameResourceEntityNameToEndpoint; -import org.jclouds.vcloud.domain.Task; -import org.jclouds.vcloud.domain.VApp; -import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; -import org.jclouds.vcloud.options.CloneVAppOptions; -import org.jclouds.vcloud.xml.TaskHandler; -import org.jclouds.vcloud.xml.VAppHandler; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides access to VApp functionality in vCloud - *

- * - * @author Adrian Cole - */ -@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface VAppAsyncClient { - - /** - * @see VAppClient#copyVAppToVDCAndName - */ - @POST - @Path("/action/cloneVApp") - @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml") - @Consumes(TASK_XML) - @XMLResponseParser(TaskHandler.class) - @MapBinder(BindCloneVAppParamsToXmlPayload.class) - ListenableFuture copyVAppToVDCAndName(@PayloadParam("Source") URI sourceVApp, - @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName, - CloneVAppOptions... options); - - /** - * @see VAppClient#moveVAppToVDCAndRename - */ - @POST - @Path("/action/cloneVApp") - @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml") - @Consumes(TASK_XML) - @XMLResponseParser(TaskHandler.class) - @PayloadParams(keys = "IsSourceDelete", values = "true") - @MapBinder(BindCloneVAppParamsToXmlPayload.class) - ListenableFuture moveVAppToVDCAndRename(@PayloadParam("Source") URI sourceVApp, - @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName, - CloneVAppOptions... options); - - /** - * @see VAppClient#findVAppInOrgVDCNamed - */ - @GET - @Consumes(VAPP_XML) - @XMLResponseParser(VAppHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class) - ListenableFuture findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName); - - /** - * @see VAppClient#getVApp - */ - @GET - @Consumes(VAPP_XML) - @XMLResponseParser(VAppHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getVApp(@EndpointParam URI href); - - /** - * @see VAppClient#deployVApp - */ - @POST - @Consumes(TASK_XML) - @Produces(DEPLOYVAPPPARAMS_XML) - @Path("/action/deploy") - @MapBinder(BindDeployVAppParamsToXmlPayload.class) - @XMLResponseParser(TaskHandler.class) - ListenableFuture deployVApp(@EndpointParam URI href); - - /** - * @see VAppClient#deployAndPowerOnVApp - */ - @POST - @Consumes(TASK_XML) - @Produces(DEPLOYVAPPPARAMS_XML) - @Path("/action/deploy") - @MapBinder(BindDeployVAppParamsToXmlPayload.class) - @PayloadParams(keys = "powerOn", values = "true") - @XMLResponseParser(TaskHandler.class) - ListenableFuture deployAndPowerOnVApp(@EndpointParam URI href); - - /** - * @see VAppClient#undeployVApp - */ - @POST - @Consumes(TASK_XML) - @Produces(UNDEPLOYVAPPPARAMS_XML) - @Path("/action/undeploy") - @MapBinder(BindUndeployVAppParamsToXmlPayload.class) - @XMLResponseParser(TaskHandler.class) - ListenableFuture undeployVApp(@EndpointParam URI href); - - /** - * @see VAppClient#undeployAndSaveStateOfVApp - */ - @POST - @Consumes(TASK_XML) - @Produces(UNDEPLOYVAPPPARAMS_XML) - @Path("/action/undeploy") - @MapBinder(BindUndeployVAppParamsToXmlPayload.class) - @PayloadParams(keys = "saveState", values = "true") - @XMLResponseParser(TaskHandler.class) - ListenableFuture undeployAndSaveStateOfVApp(@EndpointParam URI href); - - /** - * @see VAppClient#powerOnVApp - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/powerOn") - @XMLResponseParser(TaskHandler.class) - ListenableFuture powerOnVApp(@EndpointParam URI href); - - /** - * @see VAppClient#powerOffVApp - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/powerOff") - @XMLResponseParser(TaskHandler.class) - ListenableFuture powerOffVApp(@EndpointParam URI href); - - /** - * @see VAppClient#shutdownVApp - */ - @POST - @Path("/power/action/shutdown") - ListenableFuture shutdownVApp(@EndpointParam URI href); - - /** - * @see VAppClient#resetVApp - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/reset") - @XMLResponseParser(TaskHandler.class) - ListenableFuture resetVApp(@EndpointParam URI href); - - /** - * @see VAppClient#rebootVApp - */ - @POST - @Path("/power/action/reboot") - ListenableFuture rebootVApp(@EndpointParam URI href); - - /** - * @see VAppClient#suspendVApp - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/suspend") - @XMLResponseParser(TaskHandler.class) - ListenableFuture suspendVApp(@EndpointParam URI href); - - /** - * @see VAppClient#deleteVApp - */ - @DELETE - @Consumes(TASK_XML) - @Fallback(VoidOnNotFoundOr404.class) - @XMLResponseParser(TaskHandler.class) - ListenableFuture deleteVApp(@EndpointParam URI href); - -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppTemplateAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java similarity index 55% rename from apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppTemplateAsyncClient.java rename to apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java index 3ed2e28eda..536e3df4d8 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppTemplateAsyncClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java @@ -30,8 +30,7 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; +import org.jclouds.Fallbacks; import org.jclouds.javax.annotation.Nullable; import org.jclouds.ovf.Envelope; import org.jclouds.ovf.xml.EnvelopeHandler; @@ -62,16 +61,38 @@ import org.jclouds.vcloud.xml.VAppTemplateHandler; import com.google.common.util.concurrent.ListenableFuture; /** - * Provides access to VAppTemplate functionality in vCloud + * Provides access to VApp Template functionality in vCloud *

* + * @see * @author Adrian Cole */ @RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface VAppTemplateAsyncClient { +public interface VAppTemplateApi { + /** + * returns the vapp template corresponding to a catalog item in the catalog associated with the + * specified name. Note that the org and catalog parameters can be null to choose default. + * + * @param orgName + * organization name, or null for the default + * @param catalogName + * catalog name, or null for the default + * @param itemName + * item you wish to lookup + * + * @throws NoSuchElementException + * if you specified an org, catalog, or catalog item name that isn't present + */ + @GET + @Consumes(VAPPTEMPLATE_XML) + @XMLResponseParser(VAppTemplateHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class) + VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("catalogName") String catalogName, + @PayloadParam("itemName") String itemName); /** - * @see VAppTemplateClient#createVAppInVDCByInstantiatingTemplate */ @POST @Path("/action/instantiateVAppTemplate") @@ -79,49 +100,20 @@ public interface VAppTemplateAsyncClient { @Consumes(VAPP_XML) @XMLResponseParser(VAppHandler.class) @MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class) - ListenableFuture createVAppInVDCByInstantiatingTemplate( - @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName, @EndpointParam URI vdc, - @PayloadParam("template") URI template, InstantiateVAppTemplateOptions... options); + VApp createVAppInVDCByInstantiatingTemplate( + @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName, @EndpointParam URI vdc, + @PayloadParam("template") URI template, InstantiateVAppTemplateOptions... options); - /** - * @see VAppTemplateClient#getOvfEnvelopeForVAppTemplate - */ - @GET - @Consumes(MediaType.TEXT_XML) - @Path("/ovf") - @XMLResponseParser(EnvelopeHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getOvfEnvelopeForVAppTemplate(@EndpointParam URI href); - - /** - * @see VAppTemplateClient#captureVAppAsTemplateInVDC - */ - @POST - @Path("/action/captureVApp") - @Produces("application/vnd.vmware.vcloud.captureVAppParams+xml") - @Consumes(VAPPTEMPLATE_XML) - @XMLResponseParser(VAppTemplateHandler.class) - @MapBinder(BindCaptureVAppParamsToXmlPayload.class) - ListenableFuture captureVAppAsTemplateInVDC(@PayloadParam("vApp") URI toCapture, - @PayloadParam("templateName") @ParamValidators(DnsNameValidator.class) String templateName, - @EndpointParam URI vdc, CaptureVAppOptions... options); - - /** - * @see VAppTemplateClient#copyVAppTemplateToVDCAndName - */ @POST @Path("/action/cloneVAppTemplate") @Produces("application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml") @Consumes(TASK_XML) @XMLResponseParser(TaskHandler.class) @MapBinder(BindCloneVAppTemplateParamsToXmlPayload.class) - ListenableFuture copyVAppTemplateToVDCAndName(@PayloadParam("Source") URI sourceVAppTemplate, - @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName, - CloneVAppTemplateOptions... options); + Task copyVAppTemplateToVDCAndName(@PayloadParam("Source") URI sourceVAppTemplate, + @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName, + CloneVAppTemplateOptions... options); - /** - * @see VAppTemplateClient#moveVAppTemplateToVDCAndRename - */ @POST @Path("/action/cloneVAppTemplate") @Produces("application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml") @@ -129,37 +121,61 @@ public interface VAppTemplateAsyncClient { @XMLResponseParser(TaskHandler.class) @PayloadParams(keys = "IsSourceDelete", values = "true") @MapBinder(BindCloneVAppTemplateParamsToXmlPayload.class) - ListenableFuture moveVAppTemplateToVDCAndRename(@PayloadParam("Source") URI toClone, - @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName, - CloneVAppTemplateOptions... options); + Task moveVAppTemplateToVDCAndRename(@PayloadParam("Source") URI toClone, + @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName, + CloneVAppTemplateOptions... options); /** - * @see VAppTemplateClient#findVAppTemplateInOrgCatalogNamed + * The captureVApp request creates a vApp template from an instantiated vApp.

Note

+ * Before it can be captured, a vApp must be undeployed + * + * @param targetVdcHref + * @param sourceVAppHref + * @param newTemplateName + * @param options + * @return template in progress */ + @POST + @Path("/action/captureVApp") + @Produces("application/vnd.vmware.vcloud.captureVAppParams+xml") + @Consumes(VAPPTEMPLATE_XML) + @XMLResponseParser(VAppTemplateHandler.class) + @MapBinder(BindCaptureVAppParamsToXmlPayload.class) + VAppTemplate captureVAppAsTemplateInVDC(@PayloadParam("vApp") URI toCapture, + @PayloadParam("templateName") @ParamValidators(DnsNameValidator.class) String templateName, + @EndpointParam URI vdc, CaptureVAppOptions... options); + @GET @Consumes(VAPPTEMPLATE_XML) @XMLResponseParser(VAppTemplateHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class) - ListenableFuture findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName); + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + VAppTemplate getVAppTemplate(@EndpointParam URI vAppTemplate); - /** - * @see VAppTemplateClient#getVAppTemplate - */ @GET - @Consumes(VAPPTEMPLATE_XML) - @XMLResponseParser(VAppTemplateHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getVAppTemplate(@EndpointParam URI vAppTemplate); + @Consumes(MediaType.TEXT_XML) + @Path("/ovf") + @XMLResponseParser(EnvelopeHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Envelope getOvfEnvelopeForVAppTemplate(@EndpointParam URI href); /** - * @see VAppTemplateClient#deleteVAppTemplate + * delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any + * object that is being copied or moved is in use. Other criteria that determine whether an + * object is in use depend on the object type. + *
    + *
  • A vApptemplate is in use if it is being instantiated. After instantiation is complete, the + * template is no longer in use.
  • + *
  • A vApp is in use if it is deployed.
  • + *
  • A media image is in use if it is inserted in a Vm.
  • + *
+ * + * @param id + * href of the vApp + * @return task of the operation in progress */ @DELETE @Consumes(TASK_XML) - @Fallback(VoidOnNotFoundOr404.class) + @Fallback(Fallbacks.VoidOnNotFoundOr404.class) @XMLResponseParser(TaskHandler.class) - ListenableFuture deleteVAppTemplate(@EndpointParam URI href); - + Task deleteVAppTemplate(@EndpointParam URI href); } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppTemplateClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppTemplateClient.java deleted file mode 100644 index 49d0061bab..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VAppTemplateClient.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud.features; - -import java.net.URI; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.ovf.Envelope; -import org.jclouds.vcloud.domain.Task; -import org.jclouds.vcloud.domain.VApp; -import org.jclouds.vcloud.domain.VAppTemplate; -import org.jclouds.vcloud.options.CaptureVAppOptions; -import org.jclouds.vcloud.options.CloneVAppTemplateOptions; -import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions; - -/** - * Provides access to VApp Template functionality in vCloud - *

- * - * @see - * @author Adrian Cole - */ -public interface VAppTemplateClient { - /** - * returns the vapp template corresponding to a catalog item in the catalog associated with the - * specified name. Note that the org and catalog parameters can be null to choose default. - * - * @param orgName - * organization name, or null for the default - * @param catalogName - * catalog name, or null for the default - * @param itemName - * item you wish to lookup - * - * @throws NoSuchElementException - * if you specified an org, catalog, or catalog item name that isn't present - */ - VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName, String itemName); - - /** - */ - VApp createVAppInVDCByInstantiatingTemplate(String appName, URI vDC, URI template, - InstantiateVAppTemplateOptions... options); - - Task copyVAppTemplateToVDCAndName(URI sourceVAppTemplate, URI vDC, String newName, - CloneVAppTemplateOptions... options); - - Task moveVAppTemplateToVDCAndRename(URI sourceVAppTemplate, URI vDC, String newName, - CloneVAppTemplateOptions... options); - - /** - * The captureVApp request creates a vApp template from an instantiated vApp.

Note

- * Before it can be captured, a vApp must be undeployed - * - * @param targetVdcHref - * @param sourceVAppHref - * @param newTemplateName - * @param options - * @return template in progress - */ - VAppTemplate captureVAppAsTemplateInVDC(URI sourceVAppHref, String newTemplateName, URI targetVdcHref, - CaptureVAppOptions... options); - - VAppTemplate getVAppTemplate(URI vApp); - - Envelope getOvfEnvelopeForVAppTemplate(URI vAppTemplate); - - /** - * delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any - * object that is being copied or moved is in use. Other criteria that determine whether an - * object is in use depend on the object type. - * - * - * @param id - * href of the vApp - * @return task of the operation in progress - */ - Task deleteVAppTemplate(URI id); -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VDCAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VDCApi.java similarity index 72% rename from apis/vcloud/src/main/java/org/jclouds/vcloud/features/VDCAsyncClient.java rename to apis/vcloud/src/main/java/org/jclouds/vcloud/features/VDCApi.java index e00332512b..c33813e951 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VDCAsyncClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VDCApi.java @@ -23,7 +23,7 @@ import java.net.URI; import javax.ws.rs.Consumes; import javax.ws.rs.GET; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; +import org.jclouds.Fallbacks; import org.jclouds.javax.annotation.Nullable; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; @@ -45,25 +45,30 @@ import com.google.common.util.concurrent.ListenableFuture; * @author Adrian Cole */ @RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface VDCAsyncClient { +public interface VDCApi { + @GET + @XMLResponseParser(VDCHandler.class) + @Consumes(VDC_XML) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + VDC getVDC(@EndpointParam URI vdc); /** - * @see VDCClient#getVDC(URI) + * returns the VDC in the organization associated with the specified name. Note that both + * parameters can be null to choose default. + * + * @param orgName + * organization name, or null for the default + * @param vdcName + * catalog name, or null for the default + * @throws NoSuchElementException + * if you specified an org or vdc name that isn't present */ @GET @XMLResponseParser(VDCHandler.class) @Consumes(VDC_XML) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getVDC(@EndpointParam URI vdc); - - /** - * @see VDCClient#findVDCInOrgNamed(String, String) - */ - @GET - @XMLResponseParser(VDCHandler.class) - @Consumes(VDC_XML) - @Fallback(NullOnNotFoundOr404.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) @MapBinder(OrgNameAndVDCNameToEndpoint.class) - ListenableFuture findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("vdcName") String vdcName); + VDC findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("vdcName") String vdcName); + } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VDCClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VDCClient.java deleted file mode 100644 index 5fb4fe1d71..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VDCClient.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud.features; - -import java.net.URI; -import org.jclouds.vcloud.domain.VDC; - -/** - * Provides access to VDC functionality in vCloud - *

- * - * @author Adrian Cole - */ -public interface VDCClient { - VDC getVDC(URI vdc); - - /** - * returns the VDC in the organization associated with the specified name. Note that both - * parameters can be null to choose default. - * - * @param orgName - * organization name, or null for the default - * @param vdcName - * catalog name, or null for the default - * @throws NoSuchElementException - * if you specified an org or vdc name that isn't present - */ - VDC findVDCInOrgNamed(String orgName, String vdcName); - -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmApi.java similarity index 51% rename from apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmClient.java rename to apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmApi.java index 9e77a19e41..dce9075112 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmApi.java @@ -16,12 +16,47 @@ */ package org.jclouds.vcloud.features; +import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML; +import static org.jclouds.vcloud.VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML; +import static org.jclouds.vcloud.VCloudMediaType.NETWORKCONNECTIONSECTION_XML; +import static org.jclouds.vcloud.VCloudMediaType.RASDITEM_XML; +import static org.jclouds.vcloud.VCloudMediaType.TASK_XML; +import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML; +import static org.jclouds.vcloud.VCloudMediaType.VM_XML; + import java.io.InputStream; import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.jclouds.Fallbacks; +import org.jclouds.rest.annotations.BinderParam; +import org.jclouds.rest.annotations.EndpointParam; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.PayloadParams; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.XMLResponseParser; +import org.jclouds.vcloud.binders.BindCPUCountToXmlPayload; +import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload; +import org.jclouds.vcloud.binders.BindGuestCustomizationSectionToXmlPayload; +import org.jclouds.vcloud.binders.BindMemoryToXmlPayload; +import org.jclouds.vcloud.binders.BindNetworkConnectionSectionToXmlPayload; +import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload; import org.jclouds.vcloud.domain.GuestCustomizationSection; import org.jclouds.vcloud.domain.NetworkConnectionSection; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Vm; +import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.xml.TaskHandler; +import org.jclouds.vcloud.xml.VmHandler; + +import com.google.common.util.concurrent.ListenableFuture; /** * Provides access to VM functionality in vCloud @@ -29,9 +64,14 @@ import org.jclouds.vcloud.domain.Vm; * * @author Adrian Cole */ -public interface VmClient { +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) +public interface VmApi { - Vm getVm(URI vApp); + @GET + @Consumes(VM_XML) + @XMLResponseParser(VmHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Vm getVm(@EndpointParam URI href); /** * To deploy a vApp, the client makes a request to its action/deploy URL. Deploying a vApp @@ -40,13 +80,26 @@ public interface VmClient { *

* Deploying a Vm implicitly deploys the parent vApp if that vApp is not already deployed. */ - Task deployVm(URI href); + @POST + @Consumes(TASK_XML) + @Produces(DEPLOYVAPPPARAMS_XML) + @Path("/action/deploy") + @MapBinder(BindDeployVAppParamsToXmlPayload.class) + @XMLResponseParser(TaskHandler.class) + Task deployVm(@EndpointParam URI href); /** * like {@link #deploy(URI)}, except deploy transitions to power on state * */ - Task deployAndPowerOnVm(URI href); + @POST + @Consumes(TASK_XML) + @Produces(DEPLOYVAPPPARAMS_XML) + @Path("/action/deploy") + @MapBinder(BindDeployVAppParamsToXmlPayload.class) + @PayloadParams(keys = "powerOn", values = "true") + @XMLResponseParser(TaskHandler.class) + Task deployAndPowerOnVm(@EndpointParam URI href); /** * Undeploying a vApp powers off or suspends any running virtual machines it contains, then frees @@ -61,14 +114,27 @@ public interface VmClient { * {@link #undeployAndSaveStateOf} * */ - Task undeployVm(URI href); + @POST + @Consumes(TASK_XML) + @Produces(UNDEPLOYVAPPPARAMS_XML) + @Path("/action/undeploy") + @MapBinder(BindUndeployVAppParamsToXmlPayload.class) + @XMLResponseParser(TaskHandler.class) + Task undeployVm(@EndpointParam URI href); /** * like {@link #undeploy(URI)}, where the undeployed virtual machines are suspended and their * suspend state saved * */ - Task undeployAndSaveStateOfVm(URI href); + @POST + @Consumes(TASK_XML) + @Produces(UNDEPLOYVAPPPARAMS_XML) + @Path("/action/undeploy") + @MapBinder(BindUndeployVAppParamsToXmlPayload.class) + @PayloadParams(keys = "saveState", values = "true") + @XMLResponseParser(TaskHandler.class) + Task undeployAndSaveStateOfVm(@EndpointParam URI href); /** * A powerOn request to a vApp URL powers on all of the virtual machines in the vApp, as @@ -80,7 +146,11 @@ public interface VmClient { *

NOTE

A powerOn request to a vApp or virtual machine that is undeployed forces * deployment. */ - Task powerOnVm(URI href); + @POST + @Consumes(TASK_XML) + @Path("/power/action/powerOn") + @XMLResponseParser(TaskHandler.class) + Task powerOnVm(@EndpointParam URI href); /** * A powerOff request to a vApp URL powers off all of the virtual machines in the vApp, as @@ -88,7 +158,11 @@ public interface VmClient { *

* A powerOff request to a virtual machine URL powers off the specified virtual machine. */ - Task powerOffVm(URI href); + @POST + @Consumes(TASK_XML) + @Path("/power/action/powerOff") + @XMLResponseParser(TaskHandler.class) + Task powerOffVm(@EndpointParam URI href); /** * A shutdown request to a vApp URL shuts down all of the virtual machines in the vApp, as @@ -99,7 +173,9 @@ public interface VmClient { *

NOTE * A reset request to a virtual machine URL resets the specified virtual machine. */ - Task resetVm(URI href); + @POST + @Consumes(TASK_XML) + @Path("/power/action/reset") + @XMLResponseParser(TaskHandler.class) + Task resetVm(@EndpointParam URI href); /** * A reboot request to a vApp URL reboots all of the virtual machines in the vApp, as specified @@ -118,7 +198,9 @@ public interface VmClient { *

NOTE

Because this request sends a signal to the guest OS, the vCloud API cannot track * the progress or verify the result of the requested operation. Hence, void is returned */ - void rebootVm(URI href); + @POST + @Path("/power/action/reboot") + void rebootVm(@EndpointParam URI href); /** * A suspend request to a vApp URL suspends all of the virtual machines in the vApp, as specified @@ -126,7 +208,11 @@ public interface VmClient { *

* A suspend request to a virtual machine URL suspends the specified virtual machine. */ - Task suspendVm(URI href); + @POST + @Consumes(TASK_XML) + @Path("/power/action/suspend") + @XMLResponseParser(TaskHandler.class) + Task suspendVm(@EndpointParam URI href); /** * Get a Screen Thumbnail for a Virtual Machine @@ -134,7 +220,11 @@ public interface VmClient { * @param href * to snapshot */ - InputStream getScreenThumbnailForVm(URI href); + @GET + @Path("/screen") + @Consumes("image/png") + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + InputStream getScreenThumbnailForVm(@EndpointParam URI vm); /** * Modify the Guest Customization Section of a Virtual Machine @@ -145,7 +235,14 @@ public interface VmClient { * guestCustomizationSection * @return task in progress */ - Task updateGuestCustomizationOfVm(GuestCustomizationSection guestCustomizationSection, URI href); + @PUT + @Consumes(TASK_XML) + @Produces(GUESTCUSTOMIZATIONSECTION_XML) + @Path("/guestCustomizationSection") + @XMLResponseParser(TaskHandler.class) + Task updateGuestCustomizationOfVm( + @BinderParam(BindGuestCustomizationSectionToXmlPayload.class) GuestCustomizationSection guestCustomizationSection, + @EndpointParam URI href); /** * Modify the Network Connection Section of a Virtual Machine @@ -156,7 +253,14 @@ public interface VmClient { * networkConnectionSection * @return task in progress */ - Task updateNetworkConnectionOfVm(NetworkConnectionSection guestCustomizationSection, URI href); + @PUT + @Consumes(TASK_XML) + @Produces(NETWORKCONNECTIONSECTION_XML) + @Path("/networkConnectionSection") + @XMLResponseParser(TaskHandler.class) + Task updateNetworkConnectionOfVm( + @BinderParam(BindNetworkConnectionSectionToXmlPayload.class) NetworkConnectionSection networkConnectionSection, + @EndpointParam URI href); /** * update the cpuCount of an existing VM @@ -166,7 +270,13 @@ public interface VmClient { * @param cpuCount * count to change the primary cpu to */ - Task updateCPUCountOfVm(int cpuCount, URI href); + @PUT + @Consumes(TASK_XML) + @Produces(RASDITEM_XML) + @Path("/virtualHardwareSection/cpu") + @XMLResponseParser(TaskHandler.class) + Task updateCPUCountOfVm(@BinderParam(BindCPUCountToXmlPayload.class) int cpuCount, + @EndpointParam URI href); /** * update the memoryInMB of an existing VM @@ -176,5 +286,11 @@ public interface VmClient { * @param memoryInMB * memory in MB to assign to the VM */ - Task updateMemoryMBOfVm(int memoryInMB, URI href); + @PUT + @Consumes(TASK_XML) + @Produces(RASDITEM_XML) + @Path("/virtualHardwareSection/memory") + @XMLResponseParser(TaskHandler.class) + Task updateMemoryMBOfVm(@BinderParam(BindMemoryToXmlPayload.class) int memoryInMB, + @EndpointParam URI href); } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmAsyncClient.java deleted file mode 100644 index 6b945f98fc..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmAsyncClient.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud.features; - -import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML; -import static org.jclouds.vcloud.VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML; -import static org.jclouds.vcloud.VCloudMediaType.NETWORKCONNECTIONSECTION_XML; -import static org.jclouds.vcloud.VCloudMediaType.RASDITEM_XML; -import static org.jclouds.vcloud.VCloudMediaType.TASK_XML; -import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML; -import static org.jclouds.vcloud.VCloudMediaType.VM_XML; - -import java.io.InputStream; -import java.net.URI; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.PayloadParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.vcloud.binders.BindCPUCountToXmlPayload; -import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload; -import org.jclouds.vcloud.binders.BindGuestCustomizationSectionToXmlPayload; -import org.jclouds.vcloud.binders.BindMemoryToXmlPayload; -import org.jclouds.vcloud.binders.BindNetworkConnectionSectionToXmlPayload; -import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload; -import org.jclouds.vcloud.domain.GuestCustomizationSection; -import org.jclouds.vcloud.domain.NetworkConnectionSection; -import org.jclouds.vcloud.domain.Task; -import org.jclouds.vcloud.domain.Vm; -import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; -import org.jclouds.vcloud.xml.TaskHandler; -import org.jclouds.vcloud.xml.VmHandler; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides access to Vm functionality in vCloud - *

- * - * @author Adrian Cole - */ -@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface VmAsyncClient { - - /** - * @see VmClient#getVm - */ - @GET - @Consumes(VM_XML) - @XMLResponseParser(VmHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getVm(@EndpointParam URI href); - - /** - * @see VmClient#deployVm - */ - @POST - @Consumes(TASK_XML) - @Produces(DEPLOYVAPPPARAMS_XML) - @Path("/action/deploy") - @MapBinder(BindDeployVAppParamsToXmlPayload.class) - @XMLResponseParser(TaskHandler.class) - ListenableFuture deployVm(@EndpointParam URI href); - - /** - * @see VmClient#deployAndPowerOnVm - */ - @POST - @Consumes(TASK_XML) - @Produces(DEPLOYVAPPPARAMS_XML) - @Path("/action/deploy") - @MapBinder(BindDeployVAppParamsToXmlPayload.class) - @PayloadParams(keys = "powerOn", values = "true") - @XMLResponseParser(TaskHandler.class) - ListenableFuture deployAndPowerOnVm(@EndpointParam URI href); - - /** - * @see VmClient#undeployVm - */ - @POST - @Consumes(TASK_XML) - @Produces(UNDEPLOYVAPPPARAMS_XML) - @Path("/action/undeploy") - @MapBinder(BindUndeployVAppParamsToXmlPayload.class) - @XMLResponseParser(TaskHandler.class) - ListenableFuture undeployVm(@EndpointParam URI href); - - /** - * @see VmClient#undeployAndSaveStateOfVm - */ - @POST - @Consumes(TASK_XML) - @Produces(UNDEPLOYVAPPPARAMS_XML) - @Path("/action/undeploy") - @MapBinder(BindUndeployVAppParamsToXmlPayload.class) - @PayloadParams(keys = "saveState", values = "true") - @XMLResponseParser(TaskHandler.class) - ListenableFuture undeployAndSaveStateOfVm(@EndpointParam URI href); - - /** - * @see VmClient#powerOnVm - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/powerOn") - @XMLResponseParser(TaskHandler.class) - ListenableFuture powerOnVm(@EndpointParam URI href); - - /** - * @see VmClient#powerOffVm - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/powerOff") - @XMLResponseParser(TaskHandler.class) - ListenableFuture powerOffVm(@EndpointParam URI href); - - /** - * @see VmClient#shutdownVm - */ - @POST - @Path("/power/action/shutdown") - ListenableFuture shutdownVm(@EndpointParam URI href); - - /** - * @see VmClient#resetVm - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/reset") - @XMLResponseParser(TaskHandler.class) - ListenableFuture resetVm(@EndpointParam URI href); - - /** - * @see VmClient#rebootVm - */ - @POST - @Path("/power/action/reboot") - ListenableFuture rebootVm(@EndpointParam URI href); - - /** - * @see VmClient#suspendVm - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/suspend") - @XMLResponseParser(TaskHandler.class) - ListenableFuture suspendVm(@EndpointParam URI href); - - /** - * @see VmClient#updateCPUCountOfVm - */ - @PUT - @Consumes(TASK_XML) - @Produces(RASDITEM_XML) - @Path("/virtualHardwareSection/cpu") - @XMLResponseParser(TaskHandler.class) - ListenableFuture updateCPUCountOfVm(@BinderParam(BindCPUCountToXmlPayload.class) int cpuCount, - @EndpointParam URI href); - - /** - * @see VmClient#updateMemoryMBOfVm - */ - @PUT - @Consumes(TASK_XML) - @Produces(RASDITEM_XML) - @Path("/virtualHardwareSection/memory") - @XMLResponseParser(TaskHandler.class) - ListenableFuture updateMemoryMBOfVm(@BinderParam(BindMemoryToXmlPayload.class) int memoryInMB, - @EndpointParam URI href); - - /** - * @see VmClient#updateGuestCustomizationOfVm - */ - @PUT - @Consumes(TASK_XML) - @Produces(GUESTCUSTOMIZATIONSECTION_XML) - @Path("/guestCustomizationSection") - @XMLResponseParser(TaskHandler.class) - ListenableFuture updateGuestCustomizationOfVm( - @BinderParam(BindGuestCustomizationSectionToXmlPayload.class) GuestCustomizationSection guestCustomizationSection, - @EndpointParam URI href); - - /** - * @see VmClient#updateNetworkConnectionOfVm - */ - @PUT - @Consumes(TASK_XML) - @Produces(NETWORKCONNECTIONSECTION_XML) - @Path("/networkConnectionSection") - @XMLResponseParser(TaskHandler.class) - ListenableFuture updateNetworkConnectionOfVm( - @BinderParam(BindNetworkConnectionSectionToXmlPayload.class) NetworkConnectionSection networkConnectionSection, - @EndpointParam URI href); - - /** - * - * @see VmClient#getScreenThumbnailForVm - */ - @GET - @Path("/screen") - @Consumes("image/png") - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getScreenThumbnailForVm(@EndpointParam URI vm); -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java index 5aa7dd551d..746dce147c 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java @@ -17,16 +17,14 @@ package org.jclouds.vcloud.functions; import static com.google.common.collect.Iterables.filter; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.logging.Logger; -import org.jclouds.vcloud.VCloudAsyncClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.CatalogItem; @@ -34,8 +32,6 @@ import org.jclouds.vcloud.domain.ReferenceType; import com.google.common.base.Function; import com.google.common.base.Predicate; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -45,26 +41,24 @@ public class CatalogItemsInCatalog implements Function apply(Catalog from) { - return transformParallel(filter(from.values(), new Predicate() { + return transform(filter(from.values(), new Predicate() { public boolean apply(ReferenceType input) { return input.getType().equals(VCloudMediaType.CATALOGITEM_XML); } - }), new Function>() { - public ListenableFuture apply(ReferenceType from) { + }), new Function() { + public CatalogItem apply(ReferenceType from) { return aclient.getCatalogClient().getCatalogItem(from.getHref()); } - }, userExecutor, null, logger, "catalogItems in " + from.getHref()); + }); } } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java index 174f817e98..92f91a9229 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java @@ -16,23 +16,19 @@ */ package org.jclouds.vcloud.functions; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.logging.Logger; -import org.jclouds.vcloud.VCloudAsyncClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.ReferenceType; import com.google.common.base.Function; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -42,21 +38,19 @@ public class CatalogsInOrg implements Function> { @Resource public Logger logger = Logger.NULL; - private final VCloudAsyncClient aclient; - private final ListeningExecutorService userExecutor; + private final VCloudApi aclient; @Inject - CatalogsInOrg(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) { + CatalogsInOrg(VCloudApi aclient) { this.aclient = aclient; - this.userExecutor = userExecutor; } @Override public Iterable apply(final Org org) { - return transformParallel(org.getCatalogs().values(), new Function>() { - public ListenableFuture apply(ReferenceType from) { + return transform(org.getCatalogs().values(), new Function() { + public Catalog apply(ReferenceType from) { return aclient.getCatalogClient().getCatalog(from.getHref()); } - }, userExecutor, null, logger, "catalogs in " + org.getName()); + }); } } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java index 4b6f8dde12..1160494a27 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java @@ -16,23 +16,19 @@ */ package org.jclouds.vcloud.functions; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.logging.Logger; -import org.jclouds.vcloud.VCloudAsyncClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.network.OrgNetwork; import com.google.common.base.Function; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -42,22 +38,20 @@ public class NetworksInOrg implements Function> { @Resource public Logger logger = Logger.NULL; - private final VCloudAsyncClient aclient; - private final ListeningExecutorService userExecutor; + private final VCloudApi aclient; @Inject - NetworksInOrg(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) { + NetworksInOrg(VCloudApi aclient) { this.aclient = aclient; - this.userExecutor = userExecutor; } @Override public Iterable apply(final Org org) { - return transformParallel(org.getNetworks().values(), new Function>() { - public ListenableFuture apply(ReferenceType from) { + return transform(org.getNetworks().values(), new Function() { + public OrgNetwork apply(ReferenceType from) { return aclient.getNetworkClient().getNetwork(from.getHref()); } - }, userExecutor, null, logger, "OrgNetworks in org " + org.getName()); + }); } } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java index 0180a78004..138a8d2952 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java @@ -16,27 +16,23 @@ */ package org.jclouds.vcloud.functions; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import java.net.URI; import javax.annotation.Resource; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.domain.Location; import org.jclouds.domain.LocationScope; import org.jclouds.logging.Logger; -import org.jclouds.vcloud.VCloudAsyncClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.domain.Org; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.collect.FluentIterable; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -45,13 +41,11 @@ import com.google.common.util.concurrent.ListeningExecutorService; public class OrgsForLocations implements Function, Iterable> { @Resource public Logger logger = Logger.NULL; - private final VCloudAsyncClient aclient; - private final ListeningExecutorService userExecutor; + private final VCloudApi aclient; @Inject - OrgsForLocations(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) { + OrgsForLocations(VCloudApi aclient) { this.aclient = aclient; - this.userExecutor = userExecutor; } /** @@ -69,11 +63,11 @@ public class OrgsForLocations implements Function, Iterable>() { - public ListenableFuture apply(URI from) { + return transform(uris, new Function() { + public Org apply(URI from) { return aclient.getOrgClient().getOrg(from); } - }, userExecutor, null, logger, "organizations for uris"); + }); } } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java index 9301761f3c..c4e4f8ea90 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java @@ -16,23 +16,19 @@ */ package org.jclouds.vcloud.functions; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.logging.Logger; -import org.jclouds.vcloud.VCloudAsyncClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.domain.Org; import com.google.common.base.Function; import com.google.common.base.Predicates; import com.google.common.collect.Iterables; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -41,22 +37,20 @@ import com.google.common.util.concurrent.ListeningExecutorService; public class OrgsForNames implements Function, Iterable> { @Resource public Logger logger = Logger.NULL; - private final VCloudAsyncClient aclient; - private final ListeningExecutorService userExecutor; + private final VCloudApi aclient; @Inject - OrgsForNames(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) { + OrgsForNames(VCloudApi aclient) { this.aclient = aclient; - this.userExecutor = userExecutor; } @Override public Iterable apply(Iterable from) { - return Iterables.filter(transformParallel(from, new Function>() { - public ListenableFuture apply(String from) { + return Iterables.filter(transform(from, new Function() { + public Org apply(String from) { return aclient.getOrgClient().findOrgNamed(from); } - }, userExecutor, null, logger, "organizations for names"), Predicates.notNull()); + }), Predicates.notNull()); } } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java index 63fe698f91..ea23416ca3 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java @@ -17,8 +17,7 @@ package org.jclouds.vcloud.functions; import static com.google.common.collect.Iterables.filter; -import static org.jclouds.Constants.PROPERTY_USER_THREADS; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; @@ -27,7 +26,7 @@ import javax.inject.Singleton; import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; -import org.jclouds.vcloud.VCloudAsyncClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.CatalogItem; import org.jclouds.vcloud.domain.VAppTemplate; @@ -35,8 +34,6 @@ import org.jclouds.vcloud.domain.VAppTemplate; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.base.Predicates; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -46,27 +43,24 @@ public class VAppTemplatesForCatalogItems implements Function apply(Iterable from) { - return filter(transformParallel(filter(from, new Predicate() { + return filter(transform(filter(from, new Predicate() { public boolean apply(CatalogItem input) { return input.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML); } - }), new Function>() { - public ListenableFuture apply(CatalogItem from) { + }), new Function() { + public VAppTemplate apply(CatalogItem from) { return aclient.getVAppTemplateClient().getVAppTemplate(from.getEntity().getHref()); } - }, userExecutor, null, logger, "vappTemplates in"), Predicates.notNull()); + }), Predicates.notNull()); } } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java index 2053edc7ad..7f52102e25 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java @@ -16,23 +16,19 @@ */ package org.jclouds.vcloud.functions; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.logging.Logger; -import org.jclouds.vcloud.VCloudAsyncClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.VDC; import com.google.common.base.Function; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -42,22 +38,20 @@ public class VDCsInOrg implements Function> { @Resource public Logger logger = Logger.NULL; - private final VCloudAsyncClient aclient; - private final ListeningExecutorService userExecutor; + private final VCloudApi aclient; @Inject - VDCsInOrg(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) { + VDCsInOrg(VCloudApi aclient) { this.aclient = aclient; - this.userExecutor = userExecutor; } @Override public Iterable apply(final Org org) { - return transformParallel(org.getVDCs().values(), new Function>() { - public ListenableFuture apply(ReferenceType from) { + return transform(org.getVDCs().values(), new Function() { + public VDC apply(ReferenceType from) { return aclient.getVDCClient().getVDC(from.getHref()); } - }, userExecutor, null, logger, "vdcs in org " + org.getName()); + }); } } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java similarity index 82% rename from apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClient.java rename to apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java index 2cd6631150..acf77c5ac4 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java @@ -29,18 +29,9 @@ import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Establishes a context with a VCloud endpoint. - *

- * - * @see - * @author Adrian Cole - */ @Endpoint(org.jclouds.vcloud.endpoints.VCloudLogin.class) @RequestFilters(BasicAuthentication.class) -public interface VCloudLoginAsyncClient extends Closeable { +public interface VCloudLoginApi extends Closeable { /** * This request returns a token to use in subsequent requests. After 30 minutes of inactivity, @@ -49,5 +40,5 @@ public interface VCloudLoginAsyncClient extends Closeable { @POST @ResponseParser(ParseLoginResponseFromHeaders.class) @Consumes(VCloudMediaType.ORGLIST_XML) - ListenableFuture login(); + VCloudSession login(); } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginClient.java deleted file mode 100644 index 20a3a34b9f..0000000000 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginClient.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.vcloud.internal; - -import java.io.Closeable; - -import org.jclouds.vcloud.domain.VCloudSession; - -public interface VCloudLoginClient extends Closeable { - - VCloudSession login(); -} diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java index df8c93a44b..70962bca43 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java @@ -24,7 +24,7 @@ import javax.inject.Singleton; import org.jclouds.logging.Logger; import org.jclouds.ovf.Envelope; -import org.jclouds.vcloud.VCloudClient; +import org.jclouds.vcloud.VCloudApi; import com.google.common.cache.CacheLoader; @@ -33,10 +33,10 @@ public class OVFLoader extends CacheLoader { @Resource protected Logger logger = Logger.NULL; - private final VCloudClient client; + private final VCloudApi client; @Inject - OVFLoader(VCloudClient client) { + OVFLoader(VCloudApi client) { this.client = client; } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java index a13c60c379..f3f80b3d46 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java @@ -23,7 +23,7 @@ import javax.inject.Inject; import javax.inject.Singleton; import org.jclouds.logging.Logger; -import org.jclouds.vcloud.VCloudClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.domain.VAppTemplate; import com.google.common.cache.CacheLoader; @@ -33,10 +33,10 @@ public class VAppTemplateLoader extends CacheLoader { @Resource protected Logger logger = Logger.NULL; - private final VCloudClient client; + private final VCloudApi client; @Inject - VAppTemplateLoader(VCloudClient client) { + VAppTemplateLoader(VCloudApi client) { this.client = client; } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java index 30a334ae00..578b673ccc 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java @@ -23,7 +23,7 @@ import javax.inject.Singleton; import org.jclouds.logging.Logger; import org.jclouds.vcloud.TaskInErrorStateException; -import org.jclouds.vcloud.VCloudClient; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.TaskStatus; @@ -39,13 +39,13 @@ import com.google.inject.Inject; @Singleton public class TaskSuccess implements Predicate { - private final VCloudClient client; + private final VCloudApi client; @Resource protected Logger logger = Logger.NULL; @Inject - public TaskSuccess(VCloudClient client) { + public TaskSuccess(VCloudApi client) { this.client = client; } diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudApiTest.java similarity index 67% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudApiTest.java index 485bd57fe1..fab8690d33 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudApiTest.java @@ -19,24 +19,23 @@ package org.jclouds.vcloud; import java.io.IOException; import java.util.concurrent.ExecutionException; -import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; +import org.jclouds.vcloud.internal.BaseVCloudApiTest; import org.jclouds.vcloud.utils.TestUtils; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** - * Tests behavior of {@code VCloudAsyncClient} + * Tests behavior of {@code VCloudApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", testName = "VCloudAsyncClientTest") -public class VCloudAsyncClientTest extends BaseVCloudAsyncClientTest { +@Test(groups = "unit", testName = "VCloudApiTest") +public class VCloudApiTest extends BaseVCloudApiTest { - private VCloudAsyncClient asyncClient; - private VCloudClient syncClient; + private VCloudApi syncClient; public void testSync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException { assert syncClient.getVAppClient() != null; @@ -49,23 +48,11 @@ public class VCloudAsyncClientTest extends BaseVCloudAsyncClientTest { +@Test(groups = "unit", testName = "VCloudVersionsApiTest") +public class VCloudVersionsApiTest extends BaseAsyncClientTest { public void testVersions() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VCloudVersionsAsyncClient.class, "getSupportedVersions"); + Invokable method = method(VCloudVersionsApi.class, "getSupportedVersions"); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of()); assertEquals(request.getRequestLine(), "GET http://localhost:8080/versions HTTP/1.1"); @@ -63,7 +63,7 @@ public class VCloudVersionsAsyncClientTest extends BaseAsyncClientTest { +@Test(groups = "unit", testName = "CatalogApiTest") +public class CatalogApiTest extends BaseVCloudApiTest { public void testCatalog() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(CatalogAsyncClient.class, "getCatalog", URI.class); + Invokable method = method(CatalogApi.class, "getCatalog", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"))); @@ -59,7 +59,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest method = method(CatalogAsyncClient.class, "findCatalogInOrgNamed", String.class, String.class); + Invokable method = method(CatalogApi.class, "findCatalogInOrgNamed", String.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of("org", "catalog")); assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1"); @@ -74,7 +74,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest method = method(CatalogAsyncClient.class, "getCatalogItem", URI.class); + Invokable method = method(CatalogApi.class, "getCatalogItem", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))); @@ -90,7 +90,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest method = method(CatalogAsyncClient.class, "findCatalogItemInOrgCatalogNamed", String.class, + Invokable method = method(CatalogApi.class, "findCatalogItemInOrgCatalogNamed", String.class, String.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of("org", "catalog", "item")); @@ -107,7 +107,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest method = method(CatalogAsyncClient.class, "addVAppTemplateOrMediaImageToCatalogAndNameItem", URI.class, + Invokable method = method(CatalogApi.class, "addVAppTemplateOrMediaImageToCatalogAndNameItem", URI.class, URI.class, String.class, CatalogItemOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("http://fooentity"), URI .create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), "myname", CatalogItemOptions.Builder diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java similarity index 86% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCClientLiveTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java index 4b6ed693f3..c9c6e4fc4c 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCClientLiveTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java @@ -16,14 +16,14 @@ */ package org.jclouds.vcloud.features; -import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest; +import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest; import org.testng.annotations.Test; /** * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VDCClientLiveTest") -public class VDCClientLiveTest extends BaseVCloudClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "NetworkApiLiveTest") +public class NetworkApiLiveTest extends BaseVCloudApiLiveTest { } diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java similarity index 86% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkAsyncClientTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java index 22942851e2..0d23a221af 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java @@ -24,24 +24,24 @@ import java.net.URI; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.functions.ParseSax; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; +import org.jclouds.vcloud.internal.BaseVCloudApiTest; import org.jclouds.vcloud.xml.OrgNetworkHandler; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; /** - * Tests behavior of {@code NetworkAsyncClient} + * Tests behavior of {@code NetworkApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", testName = "NetworkAsyncClientTest") -public class NetworkAsyncClientTest extends BaseVCloudAsyncClientTest { +@Test(groups = "unit", testName = "NetworkApiTest") +public class NetworkApiTest extends BaseVCloudApiTest { public void testNetwork() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(NetworkAsyncClient.class, "getNetwork", URI.class); + Invokable method = method(NetworkApi.class, "getNetwork", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/network/2"))); @@ -57,7 +57,7 @@ public class NetworkAsyncClientTest extends BaseVCloudAsyncClientTest method = method(NetworkAsyncClient.class, "findNetworkInOrgVDCNamed", String.class, String.class, + Invokable method = method(NetworkApi.class, "findNetworkInOrgVDCNamed", String.class, String.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of("org", "vdc", "network")); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java similarity index 91% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgClientLiveTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java index aa944c2d31..91a06e86fa 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgClientLiveTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java @@ -20,14 +20,14 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import org.jclouds.vcloud.domain.ReferenceType; -import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest; +import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest; import org.testng.annotations.Test; /** * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "OrgClientLiveTest") -public class OrgClientLiveTest extends BaseVCloudClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "OrgApiLiveTest") +public class OrgApiLiveTest extends BaseVCloudApiLiveTest { @Test public void testListOrgs() throws Exception { diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java similarity index 88% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgAsyncClientTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java index 82eed4608a..0f9fc72a1d 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java @@ -25,7 +25,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; import org.jclouds.http.functions.ParseSax; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; +import org.jclouds.vcloud.internal.BaseVCloudApiTest; import org.jclouds.vcloud.xml.OrgHandler; import org.jclouds.vcloud.xml.OrgListHandler; import org.testng.annotations.Test; @@ -33,17 +33,17 @@ import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; /** - * Tests behavior of {@code OrgAsyncClient} + * Tests behavior of {@code OrgApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", testName = "OrgAsyncClientTest") -public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest { +@Test(groups = "unit", testName = "OrgApiTest") +public class OrgApiTest extends BaseVCloudApiTest { public void testlistOrgs() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(OrgAsyncClient.class, "listOrgs"); + Invokable method = method(OrgApi.class, "listOrgs"); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org HTTP/1.1"); @@ -58,7 +58,7 @@ public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest method = method(OrgAsyncClient.class, "getOrg", URI.class); + Invokable method = method(OrgApi.class, "getOrg", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/org/1"))); @@ -74,7 +74,7 @@ public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest method = method(OrgAsyncClient.class, "findOrgNamed", String.class); + Invokable method = method(OrgApi.class, "findOrgNamed", String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of("org")); assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1"); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java similarity index 85% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskClientLiveTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java index b6b67b057a..4a8724712a 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskClientLiveTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java @@ -16,14 +16,14 @@ */ package org.jclouds.vcloud.features; -import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest; +import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest; import org.testng.annotations.Test; /** * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TaskClientLiveTest") -public class TaskClientLiveTest extends BaseVCloudClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TaskApiLiveTest") +public class TaskApiLiveTest extends BaseVCloudApiLiveTest { } diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java similarity index 88% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskAsyncClientTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java index cac82abb9b..4c3ee519a4 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java @@ -25,7 +25,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; +import org.jclouds.vcloud.internal.BaseVCloudApiTest; import org.jclouds.vcloud.xml.TaskHandler; import org.jclouds.vcloud.xml.TasksListHandler; import org.testng.annotations.Test; @@ -33,17 +33,17 @@ import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; /** - * Tests behavior of {@code TaskAsyncClient} + * Tests behavior of {@code TaskApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", testName = "TaskAsyncClientTest") -public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest { +@Test(groups = "unit", testName = "TaskApiTest") +public class TaskApiTest extends BaseVCloudApiTest { public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TaskAsyncClient.class, "getTasksList", URI.class); + Invokable method = method(TaskApi.class, "getTasksList", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1"))); @@ -59,7 +59,7 @@ public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest method = method(TaskAsyncClient.class, "findTasksListInOrgNamed", String.class); + Invokable method = method(TaskApi.class, "findTasksListInOrgNamed", String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of("org")); assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1"); @@ -74,7 +74,7 @@ public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest method = method(TaskAsyncClient.class, "getTask", URI.class); + Invokable method = method(TaskApi.class, "getTask", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/task/1"))); @@ -90,7 +90,7 @@ public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest method = method(TaskAsyncClient.class, "cancelTask", URI.class); + Invokable method = method(TaskApi.class, "cancelTask", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/task/1"))); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java similarity index 92% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppClientLiveTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java index 43fdcd5874..dd737858c0 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppClientLiveTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java @@ -23,15 +23,15 @@ import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.VApp; import org.jclouds.vcloud.domain.VDC; -import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest; +import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest; import org.testng.annotations.Test; /** * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppClientLiveTest") -public class VAppClientLiveTest extends BaseVCloudClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppApiLiveTest") +public class VAppApiLiveTest extends BaseVCloudApiLiveTest { @Test public void testGetVApp() throws Exception { diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java similarity index 89% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppAsyncClientTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java index af4fd5c050..d8ec98f811 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java @@ -27,7 +27,7 @@ import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.rest.internal.GeneratedHttpRequest; import org.jclouds.util.Strings2; -import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; +import org.jclouds.vcloud.internal.BaseVCloudApiTest; import org.jclouds.vcloud.options.CloneVAppOptions; import org.jclouds.vcloud.xml.TaskHandler; import org.jclouds.vcloud.xml.VAppHandler; @@ -36,17 +36,17 @@ import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; /** - * Tests behavior of {@code VAppAsyncClient} + * Tests behavior of {@code VAppApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", testName = "VAppAsyncClientTest") -public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest { +@Test(groups = "unit", testName = "VAppApiTest") +public class VAppApiTest extends BaseVCloudApiTest { public void testopyVAppToVDCAndName() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VAppAsyncClient.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class, + Invokable method = method(VAppApi.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class, CloneVAppOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), URI @@ -66,7 +66,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class, + Invokable method = method(VAppApi.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class, CloneVAppOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI @@ -87,7 +87,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "moveVAppToVDCAndRename", URI.class, URI.class, String.class, + Invokable method = method(VAppApi.class, "moveVAppToVDCAndRename", URI.class, URI.class, String.class, CloneVAppOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI @@ -108,7 +108,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "deployVApp", URI.class); + Invokable method = method(VAppApi.class, "deployVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -125,7 +125,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "deployAndPowerOnVApp", URI.class); + Invokable method = method(VAppApi.class, "deployAndPowerOnVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -142,7 +142,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "getVApp", URI.class); + Invokable method = method(VAppApi.class, "getVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -158,7 +158,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "rebootVApp", URI.class); + Invokable method = method(VAppApi.class, "rebootVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -175,7 +175,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "undeployVApp", URI.class); + Invokable method = method(VAppApi.class, "undeployVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -193,7 +193,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "undeployAndSaveStateOfVApp", URI.class); + Invokable method = method(VAppApi.class, "undeployAndSaveStateOfVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -212,7 +212,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "deleteVApp", URI.class); + Invokable method = method(VAppApi.class, "deleteVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -228,7 +228,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "powerOnVApp", URI.class); + Invokable method = method(VAppApi.class, "powerOnVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -245,7 +245,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "powerOffVApp", URI.class); + Invokable method = method(VAppApi.class, "powerOffVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -262,7 +262,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "resetVApp", URI.class); + Invokable method = method(VAppApi.class, "resetVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -279,7 +279,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "suspendVApp", URI.class); + Invokable method = method(VAppApi.class, "suspendVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -296,7 +296,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppAsyncClient.class, "shutdownVApp", URI.class); + Invokable method = method(VAppApi.class, "shutdownVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java similarity index 97% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateClientLiveTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java index 26d9fc1dd6..f93f93e291 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateClientLiveTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java @@ -33,7 +33,7 @@ import org.jclouds.vcloud.domain.Status; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VApp; import org.jclouds.vcloud.domain.VAppTemplate; -import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest; +import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest; import org.jclouds.vcloud.options.CatalogItemOptions; import org.jclouds.vcloud.predicates.TaskSuccess; import org.testng.annotations.Test; @@ -45,8 +45,8 @@ import com.google.common.collect.ImmutableMap; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppTemplateClientLiveTest") -public class VAppTemplateClientLiveTest extends BaseVCloudClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppTemplateApiLiveTest") +public class VAppTemplateApiLiveTest extends BaseVCloudApiLiveTest { @Test public void testGetVAppTemplate() throws Exception { Org org = getVCloudApi().getOrgClient().findOrgNamed(null); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java similarity index 89% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateAsyncClientTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java index 92181cf41b..06f592eb0f 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java @@ -29,7 +29,7 @@ import org.jclouds.rest.internal.GeneratedHttpRequest; import org.jclouds.util.Strings2; import org.jclouds.vcloud.domain.network.FenceMode; import org.jclouds.vcloud.domain.network.NetworkConfig; -import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; +import org.jclouds.vcloud.internal.BaseVCloudApiTest; import org.jclouds.vcloud.options.CaptureVAppOptions; import org.jclouds.vcloud.options.CloneVAppTemplateOptions; import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions; @@ -41,18 +41,18 @@ import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; /** - * Tests behavior of {@code VAppTemplateAsyncClient} + * Tests behavior of {@code VAppTemplateApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", testName = "VAppTemplateAsyncClientTest") -public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest { +@Test(groups = "unit", testName = "VAppTemplateApiTest") +public class VAppTemplateApiTest extends BaseVCloudApiTest { public void testCreateVAppInVDCByInstantiatingTemplate() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VAppTemplateAsyncClient.class, "createVAppInVDCByInstantiatingTemplate", String.class, + Invokable method = method(VAppTemplateApi.class, "createVAppInVDCByInstantiatingTemplate", String.class, URI.class, URI.class, InstantiateVAppTemplateOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of("my-vapp", URI .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI @@ -77,7 +77,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppTemplateAsyncClient.class, "createVAppInVDCByInstantiatingTemplate", String.class, + Invokable method = method(VAppTemplateApi.class, "createVAppInVDCByInstantiatingTemplate", String.class, URI.class, URI.class, InstantiateVAppTemplateOptions[].class); processor.createRequest(method, ImmutableList. of("CentOS 01", URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), addNetworkConfig(new NetworkConfig(null, @@ -85,7 +85,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppTemplateAsyncClient.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class, + Invokable method = method(VAppTemplateApi.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class, String.class, CloneVAppTemplateOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181"), URI @@ -105,7 +105,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppTemplateAsyncClient.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class, + Invokable method = method(VAppTemplateApi.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class, String.class, CloneVAppTemplateOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI @@ -126,7 +126,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppTemplateAsyncClient.class, "moveVAppTemplateToVDCAndRename", URI.class, URI.class, + Invokable method = method(VAppTemplateApi.class, "moveVAppTemplateToVDCAndRename", URI.class, URI.class, String.class, CloneVAppTemplateOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI @@ -147,7 +147,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppTemplateAsyncClient.class, "captureVAppAsTemplateInVDC", URI.class, String.class, + Invokable method = method(VAppTemplateApi.class, "captureVAppAsTemplateInVDC", URI.class, String.class, URI.class, CaptureVAppOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), "my-template", URI @@ -168,7 +168,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppTemplateAsyncClient.class, "captureVAppAsTemplateInVDC", URI.class, String.class, + Invokable method = method(VAppTemplateApi.class, "captureVAppAsTemplateInVDC", URI.class, String.class, URI.class, CaptureVAppOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "my-template", URI @@ -189,7 +189,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppTemplateAsyncClient.class, "findVAppTemplateInOrgCatalogNamed", String.class, + Invokable method = method(VAppTemplateApi.class, "findVAppTemplateInOrgCatalogNamed", String.class, String.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of("org", "catalog", "template")); @@ -205,7 +205,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppTemplateAsyncClient.class, "getVAppTemplate", URI.class); + Invokable method = method(VAppTemplateApi.class, "getVAppTemplate", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2"))); @@ -221,7 +221,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VAppTemplateAsyncClient.class, "getOvfEnvelopeForVAppTemplate", URI.class); + Invokable method = method(VAppTemplateApi.class, "getOvfEnvelopeForVAppTemplate", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2"))); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java similarity index 85% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkClientLiveTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java index 1e91ac944e..5c3632a669 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkClientLiveTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java @@ -16,14 +16,14 @@ */ package org.jclouds.vcloud.features; -import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest; +import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest; import org.testng.annotations.Test; /** * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "NetworkClientLiveTest") -public class NetworkClientLiveTest extends BaseVCloudClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VDCApiLiveTest") +public class VDCApiLiveTest extends BaseVCloudApiLiveTest { } diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java similarity index 84% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCAsyncClientTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java index 9e0f2e5c6d..549b47c5a5 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java @@ -25,7 +25,7 @@ import java.util.NoSuchElementException; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.http.functions.ParseSax; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; +import org.jclouds.vcloud.internal.BaseVCloudApiTest; import org.jclouds.vcloud.xml.VDCHandler; import org.testng.annotations.Test; @@ -33,29 +33,29 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.reflect.Invokable; /** - * Tests behavior of {@code VDCAsyncClient} + * Tests behavior of {@code VDCApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", testName = "VDCAsyncClientTest") -public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest { +@Test(groups = "unit", testName = "VDCApiTest") +public class VDCApiTest extends BaseVCloudApiTest { @Test(expectedExceptions = NoSuchElementException.class) public void testFindVDCInOrgNamedBadVDC() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class); + Invokable method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class); processor.createRequest(method, ImmutableList. of("org", "vdc1")); } @Test(expectedExceptions = NoSuchElementException.class) public void testFindVDCInOrgNamedBadOrg() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class); + Invokable method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class); processor.createRequest(method, ImmutableList. of("org1", "vdc")); } public void testFindVDCInOrgNamedNullOrg() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class); + Invokable method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, Lists. newArrayList(null, "vdc")); assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1"); @@ -70,7 +70,7 @@ public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class); + Invokable method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, Lists. newArrayList(null, null)); assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1"); @@ -85,7 +85,7 @@ public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest method = method(VDCAsyncClient.class, "getVDC", URI.class); + Invokable method = method(VDCApi.class, "getVDC", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"))); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java similarity index 94% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmClientLiveTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java index c1e123ba17..48c0dc7131 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmClientLiveTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java @@ -27,7 +27,7 @@ import static org.testng.Assert.assertNotNull; import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.options.TemplateOptions; -import org.jclouds.vcloud.VCloudApiMetadata; +import org.jclouds.vcloud.VCloudApi; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.compute.options.VCloudTemplateOptions; import org.jclouds.vcloud.domain.Org; @@ -35,7 +35,7 @@ import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.VApp; import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.domain.Vm; -import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest; +import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest; import org.testng.annotations.Test; import com.google.common.collect.Iterables; @@ -48,8 +48,8 @@ import com.google.common.net.HostAndPort; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VmClientLiveTest") -public class VmClientLiveTest extends BaseVCloudClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VmApiLiveTest") +public class VmApiLiveTest extends BaseVCloudApiLiveTest { @Test public void testGetThumbnailOfVm() throws Exception { @@ -108,8 +108,8 @@ public class VmClientLiveTest extends BaseVCloudClientLiveTest { options.as(VCloudTemplateOptions.class).description(group); node = getOnlyElement(client.createNodesInGroup(group, 1, options)); - VApp vapp = client.getContext().unwrap(VCloudApiMetadata.CONTEXT_TOKEN).getApi().getVAppClient().getVApp( - node.getUri()); + VApp vapp = client.getContext().unwrapApi(VCloudApi.class).getVAppClient().getVApp( + node.getUri()); assertEquals(vapp.getDescription(), group); Vm vm = Iterables.get(vapp.getChildren(), 0); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiTest.java similarity index 90% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmAsyncClientTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiTest.java index 5a2ba04a45..6502d27e47 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiTest.java @@ -28,7 +28,7 @@ import org.jclouds.http.functions.ReturnInputStream; import org.jclouds.rest.internal.GeneratedHttpRequest; import org.jclouds.util.Strings2; import org.jclouds.vcloud.domain.GuestCustomizationSection; -import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest; +import org.jclouds.vcloud.internal.BaseVCloudApiTest; import org.jclouds.vcloud.utils.TestUtils; import org.jclouds.vcloud.xml.TaskHandler; import org.jclouds.vcloud.xml.VmHandler; @@ -38,17 +38,17 @@ import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; /** - * Tests behavior of {@code VmAsyncClient} + * Tests behavior of {@code VmApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", testName = "VmAsyncClientTest") -public class VmAsyncClientTest extends BaseVCloudAsyncClientTest { +@Test(groups = "unit", testName = "VmApiTest") +public class VmApiTest extends BaseVCloudApiTest { public void testGetThumbnailOfVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "getScreenThumbnailForVm", URI.class); + Invokable method = method(VmApi.class, "getScreenThumbnailForVm", URI.class); GeneratedHttpRequest request = processor .createRequest(method, ImmutableList. of(URI.create("http://vcloud.example.com/api/v1.0/vApp/vm-12"))); @@ -65,7 +65,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest @Test(dataProvider = "ignoreOnWindows", description = "see http://code.google.com/p/jclouds/issues/detail?id=402") public void testUpdateGuestConfiguration() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "updateGuestCustomizationOfVm", GuestCustomizationSection.class, + Invokable method = method(VmApi.class, "updateGuestCustomizationOfVm", GuestCustomizationSection.class, URI.class); GuestCustomizationSection guest = new GuestCustomizationSection(URI .create("http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection")); @@ -87,7 +87,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testUpdateCPUCountOfVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "updateCPUCountOfVm", int.class, URI.class); + Invokable method = method(VmApi.class, "updateCPUCountOfVm", int.class, URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(2, URI .create("http://vcloud.example.com/api/v1.0/vApp/vm-12"))); @@ -105,7 +105,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testUpdateMemoryMBOfVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "updateMemoryMBOfVm", int.class, URI.class); + Invokable method = method(VmApi.class, "updateMemoryMBOfVm", int.class, URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(512, URI .create("http://vcloud.example.com/api/v1.0/vApp/vm-12"))); @@ -123,7 +123,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testDeployVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "deployVm", URI.class); + Invokable method = method(VmApi.class, "deployVm", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -140,7 +140,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testDeployAndPowerOnVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "deployAndPowerOnVm", URI.class); + Invokable method = method(VmApi.class, "deployAndPowerOnVm", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -157,7 +157,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testGetVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "getVm", URI.class); + Invokable method = method(VmApi.class, "getVm", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vm/1"))); @@ -173,7 +173,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testRebootVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "rebootVm", URI.class); + Invokable method = method(VmApi.class, "rebootVm", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -190,7 +190,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testUndeployVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "undeployVm", URI.class); + Invokable method = method(VmApi.class, "undeployVm", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -208,7 +208,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testUndeployAndSaveStateOfVmSaveState() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "undeployAndSaveStateOfVm", URI.class); + Invokable method = method(VmApi.class, "undeployAndSaveStateOfVm", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -227,7 +227,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testPowerOnVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "powerOnVm", URI.class); + Invokable method = method(VmApi.class, "powerOnVm", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -244,7 +244,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testPowerOffVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "powerOffVm", URI.class); + Invokable method = method(VmApi.class, "powerOffVm", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -261,7 +261,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testResetVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "resetVm", URI.class); + Invokable method = method(VmApi.class, "resetVm", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -278,7 +278,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testSuspendVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "suspendVm", URI.class); + Invokable method = method(VmApi.class, "suspendVm", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); @@ -295,7 +295,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest } public void testShutdownVm() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VmAsyncClient.class, "shutdownVm", URI.class); + Invokable method = method(VmApi.class, "shutdownVm", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"))); diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java similarity index 82% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudClientLiveTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java index 9d9389d094..73880ee881 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudClientLiveTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java @@ -19,8 +19,7 @@ package org.jclouds.vcloud.internal; import org.jclouds.compute.ComputeService; import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; import org.jclouds.sshj.config.SshjSshClientModule; -import org.jclouds.vcloud.VCloudApiMetadata; -import org.jclouds.vcloud.VCloudClient; +import org.jclouds.vcloud.VCloudApi; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -31,19 +30,19 @@ import com.google.inject.Module; * @author Adrian Cole */ @Test(groups = "live", enabled = true, singleThreaded = true) -public abstract class BaseVCloudClientLiveTest extends BaseComputeServiceContextLiveTest { +public abstract class BaseVCloudApiLiveTest extends BaseComputeServiceContextLiveTest { // username is too long for name constraints protected String prefix = "vcd"; protected ComputeService client; - public BaseVCloudClientLiveTest() { + public BaseVCloudApiLiveTest() { provider = "vcloud"; } - protected VCloudClient getVCloudApi() { - return VCloudClient.class.cast(view.unwrap(VCloudApiMetadata.CONTEXT_TOKEN).getApi()); + protected VCloudApi getVCloudApi() { + return view.unwrapApi(VCloudApi.class); } @Override diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java similarity index 95% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudAsyncClientTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java index 166a2a9d33..2ac9667c5f 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java @@ -33,12 +33,12 @@ import org.jclouds.ovf.xml.EnvelopeHandlerTest; import org.jclouds.providers.AnonymousProviderMetadata; import org.jclouds.providers.ProviderMetadata; import org.jclouds.rest.AuthorizationException; -import org.jclouds.rest.ConfiguresRestClient; +import org.jclouds.rest.ConfiguresHttpApi; import org.jclouds.rest.internal.BaseAsyncClientTest; import org.jclouds.vcloud.VCloudApiMetadata; import org.jclouds.vcloud.VCloudMediaType; -import org.jclouds.vcloud.VCloudVersionsClient; -import org.jclouds.vcloud.config.VCloudRestClientModule; +import org.jclouds.vcloud.VCloudVersionsApi; +import org.jclouds.vcloud.config.VCloudHttpApiModule; import org.jclouds.vcloud.domain.AllocationModel; import org.jclouds.vcloud.domain.CatalogItem; import org.jclouds.vcloud.domain.Org; @@ -69,13 +69,13 @@ import com.google.inject.Module; import com.google.inject.TypeLiteral; /** - * Tests behavior of {@code VCloudAsyncClient} + * Tests behavior of {@code VCloudApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(groups = "unit", testName = "BaseVCloudAsyncClientTest") -public abstract class BaseVCloudAsyncClientTest extends BaseAsyncClientTest { +@Test(groups = "unit", testName = "BaseVCloudApiTest") +public abstract class BaseVCloudApiTest extends BaseAsyncClientTest { @Override protected void checkFilters(HttpRequest request) { @@ -85,7 +85,7 @@ public abstract class BaseVCloudAsyncClientTest extends BaseAsyncClientTest extends BaseAsyncClientTest of(NETWORK_REF.getName(), NETWORK_REF), 0, 0, 0, false); - @ConfiguresRestClient - public static class VCloudRestClientModuleExtension extends VCloudRestClientModule { + @ConfiguresHttpApi + public static class VCloudHttpApiModuleExtension extends VCloudHttpApiModule { @Override - protected Supplier provideAuthenticationURI(VCloudVersionsClient versionService, String version) { + protected Supplier provideAuthenticationURI(VCloudVersionsApi versionService, String version) { return Suppliers.ofInstance(URI.create("https://vcenterprise.bluelock.com/api/v1.0/login")); } @@ -163,7 +163,7 @@ public abstract class BaseVCloudAsyncClientTest extends BaseAsyncClientTest provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds, - AtomicReference authException, final VCloudLoginClient login) { + AtomicReference authException, final VCloudLoginApi login) { return Suppliers. ofInstance(new VCloudSession() { @Override diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java similarity index 87% rename from apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClientTest.java rename to apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java index 4b9cfe47db..b8eef72fb1 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java @@ -42,16 +42,16 @@ import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.Provides; /** - * Tests behavior of {@code VCloudLoginAsyncClient} + * Tests behavior of {@code VCloudLoginApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(groups = "unit", testName = "VCloudLoginAsyncClientTest") -public class VCloudLoginAsyncClientTest extends BaseAsyncClientTest { +@Test(groups = "unit", testName = "VCloudLoginApiTest") +public class VCloudLoginApiTest extends BaseAsyncClientTest { public void testLogin() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(VCloudLoginAsyncClient.class, "login"); + Invokable method = method(VCloudLoginApi.class, "login"); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of()); assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1"); @@ -90,8 +90,8 @@ public class VCloudLoginAsyncClientTest extends BaseAsyncClientTest + * + * @see + * @author Adrian Cole + */ +@RequestFilters(SetVCloudTokenCookie.class) +public interface TerremarkVCloudApi extends Closeable { + @GET + @XMLResponseParser(CatalogHandler.class) + @Consumes(CATALOG_XML) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Catalog getCatalog(@EndpointParam URI catalogId); + + /** + * returns the catalog in the organization associated with the specified + * name. Note that both parameters can be null to choose default. + * + * @param orgName + * organization name, or null for the default + * @param catalogName + * catalog name, or null for the default + * @throws NoSuchElementException + * if you specified an org or catalog name that isn't present + */ + @GET + @XMLResponseParser(CatalogHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(CATALOG_XML) + @MapBinder(OrgNameAndCatalogNameToEndpoint.class) + Catalog findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("catalogName") String catalogName); + + @GET + @Consumes(CATALOGITEM_XML) + @XMLResponseParser(CatalogItemHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + CatalogItem getCatalogItem(@EndpointParam URI catalogItem); + + /** + * returns the catalog item in the catalog associated with the specified + * name. Note that the org and catalog parameters can be null to choose + * default. + * + * @param orgName + * organization name, or null for the default + * @param catalogName + * catalog name, or null for the default + * @param itemName + * item you wish to lookup + * + * @throws NoSuchElementException + * if you specified an org, catalog, or catalog item name that + * isn't present + */ + @GET + @Consumes(CATALOGITEM_XML) + @XMLResponseParser(CatalogItemHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @MapBinder(OrgNameCatalogNameItemNameToEndpoint.class) + CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName); + + @GET + @Consumes(NETWORK_XML) + @XMLResponseParser(NetworkHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class) + Network findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String networkName); + + @GET + @Consumes(NETWORK_XML) + @XMLResponseParser(NetworkHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Network getNetwork(@EndpointParam URI network); + + /** + * returns the VDC in the organization associated with the specified name. + * Note that both parameters can be null to choose default. + * + * @param orgName + * organization name, or null for the default + * @param vdcName + * catalog name, or null for the default + * @throws NoSuchElementException + * if you specified an org or vdc name that isn't present + */ + @GET + @XMLResponseParser(VDCHandler.class) + @Consumes(VDC_XML) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @MapBinder(OrgNameAndVDCNameToEndpoint.class) + VDC findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("vdcName") String vdcName); + + @GET + @Consumes(TASKSLIST_XML) + @XMLResponseParser(TasksListHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + TasksList getTasksList(@EndpointParam URI tasksListId); + + @GET + @XMLResponseParser(TasksListHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(TASKSLIST_XML) + @MapBinder(OrgNameAndTasksListNameToEndpoint.class) + TasksList findTasksListInOrgNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("tasksListName") String tasksListName); + + /** + * Whenever the result of a request cannot be returned immediately, the + * server creates a Task object and includes it in the response, as a member + * of the Tasks container in the response body. Each Task has an href value, + * which is a URL that the client can use to retrieve the Task element alone, + * without the rest of the response in which it was contained. All + * information about the task is included in the Task element when it is + * returned in the response's Tasks container, so a client does not need to + * make an additional request to the Task URL unless it wants to follow the + * progress of a task that was incomplete. + */ + @GET + @Consumes(TASK_XML) + @XMLResponseParser(TaskHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Task getTask(@EndpointParam URI taskId); + + @POST + @Path("/action/cancel") + void cancelTask(@EndpointParam URI taskId); + + /** + * + * @return a listing of all orgs that the current user has access to. + */ + @Provides + @org.jclouds.trmk.vcloud_0_8.endpoints.Org + Map listOrgs(); + + @POST + @Path("/action/instantiateVAppTemplate") + @Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml") + @Consumes(VAPP_XML) + @XMLResponseParser(VAppHandler.class) + @MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class) + VApp instantiateVAppTemplateInVDC(@EndpointParam URI vdc, + @PayloadParam("template") URI template, + @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName, + InstantiateVAppTemplateOptions... options); + + @POST + @Path("/action/cloneVApp") + @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml") + @Consumes(TASK_XML) + @XMLResponseParser(TaskHandler.class) + @MapBinder(BindCloneVAppParamsToXmlPayload.class) + Task cloneVAppInVDC(@EndpointParam URI vdc, @PayloadParam("vApp") URI toClone, + @PayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName, CloneVAppOptions... options); + + @GET + @Consumes(VAPPTEMPLATE_XML) + @XMLResponseParser(VAppTemplateHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + VAppTemplate getVAppTemplate(@EndpointParam URI vAppTemplate); + + /** + * returns the vapp template corresponding to a catalog item in the catalog + * associated with the specified name. Note that the org and catalog + * parameters can be null to choose default. + * + * @param orgName + * organization name, or null for the default + * @param catalogName + * catalog name, or null for the default + * @param itemName + * item you wish to lookup + * + * @throws NoSuchElementException + * if you specified an org, catalog, or catalog item name that + * isn't present + */ + @GET + @Consumes(VAPPTEMPLATE_XML) + @XMLResponseParser(VAppTemplateHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class) + VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName); + + @GET + @Consumes(VAPP_XML) + @XMLResponseParser(VAppHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class) + VApp findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName); + + @GET + @Consumes(VAPP_XML) + @XMLResponseParser(VAppHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + VApp getVApp(@EndpointParam URI vApp); + + @POST + @Consumes(TASK_XML) + @Path("/action/deploy") + @XMLResponseParser(TaskHandler.class) + Task deployVApp(@EndpointParam URI vAppId); + + /** + * + */ + @POST + @Consumes(TASK_XML) + @Path("/action/undeploy") + @XMLResponseParser(TaskHandler.class) + Task undeployVApp(@EndpointParam URI vAppId); + + /** + * This call powers on the vApp, as specified in the vApp's ovf:Startup + * element. + */ + @POST + @Consumes(TASK_XML) + @Path("/power/action/powerOn") + @XMLResponseParser(TaskHandler.class) + Task powerOnVApp(@EndpointParam URI vAppId); + + /** + * This call powers off the vApp, as specified in the vApp's ovf:Startup + * element. + */ + @POST + @Consumes(TASK_XML) + @Path("/power/action/powerOff") + @XMLResponseParser(TaskHandler.class) + Task powerOffVApp(@EndpointParam URI vAppId); + + /** + * This call shuts down the vApp. + */ + @POST + @Path("/power/action/shutdown") + void shutdownVApp(@EndpointParam URI vAppId); + + /** + * This call resets the vApp. + */ + @POST + @Consumes(TASK_XML) + @Path("/power/action/reset") + @XMLResponseParser(TaskHandler.class) + Task resetVApp(@EndpointParam URI vAppId); + + /** + * This call suspends the vApp. + */ + @POST + @Consumes(TASK_XML) + @Path("/power/action/suspend") + @XMLResponseParser(TaskHandler.class) + Task suspendVApp(@EndpointParam URI vAppId); + + @DELETE + @ResponseParser(ParseTaskFromLocationHeader.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Task deleteVApp(@EndpointParam URI vAppId); + + /** + * {@inheritDoc} + */ + @GET + @XMLResponseParser(VDCHandler.class) + @Consumes(VDC_XML) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + VDC getVDC(@EndpointParam URI vdc); + + @GET + @XMLResponseParser(OrgHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(ORG_XML) + org.jclouds.trmk.vcloud_0_8.domain.Org getOrg(@EndpointParam URI orgId); + + @GET + @XMLResponseParser(OrgHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(ORG_XML) + org.jclouds.trmk.vcloud_0_8.domain.Org findOrgNamed( + @Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName); + + @GET + @XMLResponseParser(CustomizationParametersHandler.class) + @Consumes(CATALOGITEMCUSTOMIZATIONPARAMETERS_XML) + CustomizationParameters getCustomizationOptions(@EndpointParam URI customization); + + /** + * This call returns a list of public IP addresses. + */ + @GET + @Consumes(PUBLICIPSLIST_XML) + @XMLResponseParser(PublicIpAddressesHandler.class) + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + Set getPublicIpsAssociatedWithVDC( + @EndpointParam(parser = VDCURIToPublicIPsEndpoint.class) URI vDCId); + + @DELETE + @Fallback(TerremarkVCloudFallbacks.VoidOnDeleteDefaultIp.class) + void deletePublicIp(@EndpointParam URI ipId); + + /** + * This call adds an internet service to a known, existing public IP. This + * call is identical to Add Internet Service except you specify the public IP + * in the request. + * + */ + @POST + @Path("/internetServices") + @Produces(INTERNETSERVICE_XML) + @Consumes(INTERNETSERVICE_XML) + @XMLResponseParser(InternetServiceHandler.class) + @MapBinder(AddInternetServiceOptions.class) + InternetService addInternetServiceToExistingIp(@EndpointParam URI publicIpId, + @PayloadParam("name") String serviceName, @PayloadParam("protocol") Protocol protocol, + @PayloadParam("port") int port, AddInternetServiceOptions... options); + + @DELETE + @Fallback(Fallbacks.VoidOnNotFoundOr404.class) + void deleteInternetService(@EndpointParam URI internetServiceId); + + @GET + @Consumes(INTERNETSERVICESLIST_XML) + @XMLResponseParser(InternetServiceHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + InternetService getInternetService(@EndpointParam URI internetServiceId); + + @GET + @Consumes(INTERNETSERVICESLIST_XML) + @XMLResponseParser(InternetServicesHandler.class) + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + Set getAllInternetServicesInVDC( + @EndpointParam(parser = VDCURIToInternetServicesEndpoint.class) URI vDCId); + + /** + * This call returns information about the internet service on a public IP. + */ + @GET + @Path("/internetServices") + @Consumes(INTERNETSERVICESLIST_XML) + @XMLResponseParser(InternetServicesHandler.class) + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + Set getInternetServicesOnPublicIp(@EndpointParam URI ipId); + + @GET + @Consumes(PUBLICIP_XML) + @XMLResponseParser(InternetServicesHandler.class) + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + Set getPublicIp(@EndpointParam URI ipId); + + /** + * This call adds a node to an existing internet service. + *

+ * Every vDC is assigned a network of 60 IP addresses that can be used as + * nodes. Each node can associated with multiple internet service. You can + * get a list of the available IP addresses by calling Get IP Addresses for a + * Network. + * + * @param internetServiceId + * @param ipAddress + * @param name + * @param port + * @param options + * @return + */ + @POST + @Path("/nodeServices") + @Produces(NODESERVICE_XML) + @Consumes(NODESERVICE_XML) + @XMLResponseParser(NodeHandler.class) + @MapBinder(AddNodeOptions.class) + Node addNode(@EndpointParam URI internetServiceId, + @PayloadParam("ipAddress") String ipAddress, @PayloadParam("name") String name, + @PayloadParam("port") int port, AddNodeOptions... options); + + @GET + @XMLResponseParser(NodeHandler.class) + @Consumes(NODESERVICE_XML) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Node getNode(@EndpointParam URI nodeId); + + @PUT + @Produces(NODESERVICE_XML) + @Consumes(NODESERVICE_XML) + @XMLResponseParser(NodeHandler.class) + @MapBinder(BindNodeConfigurationToXmlPayload.class) + Node configureNode(@EndpointParam URI nodeId, @PayloadParam("name") String name, + @PayloadParam("enabled") boolean enabled, @Nullable @PayloadParam("description") String description); + + @DELETE + @Fallback(Fallbacks.VoidOnNotFoundOr404.class) + void deleteNode(@EndpointParam URI nodeId); + + @GET + @Path("/nodeServices") + @XMLResponseParser(NodesHandler.class) + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + @Consumes(NODESERVICE_XML) + Set getNodes(@EndpointParam URI internetServiceId); + + /** + * This call configures the settings of an existing vApp by passing the new + * configuration. The existing vApp must be in a powered off state (status = + * 2). + *

+ * You can change the following items for a vApp. + *

    + *
  1. vApp name Number of virtual CPUs
  2. + *
  3. Amount of virtual memory
  4. + *
  5. Add a virtual disk
  6. + *
  7. Delete a virtual disk
  8. + *
+ * You can make more than one change in a single request. For example, you + * can increase the number of virtual CPUs and the amount of virtual memory + * in the same request. + * + * @param VApp + * vApp to change in power state off + * @param configuration + * (s) to change + * @return task of configuration change + */ + @PUT + @Produces(VAPP_XML) + @Consumes(VAPP_XML) + @MapBinder(BindVAppConfigurationToXmlPayload.class) + @ResponseParser(ParseTaskFromLocationHeader.class) + Task configureVApp( + @EndpointParam(parser = BindVAppConfigurationToXmlPayload.class) VApp vApp, VAppConfiguration configuration); + + /** + */ + Set listKeyPairsInOrg(URI org); + + /** + * @throws IllegalStateException + * if a key of the same name already exists + */ + KeyPair generateKeyPairInOrg(URI org, String name, boolean makeDefault); + + /** + */ + KeyPair findKeyPairInOrg(URI org, String keyPairName); + + KeyPair getKeyPair(URI keyPair); + + // TODO + // KeyPair configureKeyPair(int keyPairId, KeyPairConfiguration + // keyPairConfiguration); + + void deleteKeyPair(URI keyPair); + +} diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudAsyncClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudAsyncClient.java deleted file mode 100644 index 4f4555c919..0000000000 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudAsyncClient.java +++ /dev/null @@ -1,547 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.trmk.vcloud_0_8; - -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.CATALOGITEMCUSTOMIZATIONPARAMETERS_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.CATALOGITEM_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.CATALOG_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.INTERNETSERVICESLIST_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.INTERNETSERVICE_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.NETWORK_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.NODESERVICE_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.ORG_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.PUBLICIPSLIST_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.PUBLICIP_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.TASKSLIST_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.TASK_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VAPPTEMPLATE_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VAPP_XML; -import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VDC_XML; - -import java.io.Closeable; -import java.net.URI; -import java.util.Map; -import java.util.Set; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; - -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.predicates.validators.DnsNameValidator; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.ParamValidators; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudFallbacks.VoidOnDeleteDefaultIp; -import org.jclouds.trmk.vcloud_0_8.binders.BindCloneVAppParamsToXmlPayload; -import org.jclouds.trmk.vcloud_0_8.binders.BindInstantiateVAppTemplateParamsToXmlPayload; -import org.jclouds.trmk.vcloud_0_8.binders.BindNodeConfigurationToXmlPayload; -import org.jclouds.trmk.vcloud_0_8.binders.BindVAppConfigurationToXmlPayload; -import org.jclouds.trmk.vcloud_0_8.binders.OrgNameAndCatalogNameToEndpoint; -import org.jclouds.trmk.vcloud_0_8.binders.OrgNameAndTasksListNameToEndpoint; -import org.jclouds.trmk.vcloud_0_8.binders.OrgNameAndVDCNameToEndpoint; -import org.jclouds.trmk.vcloud_0_8.binders.OrgNameCatalogNameItemNameToEndpoint; -import org.jclouds.trmk.vcloud_0_8.binders.OrgNameCatalogNameVAppTemplateNameToEndpoint; -import org.jclouds.trmk.vcloud_0_8.binders.OrgNameVDCNameResourceEntityNameToEndpoint; -import org.jclouds.trmk.vcloud_0_8.domain.Catalog; -import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem; -import org.jclouds.trmk.vcloud_0_8.domain.CustomizationParameters; -import org.jclouds.trmk.vcloud_0_8.domain.InternetService; -import org.jclouds.trmk.vcloud_0_8.domain.Network; -import org.jclouds.trmk.vcloud_0_8.domain.Node; -import org.jclouds.trmk.vcloud_0_8.domain.Protocol; -import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress; -import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; -import org.jclouds.trmk.vcloud_0_8.domain.Task; -import org.jclouds.trmk.vcloud_0_8.domain.TasksList; -import org.jclouds.trmk.vcloud_0_8.domain.VApp; -import org.jclouds.trmk.vcloud_0_8.domain.VAppConfiguration; -import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate; -import org.jclouds.trmk.vcloud_0_8.domain.VDC; -import org.jclouds.trmk.vcloud_0_8.endpoints.Org; -import org.jclouds.trmk.vcloud_0_8.filters.SetVCloudTokenCookie; -import org.jclouds.trmk.vcloud_0_8.functions.OrgNameToEndpoint; -import org.jclouds.trmk.vcloud_0_8.functions.ParseTaskFromLocationHeader; -import org.jclouds.trmk.vcloud_0_8.functions.VDCURIToInternetServicesEndpoint; -import org.jclouds.trmk.vcloud_0_8.functions.VDCURIToPublicIPsEndpoint; -import org.jclouds.trmk.vcloud_0_8.options.AddInternetServiceOptions; -import org.jclouds.trmk.vcloud_0_8.options.AddNodeOptions; -import org.jclouds.trmk.vcloud_0_8.options.CloneVAppOptions; -import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions; -import org.jclouds.trmk.vcloud_0_8.xml.CatalogHandler; -import org.jclouds.trmk.vcloud_0_8.xml.CatalogItemHandler; -import org.jclouds.trmk.vcloud_0_8.xml.CustomizationParametersHandler; -import org.jclouds.trmk.vcloud_0_8.xml.InternetServiceHandler; -import org.jclouds.trmk.vcloud_0_8.xml.InternetServicesHandler; -import org.jclouds.trmk.vcloud_0_8.xml.NetworkHandler; -import org.jclouds.trmk.vcloud_0_8.xml.NodeHandler; -import org.jclouds.trmk.vcloud_0_8.xml.NodesHandler; -import org.jclouds.trmk.vcloud_0_8.xml.OrgHandler; -import org.jclouds.trmk.vcloud_0_8.xml.PublicIpAddressesHandler; -import org.jclouds.trmk.vcloud_0_8.xml.TaskHandler; -import org.jclouds.trmk.vcloud_0_8.xml.TasksListHandler; -import org.jclouds.trmk.vcloud_0_8.xml.VAppHandler; -import org.jclouds.trmk.vcloud_0_8.xml.VAppTemplateHandler; -import org.jclouds.trmk.vcloud_0_8.xml.VDCHandler; - -import com.google.common.util.concurrent.ListenableFuture; -import com.google.inject.Provides; - -/** - * Provides access to VCloud resources via their REST API. - *

- * - * @see - * @author Adrian Cole - */ -@RequestFilters(SetVCloudTokenCookie.class) -public interface TerremarkVCloudAsyncClient extends Closeable { - - /** - * @see TerremarkVCloudClient#getCatalogItemInOrg - */ - @GET - @Consumes(CATALOGITEM_XML) - @XMLResponseParser(CatalogItemHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @MapBinder(OrgNameCatalogNameItemNameToEndpoint.class) - ListenableFuture findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName); - - /** - * @see TerremarkVCloudClient#getCatalogItem - */ - @GET - @Consumes(CATALOGITEM_XML) - @XMLResponseParser(CatalogItemHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getCatalogItem(@EndpointParam URI catalogItem); - - /** - * @see TerremarkVCloudClient#getTasksList - */ - @GET - @Consumes(TASKSLIST_XML) - @XMLResponseParser(TasksListHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getTasksList(@EndpointParam URI tasksListId); - - /** - * @see TerremarkVCloudClient#findTasksListInOrgNamed - */ - @GET - @XMLResponseParser(TasksListHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @Consumes(TASKSLIST_XML) - @MapBinder(OrgNameAndTasksListNameToEndpoint.class) - ListenableFuture findTasksListInOrgNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("tasksListName") String tasksListName); - - /** - * @see TerremarkVCloudClient#getTask - */ - @GET - @Consumes(TASK_XML) - @XMLResponseParser(TaskHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getTask(@EndpointParam URI taskId); - - /** - * @see TerremarkVCloudClient#cancelTask - */ - @POST - @Path("/action/cancel") - ListenableFuture cancelTask(@EndpointParam URI taskId); - - /** - * - * @return a listing of all orgs that the current user has access to. - */ - @Provides - @Org - Map listOrgs(); - - /** - * @see TerremarkVCloudClient#findCatalogInOrgNamed - */ - @GET - @XMLResponseParser(CatalogHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @Consumes(CATALOG_XML) - @MapBinder(OrgNameAndCatalogNameToEndpoint.class) - ListenableFuture findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("catalogName") String catalogName); - - /** - * @see VCloudClient#getVAppTemplate - */ - @GET - @Consumes(VAPPTEMPLATE_XML) - @XMLResponseParser(VAppTemplateHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getVAppTemplate(@EndpointParam URI vAppTemplate); - - /** - * @see VCloudClient#findVAppTemplateInOrgCatalogNamed - */ - @GET - @Consumes(VAPPTEMPLATE_XML) - @XMLResponseParser(VAppTemplateHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class) - ListenableFuture findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName); - - /** - * @see VCloudClient#findNetworkInOrgVDCNamed - */ - @GET - @Consumes(NETWORK_XML) - @XMLResponseParser(NetworkHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class) - ListenableFuture findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String networkName); - - /** - * @see VCloudClient#getNetwork - */ - @GET - @Consumes(NETWORK_XML) - @XMLResponseParser(NetworkHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getNetwork(@EndpointParam URI network); - - /** - * @see TerremarkVCloudClient#cloneVAppInVDC - */ - @POST - @Path("/action/cloneVApp") - @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml") - @Consumes(TASK_XML) - @XMLResponseParser(TaskHandler.class) - @MapBinder(BindCloneVAppParamsToXmlPayload.class) - ListenableFuture cloneVAppInVDC(@EndpointParam URI vdc, @PayloadParam("vApp") URI toClone, - @PayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName, CloneVAppOptions... options); - - /** - * @see VCloudClient#findVAppInOrgVDCNamed - */ - @GET - @Consumes(VAPP_XML) - @XMLResponseParser(VAppHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class) - ListenableFuture findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName); - - /** - * @see VCloudClient#getVApp - */ - @GET - @Consumes(VAPP_XML) - @XMLResponseParser(VAppHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getVApp(@EndpointParam URI vApp); - - /** - * @see TerremarkVCloudClient#deployVApp - */ - @POST - @Consumes(TASK_XML) - @Path("/action/deploy") - @XMLResponseParser(TaskHandler.class) - ListenableFuture deployVApp(@EndpointParam URI vAppId); - - /** - * @see TerremarkVCloudClient#undeployVApp - */ - @POST - @Consumes(TASK_XML) - @Path("/action/undeploy") - @XMLResponseParser(TaskHandler.class) - ListenableFuture undeployVApp(@EndpointParam URI vAppId); - - /** - * @see TerremarkVCloudClient#powerOnVApp - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/powerOn") - @XMLResponseParser(TaskHandler.class) - ListenableFuture powerOnVApp(@EndpointParam URI vAppId); - - /** - * @see TerremarkVCloudClient#powerOffVApp - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/powerOff") - @XMLResponseParser(TaskHandler.class) - ListenableFuture powerOffVApp(@EndpointParam URI vAppId); - - /** - * @see TerremarkVCloudClient#shutdownVApp - */ - @POST - @Path("/power/action/shutdown") - ListenableFuture shutdownVApp(@EndpointParam URI vAppId); - - /** - * @see TerremarkVCloudClient#resetVApp - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/reset") - @XMLResponseParser(TaskHandler.class) - ListenableFuture resetVApp(@EndpointParam URI vAppId); - - /** - * @see TerremarkVCloudClient#suspendVApp - */ - @POST - @Consumes(TASK_XML) - @Path("/power/action/suspend") - @XMLResponseParser(TaskHandler.class) - ListenableFuture suspendVApp(@EndpointParam URI vAppId); - - /** - * @see TerremarkVCloudClient#deleteVApp - */ - @DELETE - @ResponseParser(ParseTaskFromLocationHeader.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture deleteVApp(@EndpointParam URI vAppId); - - @GET - @XMLResponseParser(OrgHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @Consumes(ORG_XML) - ListenableFuture getOrg(@EndpointParam URI orgId); - - /** - * @see TerremarkVCloudClient#findOrgNamed - */ - @GET - @XMLResponseParser(OrgHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @Consumes(ORG_XML) - ListenableFuture findOrgNamed( - @Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName); - - /** - * Terremark does not have multiple catalogs, so we ignore this parameter. - */ - @GET - @XMLResponseParser(CatalogHandler.class) - @Consumes(CATALOG_XML) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getCatalog(@EndpointParam URI catalogId); - - /** - * @see TerremarkTerremarkVCloudClient#getVDC - */ - @GET - @XMLResponseParser(VDCHandler.class) - @Consumes(VDC_XML) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getVDC(@EndpointParam URI vdc); - - /** - * @see TerremarkVCloudClient#findVDCInOrgNamed - */ - @GET - @XMLResponseParser(VDCHandler.class) - @Consumes(VDC_XML) - @Fallback(NullOnNotFoundOr404.class) - @MapBinder(OrgNameAndVDCNameToEndpoint.class) - ListenableFuture findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("vdcName") String vdcName); - - /** - * @see TerremarkVCloudClient#instantiateVAppTemplateInVDC - */ - @POST - @Path("/action/instantiateVAppTemplate") - @Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml") - @Consumes(VAPP_XML) - @XMLResponseParser(VAppHandler.class) - @MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class) - ListenableFuture instantiateVAppTemplateInVDC(@EndpointParam URI vdc, - @PayloadParam("template") URI template, - @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName, - InstantiateVAppTemplateOptions... options); - - /** - * @see TerremarkTerremarkVCloudClient#getAllInternetServicesInVDC - */ - @GET - @Consumes(INTERNETSERVICESLIST_XML) - @XMLResponseParser(InternetServicesHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> getAllInternetServicesInVDC( - @EndpointParam(parser = VDCURIToInternetServicesEndpoint.class) URI vDCId); - - /** - * @see TerremarkTerremarkVCloudClient#addInternetServiceToExistingIp - */ - @POST - @Path("/internetServices") - @Produces(INTERNETSERVICE_XML) - @Consumes(INTERNETSERVICE_XML) - @XMLResponseParser(InternetServiceHandler.class) - @MapBinder(AddInternetServiceOptions.class) - ListenableFuture addInternetServiceToExistingIp(@EndpointParam URI publicIpId, - @PayloadParam("name") String serviceName, @PayloadParam("protocol") Protocol protocol, - @PayloadParam("port") int port, AddInternetServiceOptions... options); - - /** - * @see TerremarkTerremarkVCloudClient#deletePublicIp - */ - @DELETE - @Fallback(VoidOnDeleteDefaultIp.class) - ListenableFuture deletePublicIp(@EndpointParam URI ipId); - - /** - * @see TerremarkTerremarkVCloudClient#getInternetServicesOnPublicIP - */ - @GET - @Path("/internetServices") - @Consumes(INTERNETSERVICESLIST_XML) - @XMLResponseParser(InternetServicesHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> getInternetServicesOnPublicIp(@EndpointParam URI ipId); - - /** - * @see TerremarkTerremarkVCloudClient#getPublicIp - */ - @GET - @Consumes(PUBLICIP_XML) - @XMLResponseParser(InternetServicesHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> getPublicIp(@EndpointParam URI ipId); - - /** - * @see TerremarkTerremarkVCloudClient#getPublicIpsAssociatedWithVDC - */ - @GET - @Consumes(PUBLICIPSLIST_XML) - @XMLResponseParser(PublicIpAddressesHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> getPublicIpsAssociatedWithVDC( - @EndpointParam(parser = VDCURIToPublicIPsEndpoint.class) URI vDCId); - - /** - * @see TerremarkTerremarkVCloudClient#deleteInternetService - */ - @DELETE - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture deleteInternetService(@EndpointParam URI internetServiceId); - - /** - * @see TerremarkTerremarkVCloudClient#getInternetService - */ - @GET - @Consumes(INTERNETSERVICESLIST_XML) - @XMLResponseParser(InternetServiceHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getInternetService(@EndpointParam URI internetServiceId); - - /** - * @see TerremarkTerremarkVCloudClient#addNode - */ - @POST - @Path("/nodeServices") - @Produces(NODESERVICE_XML) - @Consumes(NODESERVICE_XML) - @XMLResponseParser(NodeHandler.class) - @MapBinder(AddNodeOptions.class) - ListenableFuture addNode(@EndpointParam URI internetServiceId, - @PayloadParam("ipAddress") String ipAddress, @PayloadParam("name") String name, - @PayloadParam("port") int port, AddNodeOptions... options); - - /** - * @see TerremarkTerremarkVCloudClient#getNodes - */ - @GET - @Path("/nodeServices") - @XMLResponseParser(NodesHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - @Consumes(NODESERVICE_XML) - ListenableFuture> getNodes(@EndpointParam URI internetServiceId); - - /** - * @see TerremarkTerremarkVCloudClient#getNode - */ - @GET - @XMLResponseParser(NodeHandler.class) - @Consumes(NODESERVICE_XML) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getNode(@EndpointParam URI nodeId); - - /** - * @see TerremarkTerremarkVCloudClient#configureNode - */ - @PUT - @Produces(NODESERVICE_XML) - @Consumes(NODESERVICE_XML) - @XMLResponseParser(NodeHandler.class) - @MapBinder(BindNodeConfigurationToXmlPayload.class) - ListenableFuture configureNode(@EndpointParam URI nodeId, @PayloadParam("name") String name, - @PayloadParam("enabled") boolean enabled, @Nullable @PayloadParam("description") String description); - - /** - * @see TerremarkTerremarkVCloudClient#deleteNode - */ - @DELETE - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture deleteNode(@EndpointParam URI nodeId); - - /** - * @see TerremarkTerremarkVCloudClient#configureVApp - */ - @PUT - @Produces(VAPP_XML) - @Consumes(VAPP_XML) - @MapBinder(BindVAppConfigurationToXmlPayload.class) - @ResponseParser(ParseTaskFromLocationHeader.class) - ListenableFuture configureVApp( - @EndpointParam(parser = BindVAppConfigurationToXmlPayload.class) VApp vApp, VAppConfiguration configuration); - - /** - * @see TerremarkVCloudClient#getCustomizationOptions - */ - @GET - @XMLResponseParser(CustomizationParametersHandler.class) - @Consumes(CATALOGITEMCUSTOMIZATIONPARAMETERS_XML) - ListenableFuture getCustomizationOptions(@EndpointParam URI customization); - -} diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudClient.java deleted file mode 100644 index 75f44f01ef..0000000000 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudClient.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.trmk.vcloud_0_8; - -import java.io.Closeable; -import java.net.URI; -import java.util.Map; -import java.util.Set; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.trmk.vcloud_0_8.domain.Catalog; -import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem; -import org.jclouds.trmk.vcloud_0_8.domain.CustomizationParameters; -import org.jclouds.trmk.vcloud_0_8.domain.InternetService; -import org.jclouds.trmk.vcloud_0_8.domain.KeyPair; -import org.jclouds.trmk.vcloud_0_8.domain.Network; -import org.jclouds.trmk.vcloud_0_8.domain.Node; -import org.jclouds.trmk.vcloud_0_8.domain.Org; -import org.jclouds.trmk.vcloud_0_8.domain.Protocol; -import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress; -import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; -import org.jclouds.trmk.vcloud_0_8.domain.Task; -import org.jclouds.trmk.vcloud_0_8.domain.TasksList; -import org.jclouds.trmk.vcloud_0_8.domain.VApp; -import org.jclouds.trmk.vcloud_0_8.domain.VAppConfiguration; -import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate; -import org.jclouds.trmk.vcloud_0_8.domain.VDC; -import org.jclouds.trmk.vcloud_0_8.options.AddInternetServiceOptions; -import org.jclouds.trmk.vcloud_0_8.options.AddNodeOptions; -import org.jclouds.trmk.vcloud_0_8.options.CloneVAppOptions; -import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions; - -import com.google.inject.Provides; - -/** - * Provides access to VCloud resources via their REST API. - *

- * - * @see - * @author Adrian Cole - */ -public interface TerremarkVCloudClient extends Closeable { - Catalog getCatalog(URI catalogId); - - /** - * returns the catalog in the organization associated with the specified - * name. Note that both parameters can be null to choose default. - * - * @param orgName - * organization name, or null for the default - * @param catalogName - * catalog name, or null for the default - * @throws NoSuchElementException - * if you specified an org or catalog name that isn't present - */ - Catalog findCatalogInOrgNamed(@Nullable String orgName, @Nullable String catalogName); - - CatalogItem getCatalogItem(URI catalogItem); - - /** - * returns the catalog item in the catalog associated with the specified - * name. Note that the org and catalog parameters can be null to choose - * default. - * - * @param orgName - * organization name, or null for the default - * @param catalogName - * catalog name, or null for the default - * @param itemName - * item you wish to lookup - * - * @throws NoSuchElementException - * if you specified an org, catalog, or catalog item name that - * isn't present - */ - CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName, String itemName); - - Network findNetworkInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String networkName); - - Network getNetwork(URI network); - - /** - * returns the VDC in the organization associated with the specified name. - * Note that both parameters can be null to choose default. - * - * @param orgName - * organization name, or null for the default - * @param vdcName - * catalog name, or null for the default - * @throws NoSuchElementException - * if you specified an org or vdc name that isn't present - */ - VDC findVDCInOrgNamed(String orgName, String vdcName); - - TasksList getTasksList(URI tasksListId); - - TasksList findTasksListInOrgNamed(String orgName, String tasksListName); - - /** - * Whenever the result of a request cannot be returned immediately, the - * server creates a Task object and includes it in the response, as a member - * of the Tasks container in the response body. Each Task has an href value, - * which is a URL that the client can use to retrieve the Task element alone, - * without the rest of the response in which it was contained. All - * information about the task is included in the Task element when it is - * returned in the response's Tasks container, so a client does not need to - * make an additional request to the Task URL unless it wants to follow the - * progress of a task that was incomplete. - */ - Task getTask(URI taskId); - - void cancelTask(URI taskId); - - /** - * - * @return a listing of all orgs that the current user has access to. - */ - @Provides - @org.jclouds.trmk.vcloud_0_8.endpoints.Org - Map listOrgs(); - - VApp instantiateVAppTemplateInVDC(URI vDC, URI template, String appName, InstantiateVAppTemplateOptions... options); - - Task cloneVAppInVDC(URI vDC, URI toClone, String newName, CloneVAppOptions... options); - - VAppTemplate getVAppTemplate(URI vAppTemplate); - - /** - * returns the vapp template corresponding to a catalog item in the catalog - * associated with the specified name. Note that the org and catalog - * parameters can be null to choose default. - * - * @param orgName - * organization name, or null for the default - * @param catalogName - * catalog name, or null for the default - * @param itemName - * item you wish to lookup - * - * @throws NoSuchElementException - * if you specified an org, catalog, or catalog item name that - * isn't present - */ - VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName, - String itemName); - - VApp findVAppInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String vAppName); - - VApp getVApp(URI vApp); - - Task deployVApp(URI vAppId); - - /** - * - */ - Task undeployVApp(URI vAppId); - - /** - * This call powers on the vApp, as specified in the vApp's ovf:Startup - * element. - */ - Task powerOnVApp(URI vAppId); - - /** - * This call powers off the vApp, as specified in the vApp's ovf:Startup - * element. - */ - Task powerOffVApp(URI vAppId); - - /** - * This call shuts down the vApp. - */ - void shutdownVApp(URI vAppId); - - /** - * This call resets the vApp. - */ - Task resetVApp(URI vAppId); - - /** - * This call suspends the vApp. - */ - Task suspendVApp(URI vAppId); - - Task deleteVApp(URI vAppId); - - /** - * {@inheritDoc} - */ - VDC getVDC(URI catalogItem); - - Org getOrg(URI orgId); - - Org findOrgNamed(String orgName); - - CustomizationParameters getCustomizationOptions(URI customizationOptions); - - /** - * This call returns a list of public IP addresses. - */ - Set getPublicIpsAssociatedWithVDC(URI vDCId); - - void deletePublicIp(URI ipId); - - /** - * This call adds an internet service to a known, existing public IP. This - * call is identical to Add Internet Service except you specify the public IP - * in the request. - * - */ - InternetService addInternetServiceToExistingIp(URI existingIpId, String serviceName, Protocol protocol, int port, - AddInternetServiceOptions... options); - - void deleteInternetService(URI internetServiceId); - - InternetService getInternetService(URI internetServiceId); - - Set getAllInternetServicesInVDC(URI vDCId); - - /** - * This call returns information about the internet service on a public IP. - */ - Set getInternetServicesOnPublicIp(URI ipId); - - Set getPublicIp(URI ipId); - - /** - * This call adds a node to an existing internet service. - *

- * Every vDC is assigned a network of 60 IP addresses that can be used as - * nodes. Each node can associated with multiple internet service. You can - * get a list of the available IP addresses by calling Get IP Addresses for a - * Network. - * - * @param internetServiceId - * @param ipAddress - * @param name - * @param port - * @param options - * @return - */ - Node addNode(URI internetServiceId, String ipAddress, String name, int port, AddNodeOptions... options); - - Node getNode(URI nodeId); - - Node configureNode(URI nodeId, String name, boolean enabled, @Nullable String description); - - void deleteNode(URI nodeId); - - Set getNodes(URI internetServiceId); - - /** - * This call configures the settings of an existing vApp by passing the new - * configuration. The existing vApp must be in a powered off state (status = - * 2). - *

- * You can change the following items for a vApp. - *

    - *
  1. vApp name Number of virtual CPUs
  2. - *
  3. Amount of virtual memory
  4. - *
  5. Add a virtual disk
  6. - *
  7. Delete a virtual disk
  8. - *
- * You can make more than one change in a single request. For example, you - * can increase the number of virtual CPUs and the amount of virtual memory - * in the same request. - * - * @param VApp - * vApp to change in power state off - * @param configuration - * (s) to change - * @return task of configuration change - */ - Task configureVApp(VApp vApp, VAppConfiguration configuration); - - /** - */ - Set listKeyPairsInOrg(URI org); - - /** - * @throws IllegalStateException - * if a key of the same name already exists - */ - KeyPair generateKeyPairInOrg(URI org, String name, boolean makeDefault); - - /** - */ - KeyPair findKeyPairInOrg(URI org, String keyPairName); - - KeyPair getKeyPair(URI keyPair); - - // TODO - // KeyPair configureKeyPair(int keyPairId, KeyPairConfiguration - // keyPairConfiguration); - - void deleteKeyPair(URI keyPair); - -} diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeClient.java index dc8af6c734..3d21a7f1f2 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeClient.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/TerremarkVCloudComputeClient.java @@ -40,7 +40,7 @@ import org.jclouds.domain.Credentials; import org.jclouds.domain.LoginCredentials; import org.jclouds.javax.annotation.Nullable; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.domain.InternetService; import org.jclouds.trmk.vcloud_0_8.domain.Node; import org.jclouds.trmk.vcloud_0_8.domain.Protocol; @@ -67,14 +67,14 @@ public class TerremarkVCloudComputeClient { @Named(ComputeServiceConstants.COMPUTE_LOGGER) protected Logger logger = Logger.NULL; - protected final TerremarkVCloudClient client; + protected final TerremarkVCloudApi client; protected final Provider passwordGenerator; protected final InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier; protected final Map vAppStatusToNodeStatus; protected final Predicate taskTester; @Inject - protected TerremarkVCloudComputeClient(TerremarkVCloudClient client, + protected TerremarkVCloudComputeClient(TerremarkVCloudApi client, @Named("PASSWORD") Provider passwordGenerator, Predicate successTester, Map vAppStatusToNodeStatus, Map credentialStore, InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier) { diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/CreateUniqueKeyPair.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/CreateUniqueKeyPair.java index b1a67ac1ba..aab12b4b73 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/CreateUniqueKeyPair.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/CreateUniqueKeyPair.java @@ -28,7 +28,7 @@ import javax.inject.Singleton; import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.http.HttpResponseException; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName; import org.jclouds.trmk.vcloud_0_8.domain.KeyPair; import org.jclouds.util.Throwables2; @@ -45,11 +45,11 @@ public class CreateUniqueKeyPair implements Function { @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER) protected Logger logger = Logger.NULL; - protected final TerremarkVCloudClient trmkClient; + protected final TerremarkVCloudApi trmkClient; protected Supplier randomSuffix; @Inject - CreateUniqueKeyPair(TerremarkVCloudClient trmkClient, Supplier randomSuffix) { + CreateUniqueKeyPair(TerremarkVCloudApi trmkClient, Supplier randomSuffix) { this.trmkClient = trmkClient; this.randomSuffix = randomSuffix; } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/NodeMetadataToOrgAndName.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/NodeMetadataToOrgAndName.java index d950a168bf..95840b88d8 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/NodeMetadataToOrgAndName.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/functions/NodeMetadataToOrgAndName.java @@ -26,7 +26,7 @@ import javax.inject.Singleton; import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName; import org.jclouds.trmk.vcloud_0_8.domain.Org; import org.jclouds.trmk.vcloud_0_8.endpoints.VDC; @@ -48,10 +48,10 @@ public class NodeMetadataToOrgAndName implements Function> vdcToOrg; - private final TerremarkVCloudClient client; + private final TerremarkVCloudApi client; @Inject - NodeMetadataToOrgAndName(TerremarkVCloudClient client, @VDC Supplier> vdcToOrg) { + NodeMetadataToOrgAndName(TerremarkVCloudApi client, @VDC Supplier> vdcToOrg) { this.vdcToOrg = vdcToOrg; this.client = client; } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/DeleteKeyPair.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/DeleteKeyPair.java index db6154899c..43dcd555a2 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/DeleteKeyPair.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/DeleteKeyPair.java @@ -26,7 +26,7 @@ import javax.inject.Singleton; import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.domain.Credentials; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName; import org.jclouds.trmk.vcloud_0_8.domain.KeyPair; @@ -41,11 +41,11 @@ public class DeleteKeyPair { @Named(ComputeServiceConstants.COMPUTE_LOGGER) protected Logger logger = Logger.NULL; - final TerremarkVCloudClient terremarkClient; + final TerremarkVCloudApi terremarkClient; final Map credentialStore; @Inject - DeleteKeyPair(TerremarkVCloudClient terremarkClient, Map credentialStore) { + DeleteKeyPair(TerremarkVCloudApi terremarkClient, Map credentialStore) { this.terremarkClient = terremarkClient; this.credentialStore = credentialStore; } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetImageStrategy.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetImageStrategy.java index 0e8019a9b5..498866d0e6 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetImageStrategy.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetImageStrategy.java @@ -25,7 +25,7 @@ import javax.inject.Singleton; import org.jclouds.compute.domain.Image; import org.jclouds.compute.strategy.GetImageStrategy; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate; import com.google.common.base.Function; @@ -36,11 +36,11 @@ import com.google.common.base.Function; @Singleton public class TerremarkVCloudGetImageStrategy implements GetImageStrategy { - protected final TerremarkVCloudClient client; + protected final TerremarkVCloudApi client; protected final Function vAppToImage; @Inject - protected TerremarkVCloudGetImageStrategy(TerremarkVCloudClient client, Function vAppToImage) { + protected TerremarkVCloudGetImageStrategy(TerremarkVCloudApi client, Function vAppToImage) { this.client = checkNotNull(client, "client"); this.vAppToImage = vAppToImage; } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetNodeMetadataStrategy.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetNodeMetadataStrategy.java index 5c72cbed98..ec2098359c 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetNodeMetadataStrategy.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudGetNodeMetadataStrategy.java @@ -25,7 +25,7 @@ import javax.inject.Singleton; import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.strategy.GetNodeMetadataStrategy; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.domain.VApp; import com.google.common.base.Function; @@ -36,11 +36,11 @@ import com.google.common.base.Function; @Singleton public class TerremarkVCloudGetNodeMetadataStrategy implements GetNodeMetadataStrategy { - protected final TerremarkVCloudClient client; + protected final TerremarkVCloudApi client; protected final Function vAppToNodeMetadata; @Inject - protected TerremarkVCloudGetNodeMetadataStrategy(TerremarkVCloudClient client, + protected TerremarkVCloudGetNodeMetadataStrategy(TerremarkVCloudApi client, Function vAppToNodeMetadata) { this.client = checkNotNull(client, "client"); this.vAppToNodeMetadata = vAppToNodeMetadata; diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudLifeCycleStrategy.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudLifeCycleStrategy.java index 2b95d10837..27bd096a65 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudLifeCycleStrategy.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudLifeCycleStrategy.java @@ -32,7 +32,7 @@ import org.jclouds.compute.strategy.RebootNodeStrategy; import org.jclouds.compute.strategy.ResumeNodeStrategy; import org.jclouds.compute.strategy.SuspendNodeStrategy; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.domain.Task; import com.google.common.base.Predicate; @@ -46,12 +46,12 @@ public class TerremarkVCloudLifeCycleStrategy implements RebootNodeStrategy, Res @Named(ComputeServiceConstants.COMPUTE_LOGGER) protected Logger logger = Logger.NULL; - private final TerremarkVCloudClient client; + private final TerremarkVCloudApi client; protected final Predicate taskTester; protected final GetNodeMetadataStrategy getNode; @Inject - protected TerremarkVCloudLifeCycleStrategy(TerremarkVCloudClient client, Predicate taskTester, + protected TerremarkVCloudLifeCycleStrategy(TerremarkVCloudApi client, Predicate taskTester, GetNodeMetadataStrategy getNode) { this.client = client; this.taskTester = taskTester; diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudListNodesStrategy.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudListNodesStrategy.java index d5e9326fc7..3a8b92a6c1 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudListNodesStrategy.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/TerremarkVCloudListNodesStrategy.java @@ -34,7 +34,7 @@ import org.jclouds.compute.domain.ComputeType; import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.strategy.ListNodesStrategy; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType; import org.jclouds.trmk.vcloud_0_8.compute.functions.FindLocationForResource; import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; @@ -46,7 +46,6 @@ import com.google.common.base.Splitter; import com.google.common.base.Supplier; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; import com.google.common.collect.Sets; import com.google.inject.Inject; @@ -60,7 +59,7 @@ public class TerremarkVCloudListNodesStrategy implements ListNodesStrategy { @Named(COMPUTE_LOGGER) public Logger logger = Logger.NULL; protected final TerremarkVCloudGetNodeMetadataStrategy getNodeMetadata; - protected final TerremarkVCloudClient client; + protected final TerremarkVCloudApi client; protected final FindLocationForResource findLocationForResourceInVDC; Set blackListVAppNames = ImmutableSet. of(); @@ -73,7 +72,7 @@ public class TerremarkVCloudListNodesStrategy implements ListNodesStrategy { private final Supplier> orgNameToEndpoint; @Inject - protected TerremarkVCloudListNodesStrategy(TerremarkVCloudClient client, + protected TerremarkVCloudListNodesStrategy(TerremarkVCloudApi client, @Org Supplier> orgNameToEndpoint, TerremarkVCloudGetNodeMetadataStrategy getNodeMetadata, FindLocationForResource findLocationForResourceInVDC) { this.client = client; diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/config/TerremarkVCloudRestClientModule.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/config/TerremarkVCloudHttpApiModule.java similarity index 95% rename from common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/config/TerremarkVCloudRestClientModule.java rename to common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/config/TerremarkVCloudHttpApiModule.java index 8c012f891d..662d549a26 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/config/TerremarkVCloudRestClientModule.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/config/TerremarkVCloudHttpApiModule.java @@ -24,7 +24,7 @@ import static com.google.common.collect.Iterables.transform; import static com.google.common.collect.Maps.transformValues; import static com.google.common.collect.Maps.uniqueIndex; import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL; -import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi; +import static org.jclouds.rest.config.BinderUtils.bindHttpApi; import static org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED; import static org.jclouds.util.Predicates2.retry; @@ -49,9 +49,9 @@ import org.jclouds.location.suppliers.ImplicitLocationSupplier; import org.jclouds.location.suppliers.LocationsSupplier; import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.annotations.ApiVersion; -import org.jclouds.rest.config.RestClientModule; +import org.jclouds.rest.config.HttpApiModule; import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.VCloudToken; import org.jclouds.trmk.vcloud_0_8.compute.functions.FindLocationForResource; import org.jclouds.trmk.vcloud_0_8.domain.Catalog; @@ -72,10 +72,8 @@ import org.jclouds.trmk.vcloud_0_8.functions.OrgsForLocations; import org.jclouds.trmk.vcloud_0_8.functions.OrgsForNames; import org.jclouds.trmk.vcloud_0_8.functions.VAppTemplatesForCatalogItems; import org.jclouds.trmk.vcloud_0_8.handlers.ParseTerremarkVCloudErrorFromHttpResponse; -import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginAsyncClient; -import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginClient; -import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsAsyncClient; -import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsClient; +import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginApi; +import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsApi; import org.jclouds.trmk.vcloud_0_8.location.DefaultVDC; import org.jclouds.trmk.vcloud_0_8.location.OrgAndVDCToLocationSupplier; import org.jclouds.trmk.vcloud_0_8.predicates.TaskSuccess; @@ -94,13 +92,9 @@ import com.google.inject.Provides; import com.google.inject.Scopes; import com.google.inject.TypeLiteral; -public class TerremarkVCloudRestClientModule extends RestClientModule { +public class TerremarkVCloudHttpApiModule extends HttpApiModule { - public TerremarkVCloudRestClientModule() { - } - - public TerremarkVCloudRestClientModule(Map, Class> delegateMap) { - super(delegateMap); + public TerremarkVCloudHttpApiModule() { } @Override @@ -132,8 +126,8 @@ public class TerremarkVCloudRestClientModule extends RestClientModule>>() { }).to(new TypeLiteral() { }); - bindSyncToAsyncHttpApi(binder(), TerremarkVCloudVersionsClient.class, TerremarkVCloudVersionsAsyncClient.class); - bindSyncToAsyncHttpApi(binder(), TerremarkVCloudLoginClient.class, TerremarkVCloudLoginAsyncClient.class); + bindHttpApi(binder(), TerremarkVCloudVersionsApi.class); + bindHttpApi(binder(), TerremarkVCloudLoginApi.class); } @Provides @@ -310,7 +304,7 @@ public class TerremarkVCloudRestClientModule extends RestClientModule provideAuthenticationURI(final TerremarkVCloudVersionsClient versionService, + protected Supplier provideAuthenticationURI(final TerremarkVCloudVersionsApi versionService, @ApiVersion final String version) { return new Supplier() { @@ -477,7 +471,7 @@ public class TerremarkVCloudRestClientModule extends RestClientModule provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds, - AtomicReference authException, final TerremarkVCloudLoginClient login) { + AtomicReference authException, final TerremarkVCloudLoginApi login) { return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, new Supplier() { @@ -517,10 +511,10 @@ public class TerremarkVCloudRestClientModule extends RestClientModule> { protected final Supplier sessionSupplier; - private final TerremarkVCloudClient client; + private final TerremarkVCloudApi client; @Inject - protected OrgNameToKeysListSupplier(Supplier sessionSupplier, TerremarkVCloudClient client) { + protected OrgNameToKeysListSupplier(Supplier sessionSupplier, TerremarkVCloudApi client) { this.sessionSupplier = sessionSupplier; this.client = client; } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogItemsInCatalog.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogItemsInCatalog.java index 05f98396e2..dc3b7c2346 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogItemsInCatalog.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogItemsInCatalog.java @@ -17,16 +17,14 @@ package org.jclouds.trmk.vcloud_0_8.functions; import static com.google.common.collect.Iterables.filter; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType; import org.jclouds.trmk.vcloud_0_8.domain.Catalog; import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem; @@ -34,8 +32,6 @@ import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; import com.google.common.base.Function; import com.google.common.base.Predicate; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -45,27 +41,24 @@ public class AllCatalogItemsInCatalog implements Function apply(Catalog from) { - return transformParallel(filter(from.values(), new Predicate() { + return transform(filter(from.values(), new Predicate() { public boolean apply(ReferenceType input) { return input.getType().equals(TerremarkVCloudMediaType.CATALOGITEM_XML); } - }), new Function>() { - public ListenableFuture apply(ReferenceType from) { + }), new Function() { + public CatalogItem apply(ReferenceType from) { return aclient.getCatalogItem(from.getHref()); } - }, userExecutor, null, logger, "catalogItems in " + from.getHref()); + }); } } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogsInOrg.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogsInOrg.java index d30dfe9c16..011fae83a1 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogsInOrg.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogsInOrg.java @@ -16,23 +16,19 @@ */ package org.jclouds.trmk.vcloud_0_8.functions; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.domain.Catalog; import org.jclouds.trmk.vcloud_0_8.domain.Org; import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; import com.google.common.base.Function; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -42,22 +38,20 @@ public class AllCatalogsInOrg implements Function apply(final Org org) { - return transformParallel(org.getCatalogs().values(), - new Function>() { - public ListenableFuture apply(ReferenceType from) { - return aclient.getCatalog(from.getHref()); - } - }, userExecutor, null, logger, "catalogs in " + org.getName()); + return transform(org.getCatalogs().values(), + new Function() { + public Catalog apply(ReferenceType from) { + return aclient.getCatalog(from.getHref()); + } + }); } } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllVDCsInOrg.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllVDCsInOrg.java index 39cd22b3f1..9f8b77572d 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllVDCsInOrg.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllVDCsInOrg.java @@ -16,22 +16,18 @@ */ package org.jclouds.trmk.vcloud_0_8.functions; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.domain.Org; import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; import com.google.common.base.Function; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -41,23 +37,21 @@ public class AllVDCsInOrg implements Function apply(final Org org) { - return transformParallel(org.getVDCs().values(), - new Function>() { - public ListenableFuture apply(ReferenceType from) { - return aclient.getVDC(from.getHref()); - } - }, userExecutor, null, logger, "vdcs in org " + org.getName()); + return transform(org.getVDCs().values(), + new Function() { + public org.jclouds.trmk.vcloud_0_8.domain.VDC apply(ReferenceType from) { + return aclient.getVDC(from.getHref()); + } + }); } } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForLocations.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForLocations.java index 745f5f53de..ec0df6de30 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForLocations.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForLocations.java @@ -18,27 +18,22 @@ package org.jclouds.trmk.vcloud_0_8.functions; import static com.google.common.collect.Iterables.filter; import static com.google.common.collect.Iterables.transform; -import static org.jclouds.concurrent.FutureIterables.transformParallel; import java.net.URI; import javax.annotation.Resource; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.domain.Location; import org.jclouds.domain.LocationScope; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.domain.Org; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.collect.Sets; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -47,13 +42,11 @@ import com.google.common.util.concurrent.ListeningExecutorService; public class OrgsForLocations implements Function, Iterable> { @Resource public Logger logger = Logger.NULL; - private final TerremarkVCloudAsyncClient aclient; - private final ListeningExecutorService userExecutor; + private final TerremarkVCloudApi aclient; @Inject - OrgsForLocations(TerremarkVCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) { + OrgsForLocations(TerremarkVCloudApi aclient) { this.aclient = aclient; - this.userExecutor = userExecutor; } /** @@ -62,7 +55,7 @@ public class OrgsForLocations implements Function, */ @Override public Iterable apply(Iterable from) { - return transformParallel(Sets.newLinkedHashSet(transform(filter(from, new Predicate() { + return transform(Sets.newLinkedHashSet(transform(filter(from, new Predicate() { public boolean apply(Location input) { return input.getScope() == LocationScope.ZONE; } @@ -70,10 +63,10 @@ public class OrgsForLocations implements Function, public URI apply(Location from) { return URI.create(from.getParent().getId()); } - })), new Function>() { - public ListenableFuture apply(URI from) { + })), new Function() { + public Org apply(URI from) { return aclient.getOrg(from); } - }, userExecutor, null, logger, "organizations for uris"); + }); } } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForNames.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForNames.java index 41eedaabc8..5823bb83eb 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForNames.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForNames.java @@ -16,21 +16,17 @@ */ package org.jclouds.trmk.vcloud_0_8.functions; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.domain.Org; import com.google.common.base.Function; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -39,22 +35,20 @@ import com.google.common.util.concurrent.ListeningExecutorService; public class OrgsForNames implements Function, Iterable> { @Resource public Logger logger = Logger.NULL; - private final TerremarkVCloudAsyncClient aclient; - private final ListeningExecutorService userExecutor; + private final TerremarkVCloudApi aclient; @Inject - OrgsForNames(TerremarkVCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) { + OrgsForNames(TerremarkVCloudApi aclient) { this.aclient = aclient; - this.userExecutor = userExecutor; } @Override public Iterable apply(Iterable from) { - return transformParallel(from, new Function>() { - public ListenableFuture apply(String from) { + return transform(from, new Function() { + public Org apply(String from) { return aclient.findOrgNamed(from); } - }, userExecutor, null, logger, "organizations for names"); + }); } } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForCatalogItems.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForCatalogItems.java index 3360b8f54b..bd407fbbf0 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForCatalogItems.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForCatalogItems.java @@ -17,25 +17,22 @@ package org.jclouds.trmk.vcloud_0_8.functions; import static com.google.common.collect.Iterables.filter; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType; import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem; import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate; import com.google.common.base.Function; import com.google.common.base.Predicate; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -46,27 +43,24 @@ public class VAppTemplatesForCatalogItems implements @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER) public Logger logger = Logger.NULL; - private final TerremarkVCloudAsyncClient aclient; - private final ListeningExecutorService userExecutor; + private final TerremarkVCloudApi aclient; @Inject - VAppTemplatesForCatalogItems(TerremarkVCloudAsyncClient aclient, - @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) { + VAppTemplatesForCatalogItems(TerremarkVCloudApi aclient) { this.aclient = aclient; - this.userExecutor = userExecutor; } @Override public Iterable apply(Iterable from) { - return transformParallel(filter(from, new Predicate() { + return transform(filter(from, new Predicate() { public boolean apply(CatalogItem input) { return input.getEntity().getType().equals(TerremarkVCloudMediaType.VAPPTEMPLATE_XML); } - }), new Function>() { - public ListenableFuture apply(CatalogItem from) { + }), new Function() { + public VAppTemplate apply(CatalogItem from) { return aclient.getVAppTemplate(from.getEntity().getHref()); } - }, userExecutor, null, logger, "vappTemplates in"); + }); } } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForResourceEntities.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForResourceEntities.java index c62f8ab6e5..6a5055c3e4 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForResourceEntities.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForResourceEntities.java @@ -18,25 +18,22 @@ package org.jclouds.trmk.vcloud_0_8.functions; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.Iterables.filter; -import static org.jclouds.concurrent.FutureIterables.transformParallel; +import static com.google.common.collect.Iterables.transform; import javax.annotation.Resource; import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.Constants; import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType; import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate; import com.google.common.base.Function; import com.google.common.base.Predicate; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; /** * @author Adrian Cole @@ -47,27 +44,24 @@ public class VAppTemplatesForResourceEntities implements @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER) public Logger logger = Logger.NULL; - private final TerremarkVCloudAsyncClient aclient; - private final ListeningExecutorService userExecutor; + private final TerremarkVCloudApi aclient; @Inject - VAppTemplatesForResourceEntities(TerremarkVCloudAsyncClient aclient, - @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) { + VAppTemplatesForResourceEntities(TerremarkVCloudApi aclient) { this.aclient = aclient; - this.userExecutor = userExecutor; } @Override public Iterable apply(Iterable from) { - return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate() { + return transform(filter(checkNotNull(from, "named resources"), new Predicate() { public boolean apply(ReferenceType input) { return input.getType().equals(TerremarkVCloudMediaType.VAPPTEMPLATE_XML); } - }), new Function>() { - public ListenableFuture apply(ReferenceType from) { + }), new Function() { + public VAppTemplate apply(ReferenceType from) { return aclient.getVAppTemplate(from.getHref()); } - }, userExecutor, null, logger, "vappTemplates in"); + }); } } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudApiMetadata.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudApiMetadata.java index aa3c2b01e2..3c2464bf82 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudApiMetadata.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudApiMetadata.java @@ -31,21 +31,22 @@ import java.util.Properties; import org.jclouds.apis.ApiMetadata; import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.rest.internal.BaseRestApiMetadata; +import org.jclouds.rest.internal.BaseHttpApiMetadata; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; /** * Implementation of {@link ApiMetadata} for Terremark's VCloud api. * @author Adrian Cole */ -public abstract class TerremarkVCloudApiMetadata extends BaseRestApiMetadata { +public abstract class TerremarkVCloudApiMetadata extends BaseHttpApiMetadata { protected TerremarkVCloudApiMetadata(Builder builder) { super(builder); } public static Properties defaultProperties() { - Properties properties = BaseRestApiMetadata.defaultProperties(); + Properties properties = BaseHttpApiMetadata.defaultProperties(); properties.setProperty(PROPERTY_VCLOUD_VERSION_SCHEMA, "0.8"); properties.setProperty(PROPERTY_SESSION_INTERVAL, 8 * 60 + ""); properties.setProperty(PROPERTY_VCLOUD_XML_SCHEMA, "http://vcloud.safesecureweb.com/ns/vcloud.xsd"); @@ -61,10 +62,9 @@ public abstract class TerremarkVCloudApiMetadata extends BaseRestApiMetadata { return properties; } - public abstract static class Builder> extends BaseRestApiMetadata.Builder { + public abstract static class Builder> extends BaseHttpApiMetadata.Builder { - protected Builder(Class syncClient, Class asyncClient) { - super(syncClient, asyncClient); + protected Builder() { identityName("Email") .credentialName("Password") .version("0.8") diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginApi.java similarity index 73% rename from common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClient.java rename to common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginApi.java index f21bb7fee1..e86272779a 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClient.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginApi.java @@ -29,25 +29,12 @@ import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType; import org.jclouds.trmk.vcloud_0_8.domain.VCloudSession; import org.jclouds.trmk.vcloud_0_8.functions.ParseLoginResponseFromHeaders; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Establishes a context with a VCloud endpoint. - *

- * - * @see - * @author Adrian Cole - */ @Endpoint(org.jclouds.trmk.vcloud_0_8.endpoints.VCloudLogin.class) @RequestFilters(BasicAuthentication.class) -public interface TerremarkVCloudLoginAsyncClient extends Closeable { +public interface TerremarkVCloudLoginApi extends Closeable { - /** - * This request returns a token to use in subsequent requests. After ten minutes of inactivity, - * the token expires and you have to request a new token with this call. - */ @POST @ResponseParser(ParseLoginResponseFromHeaders.class) @Consumes(TerremarkVCloudMediaType.ORGLIST_XML) - ListenableFuture login(); + VCloudSession login(); } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginClient.java deleted file mode 100644 index 95969569f1..0000000000 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginClient.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.trmk.vcloud_0_8.internal; - -import java.io.Closeable; - -import org.jclouds.trmk.vcloud_0_8.domain.VCloudSession; - -public interface TerremarkVCloudLoginClient extends Closeable { - - VCloudSession login(); -} diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsApi.java similarity index 75% rename from common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsClient.java rename to common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsApi.java index 0e386b4225..979d9484c9 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsClient.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsApi.java @@ -19,7 +19,17 @@ package org.jclouds.trmk.vcloud_0_8.internal; import java.io.Closeable; import java.net.URI; import java.util.SortedMap; -public interface TerremarkVCloudVersionsClient extends Closeable { +import javax.ws.rs.GET; +import javax.ws.rs.Path; + +import org.jclouds.rest.annotations.XMLResponseParser; +import org.jclouds.trmk.vcloud_0_8.xml.SupportedVersionsHandler; + +public interface TerremarkVCloudVersionsApi extends Closeable { + + @GET + @XMLResponseParser(SupportedVersionsHandler.class) + @Path("/versions") SortedMap getSupportedVersions(); } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsAsyncClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsAsyncClient.java deleted file mode 100644 index dfe8e8cda1..0000000000 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsAsyncClient.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.trmk.vcloud_0_8.internal; - -import java.io.Closeable; -import java.net.URI; -import java.util.SortedMap; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; - -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.trmk.vcloud_0_8.xml.SupportedVersionsHandler; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Establishes a context with a VCloud endpoint. - *

- * - * @see - * @author Adrian Cole - */ -public interface TerremarkVCloudVersionsAsyncClient extends Closeable { - - /** - * Retrieve information for supported versions - */ - @GET - @XMLResponseParser(SupportedVersionsHandler.class) - @Path("/versions") - ListenableFuture> getSupportedVersions(); -} diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/predicates/TaskSuccess.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/predicates/TaskSuccess.java index a8767f1a7f..62b88d78c5 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/predicates/TaskSuccess.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/predicates/TaskSuccess.java @@ -22,7 +22,7 @@ import javax.annotation.Resource; import javax.inject.Singleton; import org.jclouds.logging.Logger; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.domain.Task; import org.jclouds.trmk.vcloud_0_8.domain.TaskStatus; @@ -38,13 +38,13 @@ import com.google.inject.Inject; @Singleton public class TaskSuccess implements Predicate { - private final TerremarkVCloudClient client; + private final TerremarkVCloudApi client; @Resource protected Logger logger = Logger.NULL; @Inject - public TaskSuccess(TerremarkVCloudClient client) { + public TaskSuccess(TerremarkVCloudApi client) { this.client = client; } 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/TerremarkApiLiveTest.java similarity index 98% rename from common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/TerremarkClientLiveTest.java rename to common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/TerremarkApiLiveTest.java index 69a3bcabe4..e52666c745 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/TerremarkApiLiveTest.java @@ -84,7 +84,7 @@ import com.google.inject.Injector; import com.google.inject.Module; @Test(groups = "live", singleThreaded = true) -public abstract class TerremarkClientLiveTest extends BaseApiLiveTest { +public abstract class TerremarkApiLiveTest extends BaseApiLiveTest { protected String expectedOs = "Ubuntu Linux (64-bit)"; protected String itemName = "Ubuntu JeOS 9.10 (64-bit)"; @@ -105,7 +105,7 @@ public abstract class TerremarkClientLiveTest extends BaseApiLiveTest response = vCloudExpressClient.listKeyPairsInOrg(org.getHref()); assertNotNull(response); } @@ -477,14 +477,14 @@ public abstract class TerremarkClientLiveTest extends BaseApiLiveTest modules) { + protected TerremarkVCloudApi create(Properties props, Iterable 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); - api = injector.getInstance(TerremarkVCloudClient.class); + api = injector.getInstance(TerremarkVCloudApi.class); orgs = listOrgs(); return api; } @@ -504,7 +504,7 @@ public abstract class TerremarkClientLiveTest extends BaseApiLiveTest credentialStore = createMock(ConcurrentMap.class); - TerremarkVCloudClient terremarkClient = createMock(TerremarkVCloudClient.class); + TerremarkVCloudApi terremarkClient = createMock(TerremarkVCloudApi.class); return new DeleteKeyPair(terremarkClient, credentialStore); } diff --git a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VAppTemplatesInOrgsLiveTest.java b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VAppTemplatesInOrgsLiveTest.java index 34d92140db..221fd710aa 100644 --- a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VAppTemplatesInOrgsLiveTest.java +++ b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VAppTemplatesInOrgsLiveTest.java @@ -22,7 +22,7 @@ import java.util.Set; import org.jclouds.compute.domain.Image; import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem; import org.jclouds.trmk.vcloud_0_8.functions.AllCatalogItemsInOrg; import org.testng.annotations.BeforeClass; @@ -44,7 +44,7 @@ extends BaseComputeServiceContextLiveTest { provider = "trmk-vcloudexpress"; } - private TerremarkVCloudClient tmClient; + private TerremarkVCloudApi tmClient; private VAppTemplatesInOrgs parser; private AllCatalogItemsInOrg allCatalogItemsInOrg; @@ -54,7 +54,7 @@ extends BaseComputeServiceContextLiveTest { super.setupContext(); Injector injector = view.utils().injector(); - tmClient = injector.getInstance(TerremarkVCloudClient.class); + tmClient = injector.getInstance(TerremarkVCloudApi.class); allCatalogItemsInOrg = injector.getInstance(AllCatalogItemsInOrg.class); parser = injector.getInstance(VAppTemplatesInOrgs.class); } 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/BaseTerremarkApiLiveTest.java similarity index 88% rename from common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/BaseTerremarkClientLiveTest.java rename to common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/BaseTerremarkApiLiveTest.java index 9e5dde98b4..ad14f33f96 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/BaseTerremarkApiLiveTest.java @@ -24,7 +24,7 @@ import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; import org.jclouds.predicates.SocketOpen; import org.jclouds.ssh.SshClient.Factory; import org.jclouds.sshj.config.SshjSshClientModule; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -38,19 +38,19 @@ import com.google.inject.Module; * @author Adrian Cole */ @Test(groups = "live", enabled = true, singleThreaded = true) -public abstract class BaseTerremarkClientLiveTest extends BaseComputeServiceContextLiveTest { +public abstract class BaseTerremarkApiLiveTest extends BaseComputeServiceContextLiveTest { protected String prefix = System.getProperty("user.name"); protected ComputeService client; - public BaseTerremarkClientLiveTest() { + public BaseTerremarkApiLiveTest() { provider = "trmk-ecloud"; } protected Predicate socketTester; protected Factory sshFactory; - protected TerremarkVCloudClient api; + protected TerremarkVCloudApi api; @Override @BeforeClass(groups = { "integration", "live" }) @@ -60,7 +60,7 @@ public abstract class BaseTerremarkClientLiveTest extends BaseComputeServiceCont SocketOpen socketOpen = injector.getInstance(SocketOpen.class); socketTester = retry(socketOpen, 300, 1, SECONDS); sshFactory = injector.getInstance(Factory.class); - api = injector.getInstance(TerremarkVCloudClient.class); + api = injector.getInstance(TerremarkVCloudApi.class); } protected Module getSshModule() { diff --git a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClientTest.java b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginApiTest.java similarity index 86% rename from common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClientTest.java rename to common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginApiTest.java index 078d4ab373..95df1ff6f7 100644 --- a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClientTest.java +++ b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginApiTest.java @@ -43,17 +43,17 @@ import com.google.inject.Module; import com.google.inject.Provides; /** - * Tests behavior of {@code VCloudLoginAsyncClient} + * Tests behavior of {@code VCloudLoginApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", testName = "VCloudLoginAsyncClientTest") -public class TerremarkVCloudLoginAsyncClientTest extends BaseAsyncClientTest { +@Test(groups = "unit", testName = "VCloudLoginApiTest") +public class TerremarkVCloudLoginApiTest extends BaseAsyncClientTest { public void testLogin() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkVCloudLoginAsyncClient.class, "login"); + Invokable method = method(TerremarkVCloudLoginApi.class, "login"); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of()); assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1"); @@ -92,8 +92,8 @@ public class TerremarkVCloudLoginAsyncClientTest extends BaseAsyncClientTest { +@Test(groups = "unit", testName = "VCloudVersionsApiTest") +public class TerremarkVCloudVersionsApiTest extends BaseAsyncClientTest { public void testVersions() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkVCloudVersionsAsyncClient.class, "getSupportedVersions"); + Invokable method = method(TerremarkVCloudVersionsApi.class, "getSupportedVersions"); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of()); assertEquals(request.getRequestLine(), "GET http://localhost:8080/versions HTTP/1.1"); @@ -63,8 +63,8 @@ public class TerremarkVCloudVersionsAsyncClientTest extends BaseAsyncClientTest< @Override protected ProviderMetadata createProviderMetadata() { - return AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(TerremarkVCloudVersionsClient.class, - TerremarkVCloudVersionsAsyncClient.class, "http://localhost:8080"); + return AnonymousProviderMetadata.forApiOnEndpoint(TerremarkVCloudVersionsApi.class, + "http://localhost:8080"); } } diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppClientLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01CatalogApiLiveTest.java similarity index 81% rename from providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppClientLiveTest.java rename to providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01CatalogApiLiveTest.java index aff3aa5a6a..ab41fccefc 100644 --- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppClientLiveTest.java +++ b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01CatalogApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.bluelock.vcloud.zone01.features; -import org.jclouds.vcloud.features.VAppClientLiveTest; +import org.jclouds.vcloud.features.CatalogApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VAppClientLiveTest") -public class BluelockVCloudZone01VAppClientLiveTest extends VAppClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01CatalogApiLiveTest") +public class BluelockVCloudZone01CatalogApiLiveTest extends CatalogApiLiveTest { - public BluelockVCloudZone01VAppClientLiveTest() { + public BluelockVCloudZone01CatalogApiLiveTest() { provider = "bluelock-vcloud-zone01"; } } diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01TaskClientLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01NetworkApiLiveTest.java similarity index 81% rename from providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01TaskClientLiveTest.java rename to providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01NetworkApiLiveTest.java index d17e7d5201..6cb6cbb690 100644 --- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01TaskClientLiveTest.java +++ b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01NetworkApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.bluelock.vcloud.zone01.features; -import org.jclouds.vcloud.features.TaskClientLiveTest; +import org.jclouds.vcloud.features.NetworkApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01TaskClientLiveTest") -public class BluelockVCloudZone01TaskClientLiveTest extends TaskClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01NetworkApiLiveTest") +public class BluelockVCloudZone01NetworkApiLiveTest extends NetworkApiLiveTest { - public BluelockVCloudZone01TaskClientLiveTest() { + public BluelockVCloudZone01NetworkApiLiveTest() { provider = "bluelock-vcloud-zone01"; } } diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01NetworkClientLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01NetworkClientLiveTest.java deleted file mode 100644 index ee1670deb8..0000000000 --- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01NetworkClientLiveTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.bluelock.vcloud.zone01.features; - -import org.jclouds.vcloud.features.NetworkClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * - * @author Adrian Cole - */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01NetworkClientLiveTest") -public class BluelockVCloudZone01NetworkClientLiveTest extends NetworkClientLiveTest { - - public BluelockVCloudZone01NetworkClientLiveTest() { - provider = "bluelock-vcloud-zone01"; - } -} diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VmClientLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01OrgApiLiveTest.java similarity index 81% rename from providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VmClientLiveTest.java rename to providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01OrgApiLiveTest.java index 9992bf903e..ca007dcd03 100644 --- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VmClientLiveTest.java +++ b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01OrgApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.bluelock.vcloud.zone01.features; -import org.jclouds.vcloud.features.VmClientLiveTest; +import org.jclouds.vcloud.features.OrgApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VmClientLiveTest") -public class BluelockVCloudZone01VmClientLiveTest extends VmClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01OrgApiLiveTest") +public class BluelockVCloudZone01OrgApiLiveTest extends OrgApiLiveTest { - public BluelockVCloudZone01VmClientLiveTest() { + public BluelockVCloudZone01OrgApiLiveTest() { provider = "bluelock-vcloud-zone01"; } } diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VDCClientLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01TaskApiLiveTest.java similarity index 81% rename from providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VDCClientLiveTest.java rename to providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01TaskApiLiveTest.java index 66fa59f258..1b05cab83c 100644 --- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VDCClientLiveTest.java +++ b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01TaskApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.bluelock.vcloud.zone01.features; -import org.jclouds.vcloud.features.VDCClientLiveTest; +import org.jclouds.vcloud.features.TaskApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VDCClientLiveTest") -public class BluelockVCloudZone01VDCClientLiveTest extends VDCClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01TaskApiLiveTest") +public class BluelockVCloudZone01TaskApiLiveTest extends TaskApiLiveTest { - public BluelockVCloudZone01VDCClientLiveTest() { + public BluelockVCloudZone01TaskApiLiveTest() { provider = "bluelock-vcloud-zone01"; } } diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01OrgClientLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppApiLiveTest.java similarity index 81% rename from providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01OrgClientLiveTest.java rename to providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppApiLiveTest.java index db5d181a82..0ba76effff 100644 --- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01OrgClientLiveTest.java +++ b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.bluelock.vcloud.zone01.features; -import org.jclouds.vcloud.features.OrgClientLiveTest; +import org.jclouds.vcloud.features.VAppApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01OrgClientLiveTest") -public class BluelockVCloudZone01OrgClientLiveTest extends OrgClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VAppApiLiveTest") +public class BluelockVCloudZone01VAppApiLiveTest extends VAppApiLiveTest { - public BluelockVCloudZone01OrgClientLiveTest() { + public BluelockVCloudZone01VAppApiLiveTest() { provider = "bluelock-vcloud-zone01"; } } diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01CatalogClientLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppTemplateApiLiveTest.java similarity index 79% rename from providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01CatalogClientLiveTest.java rename to providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppTemplateApiLiveTest.java index 3fa79fca26..dd47a221d8 100644 --- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01CatalogClientLiveTest.java +++ b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppTemplateApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.bluelock.vcloud.zone01.features; -import org.jclouds.vcloud.features.CatalogClientLiveTest; +import org.jclouds.vcloud.features.VAppTemplateApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01CatalogClientLiveTest") -public class BluelockVCloudZone01CatalogClientLiveTest extends CatalogClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VAppTemplateApiLiveTest") +public class BluelockVCloudZone01VAppTemplateApiLiveTest extends VAppTemplateApiLiveTest { - public BluelockVCloudZone01CatalogClientLiveTest() { + public BluelockVCloudZone01VAppTemplateApiLiveTest() { provider = "bluelock-vcloud-zone01"; } } diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppTemplateClientLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppTemplateClientLiveTest.java deleted file mode 100644 index 5dfb00a342..0000000000 --- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppTemplateClientLiveTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.bluelock.vcloud.zone01.features; - -import org.jclouds.vcloud.features.VAppTemplateClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * - * @author Adrian Cole - */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VAppTemplateClientLiveTest") -public class BluelockVCloudZone01VAppTemplateClientLiveTest extends VAppTemplateClientLiveTest { - - public BluelockVCloudZone01VAppTemplateClientLiveTest() { - provider = "bluelock-vcloud-zone01"; - } -} diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VDCApiLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VDCApiLiveTest.java new file mode 100644 index 0000000000..3bf51a9111 --- /dev/null +++ b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VDCApiLiveTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.bluelock.vcloud.zone01.features; + +import org.jclouds.vcloud.features.VDCApiLiveTest; +import org.testng.annotations.Test; + +/** + * + * + * @author Adrian Cole + */ +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VDCApiLiveTest") +public class BluelockVCloudZone01VDCApiLiveTest extends VDCApiLiveTest { + + public BluelockVCloudZone01VDCApiLiveTest() { + provider = "bluelock-vcloud-zone01"; + } +} diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VmApiLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VmApiLiveTest.java new file mode 100644 index 0000000000..cafe991ba3 --- /dev/null +++ b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VmApiLiveTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.bluelock.vcloud.zone01.features; + +import org.jclouds.vcloud.features.VmApiLiveTest; +import org.testng.annotations.Test; + +/** + * + * + * @author Adrian Cole + */ +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VmApiLiveTest") +public class BluelockVCloudZone01VmApiLiveTest extends VmApiLiveTest { + + public BluelockVCloudZone01VmApiLiveTest() { + provider = "bluelock-vcloud-zone01"; + } +} diff --git a/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderMetadata.java b/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderMetadata.java index f4fa561033..1135c3e0d9 100644 --- a/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderMetadata.java +++ b/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderMetadata.java @@ -25,7 +25,7 @@ import org.jclouds.greenhousedata.element.vcloud.config.GreenHouseDataElementVCl import org.jclouds.providers.ProviderMetadata; import org.jclouds.providers.internal.BaseProviderMetadata; import org.jclouds.vcloud.VCloudApiMetadata; -import org.jclouds.vcloud.config.VCloudRestClientModule; +import org.jclouds.vcloud.config.VCloudHttpApiModule; import com.google.common.collect.ImmutableSet; import com.google.inject.Module; @@ -68,7 +68,7 @@ public class GreenHouseDataElementVCloudProviderMetadata extends BaseProviderMet .apiMetadata( new VCloudApiMetadata().toBuilder() .buildVersion("1.5.0.464915") - .defaultModules(ImmutableSet.>of(VCloudRestClientModule.class, GreenHouseDataElementVCloudComputeServiceContextModule.class)) + .defaultModules(ImmutableSet.>of(VCloudHttpApiModule.class, GreenHouseDataElementVCloudComputeServiceContextModule.class)) .build()) .homepage(URI.create("http://www.greenhousedata.com/element-cloud-hosting/vcloud-services/")) .console(URI.create("https://mycloud.greenhousedata.com/cloud/org/YOUR_ORG_HERE")) diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppClientLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudCatalogApiLiveTest.java similarity index 80% rename from providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppClientLiveTest.java rename to providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudCatalogApiLiveTest.java index 293d284e8f..946db6a65b 100644 --- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppClientLiveTest.java +++ b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudCatalogApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.greenhousedata.element.vcloud.features; -import org.jclouds.vcloud.features.VAppClientLiveTest; +import org.jclouds.vcloud.features.CatalogApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVAppClientLiveTest") -public class GreenHouseDataElementVCloudVAppClientLiveTest extends VAppClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudCatalogApiLiveTest") +public class GreenHouseDataElementVCloudCatalogApiLiveTest extends CatalogApiLiveTest { - public GreenHouseDataElementVCloudVAppClientLiveTest() { + public GreenHouseDataElementVCloudCatalogApiLiveTest() { provider = "greenhousedata-element-vcloud"; } } diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudTaskClientLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudNetworkApiLiveTest.java similarity index 80% rename from providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudTaskClientLiveTest.java rename to providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudNetworkApiLiveTest.java index d7e73c1061..c65c60c2c9 100644 --- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudTaskClientLiveTest.java +++ b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudNetworkApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.greenhousedata.element.vcloud.features; -import org.jclouds.vcloud.features.TaskClientLiveTest; +import org.jclouds.vcloud.features.NetworkApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudTaskClientLiveTest") -public class GreenHouseDataElementVCloudTaskClientLiveTest extends TaskClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudNetworkApiLiveTest") +public class GreenHouseDataElementVCloudNetworkApiLiveTest extends NetworkApiLiveTest { - public GreenHouseDataElementVCloudTaskClientLiveTest() { + public GreenHouseDataElementVCloudNetworkApiLiveTest() { provider = "greenhousedata-element-vcloud"; } } diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudNetworkClientLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudNetworkClientLiveTest.java deleted file mode 100644 index 0f9dac362a..0000000000 --- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudNetworkClientLiveTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.greenhousedata.element.vcloud.features; - -import org.jclouds.vcloud.features.NetworkClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * - * @author Adrian Cole - */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudNetworkClientLiveTest") -public class GreenHouseDataElementVCloudNetworkClientLiveTest extends NetworkClientLiveTest { - - public GreenHouseDataElementVCloudNetworkClientLiveTest() { - provider = "greenhousedata-element-vcloud"; - } -} diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVDCClientLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudOrgApiLiveTest.java similarity index 80% rename from providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVDCClientLiveTest.java rename to providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudOrgApiLiveTest.java index 91dc1a2ae5..a7a9886d06 100644 --- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVDCClientLiveTest.java +++ b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudOrgApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.greenhousedata.element.vcloud.features; -import org.jclouds.vcloud.features.VDCClientLiveTest; +import org.jclouds.vcloud.features.OrgApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVDCClientLiveTest") -public class GreenHouseDataElementVCloudVDCClientLiveTest extends VDCClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudOrgApiLiveTest") +public class GreenHouseDataElementVCloudOrgApiLiveTest extends OrgApiLiveTest { - public GreenHouseDataElementVCloudVDCClientLiveTest() { + public GreenHouseDataElementVCloudOrgApiLiveTest() { provider = "greenhousedata-element-vcloud"; } } diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudOrgClientLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudTaskApiLiveTest.java similarity index 80% rename from providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudOrgClientLiveTest.java rename to providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudTaskApiLiveTest.java index cee50e2585..2f97d58937 100644 --- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudOrgClientLiveTest.java +++ b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudTaskApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.greenhousedata.element.vcloud.features; -import org.jclouds.vcloud.features.OrgClientLiveTest; +import org.jclouds.vcloud.features.TaskApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudOrgClientLiveTest") -public class GreenHouseDataElementVCloudOrgClientLiveTest extends OrgClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudTaskApiLiveTest") +public class GreenHouseDataElementVCloudTaskApiLiveTest extends TaskApiLiveTest { - public GreenHouseDataElementVCloudOrgClientLiveTest() { + public GreenHouseDataElementVCloudTaskApiLiveTest() { provider = "greenhousedata-element-vcloud"; } } diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppApiLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppApiLiveTest.java new file mode 100644 index 0000000000..7865ee3466 --- /dev/null +++ b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppApiLiveTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.greenhousedata.element.vcloud.features; + +import org.jclouds.vcloud.features.VAppApiLiveTest; +import org.testng.annotations.Test; + +/** + * + * + * @author Adrian Cole + */ +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVAppApiLiveTest") +public class GreenHouseDataElementVCloudVAppApiLiveTest extends VAppApiLiveTest { + + public GreenHouseDataElementVCloudVAppApiLiveTest() { + provider = "greenhousedata-element-vcloud"; + } +} diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudCatalogClientLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppTemplateApiLiveTest.java similarity index 78% rename from providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudCatalogClientLiveTest.java rename to providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppTemplateApiLiveTest.java index a48ae8671f..900bb4ed08 100644 --- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudCatalogClientLiveTest.java +++ b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppTemplateApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.greenhousedata.element.vcloud.features; -import org.jclouds.vcloud.features.CatalogClientLiveTest; +import org.jclouds.vcloud.features.VAppTemplateApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudCatalogClientLiveTest") -public class GreenHouseDataElementVCloudCatalogClientLiveTest extends CatalogClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVAppTemplateApiLiveTest") +public class GreenHouseDataElementVCloudVAppTemplateApiLiveTest extends VAppTemplateApiLiveTest { - public GreenHouseDataElementVCloudCatalogClientLiveTest() { + public GreenHouseDataElementVCloudVAppTemplateApiLiveTest() { provider = "greenhousedata-element-vcloud"; } } diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppTemplateClientLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppTemplateClientLiveTest.java deleted file mode 100644 index 79f4d449a5..0000000000 --- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppTemplateClientLiveTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.greenhousedata.element.vcloud.features; - -import org.jclouds.vcloud.features.VAppTemplateClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * - * @author Adrian Cole - */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVAppTemplateClientLiveTest") -public class GreenHouseDataElementVCloudVAppTemplateClientLiveTest extends VAppTemplateClientLiveTest { - - public GreenHouseDataElementVCloudVAppTemplateClientLiveTest() { - provider = "greenhousedata-element-vcloud"; - } -} diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVDCApiLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVDCApiLiveTest.java new file mode 100644 index 0000000000..0650782e69 --- /dev/null +++ b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVDCApiLiveTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.greenhousedata.element.vcloud.features; + +import org.jclouds.vcloud.features.VDCApiLiveTest; +import org.testng.annotations.Test; + +/** + * + * + * @author Adrian Cole + */ +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVDCApiLiveTest") +public class GreenHouseDataElementVCloudVDCApiLiveTest extends VDCApiLiveTest { + + public GreenHouseDataElementVCloudVDCApiLiveTest() { + provider = "greenhousedata-element-vcloud"; + } +} diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVmClientLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVmApiLiveTest.java similarity index 80% rename from providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVmClientLiveTest.java rename to providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVmApiLiveTest.java index 832e655e6d..dfab51d14f 100644 --- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVmClientLiveTest.java +++ b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVmApiLiveTest.java @@ -16,7 +16,7 @@ */ package org.jclouds.greenhousedata.element.vcloud.features; -import org.jclouds.vcloud.features.VmClientLiveTest; +import org.jclouds.vcloud.features.VmApiLiveTest; import org.testng.annotations.Test; /** @@ -24,10 +24,10 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVmClientLiveTest") -public class GreenHouseDataElementVCloudVmClientLiveTest extends VmClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVmApiLiveTest") +public class GreenHouseDataElementVCloudVmApiLiveTest extends VmApiLiveTest { - public GreenHouseDataElementVCloudVmClientLiveTest() { + public GreenHouseDataElementVCloudVmApiLiveTest() { provider = "greenhousedata-element-vcloud"; } 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/TerremarkECloudApi.java similarity index 54% rename from providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClient.java rename to providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudApi.java index 5aec317a27..fb94a211dd 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/TerremarkECloudApi.java @@ -36,9 +36,7 @@ import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; +import org.jclouds.Fallbacks; import org.jclouds.javax.annotation.Nullable; import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; @@ -48,10 +46,10 @@ import org.jclouds.rest.annotations.PayloadParam; import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.trmk.ecloud.domain.ECloudOrg; -import org.jclouds.trmk.ecloud.features.DataCenterOperationsAsyncClient; -import org.jclouds.trmk.ecloud.features.TagOperationsAsyncClient; +import org.jclouds.trmk.ecloud.features.DataCenterOperationsApi; +import org.jclouds.trmk.ecloud.features.TagOperationsApi; import org.jclouds.trmk.ecloud.xml.ECloudOrgHandler; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.binders.BindCreateKeyToXmlPayload; import org.jclouds.trmk.vcloud_0_8.binders.OrgNameVDCNameNetworkNameToEndpoint; import org.jclouds.trmk.vcloud_0_8.domain.InternetService; @@ -79,75 +77,72 @@ import org.jclouds.trmk.vcloud_0_8.xml.NetworkHandler; import org.jclouds.trmk.vcloud_0_8.xml.PublicIpAddressHandler; import org.jclouds.trmk.vcloud_0_8.xml.VAppExtendedInfoHandler; -import com.google.common.util.concurrent.ListenableFuture; - /** - * Provides access to eCloud resources via their REST API. + * Provides access to VCloud resources via their REST API. *

* * @see * @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 { +public interface TerremarkECloudApi extends TerremarkVCloudApi { /** - * Provides asynchronous access to Data Center Operations. + * Provides synchronous access to Data Center Operations. * */ @Delegate - DataCenterOperationsAsyncClient getDataCenterOperationsClient(); + DataCenterOperationsApi getDataCenterOperationsApi(); /** - * Provides asynchronous access to Tag Operations. + * Provides synchronous access to Data Center Operations. * */ @Delegate - TagOperationsAsyncClient getTagOperationsClient(); + TagOperationsApi getTagOperationsApi(); + + /** + * {@inheritDoc} + */ + @Override + @GET + @XMLResponseParser(ECloudOrgHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(ORG_XML) + ECloudOrg getOrg(@EndpointParam URI orgId); @Override @GET @XMLResponseParser(ECloudOrgHandler.class) - @Fallback(NullOnNotFoundOr404.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) @Consumes(ORG_XML) - ListenableFuture getOrg(@EndpointParam URI orgId); + ECloudOrg findOrgNamed( + @Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName); - @Override - @GET - @XMLResponseParser(ECloudOrgHandler.class) - @Fallback(NullOnNotFoundOr404.class) - @Consumes(ORG_XML) - ListenableFuture findOrgNamed( - @Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName); - - /** - * @see TerremarkVCloudExpressClient#getAllInternetServices - */ @GET @Consumes(INTERNETSERVICESLIST_XML) @XMLResponseParser(InternetServicesHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) @Override - ListenableFuture> getAllInternetServicesInVDC( - @EndpointParam(parser = VDCURIToInternetServicesEndpoint.class) URI vDCId); + Set getAllInternetServicesInVDC( + @EndpointParam(parser = VDCURIToInternetServicesEndpoint.class) URI vDCId); /** - * @see TerremarkVCloudExpressClient#activatePublicIpInVDC + * Allocate a new public IP + * + * @param vDCId + * @return + * @throws org.jclouds.rest.InsufficientResourcesException + * if there's no additional ips available */ @POST @Consumes(PUBLICIP_XML) @XMLResponseParser(PublicIpAddressHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture activatePublicIpInVDC( - @EndpointParam(parser = VDCURIToPublicIPsEndpoint.class) URI vDCId); + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + PublicIpAddress activatePublicIpInVDC( + @EndpointParam(parser = VDCURIToPublicIPsEndpoint.class) URI vDCId); - /** - * @see TerremarkVCloudExpressClient#addInternetServiceToExistingIp - */ @POST @Path("/internetServices") @Produces(INTERNETSERVICE_XML) @@ -155,135 +150,106 @@ public interface TerremarkECloudAsyncClient extends TerremarkVCloudAsyncClient { @XMLResponseParser(InternetServiceHandler.class) @MapBinder(AddInternetServiceOptions.class) @Override - ListenableFuture addInternetServiceToExistingIp(@EndpointParam URI existingIpId, - @PayloadParam("name") String serviceName, @PayloadParam("protocol") Protocol protocol, - @PayloadParam("port") int port, AddInternetServiceOptions... options); + InternetService addInternetServiceToExistingIp(@EndpointParam URI existingIpId, + @PayloadParam("name") String serviceName, @PayloadParam("protocol") Protocol protocol, + @PayloadParam("port") int port, AddInternetServiceOptions... options); - /** - * @see TerremarkVCloudExpressClient#getInternetServicesOnPublicIP - */ @GET @Path("/internetServices") @Consumes(INTERNETSERVICESLIST_XML) @XMLResponseParser(InternetServicesHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) @Override - ListenableFuture> getInternetServicesOnPublicIp(@EndpointParam URI ipId); + Set getInternetServicesOnPublicIp(@EndpointParam URI ipId); - /** - * @see TerremarkVCloudExpressClient#getInternetService - */ @GET @Consumes(INTERNETSERVICESLIST_XML) @XMLResponseParser(InternetServiceHandler.class) - @Fallback(NullOnNotFoundOr404.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) @Override - ListenableFuture getInternetService(@EndpointParam URI internetServiceId); + InternetService getInternetService(@EndpointParam URI internetServiceId); - /** - * @see TerremarkVCloudExpressClient#findKeyPairInOrgNamed - */ + @Override @GET @XMLResponseParser(KeyPairByNameHandler.class) @Consumes(KEYSLIST_XML) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture findKeyPairInOrg( - @Nullable @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org, String keyName); + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + KeyPair findKeyPairInOrg(@Nullable @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org, String keyName); - /** - * @see TerremarkVCloudExpressClient#listKeyPairsInOrg - */ + @Override @GET @Consumes(KEYSLIST_XML) @XMLResponseParser(KeyPairsHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> listKeyPairsInOrg( - @Nullable @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org); + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + Set listKeyPairsInOrg(@Nullable @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org); - /** - * @see TerremarkECloudClient#listKeyPairs - */ @GET @Consumes(KEYSLIST_XML) @XMLResponseParser(KeyPairsHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> listKeyPairs(@EndpointParam URI keysList); + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + Set listKeyPairs(@EndpointParam URI keysList); - /** - * @see TerremarkECloudClient#generateKeyPairInOrg - */ + @Override @POST @Produces(KEYSLIST_XML) @Consumes(KEYSLIST_XML) @XMLResponseParser(KeyPairHandler.class) @MapBinder(BindCreateKeyToXmlPayload.class) - ListenableFuture generateKeyPairInOrg( - @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org, @PayloadParam("name") String name, - @PayloadParam("isDefault") boolean makeDefault); + KeyPair generateKeyPairInOrg( + @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org, @PayloadParam("name") String name, + @PayloadParam("isDefault") boolean makeDefault); - /** - * @see TerremarkECloudClient#getKeyPair - */ + @Override @GET @XMLResponseParser(KeyPairHandler.class) @Consumes(APPLICATION_XML) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getKeyPair(@EndpointParam URI keyId); + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + KeyPair getKeyPair(@EndpointParam URI keyId); - /** - * @see TerremarkECloudClient#deleteKeyPair - */ + @Override @DELETE - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture deleteKeyPair(@EndpointParam URI keyId); + @Fallback(Fallbacks.VoidOnNotFoundOr404.class) + void deleteKeyPair(@EndpointParam URI keyId); - /** - * @see TerremarkECloudClient#findNetworkInOrgVDCNamed - */ @Override @GET @Consumes(NETWORK_XML) @XMLResponseParser(NetworkHandler.class) - @Fallback(NullOnNotFoundOr404.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) @MapBinder(OrgNameVDCNameNetworkNameToEndpoint.class) - ListenableFuture findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, - @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String networkName); + Network findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String networkName); - /** - * @see TerremarkECloudClient#getNetwork - */ @Override @GET @Consumes(NETWORK_XML) @XMLResponseParser(NetworkHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getNetwork(@EndpointParam URI network); + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Network getNetwork(@EndpointParam URI network); - /** - * @see TerremarkECloudClient#getNetworkExtendedInfo - */ @GET @XMLResponseParser(NetworkExtendedInfoHandler.class) @Consumes(APPLICATION_XML) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getNetworkExtendedInfo(@EndpointParam URI network); + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + NetworkExtendedInfo getNetworkExtendedInfo(@EndpointParam URI network); - /** - * @see TerremarkECloudClient#getIpAddresses - */ @GET @Consumes(IPADDRESS_LIST_XML) @XMLResponseParser(IpAddressesHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> getIpAddresses(@EndpointParam URI network); + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + Set getIpAddresses(@EndpointParam URI network); /** - * @see TerremarkVCloudExpressClient#getInternetService + * Returns extended information for the vApp. + * + * @param vApp + * The URI at which the vApp information is available. + * @return Extended vApp information like tags, long name, network adapter + * information. */ @GET @Consumes(VAPPEXTINFO_XML) @XMLResponseParser(VAppExtendedInfoHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getVAppExtendedInfo(@EndpointParam URI href); - + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + VAppExtendedInfo getVAppExtendedInfo(@EndpointParam URI href); } 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 d117523e39..58f20d9c2b 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 @@ -24,11 +24,10 @@ import java.util.Properties; import org.jclouds.apis.ApiMetadata; import org.jclouds.trmk.ecloud.compute.config.TerremarkECloudComputeServiceContextModule; -import org.jclouds.trmk.ecloud.config.TerremarkECloudRestClientModule; +import org.jclouds.trmk.ecloud.config.TerremarkECloudHttpApiModule; import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudApiMetadata; import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; import com.google.inject.Module; /** @@ -38,15 +37,7 @@ import com.google.inject.Module; */ public class TerremarkECloudApiMetadata extends TerremarkVCloudApiMetadata { - /** - * @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; - }; - + @Override public Builder toBuilder() { return new Builder().fromApiMetadata(this); @@ -69,16 +60,14 @@ public class TerremarkECloudApiMetadata extends TerremarkVCloudApiMetadata { public static class Builder extends TerremarkVCloudApiMetadata.Builder { - @SuppressWarnings("deprecation") protected Builder() { - super(TerremarkECloudClient.class, TerremarkECloudAsyncClient.class); id("trmk-ecloud") .name("Terremark Enterprise Cloud v2.8 API") .version("0.8b-ext2.8") .defaultEndpoint("https://services.enterprisecloud.terremark.com/api") .documentation(URI.create("http://support.theenterprisecloud.com/kb/default.asp?id=533&Lang=1&SID=")) .defaultProperties(TerremarkECloudApiMetadata.defaultProperties()) - .defaultModules(ImmutableSet.>of(TerremarkECloudRestClientModule.class, TerremarkECloudComputeServiceContextModule.class)); + .defaultModules(ImmutableSet.>of(TerremarkECloudHttpApiModule.class, TerremarkECloudComputeServiceContextModule.class)); } @Override diff --git a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudClient.java b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudClient.java deleted file mode 100644 index 78cd5f91a2..0000000000 --- a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/TerremarkECloudClient.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.trmk.ecloud; - -import java.net.URI; -import java.util.Set; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.rest.annotations.Delegate; -import org.jclouds.trmk.ecloud.domain.ECloudOrg; -import org.jclouds.trmk.ecloud.features.DataCenterOperationsClient; -import org.jclouds.trmk.ecloud.features.TagOperationsClient; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; -import org.jclouds.trmk.vcloud_0_8.domain.IpAddress; -import org.jclouds.trmk.vcloud_0_8.domain.Network; -import org.jclouds.trmk.vcloud_0_8.domain.NetworkExtendedInfo; -import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress; -import org.jclouds.trmk.vcloud_0_8.domain.VAppExtendedInfo; - -/** - * Provides access to VCloud resources via their REST API. - *

- * - * @see - * @author Adrian Cole - */ -public interface TerremarkECloudClient extends TerremarkVCloudClient { - /** - * Provides synchronous access to Data Center Operations. - * - */ - @Delegate - DataCenterOperationsClient getDataCenterOperationsClient(); - - /** - * Provides synchronous access to Data Center Operations. - * - */ - @Delegate - TagOperationsClient getTagOperationsClient(); - - /** - * {@inheritDoc} - */ - @Override - ECloudOrg getOrg(URI orgId); - - /** - * Allocate a new public IP - * - * @param vDCId - * @return - * @throws org.jclouds.rest.InsufficientResourcesException - * if there's no additional ips available - */ - PublicIpAddress activatePublicIpInVDC(URI vDCId); - - Network findNetworkInOrgVDCNamed(@Nullable String orgName, @Nullable String vdc, String networkName); - - Network getNetwork(URI network); - - NetworkExtendedInfo getNetworkExtendedInfo(URI network); - - Set getIpAddresses(URI network); - - /** - * Returns extended information for the vApp. - * - * @param vApp - * The URI at which the vApp information is available. - * @return Extended vApp information like tags, long name, network adapter - * information. - */ - VAppExtendedInfo getVAppExtendedInfo(URI href); -} diff --git a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/config/TerremarkECloudRestClientModule.java b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/config/TerremarkECloudHttpApiModule.java similarity index 67% rename from providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/config/TerremarkECloudRestClientModule.java rename to providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/config/TerremarkECloudHttpApiModule.java index 8355256464..78b98ced4b 100644 --- a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/config/TerremarkECloudRestClientModule.java +++ b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/config/TerremarkECloudHttpApiModule.java @@ -18,28 +18,19 @@ package org.jclouds.trmk.ecloud.config; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.Map; - import javax.inject.Inject; import javax.inject.Singleton; import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.trmk.ecloud.TerremarkECloudAsyncClient; -import org.jclouds.trmk.ecloud.TerremarkECloudClient; -import org.jclouds.trmk.ecloud.features.DataCenterOperationsAsyncClient; -import org.jclouds.trmk.ecloud.features.DataCenterOperationsClient; -import org.jclouds.trmk.ecloud.features.TagOperationsAsyncClient; -import org.jclouds.trmk.ecloud.features.TagOperationsClient; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; +import org.jclouds.trmk.ecloud.TerremarkECloudApi; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.config.DefaultVCloudReferencesModule; -import org.jclouds.trmk.vcloud_0_8.config.TerremarkVCloudRestClientModule; +import org.jclouds.trmk.vcloud_0_8.config.TerremarkVCloudHttpApiModule; import org.jclouds.trmk.vcloud_0_8.domain.Network; import org.jclouds.trmk.vcloud_0_8.domain.NetworkExtendedInfo; import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableMap; import com.google.inject.Injector; import com.google.inject.Provides; @@ -50,36 +41,21 @@ import com.google.inject.Provides; * @author Adrian Cole */ @ConfiguresRestClient -public class TerremarkECloudRestClientModule extends - TerremarkVCloudRestClientModule { - - public static final Map, Class> DELEGATE_MAP = ImmutableMap., Class> builder()// - .put(DataCenterOperationsClient.class, DataCenterOperationsAsyncClient.class)// - .put(TagOperationsClient.class, TagOperationsAsyncClient.class)// - .build(); - - public TerremarkECloudRestClientModule() { - super(DELEGATE_MAP); - } +public class TerremarkECloudHttpApiModule extends + TerremarkVCloudHttpApiModule { @Provides @Singleton - protected TerremarkVCloudAsyncClient provideTerremarkAsyncClient(TerremarkECloudAsyncClient in) { - return in; - } - - @Provides - @Singleton - protected TerremarkVCloudClient provideTerremarkClient(TerremarkECloudClient in) { + protected TerremarkVCloudApi provideTerremarkApi(TerremarkECloudApi in) { return in; } @Singleton public static class IsDMZNetwork implements Predicate { - private final TerremarkECloudClient client; + private final TerremarkECloudApi client; @Inject - public IsDMZNetwork(TerremarkECloudClient client) { + public IsDMZNetwork(TerremarkECloudApi client) { this.client = client; } diff --git a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsAsyncClient.java b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsApi.java similarity index 65% rename from providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsAsyncClient.java rename to providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsApi.java index 2271307f44..ba31d97471 100644 --- a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsAsyncClient.java +++ b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsApi.java @@ -24,7 +24,7 @@ import java.util.Set; import javax.ws.rs.Consumes; import javax.ws.rs.GET; -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; +import org.jclouds.Fallbacks; import org.jclouds.javax.annotation.Nullable; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; @@ -32,40 +32,44 @@ import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.trmk.ecloud.functions.OrgURIToDataCentersListEndpoint; import org.jclouds.trmk.vcloud_0_8.domain.DataCenter; -import org.jclouds.trmk.vcloud_0_8.domain.KeyPair; import org.jclouds.trmk.vcloud_0_8.filters.SetVCloudTokenCookie; import org.jclouds.trmk.vcloud_0_8.xml.DataCentersHandler; -import com.google.common.util.concurrent.ListenableFuture; - /** - * - * @see - * @see DataCenterOperationsClient + * Data Center Operations access to DataCenterOperations functionality in vCloud + *

+ * There are times where knowing a data center is necessary to complete certain + * operations (i.e. uploading a catalog item). The data centers for an + * organization are those data centers that contain at least one of the + * organization's environments. * * @author Adrian Cole */ @RequestFilters(SetVCloudTokenCookie.class) -public interface DataCenterOperationsAsyncClient { +public interface DataCenterOperationsApi { /** - * @see DataCenterOperationsClient#listDataCentersInOrg + * This call will get the list of data centers that contain at least one of + * the organization's environments. + * + * + * @return data centers */ @GET @Consumes(DATACENTERSLIST_XML) @XMLResponseParser(DataCentersHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> listDataCentersInOrg( - @Nullable @EndpointParam(parser = OrgURIToDataCentersListEndpoint.class) URI org); + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + Set listDataCentersInOrg(@Nullable @EndpointParam(parser = OrgURIToDataCentersListEndpoint.class) URI org); /** - * @see DataCenterOperationsClient#listDataCenters + * This call will get the list of data centers by list id. + * + * @return data centers */ @GET @Consumes(DATACENTERSLIST_XML) @XMLResponseParser(DataCentersHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> listDataCenters(@EndpointParam URI dataCenters); + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + Set listDataCenters(@EndpointParam URI dataCenters); + } diff --git a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsClient.java b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsClient.java deleted file mode 100644 index 6728cd3dcb..0000000000 --- a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsClient.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.trmk.ecloud.features; - -import java.net.URI; -import java.util.Set; -import org.jclouds.trmk.vcloud_0_8.domain.DataCenter; - -/** - * Data Center Operations access to DataCenterOperations functionality in vCloud - *

- * There are times where knowing a data center is necessary to complete certain - * operations (i.e. uploading a catalog item). The data centers for an - * organization are those data centers that contain at least one of the - * organization's environments. - * - * @see DataCenterOperationsAsyncClient - * @author Adrian Cole - */ -public interface DataCenterOperationsClient { - - /** - * This call will get the list of data centers that contain at least one of - * the organization's environments. - * - * - * @return data centers - */ - Set listDataCentersInOrg(URI orgId); - - /** - * This call will get the list of data centers by list id. - * - * @return data centers - */ - Set listDataCenters(URI dataCentersList); - -} diff --git a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/TagOperationsAsyncClient.java b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/TagOperationsApi.java similarity index 69% rename from providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/TagOperationsAsyncClient.java rename to providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/TagOperationsApi.java index 875baae387..f024ba30b1 100644 --- a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/TagOperationsAsyncClient.java +++ b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/TagOperationsApi.java @@ -24,7 +24,7 @@ import java.util.Map; import javax.ws.rs.Consumes; import javax.ws.rs.GET; -import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404; +import org.jclouds.Fallbacks; import org.jclouds.javax.annotation.Nullable; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; @@ -34,36 +34,35 @@ import org.jclouds.trmk.ecloud.functions.OrgURIToTagsListEndpoint; import org.jclouds.trmk.ecloud.xml.TagNameToUsageCountHandler; import org.jclouds.trmk.vcloud_0_8.filters.SetVCloudTokenCookie; -import com.google.common.util.concurrent.ListenableFuture; - /** - * - * @see - * @see TagOperationsClient + * Tag Based Operations + *

* * @author Adrian Cole */ @RequestFilters(SetVCloudTokenCookie.class) -public interface TagOperationsAsyncClient { +public interface TagOperationsApi { /** - * @see TagOperationsClient#getTagNameToUsageCountInOrg + * This call returns the list of all tags belonging to the organization. + * + * @return tags */ @GET @Consumes(TAGSLISTLIST_XML) @XMLResponseParser(TagNameToUsageCountHandler.class) - @Fallback(EmptyMapOnNotFoundOr404.class) - ListenableFuture> getTagNameToUsageCountInOrg( - @Nullable @EndpointParam(parser = OrgURIToTagsListEndpoint.class) URI org); + @Fallback(Fallbacks.EmptyMapOnNotFoundOr404.class) + Map getTagNameToUsageCountInOrg(@Nullable @EndpointParam(parser = OrgURIToTagsListEndpoint.class) URI org); /** - * @see TagOperationsClient#getTagNameToUsageCount + * This call returns the list of all tags by list id. + * + * @return tags */ @GET @Consumes(TAGSLISTLIST_XML) @XMLResponseParser(TagNameToUsageCountHandler.class) - @Fallback(EmptyMapOnNotFoundOr404.class) - ListenableFuture> getTagNameToUsageCount(@EndpointParam URI tagList); + @Fallback(Fallbacks.EmptyMapOnNotFoundOr404.class) + Map getTagNameToUsageCount(@EndpointParam URI tagList); + } diff --git a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/TagOperationsClient.java b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/TagOperationsClient.java deleted file mode 100644 index 7e1cbadebf..0000000000 --- a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/TagOperationsClient.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.trmk.ecloud.features; - -import java.net.URI; -import java.util.Map; -/** - * Tag Based Operations - *

- * - * @see TagOperationsAsyncClient - * @author Adrian Cole - */ -public interface TagOperationsClient { - - /** - * This call returns the list of all tags belonging to the organization. - * - * @return tags - */ - Map getTagNameToUsageCountInOrg(URI orgId); - - /** - * This call returns the list of all tags by list id. - * - * @return tags - */ - Map getTagNameToUsageCount(URI tagsList); - -} diff --git a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/suppliers/TerremarkECloudInternetServiceAndPublicIpAddressSupplier.java b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/suppliers/TerremarkECloudInternetServiceAndPublicIpAddressSupplier.java index 0866aa294c..7316464fa2 100644 --- a/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/suppliers/TerremarkECloudInternetServiceAndPublicIpAddressSupplier.java +++ b/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/suppliers/TerremarkECloudInternetServiceAndPublicIpAddressSupplier.java @@ -30,7 +30,7 @@ import javax.inject.Singleton; import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; import org.jclouds.rest.InsufficientResourcesException; -import org.jclouds.trmk.ecloud.TerremarkECloudClient; +import org.jclouds.trmk.ecloud.TerremarkECloudApi; import org.jclouds.trmk.vcloud_0_8.domain.InternetService; import org.jclouds.trmk.vcloud_0_8.domain.Protocol; import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress; @@ -50,10 +50,10 @@ public class TerremarkECloudInternetServiceAndPublicIpAddressSupplier implements @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER) public Logger logger = Logger.NULL; - protected final TerremarkECloudClient client; + protected final TerremarkECloudApi client; @Inject - public TerremarkECloudInternetServiceAndPublicIpAddressSupplier(TerremarkECloudClient client) { + public TerremarkECloudInternetServiceAndPublicIpAddressSupplier(TerremarkECloudApi client) { this.client = client; } 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/BaseTerremarkECloudApiLiveTest.java similarity index 84% rename from providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudClientLiveTest.java rename to providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudApiLiveTest.java index f1d3b58428..77258c6812 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/BaseTerremarkECloudApiLiveTest.java @@ -18,7 +18,7 @@ package org.jclouds.trmk.ecloud; import java.util.Properties; -import org.jclouds.trmk.vcloud_0_8.internal.BaseTerremarkClientLiveTest; +import org.jclouds.trmk.vcloud_0_8.internal.BaseTerremarkApiLiveTest; import org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants; import org.testng.annotations.Test; @@ -26,7 +26,7 @@ import org.testng.annotations.Test; * @author Adrian Cole */ @Test(groups = "live", enabled = true, singleThreaded = true) -public class BaseTerremarkECloudClientLiveTest extends BaseTerremarkClientLiveTest { +public class BaseTerremarkECloudApiLiveTest extends BaseTerremarkApiLiveTest { @Override protected Properties setupProperties() { Properties props = super.setupProperties(); @@ -35,7 +35,7 @@ public class BaseTerremarkECloudClientLiveTest extends BaseTerremarkClientLiveTe return props; } - protected TerremarkECloudClient api() { - return TerremarkECloudClient.class.cast(api); + protected TerremarkECloudApi api() { + return TerremarkECloudApi.class.cast(api); } } diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudAsyncClientTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudApiTest.java similarity index 96% rename from providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudAsyncClientTest.java rename to providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudApiTest.java index 977a13d2d5..33d8cfc530 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudAsyncClientTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/BaseTerremarkECloudApiTest.java @@ -32,7 +32,7 @@ import org.jclouds.providers.ProviderMetadata; import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.internal.BaseAsyncClientTest; -import org.jclouds.trmk.ecloud.config.TerremarkECloudRestClientModule; +import org.jclouds.trmk.ecloud.config.TerremarkECloudHttpApiModule; import org.jclouds.trmk.ecloud.domain.internal.ECloudOrgImpl; import org.jclouds.trmk.vcloud_0_8.domain.Org; import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; @@ -43,8 +43,8 @@ import org.jclouds.trmk.vcloud_0_8.domain.internal.CatalogItemImpl; import org.jclouds.trmk.vcloud_0_8.domain.internal.ReferenceTypeImpl; import org.jclouds.trmk.vcloud_0_8.domain.internal.VDCImpl; import org.jclouds.trmk.vcloud_0_8.filters.SetVCloudTokenCookie; -import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginClient; -import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsClient; +import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginApi; +import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsApi; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; @@ -56,7 +56,7 @@ import com.google.inject.TypeLiteral; /** * @author Adrian Cole */ -public abstract class BaseTerremarkECloudAsyncClientTest extends BaseAsyncClientTest { +public abstract class BaseTerremarkECloudApiTest extends BaseAsyncClientTest { @Override protected void checkFilters(HttpRequest request) { @@ -66,7 +66,7 @@ public abstract class BaseTerremarkECloudAsyncClientTest extends BaseAsyncCli @Override protected Module createModule() { - return new TerremarkECloudRestClientModuleExtension(); + return new TerremarkECloudHttpApiModuleExtension(); } @Override @@ -125,10 +125,10 @@ public abstract class BaseTerremarkECloudAsyncClientTest extends BaseAsyncCli ImmutableMap. of(NETWORK_REF.getName(), NETWORK_REF)); @ConfiguresRestClient - protected static class TerremarkECloudRestClientModuleExtension extends TerremarkECloudRestClientModule { + protected static class TerremarkECloudHttpApiModuleExtension extends TerremarkECloudHttpApiModule { @Override - protected Supplier provideAuthenticationURI(TerremarkVCloudVersionsClient versionService, String version) { + protected Supplier provideAuthenticationURI(TerremarkVCloudVersionsApi versionService, String version) { return Suppliers.ofInstance(URI.create("https://vcloud.safesecureweb.com/api/v0.8/login")); } @@ -163,7 +163,7 @@ public abstract class BaseTerremarkECloudAsyncClientTest extends BaseAsyncCli @Override protected Supplier provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds, - AtomicReference authException, TerremarkVCloudLoginClient login) { + AtomicReference authException, TerremarkVCloudLoginApi login) { return Suppliers. ofInstance(new VCloudSession() { @Override 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/TerremarkECloudApiLiveTest.java similarity index 88% rename from providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudClientLiveTest.java rename to providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudApiLiveTest.java index 4dd9c55f1e..80b851c25f 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/TerremarkECloudApiLiveTest.java @@ -22,7 +22,7 @@ import java.util.Properties; import org.jclouds.domain.LoginCredentials; import org.jclouds.ssh.SshClient; import org.jclouds.trmk.ecloud.suppliers.TerremarkECloudInternetServiceAndPublicIpAddressSupplier; -import org.jclouds.trmk.vcloud_0_8.TerremarkClientLiveTest; +import org.jclouds.trmk.vcloud_0_8.TerremarkApiLiveTest; import org.jclouds.trmk.vcloud_0_8.domain.InternetService; import org.jclouds.trmk.vcloud_0_8.domain.Protocol; import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress; @@ -33,14 +33,14 @@ import org.testng.annotations.Test; import com.google.common.net.HostAndPort; /** - * Tests behavior of {@code TerremarkECloudClient} + * Tests behavior of {@code TerremarkECloudApi} * * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TerremarkECloudClientLiveTest") -public class TerremarkECloudClientLiveTest extends TerremarkClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TerremarkECloudApiLiveTest") +public class TerremarkECloudApiLiveTest extends TerremarkApiLiveTest { - public TerremarkECloudClientLiveTest() { + public TerremarkECloudApiLiveTest() { this.provider = "trmk-ecloud"; this.itemName = "Ubuntu Server 10.04 x64"; this.expectedOs = "Ubuntu Linux (64-bit)"; @@ -62,7 +62,7 @@ public class TerremarkECloudClientLiveTest extends TerremarkClientLiveTest { @Override protected Entry getNewInternetServiceAndIpForSSH(VApp vApp) { - return new TerremarkECloudInternetServiceAndPublicIpAddressSupplier(TerremarkECloudClient.class.cast(api)) + return new TerremarkECloudInternetServiceAndPublicIpAddressSupplier(TerremarkECloudApi.class.cast(api)) .getNewInternetServiceAndIp(vApp, 22, Protocol.TCP); } diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClientTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudApiTest.java similarity index 89% rename from providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClientTest.java rename to providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudApiTest.java index 70d964f440..f072162347 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudAsyncClientTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/TerremarkECloudApiTest.java @@ -58,22 +58,22 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.reflect.Invokable; /** - * Tests behavior of {@code TerremarkECloudAsyncClient} + * Tests behavior of {@code TerremarkECloudApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", singleThreaded = true, testName = "TerremarkECloudAsyncClientTest") -public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClientTest { +@Test(groups = "unit", singleThreaded = true, testName = "TerremarkECloudApiTest") +public class TerremarkECloudApiTest extends BaseTerremarkECloudApiTest { public void testListOrgs() { - assertEquals(injector.getInstance(TerremarkECloudAsyncClient.class).listOrgs().toString(), + assertEquals(injector.getInstance(TerremarkECloudApi.class).listOrgs().toString(), ImmutableMap.of(ORG_REF.getName(), ORG_REF).toString()); } public void testNetwork() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "getNetwork", URI.class); + Invokable method = method(TerremarkECloudApi.class, "getNetwork", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdcItem/2"))); @@ -89,7 +89,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testDelete() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "deleteVApp", URI.class); + Invokable method = method(TerremarkECloudApi.class, "deleteVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"))); @@ -105,7 +105,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testFindNetworkInOrgVDCNamed() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "findNetworkInOrgVDCNamed", String.class, + Invokable method = method(TerremarkECloudApi.class, "findNetworkInOrgVDCNamed", String.class, String.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of("org", "vdc", "network")); @@ -124,7 +124,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie * ignore parameter of catalog id since this doesn't work */ public void testCatalog() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "getCatalog", URI.class); + Invokable method = method(TerremarkECloudApi.class, "getCatalog", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://catalog"))); assertRequestLineEquals(request, "GET https://catalog HTTP/1.1"); @@ -139,7 +139,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "getVDC", URI.class); + Invokable method = method(TerremarkECloudApi.class, "getVDC", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/vdc/1"))); assertRequestLineEquals(request, "GET https://vcloud/vdc/1 HTTP/1.1"); @@ -154,7 +154,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testInstantiateVAppTemplateInVDCURI() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "instantiateVAppTemplateInVDC", URI.class, URI.class, + Invokable method = method(TerremarkECloudApi.class, "instantiateVAppTemplateInVDC", URI.class, URI.class, String.class, InstantiateVAppTemplateOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI.create("https://vcloud/vAppTemplate/3"), @@ -176,7 +176,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie public void testInstantiateVAppTemplateInVDCURIOptions() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "instantiateVAppTemplateInVDC", URI.class, URI.class, + Invokable method = method(TerremarkECloudApi.class, "instantiateVAppTemplateInVDC", URI.class, URI.class, String.class, InstantiateVAppTemplateOptions[].class); GeneratedHttpRequest request = processor.createRequest( method, ImmutableList. of( @@ -202,7 +202,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testActivatePublicIpInVDC() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "activatePublicIpInVDC", URI.class); + Invokable method = method(TerremarkECloudApi.class, "activatePublicIpInVDC", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))); @@ -218,7 +218,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testGetAllInternetServices() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "getAllInternetServicesInVDC", URI.class); + Invokable method = method(TerremarkECloudApi.class, "getAllInternetServicesInVDC", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))); @@ -234,7 +234,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testGetInternetService() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "getInternetService", URI.class); + Invokable method = method(TerremarkECloudApi.class, "getInternetService", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/internetService/12"))); assertRequestLineEquals(request, "GET https://vcloud/extensions/internetService/12 HTTP/1.1"); @@ -249,7 +249,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testDeleteInternetService() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "deleteInternetService", URI.class); + Invokable method = method(TerremarkECloudApi.class, "deleteInternetService", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/internetService/12"))); assertRequestLineEquals(request, "DELETE https://vcloud/extensions/internetService/12 HTTP/1.1"); @@ -264,7 +264,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testAddInternetServiceToExistingIp() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "addInternetServiceToExistingIp", URI.class, + Invokable method = method(TerremarkECloudApi.class, "addInternetServiceToExistingIp", URI.class, String.class, Protocol.class, int.class, AddInternetServiceOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/publicIp/12"), "name", Protocol.TCP, 22)); @@ -285,7 +285,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testAddInternetServiceToExistingIpOptions() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "addInternetServiceToExistingIp", URI.class, + Invokable method = method(TerremarkECloudApi.class, "addInternetServiceToExistingIp", URI.class, String.class, Protocol.class, int.class, AddInternetServiceOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/publicIp/12"), "name", Protocol.TCP, 22, disabled().withDescription("yahoo").monitorDisabled())); @@ -304,7 +304,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testAddNode() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "addNode", URI.class, String.class, String.class, + Invokable method = method(TerremarkECloudApi.class, "addNode", URI.class, String.class, String.class, int.class, AddNodeOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/internetService/12"), "10.2.2.2", "name", 22)); @@ -325,7 +325,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testAddNodeOptions() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "addNode", URI.class, String.class, String.class, + Invokable method = method(TerremarkECloudApi.class, "addNode", URI.class, String.class, String.class, int.class, AddNodeOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/internetService/12"), "10.2.2.2", "name", 22, AddNodeOptions.Builder.disabled().withDescription("yahoo"))); @@ -346,7 +346,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testGetKeyPairInOrg() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "findKeyPairInOrg", URI.class, String.class); + Invokable method = method(TerremarkECloudApi.class, "findKeyPairInOrg", URI.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), "keyPair")); @@ -362,7 +362,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testConfigureNodeWithDescription() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "configureNode", URI.class, String.class, + Invokable method = method(TerremarkECloudApi.class, "configureNode", URI.class, String.class, boolean.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/nodeService/12"), "name", true, "eggs")); @@ -381,7 +381,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testConfigureNodeNoDescription() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "configureNode", URI.class, String.class, + Invokable method = method(TerremarkECloudApi.class, "configureNode", URI.class, String.class, boolean.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, Lists. newArrayList(URI.create("https://vcloud/extensions/nodeService/12"), "name", true, null)); @@ -400,7 +400,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testGetNodes() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "getNodes", URI.class); + Invokable method = method(TerremarkECloudApi.class, "getNodes", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/internetService/12"))); assertRequestLineEquals(request, "GET https://vcloud/extensions/internetService/12/nodeServices HTTP/1.1"); @@ -415,7 +415,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testDeleteNode() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "deleteNode", URI.class); + Invokable method = method(TerremarkECloudApi.class, "deleteNode", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/nodeService/12"))); assertRequestLineEquals(request, "DELETE https://vcloud/extensions/nodeService/12 HTTP/1.1"); @@ -430,7 +430,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testGetCustomizationOptionsOfCatalogItem() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "getCustomizationOptions", URI.class); + Invokable method = method(TerremarkECloudApi.class, "getCustomizationOptions", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/template/12"))); assertRequestLineEquals(request, "GET https://vcloud/extensions/template/12 HTTP/1.1"); @@ -446,7 +446,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testListKeyPairsInOrg() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "listKeyPairsInOrg", URI.class); + Invokable method = method(TerremarkECloudApi.class, "listKeyPairsInOrg", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"))); @@ -463,12 +463,12 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie @Test(expectedExceptions = ResourceNotFoundException.class) public void testListKeyPairsInOrgNotFound() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "listKeyPairsInOrg", URI.class); + Invokable method = method(TerremarkECloudApi.class, "listKeyPairsInOrg", URI.class); processor.createRequest(method, ImmutableList. of(URI.create("d"))); } public void testGetKeyPair() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "getKeyPair", URI.class); + Invokable method = method(TerremarkECloudApi.class, "getKeyPair", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/key/12"))); assertRequestLineEquals(request, "GET https://vcloud/extensions/key/12 HTTP/1.1"); @@ -483,7 +483,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testDeleteKeyPair() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "deleteKeyPair", URI.class); + Invokable method = method(TerremarkECloudApi.class, "deleteKeyPair", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/key/12"))); assertRequestLineEquals(request, "DELETE https://vcloud/extensions/key/12 HTTP/1.1"); @@ -498,7 +498,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testGetNode() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "getNode", URI.class); + Invokable method = method(TerremarkECloudApi.class, "getNode", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/nodeService/12"))); assertRequestLineEquals(request, "GET https://vcloud/extensions/nodeService/12 HTTP/1.1"); @@ -513,7 +513,7 @@ public class TerremarkECloudAsyncClientTest extends BaseTerremarkECloudAsyncClie } public void testGetExtendedInfo() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkECloudAsyncClient.class, "getVAppExtendedInfo", URI.class); + Invokable method = method(TerremarkECloudApi.class, "getVAppExtendedInfo", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/vapp/12"))); assertRequestLineEquals(request, "GET https://vcloud/extensions/vapp/12 HTTP/1.1"); 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 102b649673..9113a71846 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 @@ -47,7 +47,7 @@ public class TerremarkECloudClientMockTest { private static final Set modules = ImmutableSet. of( new ExecutorServiceModule(sameThreadExecutor(), sameThreadExecutor())); - static TerremarkECloudClient mockTerremarkECloudClient(String uri) { + static TerremarkECloudApi mockTerremarkECloudClient(String uri) { Properties overrides = new Properties(); overrides.setProperty(PROPERTY_MAX_RETRIES, "1"); return ContextBuilder.newBuilder("trmk-ecloud") @@ -55,7 +55,7 @@ public class TerremarkECloudClientMockTest { .endpoint(uri) .overrides(overrides) .modules(modules) - .buildApi(TerremarkECloudClient.class); + .buildApi(TerremarkECloudApi.class); } String versionXML = "0.8b-ext2.8URLv0.8/login"; @@ -70,7 +70,7 @@ public class TerremarkECloudClientMockTest { .addHeader("x-vcloud-authorization", "cookie") .setBody("")); - TerremarkECloudClient api = mockTerremarkECloudClient(server.getUrl("/").toString()); + TerremarkECloudApi api = mockTerremarkECloudClient(server.getUrl("/").toString()); try { api.listOrgs(); 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 017350d6fe..b1ba895a23 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 @@ -29,7 +29,7 @@ import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.internal.BaseComputeServiceLiveTest; import org.jclouds.sshj.config.SshjSshClientModule; -import org.jclouds.trmk.ecloud.TerremarkECloudClient; +import org.jclouds.trmk.ecloud.TerremarkECloudApi; import org.jclouds.trmk.vcloud_0_8.domain.VApp; import org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants; import org.testng.annotations.Test; @@ -100,7 +100,7 @@ public class TerremarkECloudComputeServiceLiveTest extends BaseComputeServiceLiv assert node.getLocation() != null; assertEquals(node.getType(), ComputeType.NODE); NodeMetadata allData = client.getNodeMetadata(node.getId()); - TerremarkECloudClient api = view.utils().injector().getInstance(TerremarkECloudClient.class); + TerremarkECloudApi api = view.utils().injector().getInstance(TerremarkECloudApi.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/DataCenterOperationsApiLiveTest.java similarity index 78% rename from providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsClientLiveTest.java rename to providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsApiLiveTest.java index 9f1857d219..1ce7924340 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/DataCenterOperationsApiLiveTest.java @@ -19,7 +19,7 @@ package org.jclouds.trmk.ecloud.features; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; -import org.jclouds.trmk.ecloud.BaseTerremarkECloudClientLiveTest; +import org.jclouds.trmk.ecloud.BaseTerremarkECloudApiLiveTest; import org.jclouds.trmk.ecloud.domain.ECloudOrg; import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; import org.testng.annotations.Test; @@ -27,8 +27,8 @@ import org.testng.annotations.Test; /** * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "DataCenterOperationsClientLiveTest") -public class DataCenterOperationsClientLiveTest extends BaseTerremarkECloudClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "DataCenterOperationsApiLiveTest") +public class DataCenterOperationsApiLiveTest extends BaseTerremarkECloudApiLiveTest { @Test public void testListDataCentersInOrg() throws Exception { for (ReferenceType response : api().listOrgs().values()) { @@ -36,8 +36,8 @@ public class DataCenterOperationsClientLiveTest extends BaseTerremarkECloudClien assertNotNull(response); assertNotNull(response.getName()); assertNotNull(response.getHref()); - assertEquals(api().getDataCenterOperationsClient().listDataCentersInOrg(org.getHref()), api() - .getDataCenterOperationsClient().listDataCenters(org.getDataCenters().getHref())); + assertEquals(api().getDataCenterOperationsApi().listDataCentersInOrg(org.getHref()), api() + .getDataCenterOperationsApi().listDataCenters(org.getDataCenters().getHref())); } } } diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsAsyncClientTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsApiTest.java similarity index 85% rename from providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsAsyncClientTest.java rename to providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsApiTest.java index 19a1ada172..88ca8e900f 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsAsyncClientTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsApiTest.java @@ -24,25 +24,25 @@ import java.net.URI; import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; import org.jclouds.http.functions.ParseSax; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.trmk.ecloud.BaseTerremarkECloudAsyncClientTest; +import org.jclouds.trmk.ecloud.BaseTerremarkECloudApiTest; import org.jclouds.trmk.vcloud_0_8.xml.DataCentersHandler; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; /** - * Tests behavior of {@code DataCenterOperationsAsyncClient} + * Tests behavior of {@code DataCenterOperationsApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", testName = "DataCenterOperationsAsyncClientTest") -public class DataCenterOperationsAsyncClientTest extends - BaseTerremarkECloudAsyncClientTest { +@Test(groups = "unit", testName = "DataCenterOperationsApiTest") +public class DataCenterOperationsApiTest extends + BaseTerremarkECloudApiTest { public void testlistDataCenters() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(DataCenterOperationsAsyncClient.class, "listDataCenters", URI.class); + Invokable method = method(DataCenterOperationsApi.class, "listDataCenters", URI.class); GeneratedHttpRequest request = processor .createRequest( method, ImmutableList. of( @@ -61,7 +61,7 @@ public class DataCenterOperationsAsyncClientTest extends } public void testlistDataCentersInOrg() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(DataCenterOperationsAsyncClient.class, "listDataCentersInOrg", URI.class); + Invokable method = method(DataCenterOperationsApi.class, "listDataCentersInOrg", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"))); 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/TagOperationsApiLiveTest.java similarity index 79% rename from providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsClientLiveTest.java rename to providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsApiLiveTest.java index 146949e2b0..bc7e1948ad 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/TagOperationsApiLiveTest.java @@ -19,7 +19,7 @@ package org.jclouds.trmk.ecloud.features; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; -import org.jclouds.trmk.ecloud.BaseTerremarkECloudClientLiveTest; +import org.jclouds.trmk.ecloud.BaseTerremarkECloudApiLiveTest; import org.jclouds.trmk.ecloud.domain.ECloudOrg; import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType; import org.testng.annotations.Test; @@ -27,8 +27,8 @@ import org.testng.annotations.Test; /** * @author Adrian Cole */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TagOperationsClientLiveTest") -public class TagOperationsClientLiveTest extends BaseTerremarkECloudClientLiveTest { +@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TagOperationsApiLiveTest") +public class TagOperationsApiLiveTest extends BaseTerremarkECloudApiLiveTest { @Test public void testListTagsInOrg() throws Exception { for (ReferenceType response : api().listOrgs().values()) { @@ -36,8 +36,8 @@ public class TagOperationsClientLiveTest extends BaseTerremarkECloudClientLiveTe assertNotNull(response); assertNotNull(response.getName()); assertNotNull(response.getHref()); - assertEquals(api().getTagOperationsClient().getTagNameToUsageCountInOrg(org.getHref()), api() - .getTagOperationsClient().getTagNameToUsageCount(org.getTags().getHref())); + assertEquals(api().getTagOperationsApi().getTagNameToUsageCountInOrg(org.getHref()), api() + .getTagOperationsApi().getTagNameToUsageCount(org.getTags().getHref())); } } } diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsAsyncClientTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsApiTest.java similarity index 85% rename from providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsAsyncClientTest.java rename to providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsApiTest.java index 9f56023b1c..a58eb40f49 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsAsyncClientTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/trmk/ecloud/features/TagOperationsApiTest.java @@ -24,24 +24,24 @@ import java.net.URI; import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404; import org.jclouds.http.functions.ParseSax; import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.trmk.ecloud.BaseTerremarkECloudAsyncClientTest; +import org.jclouds.trmk.ecloud.BaseTerremarkECloudApiTest; import org.jclouds.trmk.ecloud.xml.TagNameToUsageCountHandler; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; /** - * Tests behavior of {@code TagOperationsAsyncClient} + * Tests behavior of {@code TagOperationsApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", testName = "TagOperationsAsyncClientTest") -public class TagOperationsAsyncClientTest extends BaseTerremarkECloudAsyncClientTest { +@Test(groups = "unit", testName = "TagOperationsApiTest") +public class TagOperationsApiTest extends BaseTerremarkECloudApiTest { public void testgetTagNameToUsageCount() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TagOperationsAsyncClient.class, "getTagNameToUsageCount", URI.class); + Invokable method = method(TagOperationsApi.class, "getTagNameToUsageCount", URI.class); GeneratedHttpRequest request = processor .createRequest( method, ImmutableList. of( @@ -60,7 +60,7 @@ public class TagOperationsAsyncClientTest extends BaseTerremarkECloudAsyncClient } public void testgetTagNameToUsageCountInOrg() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TagOperationsAsyncClient.class, "getTagNameToUsageCountInOrg", URI.class); + Invokable method = method(TagOperationsApi.class, "getTagNameToUsageCountInOrg", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"))); 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/TerremarkVCloudExpressApi.java similarity index 52% rename from providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClient.java rename to providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressApi.java index 1e70d22dcd..7759dcfec2 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/TerremarkVCloudExpressApi.java @@ -29,9 +29,7 @@ import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Produces; -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; +import org.jclouds.Fallbacks; import org.jclouds.javax.annotation.Nullable; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; @@ -39,7 +37,7 @@ import org.jclouds.rest.annotations.MapBinder; import org.jclouds.rest.annotations.PayloadParam; import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; import org.jclouds.trmk.vcloud_0_8.binders.BindCreateKeyToXmlPayload; import org.jclouds.trmk.vcloud_0_8.domain.InternetService; import org.jclouds.trmk.vcloud_0_8.domain.KeyPair; @@ -53,103 +51,63 @@ import org.jclouds.trmk.vcloud_0_8.xml.KeyPairByNameHandler; import org.jclouds.trmk.vcloud_0_8.xml.KeyPairHandler; import org.jclouds.trmk.vcloud_0_8.xml.KeyPairsHandler; -import com.google.common.util.concurrent.ListenableFuture; - /** * Provides access to VCloud resources via their REST API. *

* - * @see + * @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 { - /** - * @see TerremarkVCloudExpressClient#addInternetServiceToVDC - */ +public interface TerremarkVCloudExpressApi extends TerremarkVCloudApi { + @POST @Produces(INTERNETSERVICE_XML) @Consumes(INTERNETSERVICE_XML) @XMLResponseParser(InternetServiceHandler.class) @MapBinder(AddInternetServiceOptions.class) - ListenableFuture addInternetServiceToVDC( - @EndpointParam(parser = VDCURIToInternetServicesEndpoint.class) URI vDCId, - @PayloadParam("name") String serviceName, @PayloadParam("protocol") Protocol protocol, - @PayloadParam("port") int port, AddInternetServiceOptions... options); + InternetService addInternetServiceToVDC( + @EndpointParam(parser = VDCURIToInternetServicesEndpoint.class) URI vDCId, + @PayloadParam("name") String serviceName, @PayloadParam("protocol") Protocol protocol, + @PayloadParam("port") int port, AddInternetServiceOptions... options); - /** - * @see TerremarkVCloudExpressClient#findKeyPairInOrgNamed - */ @GET @XMLResponseParser(KeyPairByNameHandler.class) @Consumes(KEYSLIST_XML) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture findKeyPairInOrg( - @Nullable @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org, String keyName); + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + KeyPair findKeyPairInOrg( + @Nullable @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org, String keyName); - /** - * @see TerremarkVCloudExpressClient#listKeyPairsInOrgNamed - */ @GET @Consumes(KEYSLIST_XML) @XMLResponseParser(KeyPairsHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> listKeyPairsInOrg( - @Nullable @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org); + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + Set listKeyPairsInOrg( + @Nullable @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org); - /** - * @see TerremarkVCloudExpressClient#listKeyPairs - */ @GET @Consumes(KEYSLIST_XML) @XMLResponseParser(KeyPairsHandler.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> listKeyPairs(@EndpointParam URI keysList); + @Fallback(Fallbacks.EmptySetOnNotFoundOr404.class) + Set listKeyPairs(@EndpointParam URI keysList); - /** - * @see TerremarkVCloudExpressClient#generateKeyPairInOrg - */ @POST @Produces(KEYSLIST_XML) @Consumes(KEYSLIST_XML) @XMLResponseParser(KeyPairHandler.class) @MapBinder(BindCreateKeyToXmlPayload.class) - ListenableFuture generateKeyPairInOrg( - @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org, @PayloadParam("name") String name, - @PayloadParam("isDefault") boolean makeDefault); + KeyPair generateKeyPairInOrg( + @EndpointParam(parser = OrgURIToKeysListEndpoint.class) URI org, @PayloadParam("name") String name, + @PayloadParam("isDefault") boolean makeDefault); - /** - * @see TerremarkVCloudExpressClient#getKeyPair - */ @GET @XMLResponseParser(KeyPairHandler.class) @Consumes(APPLICATION_XML) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getKeyPair(@EndpointParam URI keyId); + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + KeyPair getKeyPair(@EndpointParam URI keyId); - // TODO - // /** - // * @see TerremarkVCloudClient#configureKeyPair - // */ - // @PUT - // @Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class) - // @Path("/extensions/key/{keyId}") - // @Produces(APPLICATION_XML) - // @Consumes(APPLICATION_XML) - // @XMLResponseParser(KeyPairHandler.class) - // ListenableFuture configureKeyPair( - // @PathParam("keyId") int keyId, - // @BinderParam(BindKeyPairConfigurationToXmlPayload.class) - // KeyPairConfiguration keyConfiguration); - - /** - * @see TerremarkVCloudExpressClient#deleteKeyPair - */ @DELETE - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture deleteKeyPair(@EndpointParam URI keyId); - + @Fallback(Fallbacks.VoidOnNotFoundOr404.class) + void deleteKeyPair(@EndpointParam URI keyId); } 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 8c0b49b620..f5a2d5aa01 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,10 +25,9 @@ import java.util.Properties; import org.jclouds.apis.ApiMetadata; import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudApiMetadata; import org.jclouds.trmk.vcloudexpress.compute.TerremarkVCloudExpressComputeServiceContextModule; -import org.jclouds.trmk.vcloudexpress.config.TerremarkVCloudExpressRestClientModule; +import org.jclouds.trmk.vcloudexpress.config.TerremarkVCloudExpressHttpApiModule; import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; import com.google.inject.Module; /** @@ -38,15 +37,7 @@ import com.google.inject.Module; */ public class TerremarkVCloudExpressApiMetadata extends TerremarkVCloudApiMetadata { - /** - * @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; - }; - + @Override public Builder toBuilder() { return new Builder().fromApiMetadata(this); @@ -71,7 +62,6 @@ public class TerremarkVCloudExpressApiMetadata extends TerremarkVCloudApiMetadat @SuppressWarnings("deprecation") protected Builder() { - super(TerremarkVCloudExpressClient.class, TerremarkVCloudExpressAsyncClient.class); id("trmk-vcloudexpress") .name("Terremark vCloud Express API") .identityName("Email") @@ -80,7 +70,7 @@ public class TerremarkVCloudExpressApiMetadata extends TerremarkVCloudApiMetadat .defaultEndpoint("https://services.vcloudexpress.terremark.com/api") .documentation(URI.create("https://community.vcloudexpress.terremark.com/en-us/product_docs/m/vcefiles/2342.aspx")) .defaultProperties(TerremarkVCloudExpressApiMetadata.defaultProperties()) - .defaultModules(ImmutableSet.>of(TerremarkVCloudExpressRestClientModule.class, TerremarkVCloudExpressComputeServiceContextModule.class)); + .defaultModules(ImmutableSet.>of(TerremarkVCloudExpressHttpApiModule.class, TerremarkVCloudExpressComputeServiceContextModule.class)); } @Override diff --git a/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressClient.java b/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressClient.java deleted file mode 100644 index acb0e47e2f..0000000000 --- a/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressClient.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.trmk.vcloudexpress; - -import java.net.URI; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; -import org.jclouds.trmk.vcloud_0_8.domain.InternetService; -import org.jclouds.trmk.vcloud_0_8.domain.Protocol; -import org.jclouds.trmk.vcloud_0_8.options.AddInternetServiceOptions; - -/** - * Provides access to VCloud resources via their REST API. - *

- * - * @see - * @author Adrian Cole - */ -public interface TerremarkVCloudExpressClient extends TerremarkVCloudClient { - - InternetService addInternetServiceToVDC(URI vDCId, String serviceName, Protocol protocol, int port, - AddInternetServiceOptions... options); -} diff --git a/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/config/TerremarkVCloudExpressRestClientModule.java b/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/config/TerremarkVCloudExpressHttpApiModule.java similarity index 61% rename from providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/config/TerremarkVCloudExpressRestClientModule.java rename to providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/config/TerremarkVCloudExpressHttpApiModule.java index 19f6d2e633..b24b3036de 100644 --- a/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/config/TerremarkVCloudExpressRestClientModule.java +++ b/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/config/TerremarkVCloudExpressHttpApiModule.java @@ -19,11 +19,9 @@ package org.jclouds.trmk.vcloudexpress.config; import javax.inject.Singleton; import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient; -import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient; -import org.jclouds.trmk.vcloud_0_8.config.TerremarkVCloudRestClientModule; -import org.jclouds.trmk.vcloudexpress.TerremarkVCloudExpressAsyncClient; -import org.jclouds.trmk.vcloudexpress.TerremarkVCloudExpressClient; +import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi; +import org.jclouds.trmk.vcloud_0_8.config.TerremarkVCloudHttpApiModule; +import org.jclouds.trmk.vcloudexpress.TerremarkVCloudExpressApi; import com.google.inject.Provides; @@ -34,18 +32,12 @@ import com.google.inject.Provides; * @author Adrian Cole */ @ConfiguresRestClient -public class TerremarkVCloudExpressRestClientModule extends - TerremarkVCloudRestClientModule { +public class TerremarkVCloudExpressHttpApiModule extends + TerremarkVCloudHttpApiModule { @Provides @Singleton - protected TerremarkVCloudAsyncClient provideVCloudAsyncClient(TerremarkVCloudExpressAsyncClient in) { - return in; - } - - @Provides - @Singleton - protected TerremarkVCloudClient provideVCloudClient(TerremarkVCloudExpressClient in) { + protected TerremarkVCloudApi provideVCloudApi(TerremarkVCloudExpressApi in) { return in; } diff --git a/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/suppliers/TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier.java b/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/suppliers/TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier.java index 7294b42397..5d95d143aa 100644 --- a/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/suppliers/TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier.java +++ b/providers/trmk-vcloudexpress/src/main/java/org/jclouds/trmk/vcloudexpress/suppliers/TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier.java @@ -33,7 +33,7 @@ import org.jclouds.trmk.vcloud_0_8.domain.Protocol; import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress; import org.jclouds.trmk.vcloud_0_8.domain.VApp; import org.jclouds.trmk.vcloud_0_8.suppliers.InternetServiceAndPublicIpAddressSupplier; -import org.jclouds.trmk.vcloudexpress.TerremarkVCloudExpressClient; +import org.jclouds.trmk.vcloudexpress.TerremarkVCloudExpressApi; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; @@ -48,10 +48,10 @@ public class TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier imp @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER) public Logger logger = Logger.NULL; - protected final TerremarkVCloudExpressClient client; + protected final TerremarkVCloudExpressApi client; @Inject - public TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier(TerremarkVCloudExpressClient client) { + public TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier(TerremarkVCloudExpressApi client) { this.client = client; } diff --git a/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/InternetServiceLiveTest.java b/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/InternetServiceLiveTest.java index b90ddcccc5..71169c56b8 100644 --- a/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/InternetServiceLiveTest.java +++ b/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/InternetServiceLiveTest.java @@ -32,7 +32,7 @@ import org.testng.annotations.Test; import com.google.common.collect.Sets; /** - * Tests behavior of {@code TerremarkVCloudClient} + * Tests behavior of {@code TerremarkVCloudApi} * * @author Adrian Cole */ @@ -44,7 +44,7 @@ public class InternetServiceLiveTest provider = "trmk-vcloudexpress"; } - TerremarkVCloudExpressClient tmClient; + TerremarkVCloudExpressApi tmClient; private Set services = Sets.newLinkedHashSet(); @@ -86,7 +86,7 @@ public class InternetServiceLiveTest @BeforeClass(groups = { "integration", "live" }) public void setupContext() { super.setupContext(); - tmClient = view.unwrap(TerremarkVCloudExpressApiMetadata.CONTEXT_TOKEN).getApi(); + tmClient = view.unwrapApi(TerremarkVCloudExpressApi.class); } 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/TerremarkVCloudExpressApiLiveTest.java similarity index 84% rename from providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressClientLiveTest.java rename to providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressApiLiveTest.java index fe8300e451..73cf69a43d 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/TerremarkVCloudExpressApiLiveTest.java @@ -20,7 +20,7 @@ import java.util.Map.Entry; import org.jclouds.domain.LoginCredentials; import org.jclouds.ssh.SshClient; -import org.jclouds.trmk.vcloud_0_8.TerremarkClientLiveTest; +import org.jclouds.trmk.vcloud_0_8.TerremarkApiLiveTest; import org.jclouds.trmk.vcloud_0_8.domain.InternetService; import org.jclouds.trmk.vcloud_0_8.domain.Protocol; import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress; @@ -31,12 +31,12 @@ import org.testng.annotations.Test; import com.google.common.net.HostAndPort; /** - * Tests behavior of {@code TerremarkVCloudExpressClient} + * Tests behavior of {@code TerremarkVCloudExpressApi} * * @author Adrian Cole */ -@Test(groups = "live", singleThreaded = true, testName = "TerremarkVCloudExpressClientLiveTest") -public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTest { +@Test(groups = "live", singleThreaded = true, testName = "TerremarkVCloudExpressApiLiveTest") +public class TerremarkVCloudExpressApiLiveTest extends TerremarkApiLiveTest { @Override protected SshClient getConnectionFor(HostAndPort socket) { @@ -47,6 +47,6 @@ public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTes @Override protected Entry getNewInternetServiceAndIpForSSH(VApp vApp) { return new TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier( - TerremarkVCloudExpressClient.class.cast(api)).getNewInternetServiceAndIp(vApp, 22, Protocol.TCP); + TerremarkVCloudExpressApi.class.cast(api)).getNewInternetServiceAndIp(vApp, 22, Protocol.TCP); } } diff --git a/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClientTest.java b/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressApiTest.java similarity index 91% rename from providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClientTest.java rename to providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressApiTest.java index c29a599a6d..1ce83d66b8 100644 --- a/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressAsyncClientTest.java +++ b/providers/trmk-vcloudexpress/src/test/java/org/jclouds/trmk/vcloudexpress/TerremarkVCloudExpressApiTest.java @@ -59,8 +59,8 @@ import org.jclouds.trmk.vcloud_0_8.domain.internal.ReferenceTypeImpl; import org.jclouds.trmk.vcloud_0_8.domain.internal.VDCImpl; import org.jclouds.trmk.vcloud_0_8.filters.SetVCloudTokenCookie; import org.jclouds.trmk.vcloud_0_8.functions.ParseTaskFromLocationHeader; -import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginClient; -import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsClient; +import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginApi; +import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsApi; import org.jclouds.trmk.vcloud_0_8.options.AddInternetServiceOptions; import org.jclouds.trmk.vcloud_0_8.options.AddNodeOptions; import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions; @@ -77,7 +77,7 @@ import org.jclouds.trmk.vcloud_0_8.xml.NodeHandler; import org.jclouds.trmk.vcloud_0_8.xml.NodesHandler; import org.jclouds.trmk.vcloud_0_8.xml.VAppHandler; import org.jclouds.trmk.vcloud_0_8.xml.VDCHandler; -import org.jclouds.trmk.vcloudexpress.config.TerremarkVCloudExpressRestClientModule; +import org.jclouds.trmk.vcloudexpress.config.TerremarkVCloudExpressHttpApiModule; import org.jclouds.util.Strings2; import org.testng.annotations.Test; @@ -91,22 +91,22 @@ import com.google.inject.AbstractModule; import com.google.inject.Module; import com.google.inject.TypeLiteral; /** - * Tests behavior of {@code TerremarkVCloudExpressAsyncClient} + * Tests behavior of {@code TerremarkVCloudExpressApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during // surefire -@Test(groups = "unit", singleThreaded = true, testName = "TerremarkVCloudExpressAsyncClientTest") -public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest { +@Test(groups = "unit", singleThreaded = true, testName = "TerremarkVCloudExpressApiTest") +public class TerremarkVCloudExpressApiTest extends BaseAsyncClientTest { public void testListOrgs() { - assertEquals(injector.getInstance(TerremarkVCloudExpressAsyncClient.class).listOrgs().toString(), ImmutableMap + assertEquals(injector.getInstance(TerremarkVCloudExpressApi.class).listOrgs().toString(), ImmutableMap .of(ORG_REF.getName(), ORG_REF).toString()); } public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkVCloudExpressAsyncClient.class, "getCatalogItem", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "getCatalogItem", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"))); @@ -122,7 +122,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "deleteVApp", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "deleteVApp", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"))); @@ -138,7 +138,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "findCatalogItemInOrgCatalogNamed", + Invokable method = method(TerremarkVCloudExpressApi.class, "findCatalogItemInOrgCatalogNamed", String.class, String.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of("org", "catalog", "item")); @@ -157,7 +157,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "getCatalog", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "getCatalog", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://catalog"))); assertRequestLineEquals(request, "GET https://catalog HTTP/1.1"); @@ -172,7 +172,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "getVDC", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "getVDC", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/vdc/1"))); assertRequestLineEquals(request, "GET https://vcloud/vdc/1 HTTP/1.1"); @@ -187,7 +187,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "instantiateVAppTemplateInVDC", URI.class, + Invokable method = method(TerremarkVCloudExpressApi.class, "instantiateVAppTemplateInVDC", URI.class, URI.class, String.class, InstantiateVAppTemplateOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI.create("https://vcloud/vAppTemplate/3"), @@ -209,7 +209,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "instantiateVAppTemplateInVDC", URI.class, + Invokable method = method(TerremarkVCloudExpressApi.class, "instantiateVAppTemplateInVDC", URI.class, URI.class, String.class, InstantiateVAppTemplateOptions[].class); GeneratedHttpRequest request = processor.createRequest( method, ImmutableList. of( @@ -235,7 +235,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "addInternetServiceToVDC", URI.class, + Invokable method = method(TerremarkVCloudExpressApi.class, "addInternetServiceToVDC", URI.class, String.class, Protocol.class, int.class, AddInternetServiceOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), "name", Protocol.TCP, 22)); @@ -254,7 +254,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "addInternetServiceToVDC", URI.class, + Invokable method = method(TerremarkVCloudExpressApi.class, "addInternetServiceToVDC", URI.class, String.class, Protocol.class, int.class, AddInternetServiceOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI .create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), "name", Protocol.TCP, 22, disabled() @@ -273,7 +273,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "getAllInternetServicesInVDC", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "getAllInternetServicesInVDC", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))); @@ -289,7 +289,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "getInternetService", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "getInternetService", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/internetService/12"))); assertRequestLineEquals(request, "GET https://vcloud/extensions/internetService/12 HTTP/1.1"); @@ -304,7 +304,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "deleteInternetService", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "deleteInternetService", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/internetService/12"))); assertRequestLineEquals(request, "DELETE https://vcloud/extensions/internetService/12 HTTP/1.1"); @@ -319,7 +319,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "addInternetServiceToExistingIp", URI.class, + Invokable method = method(TerremarkVCloudExpressApi.class, "addInternetServiceToExistingIp", URI.class, String.class, Protocol.class, int.class, AddInternetServiceOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/publicIp/12"), "name", Protocol.TCP, 22)); @@ -338,7 +338,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "addInternetServiceToExistingIp", URI.class, + Invokable method = method(TerremarkVCloudExpressApi.class, "addInternetServiceToExistingIp", URI.class, String.class, Protocol.class, int.class, AddInternetServiceOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/publicIp/12"), "name", Protocol.TCP, 22, disabled().withDescription("yahoo"))); @@ -356,7 +356,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "addNode", URI.class, String.class, + Invokable method = method(TerremarkVCloudExpressApi.class, "addNode", URI.class, String.class, String.class, int.class, AddNodeOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/internetService/12"), "10.2.2.2", "name", 22)); @@ -375,7 +375,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "addNode", URI.class, String.class, + Invokable method = method(TerremarkVCloudExpressApi.class, "addNode", URI.class, String.class, String.class, int.class, AddNodeOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/internetService/12"), "10.2.2.2", "name", 22, AddNodeOptions.Builder.disabled().withDescription("yahoo"))); @@ -394,7 +394,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "findKeyPairInOrg", URI.class, String.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "findKeyPairInOrg", URI.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), "keyPair")); @@ -410,7 +410,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "configureNode", URI.class, String.class, + Invokable method = method(TerremarkVCloudExpressApi.class, "configureNode", URI.class, String.class, boolean.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/nodeService/12"), "name", true, "eggs")); @@ -429,7 +429,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "configureNode", URI.class, String.class, + Invokable method = method(TerremarkVCloudExpressApi.class, "configureNode", URI.class, String.class, boolean.class, String.class); GeneratedHttpRequest request = processor.createRequest(method, Lists. newArrayList(URI.create("https://vcloud/extensions/nodeService/12"), "name", true, null)); @@ -448,7 +448,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "getNodes", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "getNodes", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/internetService/12"))); assertRequestLineEquals(request, "GET https://vcloud/extensions/internetService/12/nodeServices HTTP/1.1"); @@ -463,7 +463,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "deleteNode", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "deleteNode", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/nodeService/12"))); assertRequestLineEquals(request, "DELETE https://vcloud/extensions/nodeService/12 HTTP/1.1"); @@ -478,7 +478,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "getCustomizationOptions", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "getCustomizationOptions", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud/extensions/template/12/options/customization"))); @@ -495,7 +495,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "listKeyPairsInOrg", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "listKeyPairsInOrg", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of( URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"))); @@ -511,7 +511,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "listKeyPairsInOrg", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "listKeyPairsInOrg", URI.class); GeneratedHttpRequest request = processor.createRequest(method, Lists. newArrayList((URI) null)); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/keysList/1 HTTP/1.1"); @@ -527,12 +527,12 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "listKeyPairsInOrg", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "listKeyPairsInOrg", URI.class); processor.createRequest(method, ImmutableList. of(URI.create("d"))); } public void testGetNode() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(TerremarkVCloudExpressAsyncClient.class, "getNode", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "getNode", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/nodeService/12"))); assertRequestLineEquals(request, "GET https://vcloud/extensions/nodeService/12 HTTP/1.1"); @@ -547,7 +547,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "getKeyPair", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "getKeyPair", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/key/12"))); assertRequestLineEquals(request, "GET https://vcloud/extensions/key/12 HTTP/1.1"); @@ -562,7 +562,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest method = method(TerremarkVCloudExpressAsyncClient.class, "deleteKeyPair", URI.class); + Invokable method = method(TerremarkVCloudExpressApi.class, "deleteKeyPair", URI.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(URI.create("https://vcloud/extensions/key/12"))); assertRequestLineEquals(request, "DELETE https://vcloud/extensions/key/12 HTTP/1.1"); @@ -584,7 +584,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest of(NETWORK_REF.getName(), NETWORK_REF)); @ConfiguresRestClient - protected static class TerremarkVCloudRestClientModuleExtension extends TerremarkVCloudExpressRestClientModule { + protected static class TerremarkVCloudHttpApiModuleExtension extends TerremarkVCloudExpressHttpApiModule { @Override - protected Supplier provideAuthenticationURI(TerremarkVCloudVersionsClient versionService, String version) { + protected Supplier provideAuthenticationURI(TerremarkVCloudVersionsApi versionService, String version) { return Suppliers.ofInstance(URI.create("https://vcloud.safesecureweb.com/api/v0.8/login")); } @@ -673,7 +673,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends BaseAsyncClientTest provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds, - AtomicReference authException, TerremarkVCloudLoginClient login) { + AtomicReference authException, TerremarkVCloudLoginApi login) { return Suppliers. ofInstance(new VCloudSession() { @Override 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 a53790bca9..64a0581035 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,7 +29,7 @@ import org.jclouds.compute.internal.BaseComputeServiceLiveTest; import org.jclouds.domain.Credentials; import org.jclouds.sshj.config.SshjSshClientModule; import org.jclouds.trmk.vcloud_0_8.domain.VApp; -import org.jclouds.trmk.vcloudexpress.TerremarkVCloudExpressClient; +import org.jclouds.trmk.vcloudexpress.TerremarkVCloudExpressApi; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; @@ -92,7 +92,7 @@ public class TerremarkVCloudExpressComputeServiceLiveTest extends BaseComputeSer assertEquals(node.getType(), ComputeType.NODE); NodeMetadata allData = client.getNodeMetadata(node.getId()); System.out.println(allData.getHardware()); - TerremarkVCloudExpressClient api = view.utils().injector().getInstance(TerremarkVCloudExpressClient.class); + TerremarkVCloudExpressApi api = view.utils().injector().getInstance(TerremarkVCloudExpressApi.class); VApp vApp = api.findVAppInOrgVDCNamed(null, null, allData.getName()); assertEquals(vApp.getName(), allData.getName()); }