mirror of https://github.com/apache/jclouds.git
Issue 830: Fix for modifyLeaseSettingsSection
This commit is contained in:
parent
7998e1b012
commit
0534821234
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue