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 055ee5b0f4..86f0f38541 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 @@ -529,7 +529,10 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { public void testModifyLeaseSettingsSection() { // Copy existing section LeaseSettingsSection oldSection = vAppClient.getLeaseSettingsSection(vApp.getHref()); - LeaseSettingsSection newSection = oldSection.toBuilder().build(); + Integer twoHours = (int) TimeUnit.SECONDS.convert(2L, TimeUnit.HOURS); + LeaseSettingsSection newSection = oldSection.toBuilder() + .deploymentLeaseInSeconds(twoHours) + .build(); // The method under test Task modifyLeaseSettingsSection = vAppClient.modifyLeaseSettingsSection(vApp.getHref(), newSection); @@ -542,13 +545,13 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { checkLeaseSettingsSection(modified); // Check the date fields - if (modified.getDeploymentLeaseExpiration() != null) { + if (modified.getDeploymentLeaseExpiration() != null && newSection.getDeploymentLeaseExpiration() != null) { assertTrue(modified.getDeploymentLeaseExpiration().after(newSection.getDeploymentLeaseExpiration()), String.format("The new deploymentLeaseExpiration timestamp must be later than the original: %s > %s", dateService.iso8601DateFormat(modified.getDeploymentLeaseExpiration()), dateService.iso8601DateFormat(newSection.getDeploymentLeaseExpiration()))); } - if (modified.getStorageLeaseExpiration() != null) { + if (modified.getStorageLeaseExpiration() != null && newSection.getStorageLeaseExpiration() != null) { assertTrue(modified.getStorageLeaseExpiration().after(newSection.getStorageLeaseExpiration()), String.format("The new storageLeaseExpiration timestamp must be later than the original: %s > %s", dateService.iso8601DateFormat(modified.getStorageLeaseExpiration()), @@ -566,6 +569,8 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { .build(); // Check the section was modified correctly + assertEquals(modified.getDeploymentLeaseInSeconds(), twoHours, + String.format(OBJ_FIELD_EQ, "LeaseSettingsSection", "DeploymentLeaseInSeconds", Integer.toString(twoHours), modified.getDeploymentLeaseInSeconds().toString())); assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "LeaseSettingsSection")); } @@ -819,7 +824,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { checkRuntimeInfoSection(section); } - // FIXME If still failing, consider escalating? + // FIXME If still failing, consider escalating? @Test(testName = "GET /vApp/{id}/screen", dependsOnMethods = { "testDeployVApp" }) public void testGetScreenImage() { // Power on VApp diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java index 6bf630df17..a8f0e58433 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java @@ -318,9 +318,9 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest { @Test(testName = "PUT /vAppTemplate/{id}/leaseSettingsSection") public void testEditLeaseSettingsSection() throws Exception { int deploymentLeaseInSeconds = random.nextInt(10000)+1; - - // Note: use smallish number for storageLeaseInSeconds; it seems to be capped at 5184000? + // NOTE use smallish number for storageLeaseInSeconds; it seems to be capped at 5184000? int storageLeaseInSeconds = random.nextInt(10000)+1; + LeaseSettingsSection leaseSettingSection = LeaseSettingsSection.builder() .info("my info") .storageLeaseInSeconds(storageLeaseInSeconds) @@ -331,8 +331,8 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest { retryTaskSuccess.apply(task); LeaseSettingsSection newLeaseSettingsSection = vAppTemplateClient.getVappTemplateLeaseSettingsSection(vAppTemplateURI); - assertEquals(newLeaseSettingsSection.getStorageLeaseInSeconds(), (Integer)storageLeaseInSeconds); - assertEquals(newLeaseSettingsSection.getDeploymentLeaseInSeconds(), (Integer)deploymentLeaseInSeconds); + assertEquals(newLeaseSettingsSection.getStorageLeaseInSeconds(), (Integer) storageLeaseInSeconds); + assertEquals(newLeaseSettingsSection.getDeploymentLeaseInSeconds(), (Integer) deploymentLeaseInSeconds); } @Test(testName = "PUT /vAppTemplate/{id}/networkConfigSection") 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 56e345219b..e3b4c519f6 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 @@ -126,10 +126,10 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ provider = "vcloud-director"; } - protected static DateService dateService; + protected DateService dateService; - @BeforeGroups(alwaysRun = true) - protected static void setupDateService() { + @BeforeClass(alwaysRun = true) + protected void setupDateService() { dateService = Guice.createInjector().getInstance(DateService.class); assertNotNull(dateService); }