From 3420a1794c20b0c1c273761f5c1e9aa8e7694197 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Thu, 15 Mar 2012 18:16:51 +0000 Subject: [PATCH] Fix VApp instantiation failure --- .../v1_5/domain/AbstractVAppType.java | 1 + .../director/v1_5/domain/Reference.java | 3 +- .../v1_5/features/QueryAsyncClient.java | 12 +- .../director/v1_5/features/QueryClient.java | 12 +- .../v1_5/features/VAppClientLiveTest.java | 211 +++++++++++------- .../BaseVCloudDirectorClientLiveTest.java | 11 +- 6 files changed, 154 insertions(+), 96 deletions(-) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java index 293dbf26c4..3003ae7add 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java @@ -51,6 +51,7 @@ public abstract class AbstractVAppType extends ResourceEntityType { return new ConcreteBuilder(); } + @Override public Builder toBuilder() { return builder().fromResourceEntityType(this); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java index 33e6fb920a..b5dba21794 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java @@ -25,6 +25,7 @@ import java.util.Map; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; import org.jclouds.logging.Logger; @@ -45,7 +46,7 @@ import com.google.common.base.Objects.ToStringHelper; @XmlSeeAlso({ CatalogReference.class }) -//@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ReferenceType") public class Reference { @javax.annotation.Resource diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryAsyncClient.java index b9f25392b8..cebd6eac94 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryAsyncClient.java @@ -60,21 +60,21 @@ public interface QueryAsyncClient { @Consumes @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture> queryAll(@QueryParam("type") String type); + ListenableFuture queryAll(@QueryParam("type") String type); @GET @Path("/query") @Consumes @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture> query(@QueryParam("type") String type, @QueryParam("filter") String filter); + ListenableFuture query(@QueryParam("type") String type, @QueryParam("filter") String filter); @GET @Path("/query") @Consumes @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture> query(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize, + ListenableFuture query(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize, @QueryParam("format") String format, @QueryParam("type") String type, @QueryParam("filter") String filter); /** @@ -85,21 +85,21 @@ public interface QueryAsyncClient { @Consumes @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture> catalogsQueryAll(); + ListenableFuture catalogsQueryAll(); @GET @Path("/catalogs/query") @Consumes @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture> catalogsQuery(@QueryParam("filter") String filter); + ListenableFuture catalogsQuery(@QueryParam("filter") String filter); @GET @Path("/catalogs/query") @Consumes @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture> catalogsQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize, + ListenableFuture catalogsQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize, @QueryParam("filter") String filter); @GET diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryClient.java index a48d361b9d..9df4ffa54a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryClient.java @@ -43,11 +43,11 @@ public interface QueryClient { */ QueryList queryList(); - QueryResultRecords queryAll(String type); + QueryResultRecords queryAll(String type); - QueryResultRecords query(String type, String filter); + QueryResultRecords query(String type, String filter); - QueryResultRecords query(Integer page, Integer pageSize, String format, String type, String filter); + QueryResultRecords query(Integer page, Integer pageSize, String format, String type, String filter); /** * Retrieves a list of Catalogs by using REST API general QueryHandler. @@ -60,11 +60,11 @@ public interface QueryClient { * GET /catalogs/query * */ - QueryResultRecords catalogsQueryAll(); + QueryResultRecords catalogsQueryAll(); - QueryResultRecords catalogsQuery(String filter); + QueryResultRecords catalogsQuery(String filter); - QueryResultRecords catalogsQuery(Integer page, Integer pageSize, String filter); + QueryResultRecords catalogsQuery(Integer page, Integer pageSize, String filter); CatalogReferences catalogReferencesQueryAll(); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java index 5779c285da..2b2925d542 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java @@ -149,16 +149,32 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest { assertNotNull(vAppTemplate, String.format(ENTITY_NON_NULL, VAPP_TEMPLATE)); // Delete the test-vapp VApp if present - Optional testVApp = Iterables.tryFind( + Iterable vApps = Iterables.filter( vdc.getResourceEntities().getResourceEntities(), Predicates.and( ReferenceTypePredicates.typeEquals(VCloudDirectorMediaType.VAPP), - ReferenceTypePredicates.nameEquals("test-vapp") + Predicates.or( + ReferenceTypePredicates.nameEquals("test-vapp"), + ReferenceTypePredicates.nameEquals("new-name") + ) ) ); - if (testVApp.isPresent()) { - Task deleteTestVApp = vAppClient.deleteVApp(testVApp.get().getHref()); - retryTaskSuccess.apply(deleteTestVApp); + if (vApps != null && !Iterables.isEmpty(vApps)) { + for (Reference each : vApps) { + VApp found = vAppClient.getVApp(each.getHref()); + // debug(found); + if (found.getStatus().equals(Status.POWERED_ON.getValue())) { + Task shutdownTask = vAppClient.shutdown(found.getHref()); + retryTaskSuccess.apply(shutdownTask); + } + if (found.isDeployed()) { + UndeployVAppParams params = UndeployVAppParams.builder().build(); + Task undeployTask = vAppClient.undeploy(vApp.getHref(), params); + retryTaskSuccess.apply(undeployTask); + } + Task deleteTask = vAppClient.deleteVApp(found.getHref()); + retryTaskSuccess.apply(deleteTask); + } } } @@ -168,6 +184,10 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest { @Test(testName = "GET /vApp/{id}") public void testGetVApp() { VApp vAppInstantiated = instantiateVApp(); + + // Wait for the task to complete + Task instantiateTask = Iterables.getOnlyElement(vAppInstantiated.getTasks()); + assertTrue(retryTaskSuccessLong.apply(instantiateTask), String.format(TASK_COMPLETE_TIMELY, "instantiateTask")); // The method under test vApp = vAppClient.getVApp(vAppInstantiated.getHref()); @@ -175,15 +195,13 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest { // Check the retrieved object is well formed checkVApp(vApp); - // Check that task progress is increasing - Integer vAppProgress = Iterables.getOnlyElement(vApp.getTasks()).getProgress(); - Integer vAppInstantiatedProgress = Iterables.getOnlyElement(vAppInstantiated.getTasks()).getProgress(); - assertTrue(vAppProgress >= vAppInstantiatedProgress, - String.format(ENTITY_CONDITION, VAPP, "have an increasing value in the Progress field", String.format("%d < %d", vAppProgress, vAppInstantiatedProgress))); - - // Cheat and copy the VApp with the progress of the instantiate task modified for equality testing - VApp vAppCopy = vApp.toBuilder().tasks(ImmutableSet.of(Iterables.getOnlyElement(vApp.getTasks()).toBuilder().progress(vAppInstantiatedProgress).build())).build(); - assertEquals(vAppCopy, vAppInstantiated, String.format(ENTITY_EQUAL, VAPP)); + // Check the required fields are set + assertEquals(vApp.isDeployed(), Boolean.FALSE, String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString())); + // TODO others + + // Check status + Status poweredOffStatus = Status.POWERED_OFF; + assertEquals(vApp.getStatus(), poweredOffStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus.toString(), Status.fromValue(vApp.getStatus()).toString())); } /** @@ -200,7 +218,10 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest { Task modifyVApp = vAppClient.modifyVApp(vApp.getHref(), newVApp); assertTrue(retryTaskSuccess.apply(modifyVApp), String.format(TASK_COMPLETE_TIMELY, "modifyVApp")); + // Get the updated VApp vApp = vAppClient.getVApp(vApp.getHref()); + + // Check the required fields are set assertEquals(vApp.getName(), newVApp.getName(), String.format(OBJ_FIELD_EQ, VAPP, "Name", newVApp.getName(), vApp.getName())); assertEquals(vApp.getDescription(), newVApp.getDescription(), String.format(OBJ_FIELD_EQ, VAPP, "Description", newVApp.getDescription(), vApp.getDescription())); } @@ -209,17 +230,23 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest { public void testDeployVApp() { DeployVAppParams params = DeployVAppParams.builder() .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)) - .forceCustomization() + .notForceCustomization() .notPowerOn() .build(); // The method under test Task deployVApp = vAppClient.deploy(vApp.getHref(), params); - assertTrue(retryTaskSuccess.apply(deployVApp), String.format(TASK_COMPLETE_TIMELY, "deployVApp")); + assertTrue(retryTaskSuccessLong.apply(deployVApp), String.format(TASK_COMPLETE_TIMELY, "deployVApp")); + // Get the updated VApp vApp = vAppClient.getVApp(vApp.getHref()); - Integer deployedStatus = Status.DEPLOYED.getValue(); - assertEquals(vApp.getStatus(), deployedStatus, String.format(OBJ_FIELD_EQ, VAPP, "status", deployedStatus, vApp.getStatus())); + + // Check the required fields are set + assertEquals(vApp.isDeployed(), Boolean.TRUE, String.format(OBJ_FIELD_EQ, VAPP, "deployed", "TRUE", vApp.isDeployed().toString())); + + // Check status + Status deployedStatus = Status.POWERED_OFF; + assertEquals(vApp.getStatus(), deployedStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", deployedStatus.toString(), Status.fromValue(vApp.getStatus()).toString())); } @Test(testName = "POST /vApp/{id}/power/action/powerOn", dependsOnMethods = { "testDeployVApp" }) @@ -228,9 +255,84 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest { Task powerOnVApp = vAppClient.powerOn(vApp.getHref()); assertTrue(retryTaskSuccess.apply(powerOnVApp), String.format(TASK_COMPLETE_TIMELY, "powerOnVApp")); + // Get the updated VApp vApp = vAppClient.getVApp(vApp.getHref()); - Integer poweredOnStatus = Status.POWERED_ON.getValue(); - assertEquals(vApp.getStatus(), poweredOnStatus, String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus, vApp.getStatus())); + + // Check status + Status poweredOnStatus = Status.POWERED_ON; + assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString())); + } + + @Test(testName = "POST /vApp/{id}/power/action/reboot", dependsOnMethods = { "testPowerOnVApp" }) + public void testReboot() { + // The method under test + Task reboot = vAppClient.reboot(vApp.getHref()); + assertTrue(retryTaskSuccess.apply(reboot), String.format(TASK_COMPLETE_TIMELY, "reboot")); + + // Get the updated VApp + vApp = vAppClient.getVApp(vApp.getHref()); + + // Check status + Status poweredOnStatus = Status.POWERED_ON; + assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString())); + } + + @Test(testName = "POST /vApp/{id}/power/action/shutdown", dependsOnMethods = { "testReboot" }) + public void testShutdown() { + // The method under test + Task shutdown = vAppClient.shutdown(vApp.getHref()); + assertTrue(retryTaskSuccess.apply(shutdown), String.format(TASK_COMPLETE_TIMELY, "shutdown")); + + // Get the updated VApp + vApp = vAppClient.getVApp(vApp.getHref()); + + // Check status + Status poweredOnStatus = Status.POWERED_ON; + assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString())); + } + + @Test(testName = "POST /vApp/{id}/power/action/suspend", dependsOnMethods = { "testShutdown" }) + public void testSuspend() { + // The method under test + Task suspend = vAppClient.suspend(vApp.getHref()); + assertTrue(retryTaskSuccess.apply(suspend), String.format(TASK_COMPLETE_TIMELY, "suspend")); + + // Get the updated VApp + vApp = vAppClient.getVApp(vApp.getHref()); + + // Check status + Status poweredOnStatus = Status.POWERED_ON; + assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString())); + } + + @Test(testName = "POST /vApp/{id}/power/action/reset", dependsOnMethods = { "testSuspend" }) + public void testReset() { + // The method under test + Task reset = vAppClient.reset(vApp.getHref()); + assertTrue(retryTaskSuccess.apply(reset), String.format(TASK_COMPLETE_TIMELY, "reset")); + + // Get the updated VApp + vApp = vAppClient.getVApp(vApp.getHref()); + + // Check status + Status poweredOnStatus = Status.POWERED_ON; + assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString())); + } + + @Test(testName = "POST /vApp/{id}/action/undeploy", dependsOnMethods = { "testReset" }) + public void testUndeployVApp() { + UndeployVAppParams params = UndeployVAppParams.builder().build(); + + // The method under test + Task undeploy = vAppClient.undeploy(vApp.getHref(), params); + assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy")); + + // Get the updated VApp + vApp = vAppClient.getVApp(vApp.getHref()); + + // Check status + Status poweredOnStatus = Status.POWERED_ON; + assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString())); } @Test(testName = "POST /vApp/{id}/power/action/powerOff", dependsOnMethods = { "testUndeployVApp" }) @@ -239,12 +341,15 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest { Task powerOffVApp = vAppClient.powerOff(vApp.getHref()); assertTrue(retryTaskSuccess.apply(powerOffVApp), String.format(TASK_COMPLETE_TIMELY, "powerOffVApp")); + // Get the updated VApp vApp = vAppClient.getVApp(vApp.getHref()); - Integer poweredOffStatus = Status.POWERED_OFF.getValue(); - assertEquals(vApp.getStatus(), poweredOffStatus, String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus, vApp.getStatus())); + + // Check status + Status poweredOffStatus = Status.POWERED_OFF; + assertEquals(vApp.getStatus(), poweredOffStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus.toString(), Status.fromValue(vApp.getStatus()).toString())); } - @Test(testName = "POST /vApp/{id}/action/consolidate", dependsOnMethods = { "testGetVApp" }) + @Test(testName = "POST /vApp/{id}/action/consolidate", dependsOnMethods = { "testPowerOnVApp" }) public void testConsolidateVApp() { // The method under test Task consolidateVApp = vAppClient.consolidateVApp(vApp.getHref()); @@ -282,7 +387,7 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest { assertEquals(modified, params, String.format(ENTITY_EQUAL, "ControlAccessParams")); } - @Test(testName = "POST /vApp/{id}/action/discardSuspendedState", dependsOnMethods = { "testGetVApp" }) + @Test(testName = "POST /vApp/{id}/action/discardSuspendedState", dependsOnMethods = { "testSuspend" }) public void testDiscardSuspendedState() { // The method under test Task discardSuspendedState = vAppClient.discardSuspendedState(vApp.getHref()); @@ -337,20 +442,6 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest { assertTrue(retryTaskSuccess.apply(relocate), String.format(TASK_COMPLETE_TIMELY, "relocate")); } - @Test(testName = "POST /vApp/{id}/action/undeploy", dependsOnMethods = { "testDeployVApp" }) - public void testUndeployVApp() { - UndeployVAppParams params = UndeployVAppParams.builder() - .build(); - - // The method under test - Task undeploy = vAppClient.undeploy(vApp.getHref(), params); - assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy")); - - vApp = vAppClient.getVApp(vApp.getHref()); - Integer resolvedStatus = Status.RESOLVED.getValue(); - assertEquals(vApp.getStatus(), resolvedStatus, String.format(OBJ_FIELD_EQ, VAPP, "status", resolvedStatus, vApp.getStatus())); - } - @Test(testName = "POST /vApp/{id}/action/upgradeHardwareVersion", dependsOnMethods = { "testGetVApp" }) public void testUpgradeHardwareVersion() { // The method under test @@ -358,50 +449,6 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest { assertTrue(retryTaskSuccess.apply(upgradeHardwareVersion), String.format(TASK_COMPLETE_TIMELY, "upgradeHardwareVersion")); } - @Test(testName = "POST /vApp/{id}/power/action/reboot", dependsOnMethods = { "testGetVApp" }) - public void testReboot() { - // The method under test - Task reboot = vAppClient.reboot(vApp.getHref()); - assertTrue(retryTaskSuccess.apply(reboot), String.format(TASK_COMPLETE_TIMELY, "reboot")); - - vApp = vAppClient.getVApp(vApp.getHref()); - Integer poweredOnStatus = Status.POWERED_ON.getValue(); - assertEquals(vApp.getStatus(), poweredOnStatus, String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus, "powered off")); - } - - @Test(testName = "POST /vApp/{id}/power/action/reset", dependsOnMethods = { "testGetVApp" }) - public void testReset() { - // The method under test - Task reset = vAppClient.reset(vApp.getHref()); - assertTrue(retryTaskSuccess.apply(reset), String.format(TASK_COMPLETE_TIMELY, "reset")); - - vApp = vAppClient.getVApp(vApp.getHref()); - Integer poweredOffStatus = Status.POWERED_ON.getValue(); - assertEquals(vApp.getStatus(), poweredOffStatus, String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus, "powered off")); - } - - @Test(testName = "POST /vApp/{id}/power/action/shutdown", dependsOnMethods = { "testGetVApp" }) - public void testShutdown() { - // The method under test - Task shutdown = vAppClient.shutdown(vApp.getHref()); - assertTrue(retryTaskSuccess.apply(shutdown), String.format(TASK_COMPLETE_TIMELY, "shutdown")); - - vApp = vAppClient.getVApp(vApp.getHref()); - Integer poweredOffStatus = Status.POWERED_OFF.getValue(); - assertEquals(vApp.getStatus(), poweredOffStatus, String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus, "powered off")); - } - - @Test(testName = "POST /vApp/{id}/power/action/suspend", dependsOnMethods = { "testGetVApp" }) - public void testSuspend() { - // The method under test - Task suspend = vAppClient.suspend(vApp.getHref()); - assertTrue(retryTaskSuccess.apply(suspend), String.format(TASK_COMPLETE_TIMELY, "suspend")); - - vApp = vAppClient.getVApp(vApp.getHref()); - Integer poweredOffStatus = Status.POWERED_OFF.getValue(); - assertEquals(vApp.getStatus(), poweredOffStatus, String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus, "powered off")); - } - @Test(testName = "GET /vApp/{id}/controlAccess", dependsOnMethods = { "testGetVApp" }) public void testGetControlAccess() { // The method under test diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java index dd13abebf5..3903d9a30c 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java @@ -61,6 +61,9 @@ import com.google.inject.Module; @Listeners(FormatApiResultsListener.class) @Test(groups = "live") public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTest { + + protected static final long TASK_TIMEOUT_SECONDS = 10L; + protected static final long LONG_TASK_TIMEOUT_SECONDS = 300L; protected BaseVCloudDirectorClientLiveTest() { provider = "vcloud-director"; @@ -70,10 +73,16 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ public abstract void setupRequiredClients(); public Predicate retryTaskSuccess; + public Predicate retryTaskSuccessLong; @Inject protected void initTaskSuccess(TaskSuccess taskSuccess) { - retryTaskSuccess = new RetryablePredicate(taskSuccess, 1000L); + retryTaskSuccess = new RetryablePredicate(taskSuccess, TASK_TIMEOUT_SECONDS * 1000L); + } + + @Inject + protected void initTaskSuccessLong(TaskSuccess taskSuccess) { + retryTaskSuccessLong = new RetryablePredicate(taskSuccess, LONG_TASK_TIMEOUT_SECONDS * 1000L); } protected RestContext context;