From 79e8c7185e2d25ddae6b03a03f185cf2cec17f9e Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 30 May 2011 11:31:01 -0700 Subject: [PATCH] Issue 579: regression on trmk --- .../vcloud/VCloudExpressAsyncClient.java | 25 +++++++++++++++++++ ....java => VCloudExpressCatalogHandler.java} | 4 +-- .../vcloud/VCloudExpressAsyncClientTest.java | 6 ++--- .../terremark/TerremarkVCloudAsyncClient.java | 4 +-- .../TerremarkECloudAsyncClientTest.java | 4 +-- ...TerremarkECloudClientLiveTestDisabled.java | 4 +-- ...ECloudParseOsFromVAppTemplateNameTest.java | 4 +-- ...TerremarkVCloudExpressAsyncClientTest.java | 4 +-- .../TerremarkVCloudExpressClientLiveTest.java | 4 +-- ...rkVCloudExpressComputeServiceLiveTest.java | 20 +-------------- 10 files changed, 43 insertions(+), 36 deletions(-) rename apis/vcloudexpress/src/main/java/org/jclouds/vcloud/xml/{CatalogHandler.java => VCloudExpressCatalogHandler.java} (95%) diff --git a/apis/vcloudexpress/src/main/java/org/jclouds/vcloud/VCloudExpressAsyncClient.java b/apis/vcloudexpress/src/main/java/org/jclouds/vcloud/VCloudExpressAsyncClient.java index f93d55db27..68048ec141 100644 --- a/apis/vcloudexpress/src/main/java/org/jclouds/vcloud/VCloudExpressAsyncClient.java +++ b/apis/vcloudexpress/src/main/java/org/jclouds/vcloud/VCloudExpressAsyncClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.vcloud; +import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML; import static org.jclouds.vcloud.VCloudMediaType.NETWORK_XML; import static org.jclouds.vcloud.VCloudMediaType.TASK_XML; import static org.jclouds.vcloud.VCloudMediaType.VAPPTEMPLATE_XML; @@ -45,11 +46,13 @@ import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload; import org.jclouds.vcloud.binders.BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload; +import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.VCloudExpressVApp; import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate; import org.jclouds.vcloud.domain.network.OrgNetwork; import org.jclouds.vcloud.filters.SetVCloudTokenCookie; +import org.jclouds.vcloud.functions.OrgNameAndCatalogNameToEndpoint; import org.jclouds.vcloud.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint; import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint; import org.jclouds.vcloud.functions.ParseTaskFromLocationHeader; @@ -57,6 +60,7 @@ import org.jclouds.vcloud.options.CloneVAppOptions; import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions; import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler; import org.jclouds.vcloud.xml.TaskHandler; +import org.jclouds.vcloud.xml.VCloudExpressCatalogHandler; import org.jclouds.vcloud.xml.VCloudExpressVAppHandler; import org.jclouds.vcloud.xml.VCloudExpressVAppTemplateHandler; @@ -72,6 +76,27 @@ import com.google.common.util.concurrent.ListenableFuture; @RequestFilters(SetVCloudTokenCookie.class) public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient { + /** + * @see CommonVCloudClient#getCatalog + */ + @Override + @GET + @XMLResponseParser(VCloudExpressCatalogHandler.class) + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + @Consumes(CATALOG_XML) + ListenableFuture getCatalog(@EndpointParam URI catalogId); + + /** + * @see CommonVCloudClient#findCatalogInOrgNamed + */ + @GET + @XMLResponseParser(VCloudExpressCatalogHandler.class) + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + @Consumes(CATALOG_XML) + ListenableFuture findCatalogInOrgNamed( + @Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String orgName, + @Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String catalogName); + /** * @see VCloudClient#getVAppTemplate */ diff --git a/apis/vcloudexpress/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java b/apis/vcloudexpress/src/main/java/org/jclouds/vcloud/xml/VCloudExpressCatalogHandler.java similarity index 95% rename from apis/vcloudexpress/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java rename to apis/vcloudexpress/src/main/java/org/jclouds/vcloud/xml/VCloudExpressCatalogHandler.java index b4b80d19ac..11c4b8c9bc 100644 --- a/apis/vcloudexpress/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java +++ b/apis/vcloudexpress/src/main/java/org/jclouds/vcloud/xml/VCloudExpressCatalogHandler.java @@ -42,12 +42,12 @@ import com.google.common.collect.Maps; /** * @author Adrian Cole */ -public class CatalogHandler extends ParseSax.HandlerWithResult { +public class VCloudExpressCatalogHandler extends ParseSax.HandlerWithResult { protected final TaskHandler taskHandler; @Inject - public CatalogHandler(TaskHandler taskHandler) { + public VCloudExpressCatalogHandler(TaskHandler taskHandler) { this.taskHandler = taskHandler; } diff --git a/apis/vcloudexpress/src/test/java/org/jclouds/vcloud/VCloudExpressAsyncClientTest.java b/apis/vcloudexpress/src/test/java/org/jclouds/vcloud/VCloudExpressAsyncClientTest.java index 6746cfaf2a..cbdcff315a 100644 --- a/apis/vcloudexpress/src/test/java/org/jclouds/vcloud/VCloudExpressAsyncClientTest.java +++ b/apis/vcloudexpress/src/test/java/org/jclouds/vcloud/VCloudExpressAsyncClientTest.java @@ -62,7 +62,7 @@ import org.jclouds.vcloud.filters.SetVCloudTokenCookie; import org.jclouds.vcloud.functions.ParseTaskFromLocationHeader; import org.jclouds.vcloud.options.CloneVAppOptions; import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions; -import org.jclouds.vcloud.xml.CatalogHandler; +import org.jclouds.vcloud.xml.VCloudExpressCatalogHandler; import org.jclouds.vcloud.xml.CatalogItemHandler; import org.jclouds.vcloud.xml.OrgHandler; import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler; @@ -238,7 +238,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest getCatalog(@EndpointParam URI catalogId); diff --git a/providers/trmk-ecloud/src/test/java/org/jclouds/vcloud/terremark/TerremarkECloudAsyncClientTest.java b/providers/trmk-ecloud/src/test/java/org/jclouds/vcloud/terremark/TerremarkECloudAsyncClientTest.java index a238e18b7c..5fc7bb4e75 100644 --- a/providers/trmk-ecloud/src/test/java/org/jclouds/vcloud/terremark/TerremarkECloudAsyncClientTest.java +++ b/providers/trmk-ecloud/src/test/java/org/jclouds/vcloud/terremark/TerremarkECloudAsyncClientTest.java @@ -82,7 +82,7 @@ import org.jclouds.vcloud.terremark.xml.NodesHandler; import org.jclouds.vcloud.terremark.xml.PublicIpAddressesHandler; import org.jclouds.vcloud.terremark.xml.TerremarkOrgNetworkFromTerremarkVCloudExpressNetworkHandler; import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler; -import org.jclouds.vcloud.xml.CatalogHandler; +import org.jclouds.vcloud.xml.VCloudExpressCatalogHandler; import org.jclouds.vcloud.xml.VCloudExpressVAppHandler; import org.testng.annotations.Test; @@ -163,7 +163,7 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest tmContext = new ComputeServiceContextFactory() - .createContext(provider, identity, credential).getProviderSpecificContext(); - } - + @Override protected Template buildTemplate(TemplateBuilder templateBuilder) { Template template = super.buildTemplate(templateBuilder);