From beb76f925a8a60a4c82f1191d75c62e4ed708655 Mon Sep 17 00:00:00 2001 From: Richard Downer Date: Fri, 2 Dec 2011 11:02:10 +0200 Subject: [PATCH] Changes to TemplateClientLiveTest to make it faster (using a smaller VHD for import) and more reliable (it won't break if the provider's default templates are marked as not extractable) --- .../features/TemplateClientLiveTest.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateClientLiveTest.java index eeab3c9511..a339ebb76a 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateClientLiveTest.java @@ -44,9 +44,10 @@ import static org.testng.Assert.*; @Test(groups = "live", singleThreaded = true, testName = "TemplateClientLiveTest") public class TemplateClientLiveTest extends BaseCloudStackClientLiveTest { - private static final String IMPORT_VHD_URL = "http://www.frontiertown.co.uk/jclouds/openwrt.vhd"; + private static final String IMPORT_VHD_URL = "http://www.frontiertown.co.uk/jclouds/empty.vhd"; private VirtualMachine vm; - private Template template; + private Template createdTemplate; + private Template registeredTemplate; @Test public void testListTemplates() throws Exception { @@ -110,17 +111,17 @@ public class TemplateClientLiveTest extends BaseCloudStackClientLiveTest { CreateTemplateOptions options = CreateTemplateOptions.Builder.volumeId(volume.getId()); AsyncCreateResponse response = client.getTemplateClient().createTemplate(TemplateMetadata.builder().name(tmplName).osTypeId(vm.getGuestOSId()).displayText("jclouds live testCreateTemplate").build(), options); assert jobComplete.apply(response.getJobId()) : vm; - template = client.getTemplateClient().getTemplateInZone(response.getId(), vm.getZoneId()); + createdTemplate = client.getTemplateClient().getTemplateInZone(response.getId(), vm.getZoneId()); // Assertions - assertNotNull(template); + assertNotNull(createdTemplate); } - @Test(enabled = true, dependsOnMethods = "testCreateTemplate") + @Test(enabled = true, dependsOnMethods = "testRegisterTemplate") public void testExtractTemplate() throws Exception { // Initiate the extraction and wait for it to complete - AsyncCreateResponse response = client.getTemplateClient().extractTemplate(template.getId(), ExtractMode.HTTP_DOWNLOAD, template.getZoneId()); - assert jobComplete.apply(response.getJobId()) : template; + AsyncCreateResponse response = client.getTemplateClient().extractTemplate(registeredTemplate.getId(), ExtractMode.HTTP_DOWNLOAD, registeredTemplate.getZoneId()); + assert jobComplete.apply(response.getJobId()) : registeredTemplate; // Get the result AsyncJob asyncJob = client.getAsyncJobClient().getAsyncJob(response.getJobId()); @@ -153,11 +154,11 @@ public class TemplateClientLiveTest extends BaseCloudStackClientLiveTest { // Register a template String tmplName = "jclouds-" + Integer.toHexString(new Random().nextInt()); - RegisterTemplateOptions options = RegisterTemplateOptions.Builder.bits(32); + RegisterTemplateOptions options = RegisterTemplateOptions.Builder.bits(32).isExtractable(true); TemplateMetadata templateMetadata = TemplateMetadata.builder().name(tmplName).osTypeId(osType.getId()).displayText("jclouds live testRegisterTemplate").build(); - Set