Issue 579: regression on trmk

This commit is contained in:
Adrian Cole 2011-05-30 11:31:01 -07:00
parent 1d81641279
commit 79e8c7185e
10 changed files with 43 additions and 36 deletions

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.vcloud; 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.NETWORK_XML;
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML; import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
import static org.jclouds.vcloud.VCloudMediaType.VAPPTEMPLATE_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.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload; import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
import org.jclouds.vcloud.binders.BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload; import org.jclouds.vcloud.binders.BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload;
import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.Task; import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VCloudExpressVApp; import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate; import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.domain.network.OrgNetwork; import org.jclouds.vcloud.domain.network.OrgNetwork;
import org.jclouds.vcloud.filters.SetVCloudTokenCookie; import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
import org.jclouds.vcloud.functions.OrgNameAndCatalogNameToEndpoint;
import org.jclouds.vcloud.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint; import org.jclouds.vcloud.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint;
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint; import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
import org.jclouds.vcloud.functions.ParseTaskFromLocationHeader; 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.options.InstantiateVAppTemplateOptions;
import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler; import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler;
import org.jclouds.vcloud.xml.TaskHandler; import org.jclouds.vcloud.xml.TaskHandler;
import org.jclouds.vcloud.xml.VCloudExpressCatalogHandler;
import org.jclouds.vcloud.xml.VCloudExpressVAppHandler; import org.jclouds.vcloud.xml.VCloudExpressVAppHandler;
import org.jclouds.vcloud.xml.VCloudExpressVAppTemplateHandler; import org.jclouds.vcloud.xml.VCloudExpressVAppTemplateHandler;
@ -72,6 +76,27 @@ import com.google.common.util.concurrent.ListenableFuture;
@RequestFilters(SetVCloudTokenCookie.class) @RequestFilters(SetVCloudTokenCookie.class)
public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient { public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient {
/**
* @see CommonVCloudClient#getCatalog
*/
@Override
@GET
@XMLResponseParser(VCloudExpressCatalogHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Consumes(CATALOG_XML)
ListenableFuture<? extends Catalog> getCatalog(@EndpointParam URI catalogId);
/**
* @see CommonVCloudClient#findCatalogInOrgNamed
*/
@GET
@XMLResponseParser(VCloudExpressCatalogHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Consumes(CATALOG_XML)
ListenableFuture<? extends Catalog> findCatalogInOrgNamed(
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String catalogName);
/** /**
* @see VCloudClient#getVAppTemplate * @see VCloudClient#getVAppTemplate
*/ */

View File

@ -42,12 +42,12 @@ import com.google.common.collect.Maps;
/** /**
* @author Adrian Cole * @author Adrian Cole
*/ */
public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> { public class VCloudExpressCatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
protected final TaskHandler taskHandler; protected final TaskHandler taskHandler;
@Inject @Inject
public CatalogHandler(TaskHandler taskHandler) { public VCloudExpressCatalogHandler(TaskHandler taskHandler) {
this.taskHandler = taskHandler; this.taskHandler = taskHandler;
} }

View File

@ -62,7 +62,7 @@ import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
import org.jclouds.vcloud.functions.ParseTaskFromLocationHeader; import org.jclouds.vcloud.functions.ParseTaskFromLocationHeader;
import org.jclouds.vcloud.options.CloneVAppOptions; import org.jclouds.vcloud.options.CloneVAppOptions;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions; 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.CatalogItemHandler;
import org.jclouds.vcloud.xml.OrgHandler; import org.jclouds.vcloud.xml.OrgHandler;
import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler; import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler;
@ -238,7 +238,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
assertPayloadEquals(request, null, null, false); assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, CatalogHandler.class); assertSaxResponseParserClassEquals(method, VCloudExpressCatalogHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
@ -253,7 +253,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
assertPayloadEquals(request, null, null, false); assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, CatalogHandler.class); assertSaxResponseParserClassEquals(method, VCloudExpressCatalogHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);

View File

@ -92,7 +92,7 @@ import org.jclouds.vcloud.terremark.xml.PublicIpAddressesHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkCatalogItemHandler; import org.jclouds.vcloud.terremark.xml.TerremarkCatalogItemHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkOrgHandler; import org.jclouds.vcloud.terremark.xml.TerremarkOrgHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler; 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.jclouds.vcloud.xml.VCloudExpressVAppHandler;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -152,7 +152,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudExpressAsyncClient {
*/ */
@GET @GET
@Override @Override
@XMLResponseParser(CatalogHandler.class) @XMLResponseParser(VCloudExpressCatalogHandler.class)
@Consumes(CATALOG_XML) @Consumes(CATALOG_XML)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends Catalog> getCatalog(@EndpointParam URI catalogId); ListenableFuture<? extends Catalog> getCatalog(@EndpointParam URI catalogId);

View File

@ -82,7 +82,7 @@ import org.jclouds.vcloud.terremark.xml.NodesHandler;
import org.jclouds.vcloud.terremark.xml.PublicIpAddressesHandler; import org.jclouds.vcloud.terremark.xml.PublicIpAddressesHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkOrgNetworkFromTerremarkVCloudExpressNetworkHandler; import org.jclouds.vcloud.terremark.xml.TerremarkOrgNetworkFromTerremarkVCloudExpressNetworkHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler; 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.jclouds.vcloud.xml.VCloudExpressVAppHandler;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -163,7 +163,7 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
assertPayloadEquals(request, null, null, false); assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, CatalogHandler.class); assertSaxResponseParserClassEquals(method, VCloudExpressCatalogHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);

View File

@ -35,11 +35,11 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* Tests behavior of {@code TerremarkVCloudClient} * Tests behavior of {@code TerremarkECloudClient}
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", enabled = true, sequential = true) @Test(groups = "live", enabled = true, singleThreaded = true, testName = "TerremarkECloudClientLiveTestDisabled")
public class TerremarkECloudClientLiveTestDisabled extends TerremarkClientLiveTest { public class TerremarkECloudClientLiveTestDisabled extends TerremarkClientLiveTest {
@BeforeClass @BeforeClass
void setProvider() { void setProvider() {

View File

@ -32,7 +32,7 @@ import org.jclouds.http.functions.ParseSax.Factory;
import org.jclouds.http.functions.config.SaxParserModule; import org.jclouds.http.functions.config.SaxParserModule;
import org.jclouds.json.Json; import org.jclouds.json.Json;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
import org.jclouds.vcloud.xml.CatalogHandler; import org.jclouds.vcloud.xml.VCloudExpressCatalogHandler;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -52,7 +52,7 @@ public class TerremarkECloudParseOsFromVAppTemplateNameTest {
InputStream is = getClass().getResourceAsStream(resource); InputStream is = getClass().getResourceAsStream(resource);
Injector injector = Guice.createInjector(new SaxParserModule()); Injector injector = Guice.createInjector(new SaxParserModule());
Factory factory = injector.getInstance(ParseSax.Factory.class); Factory factory = injector.getInstance(ParseSax.Factory.class);
return factory.create(injector.getInstance(CatalogHandler.class)).parse(is).keySet(); return factory.create(injector.getInstance(VCloudExpressCatalogHandler.class)).parse(is).keySet();
} }
public void test() { public void test() {

View File

@ -81,7 +81,7 @@ import org.jclouds.vcloud.terremark.xml.NodeHandler;
import org.jclouds.vcloud.terremark.xml.NodesHandler; import org.jclouds.vcloud.terremark.xml.NodesHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkCatalogItemHandler; import org.jclouds.vcloud.terremark.xml.TerremarkCatalogItemHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler; 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.jclouds.vcloud.xml.VCloudExpressVAppHandler;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -163,7 +163,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest<Terrem
assertPayloadEquals(request, null, null, false); assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, CatalogHandler.class); assertSaxResponseParserClassEquals(method, VCloudExpressCatalogHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);

View File

@ -42,11 +42,11 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* Tests behavior of {@code TerremarkVCloudClient} * Tests behavior of {@code TerremarkVCloudExpressClient}
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "TerremarkVCloudExpressClientLiveTest")
public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTest { public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTest {
KeyPair key; KeyPair key;

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.vcloud.terremark.compute; package org.jclouds.vcloud.terremark.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import org.jclouds.compute.BaseComputeServiceLiveTest; import org.jclouds.compute.BaseComputeServiceLiveTest;
@ -34,8 +33,6 @@ import org.jclouds.rest.RestContext;
import org.jclouds.ssh.jsch.config.JschSshClientModule; import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.jclouds.vcloud.domain.VCloudExpressVApp; import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.terremark.TerremarkVCloudClient; import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressAsyncClient;
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@ -53,22 +50,7 @@ public class TerremarkVCloudExpressComputeServiceLiveTest extends BaseComputeSer
public void setServiceDefaults() { public void setServiceDefaults() {
group = "vcx"; group = "vcx";
} }
@Test
public void testTemplateBuilder() {
Template defaultTemplate = client.templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getDescription(), "Miami Environment 1");
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
public void testAssignability() throws Exception {
@SuppressWarnings("unused")
RestContext<TerremarkVCloudExpressClient, TerremarkVCloudExpressAsyncClient> tmContext = new ComputeServiceContextFactory()
.createContext(provider, identity, credential).getProviderSpecificContext();
}
@Override @Override
protected Template buildTemplate(TemplateBuilder templateBuilder) { protected Template buildTemplate(TemplateBuilder templateBuilder) {
Template template = super.buildTemplate(templateBuilder); Template template = super.buildTemplate(templateBuilder);