VDC vdc = createMock(VDC.class);
URI templateURI = URI.create("template");
URI vdcURI = URI.create("vdc");
expect(template.getDescription()).andReturn(description).atLeastOnce();
TerremarkVCloudClient client = createMock(TerremarkVCloudClient.class);
VApp vApp = createMock(VApp.class);
InternetServiceAndPublicIpAddressSupplier supplier = createMock(InternetServiceAndPublicIpAddressSupplier.class);
expect(client.getVAppTemplate(templateURI)).andReturn(template);
expect(
client.instantiateVAppTemplateInVDC(vdcURI, templateURI, "name",
new InstantiateVAppTemplateOptions().productProperty("password", "password"))).andReturn(vApp);
Task task = createMock(Task.class);
URI vappLocation = URI.create("vapp");
URI taskLocation = URI.create("task");
expect(vApp.getHref()).andReturn(vappLocation).atLeastOnce();
expect(vApp.getName()).andReturn("name").atLeastOnce();
expect(client.deployVApp(vappLocation)).andReturn(task);
expect(task.getHref()).andReturn(taskLocation).atLeastOnce();
Predicate<URI> successTester = createMock(Predicate.class);
expect(successTester.apply(taskLocation)).andReturn(true).atLeastOnce();
expect(client.powerOnVApp(vappLocation)).andReturn(task);
Predicate<VApp> notFoundTester = createMock(Predicate.class);
Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus = createMock(Map.class);
TerremarkVCloudComputeClient computeClient = new TerremarkVCloudComputeClient(client,