mirror of https://github.com/apache/jclouds.git
Issue 830: Updates for failing tests
This commit is contained in:
parent
16d72204b0
commit
78a4a674ab
|
@ -122,7 +122,7 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
Set<URI> hrefs = toHrefs(queryResult);
|
Set<URI> hrefs = toHrefs(queryResult);
|
||||||
|
|
||||||
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP_TEMPLATE, null), QueryResultVAppTemplateRecord.class);
|
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")
|
@Test(testName = "GET /vApps/query")
|
||||||
|
|
|
@ -484,7 +484,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
||||||
// Copy existing section and update fields
|
// Copy existing section and update fields
|
||||||
GuestCustomizationSection oldSection = vAppClient.getGuestCustomizationSection(vm.getHref());
|
GuestCustomizationSection oldSection = vAppClient.getGuestCustomizationSection(vm.getHref());
|
||||||
GuestCustomizationSection newSection = oldSection.toBuilder()
|
GuestCustomizationSection newSection = oldSection.toBuilder()
|
||||||
.computerName("newComputerName")
|
.computerName(name("n"))
|
||||||
.enabled(Boolean.FALSE)
|
.enabled(Boolean.FALSE)
|
||||||
.adminPassword(null) // Not allowed
|
.adminPassword(null) // Not allowed
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -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.MetadataEntry;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
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.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.NetworkConnectionSection;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList;
|
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.RelocateParams;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
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.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.Envelope;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -280,9 +282,9 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
||||||
|
|
||||||
@Test(testName = "PUT /vAppTemplate/{id}/guestCustomizationSection")
|
@Test(testName = "PUT /vAppTemplate/{id}/guestCustomizationSection")
|
||||||
public void testEditGuestCustomizationSection() {
|
public void testEditGuestCustomizationSection() {
|
||||||
String computerName = name("server-");
|
String computerName = name("n");
|
||||||
GuestCustomizationSection newSection = GuestCustomizationSection.builder()
|
GuestCustomizationSection newSection = GuestCustomizationSection.builder()
|
||||||
.info("my info")
|
.info("")
|
||||||
.computerName(computerName)
|
.computerName(computerName)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -301,7 +303,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
||||||
boolean newVal = !oldVal;
|
boolean newVal = !oldVal;
|
||||||
|
|
||||||
CustomizationSection customizationSection = CustomizationSection.builder()
|
CustomizationSection customizationSection = CustomizationSection.builder()
|
||||||
.info("my info")
|
.info("")
|
||||||
.customizeOnInstantiate(newVal)
|
.customizeOnInstantiate(newVal)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -368,13 +370,20 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
||||||
|
|
||||||
@Test(testName = "PUT /vAppTemplate/{id}/networkConnectionSection")
|
@Test(testName = "PUT /vAppTemplate/{id}/networkConnectionSection")
|
||||||
public void testEditNetworkConnectionSection() {
|
public void testEditNetworkConnectionSection() {
|
||||||
// TODO Modify a field so can assert that the change really took effect
|
// Look up a network in the Vdc
|
||||||
|
Set<Reference> networks = vdc.getAvailableNetworks().getNetworks();
|
||||||
NetworkConnectionSection oldSection = vAppTemplateClient.getVAppTemplateNetworkConnectionSection(vm.getHref());
|
Reference network = Iterables.getLast(networks);
|
||||||
|
|
||||||
|
// Copy existing section and update fields
|
||||||
|
NetworkConnectionSection oldSection = vAppClient.getNetworkConnectionSection(vm.getHref());
|
||||||
NetworkConnectionSection newSection = oldSection.toBuilder()
|
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);
|
assertTaskSucceeds(task);
|
||||||
|
|
||||||
NetworkConnectionSection modified = vAppTemplateClient.getVAppTemplateNetworkConnectionSection(vm.getHref());
|
NetworkConnectionSection modified = vAppTemplateClient.getVAppTemplateNetworkConnectionSection(vm.getHref());
|
||||||
|
@ -445,11 +454,10 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
||||||
|
|
||||||
@Test(testName = "POST /vAppTemplate/{id}/action/consolidate")
|
@Test(testName = "POST /vAppTemplate/{id}/action/consolidate")
|
||||||
public void testConsolidateVAppTemplate() throws Exception {
|
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());
|
final Task task = vAppTemplateClient.consolidateVappTemplate(vm.getHref());
|
||||||
assertTaskSucceedsLong(task);
|
assertTaskSucceedsLong(task);
|
||||||
|
|
||||||
|
// TODO Need assertion that command had effect
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "POST /vAppTemplate/{id}/action/relocate") // FIXME Need a datastore reference
|
@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
|
// Kick off a task, and wait for it to complete
|
||||||
vAppTemplateClient.disableDownloadVappTemplate(vAppTemplateURI);
|
vAppTemplateClient.disableDownloadVappTemplate(vAppTemplateURI);
|
||||||
final Task task = vAppTemplateClient.enableDownloadVappTemplate(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
|
// Ask the VAppTemplate for its tasks, and the status of the matching task if it exists
|
||||||
VAppTemplate vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
|
VAppTemplate vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
|
||||||
Set<Task> tasks = vAppTemplate.getTasks();
|
Set<Task> tasks = vAppTemplate.getTasks();
|
||||||
if (tasks != null) {
|
for (Task contender : tasks) {
|
||||||
for (Task contender : tasks) {
|
if (task.getId().equals(contender.getId())) {
|
||||||
if (task.getId().equals(contender.getId())) {
|
String status = contender.getStatus();
|
||||||
String status = contender.getStatus();
|
if (status.equals(Task.Status.QUEUED) || status.equals(Task.Status.PRE_RUNNING) || status.equals(Task.Status.RUNNING)) {
|
||||||
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);
|
||||||
fail("Task "+contender+" reported complete, but is included in VAppTemplate in status "+status);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue