Issue 830: Updates for failing tests

This commit is contained in:
Andrew Donald Kennedy 2012-03-21 16:27:27 +00:00
parent 16d72204b0
commit 78a4a674ab
3 changed files with 27 additions and 21 deletions

View File

@ -122,7 +122,7 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
Set<URI> hrefs = toHrefs(queryResult);
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP_TEMPLATE, null), QueryResultVAppTemplateRecord.class);
assertEquals(hrefs, Collections.singleton(vAppTemplateURI), "VAppTemplates query result should have found vAppTemplate "+vAppTemplateURI);
assertTrue(hrefs.contains(vAppTemplateURI), "VAppTemplates query result should have found vAppTemplate "+vAppTemplateURI);
}
@Test(testName = "GET /vApps/query")

View File

@ -484,7 +484,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Copy existing section and update fields
GuestCustomizationSection oldSection = vAppClient.getGuestCustomizationSection(vm.getHref());
GuestCustomizationSection newSection = oldSection.toBuilder()
.computerName("newComputerName")
.computerName(name("n"))
.enabled(Boolean.FALSE)
.adminPassword(null) // Not allowed
.build();

View File

@ -52,6 +52,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection;
import org.jclouds.vcloud.director.v1_5.domain.NetworkConnection;
import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection;
import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList;
@ -60,6 +61,7 @@ import org.jclouds.vcloud.director.v1_5.domain.References;
import org.jclouds.vcloud.director.v1_5.domain.RelocateParams;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
import org.jclouds.vcloud.director.v1_5.domain.NetworkConnection.IpAddressAllocationMode;
import org.jclouds.vcloud.director.v1_5.domain.ovf.Envelope;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import org.testng.annotations.Test;
@ -280,9 +282,9 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
@Test(testName = "PUT /vAppTemplate/{id}/guestCustomizationSection")
public void testEditGuestCustomizationSection() {
String computerName = name("server-");
String computerName = name("n");
GuestCustomizationSection newSection = GuestCustomizationSection.builder()
.info("my info")
.info("")
.computerName(computerName)
.build();
@ -301,7 +303,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
boolean newVal = !oldVal;
CustomizationSection customizationSection = CustomizationSection.builder()
.info("my info")
.info("")
.customizeOnInstantiate(newVal)
.build();
@ -368,13 +370,20 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
@Test(testName = "PUT /vAppTemplate/{id}/networkConnectionSection")
public void testEditNetworkConnectionSection() {
// TODO Modify a field so can assert that the change really took effect
NetworkConnectionSection oldSection = vAppTemplateClient.getVAppTemplateNetworkConnectionSection(vm.getHref());
// Look up a network in the Vdc
Set<Reference> networks = vdc.getAvailableNetworks().getNetworks();
Reference network = Iterables.getLast(networks);
// Copy existing section and update fields
NetworkConnectionSection oldSection = vAppClient.getNetworkConnectionSection(vm.getHref());
NetworkConnectionSection newSection = oldSection.toBuilder()
.build();
.networkConnection(NetworkConnection.builder()
.ipAddressAllocationMode(IpAddressAllocationMode.DHCP.toString())
.network(network.getName())
.build())
.build();
final Task task = vAppTemplateClient.editVAppTemplateNetworkConnectionSection(vm.getHref(), newSection);
Task task = vAppTemplateClient.editVAppTemplateNetworkConnectionSection(vm.getHref(), newSection);
assertTaskSucceeds(task);
NetworkConnectionSection modified = vAppTemplateClient.getVAppTemplateNetworkConnectionSection(vm.getHref());
@ -445,11 +454,10 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
@Test(testName = "POST /vAppTemplate/{id}/action/consolidate")
public void testConsolidateVAppTemplate() throws Exception {
// TODO Need assertion that command had effect
System.out.println("About to try to consolidate "+vm);
final Task task = vAppTemplateClient.consolidateVappTemplate(vm.getHref());
assertTaskSucceedsLong(task);
// TODO Need assertion that command had effect
}
@Test(testName = "POST /vAppTemplate/{id}/action/relocate") // FIXME Need a datastore reference
@ -478,18 +486,16 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
// Kick off a task, and wait for it to complete
vAppTemplateClient.disableDownloadVappTemplate(vAppTemplateURI);
final Task task = vAppTemplateClient.enableDownloadVappTemplate(vAppTemplateURI);
retryTaskSuccess.apply(task);
assertTaskDoneEventually(task);
// Ask the VAppTemplate for its tasks, and the status of the matching task if it exists
VAppTemplate vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
Set<Task> tasks = vAppTemplate.getTasks();
if (tasks != null) {
for (Task contender : tasks) {
if (task.getId().equals(contender.getId())) {
String status = contender.getStatus();
if (status.equals(Task.Status.QUEUED) || status.equals(Task.Status.PRE_RUNNING) || status.equals(Task.Status.RUNNING)) {
fail("Task "+contender+" reported complete, but is included in VAppTemplate in status "+status);
}
for (Task contender : tasks) {
if (task.getId().equals(contender.getId())) {
String status = contender.getStatus();
if (status.equals(Task.Status.QUEUED) || status.equals(Task.Status.PRE_RUNNING) || status.equals(Task.Status.RUNNING)) {
fail("Task "+contender+" reported complete, but is included in VAppTemplate in status "+status);
}
}
}