mirror of https://github.com/apache/jclouds.git
Cleanup of Client->Api getters for vcloud
This commit is contained in:
parent
a61ad06cbf
commit
de8ab57072
|
@ -44,48 +44,48 @@ public interface VCloudApi extends Closeable {
|
|||
*
|
||||
*/
|
||||
@Delegate
|
||||
VAppTemplateApi getVAppTemplateClient();
|
||||
VAppTemplateApi getVAppTemplateApi();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to VApp features.
|
||||
*/
|
||||
@Delegate
|
||||
VAppApi getVAppClient();
|
||||
VAppApi getVAppApi();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Vm features.
|
||||
*/
|
||||
@Delegate
|
||||
VmApi getVmClient();
|
||||
VmApi getVmApi();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Catalog features.
|
||||
*/
|
||||
@Delegate
|
||||
CatalogApi getCatalogClient();
|
||||
CatalogApi getCatalogApi();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Task features.
|
||||
*/
|
||||
@Delegate
|
||||
TaskApi getTaskClient();
|
||||
TaskApi getTaskApi();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to VDC features.
|
||||
*/
|
||||
@Delegate
|
||||
VDCApi getVDCClient();
|
||||
VDCApi getVDCApi();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Network features.
|
||||
*/
|
||||
@Delegate
|
||||
NetworkApi getNetworkClient();
|
||||
NetworkApi getNetworkApi();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Org features.
|
||||
*/
|
||||
@Delegate
|
||||
OrgApi getOrgClient();
|
||||
OrgApi getOrgApi();
|
||||
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
|
|||
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
|
||||
|
||||
// vm data is available after instantiate completes
|
||||
vAppResponse = client.getVAppClient().getVApp(vAppResponse.getHref());
|
||||
vAppResponse = client.getVAppApi().getVApp(vAppResponse.getHref());
|
||||
|
||||
// per above check, we know there is only a single VM
|
||||
Vm vm = get(vAppResponse.getChildren(), 0);
|
||||
|
@ -145,14 +145,14 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
|
|||
waitForTask(updateMemoryMBOfVm(vm, memoryMB));
|
||||
logger.trace("<< updated memoryMB vm(%s)", vm.getName());
|
||||
logger.trace(">> deploying vApp(%s)", vAppResponse.getName());
|
||||
waitForTask(client.getVAppClient().deployVApp(vAppResponse.getHref()));
|
||||
waitForTask(client.getVAppApi().deployVApp(vAppResponse.getHref()));
|
||||
logger.trace("<< deployed vApp(%s)", vAppResponse.getName());
|
||||
|
||||
// only after deploy is the password valid
|
||||
vAppResponse = client.getVAppClient().getVApp(vAppResponse.getHref());
|
||||
vAppResponse = client.getVAppApi().getVApp(vAppResponse.getHref());
|
||||
|
||||
logger.trace(">> powering on vApp(%s)", vAppResponse.getName());
|
||||
client.getVAppClient().powerOnVApp(vAppResponse.getHref());
|
||||
client.getVAppApi().powerOnVApp(vAppResponse.getHref());
|
||||
|
||||
return new NodeAndInitialCredentials<VApp>(vAppResponse, vAppResponse.getHref().toASCIIString(),
|
||||
getCredentialsFrom(vAppResponse));
|
||||
|
@ -203,7 +203,7 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
|
|||
|
||||
logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);
|
||||
|
||||
VApp vAppResponse = client.getVAppTemplateClient().createVAppInVDCByInstantiatingTemplate(name, VDC, templateId,
|
||||
VApp vAppResponse = client.getVAppTemplateApi().createVAppInVDCByInstantiatingTemplate(name, VDC, templateId,
|
||||
options);
|
||||
return vAppResponse;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
|
|||
|
||||
guestConfiguration.setCustomizationScript(customizationScript);
|
||||
}
|
||||
return client.getVmClient().updateGuestCustomizationOfVm(guestConfiguration, vm.getHref());
|
||||
return client.getVmApi().updateGuestCustomizationOfVm(guestConfiguration, vm.getHref());
|
||||
}
|
||||
|
||||
public void ensureVmHasAllocationModeOrPooled(VApp vApp, @Nullable IpAddressAllocationMode ipAllocationMode) {
|
||||
|
@ -273,7 +273,7 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
|
|||
.ipAddressAllocationMode(ipAllocationMode).build()));
|
||||
logger.trace(">> updating networkConnection vm(%s)", vm.getName());
|
||||
|
||||
waitForTask(client.getVmClient().updateNetworkConnectionOfVm(builder.build(), vm.getHref()));
|
||||
waitForTask(client.getVmApi().updateNetworkConnectionOfVm(builder.build(), vm.getHref()));
|
||||
logger.trace("<< updated networkConnection vm(%s)", vm.getName());
|
||||
|
||||
}
|
||||
|
@ -292,10 +292,10 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
|
|||
}
|
||||
|
||||
public Task updateCPUCountOfVm(Vm vm, int cpuCount) {
|
||||
return client.getVmClient().updateCPUCountOfVm(cpuCount, vm.getHref());
|
||||
return client.getVmApi().updateCPUCountOfVm(cpuCount, vm.getHref());
|
||||
}
|
||||
|
||||
public Task updateMemoryMBOfVm(Vm vm, int memoryInMB) {
|
||||
return client.getVmClient().updateMemoryMBOfVm(memoryInMB, vm.getHref());
|
||||
return client.getVmApi().updateMemoryMBOfVm(memoryInMB, vm.getHref());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ public class VCloudComputeServiceAdapter implements ComputeServiceAdapter<VApp,
|
|||
Builder<VApp> nodes = ImmutableSet.builder();
|
||||
for (Org org : nameToOrg.get().values()) {
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
for (ReferenceType resource : client.getVDCClient().getVDC(vdc.getHref()).getResourceEntities().values()) {
|
||||
for (ReferenceType resource : client.getVDCApi().getVDC(vdc.getHref()).getResourceEntities().values()) {
|
||||
if (resource.getType().equals(VCloudMediaType.VAPP_XML)) {
|
||||
addVAppToSetRetryingIfNotYetPresent(nodes, vdc, resource);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public class VCloudComputeServiceAdapter implements ComputeServiceAdapter<VApp,
|
|||
int i = 0;
|
||||
while (node == null && i++ < 3) {
|
||||
try {
|
||||
node = client.getVAppClient().getVApp(resource.getHref());
|
||||
node = client.getVAppApi().getVApp(resource.getHref());
|
||||
nodes.add(node);
|
||||
} catch (NullPointerException e) {
|
||||
logger.warn("vApp %s not yet present in vdc %s", resource.getName(), vdc.getName());
|
||||
|
@ -178,13 +178,13 @@ public class VCloudComputeServiceAdapter implements ComputeServiceAdapter<VApp,
|
|||
@Override
|
||||
public VApp getNode(String in) {
|
||||
URI id = URI.create(in);
|
||||
return client.getVAppClient().getVApp(id);
|
||||
return client.getVAppApi().getVApp(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VAppTemplate getImage(String in) {
|
||||
URI id = URI.create(in);
|
||||
return client.getVAppTemplateClient().getVAppTemplate(id);
|
||||
return client.getVAppTemplateApi().getVAppTemplate(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -194,47 +194,47 @@ public class VCloudComputeServiceAdapter implements ComputeServiceAdapter<VApp,
|
|||
if (vApp.getStatus() != Status.OFF) {
|
||||
logger.debug(">> powering off VApp vApp(%s), current status: %s", vApp.getName(), vApp.getStatus());
|
||||
try {
|
||||
waitForTask(client.getVAppClient().powerOffVApp(vApp.getHref()));
|
||||
vApp = client.getVAppClient().getVApp(vApp.getHref());
|
||||
waitForTask(client.getVAppApi().powerOffVApp(vApp.getHref()));
|
||||
vApp = client.getVAppApi().getVApp(vApp.getHref());
|
||||
logger.debug("<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
|
||||
} catch (IllegalStateException e) {
|
||||
logger.warn(e, "<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
|
||||
}
|
||||
logger.debug(">> undeploying vApp(%s), current status: %s", vApp.getName(), vApp.getStatus());
|
||||
try {
|
||||
waitForTask(client.getVAppClient().undeployVApp(vApp.getHref()));
|
||||
vApp = client.getVAppClient().getVApp(vApp.getHref());
|
||||
waitForTask(client.getVAppApi().undeployVApp(vApp.getHref()));
|
||||
vApp = client.getVAppApi().getVApp(vApp.getHref());
|
||||
logger.debug("<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
|
||||
} catch (IllegalStateException e) {
|
||||
logger.warn(e, "<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
|
||||
}
|
||||
}
|
||||
logger.debug(">> deleting vApp(%s)", vApp.getHref());
|
||||
waitForTask(client.getVAppClient().deleteVApp(vApp.getHref()));
|
||||
waitForTask(client.getVAppApi().deleteVApp(vApp.getHref()));
|
||||
logger.debug("<< deleted vApp(%s)", vApp.getHref());
|
||||
}
|
||||
|
||||
VApp waitForPendingTasksToComplete(URI vappId) {
|
||||
VApp vApp = client.getVAppClient().getVApp(vappId);
|
||||
VApp vApp = client.getVAppApi().getVApp(vappId);
|
||||
if (vApp.getTasks().size() == 0)
|
||||
return vApp;
|
||||
for (Task task : vApp.getTasks())
|
||||
waitForTask(task);
|
||||
return client.getVAppClient().getVApp(vappId);
|
||||
return client.getVAppApi().getVApp(vappId);
|
||||
}
|
||||
|
||||
VApp cancelAnyRunningTasks(URI vappId) {
|
||||
VApp vApp = client.getVAppClient().getVApp(vappId);
|
||||
VApp vApp = client.getVAppApi().getVApp(vappId);
|
||||
if (vApp.getTasks().size() == 0)
|
||||
return vApp;
|
||||
for (Task task : vApp.getTasks()) {
|
||||
try {
|
||||
client.getTaskClient().cancelTask(task.getHref());
|
||||
client.getTaskApi().cancelTask(task.getHref());
|
||||
waitForTask(task);
|
||||
} catch (TaskInErrorStateException e) {
|
||||
}
|
||||
}
|
||||
return client.getVAppClient().getVApp(vappId);
|
||||
return client.getVAppApi().getVApp(vappId);
|
||||
|
||||
}
|
||||
|
||||
|
@ -246,18 +246,18 @@ public class VCloudComputeServiceAdapter implements ComputeServiceAdapter<VApp,
|
|||
@Override
|
||||
public void rebootNode(String in) {
|
||||
URI id = URI.create(checkNotNull(in, "node.id"));
|
||||
waitForTask(client.getVAppClient().resetVApp(id));
|
||||
waitForTask(client.getVAppApi().resetVApp(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeNode(String in) {
|
||||
URI id = URI.create(checkNotNull(in, "node.id"));
|
||||
waitForTask(client.getVAppClient().powerOnVApp(id));
|
||||
waitForTask(client.getVAppApi().powerOnVApp(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suspendNode(String in) {
|
||||
URI id = URI.create(checkNotNull(in, "node.id"));
|
||||
waitForTask(client.getVAppClient().powerOffVApp(id));
|
||||
waitForTask(client.getVAppApi().powerOffVApp(id));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class CatalogItemsInCatalog implements Function<Catalog, Iterable<Catalog
|
|||
}
|
||||
}), new Function<ReferenceType, CatalogItem>() {
|
||||
public CatalogItem apply(ReferenceType from) {
|
||||
return aclient.getCatalogClient().getCatalogItem(from.getHref());
|
||||
return aclient.getCatalogApi().getCatalogItem(from.getHref());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class CatalogsInOrg implements Function<Org, Iterable<Catalog>> {
|
|||
public Iterable<Catalog> apply(final Org org) {
|
||||
return transform(org.getCatalogs().values(), new Function<ReferenceType, Catalog>() {
|
||||
public Catalog apply(ReferenceType from) {
|
||||
return aclient.getCatalogClient().getCatalog(from.getHref());
|
||||
return aclient.getCatalogApi().getCatalog(from.getHref());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class NetworksInOrg implements Function<Org, Iterable<OrgNetwork>> {
|
|||
public Iterable<OrgNetwork> apply(final Org org) {
|
||||
return transform(org.getNetworks().values(), new Function<ReferenceType, OrgNetwork>() {
|
||||
public OrgNetwork apply(ReferenceType from) {
|
||||
return aclient.getNetworkClient().getNetwork(from.getHref());
|
||||
return aclient.getNetworkApi().getNetwork(from.getHref());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class OrgsForLocations implements Function<Iterable<Location>, Iterable<O
|
|||
});
|
||||
return transform(uris, new Function<URI, Org>() {
|
||||
public Org apply(URI from) {
|
||||
return aclient.getOrgClient().getOrg(from);
|
||||
return aclient.getOrgApi().getOrg(from);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class OrgsForNames implements Function<Iterable<String>, Iterable<Org>> {
|
|||
public Iterable<Org> apply(Iterable<String> from) {
|
||||
return Iterables.filter(transform(from, new Function<String, Org>() {
|
||||
public Org apply(String from) {
|
||||
return aclient.getOrgClient().findOrgNamed(from);
|
||||
return aclient.getOrgApi().findOrgNamed(from);
|
||||
}
|
||||
}), Predicates.notNull());
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class VAppTemplatesForCatalogItems implements Function<Iterable<CatalogIt
|
|||
}
|
||||
}), new Function<CatalogItem, VAppTemplate>() {
|
||||
public VAppTemplate apply(CatalogItem from) {
|
||||
return aclient.getVAppTemplateClient().getVAppTemplate(from.getEntity().getHref());
|
||||
return aclient.getVAppTemplateApi().getVAppTemplate(from.getEntity().getHref());
|
||||
}
|
||||
}), Predicates.notNull());
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class VDCsInOrg implements Function<Org, Iterable<VDC>> {
|
|||
public Iterable<VDC> apply(final Org org) {
|
||||
return transform(org.getVDCs().values(), new Function<ReferenceType, VDC>() {
|
||||
public VDC apply(ReferenceType from) {
|
||||
return aclient.getVDCClient().getVDC(from.getHref());
|
||||
return aclient.getVDCApi().getVDC(from.getHref());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -42,6 +42,6 @@ public class OVFLoader extends CacheLoader<URI, Envelope> {
|
|||
|
||||
@Override
|
||||
public Envelope load(URI template) {
|
||||
return client.getVAppTemplateClient().getOvfEnvelopeForVAppTemplate(template);
|
||||
return client.getVAppTemplateApi().getOvfEnvelopeForVAppTemplate(template);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,6 @@ public class VAppTemplateLoader extends CacheLoader<URI, VAppTemplate> {
|
|||
|
||||
@Override
|
||||
public VAppTemplate load(URI template) {
|
||||
return client.getVAppTemplateClient().getVAppTemplate(template);
|
||||
return client.getVAppTemplateApi().getVAppTemplate(template);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class TaskSuccess implements Predicate<URI> {
|
|||
public boolean apply(URI taskId) {
|
||||
logger.trace("looking for status on task %s", taskId);
|
||||
|
||||
Task task = client.getTaskClient().getTask(taskId);
|
||||
Task task = client.getTaskApi().getTask(taskId);
|
||||
// perhaps task isn't available, yet
|
||||
if (task == null)
|
||||
return false;
|
||||
|
|
|
@ -38,14 +38,14 @@ public class VCloudApiTest extends BaseVCloudApiTest<VCloudApi> {
|
|||
private VCloudApi syncClient;
|
||||
|
||||
public void testSync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException {
|
||||
assert syncClient.getVAppClient() != null;
|
||||
assert syncClient.getCatalogClient() != null;
|
||||
assert syncClient.getVmClient() != null;
|
||||
assert syncClient.getVAppTemplateClient() != null;
|
||||
assert syncClient.getTaskClient() != null;
|
||||
assert syncClient.getVDCClient() != null;
|
||||
assert syncClient.getNetworkClient() != null;
|
||||
assert syncClient.getOrgClient() != null;
|
||||
assert syncClient.getVAppApi() != null;
|
||||
assert syncClient.getCatalogApi() != null;
|
||||
assert syncClient.getVmApi() != null;
|
||||
assert syncClient.getVAppTemplateApi() != null;
|
||||
assert syncClient.getTaskApi() != null;
|
||||
assert syncClient.getVDCApi() != null;
|
||||
assert syncClient.getNetworkApi() != null;
|
||||
assert syncClient.getOrgApi() != null;
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
|
|
|
@ -33,9 +33,9 @@ public class VCloudSessionRefreshLiveTest extends BaseVCloudApiLiveTest {
|
|||
public void testSessionRefresh() throws Exception {
|
||||
VCloudApi connection = view.unwrapApi(VCloudApi.class);
|
||||
|
||||
connection.getOrgClient().findOrgNamed(null);
|
||||
connection.getOrgApi().findOrgNamed(null);
|
||||
Thread.sleep(timeOut * 1000);
|
||||
connection.getOrgClient().findOrgNamed(null);
|
||||
connection.getOrgApi().findOrgNamed(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,10 +36,10 @@ import com.google.inject.Key;
|
|||
public class CatalogApiLiveTest extends BaseVCloudApiLiveTest {
|
||||
@Test
|
||||
public void testGetCatalog() throws Exception {
|
||||
Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
|
||||
Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
|
||||
for (ReferenceType catalog : org.getCatalogs().values()) {
|
||||
assertEquals(catalog.getType(), VCloudMediaType.CATALOG_XML);
|
||||
assertNotNull(getVCloudApi().getCatalogClient().getCatalog(catalog.getHref()));
|
||||
assertNotNull(getVCloudApi().getCatalogApi().getCatalog(catalog.getHref()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,6 @@ public class CatalogApiLiveTest extends BaseVCloudApiLiveTest {
|
|||
// when we are in vCloud 1.0.0 public catalogs don't work, so our default
|
||||
// catalog is private
|
||||
if (!view.utils().injector().getInstance(Key.get(String.class, ApiVersion.class)).startsWith("1.5"))
|
||||
assertTrue(getVCloudApi().getCatalogClient().findCatalogInOrgNamed(null, null).isReadOnly());
|
||||
assertTrue(getVCloudApi().getCatalogApi().findCatalogInOrgNamed(null, null).isReadOnly());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,12 +31,12 @@ public class OrgApiLiveTest extends BaseVCloudApiLiveTest {
|
|||
|
||||
@Test
|
||||
public void testListOrgs() throws Exception {
|
||||
for (ReferenceType response : getVCloudApi().getOrgClient().listOrgs().values()) {
|
||||
for (ReferenceType response : getVCloudApi().getOrgApi().listOrgs().values()) {
|
||||
assertNotNull(response);
|
||||
assertNotNull(response.getName());
|
||||
assertNotNull(response.getHref());
|
||||
assertEquals(getVCloudApi().getOrgClient().getOrg(response.getHref()).getName(), response.getName());
|
||||
assertEquals(getVCloudApi().getOrgClient().findOrgNamed(response.getName()).getName(), response.getName());
|
||||
assertEquals(getVCloudApi().getOrgApi().getOrg(response.getHref()).getName(), response.getName());
|
||||
assertEquals(getVCloudApi().getOrgApi().findOrgNamed(response.getName()).getName(), response.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,13 +35,13 @@ public class VAppApiLiveTest extends BaseVCloudApiLiveTest {
|
|||
|
||||
@Test
|
||||
public void testGetVApp() throws Exception {
|
||||
Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
|
||||
Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
VDC response = getVCloudApi().getVDCClient().getVDC(vdc.getHref());
|
||||
VDC response = getVCloudApi().getVDCApi().getVDC(vdc.getHref());
|
||||
for (ReferenceType item : response.getResourceEntities().values()) {
|
||||
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
|
||||
try {
|
||||
VApp app = getVCloudApi().getVAppClient().getVApp(item.getHref());
|
||||
VApp app = getVCloudApi().getVAppApi().getVApp(item.getHref());
|
||||
assertNotNull(app);
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
|
|
|
@ -49,14 +49,14 @@ import com.google.common.collect.ImmutableMap;
|
|||
public class VAppTemplateApiLiveTest extends BaseVCloudApiLiveTest {
|
||||
@Test
|
||||
public void testGetVAppTemplate() throws Exception {
|
||||
Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
|
||||
Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
|
||||
for (ReferenceType cat : org.getCatalogs().values()) {
|
||||
Catalog response = getVCloudApi().getCatalogClient().getCatalog(cat.getHref());
|
||||
Catalog response = getVCloudApi().getCatalogApi().getCatalog(cat.getHref());
|
||||
for (ReferenceType resource : response.values()) {
|
||||
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||
CatalogItem item = getVCloudApi().getCatalogClient().getCatalogItem(resource.getHref());
|
||||
CatalogItem item = getVCloudApi().getCatalogApi().getCatalogItem(resource.getHref());
|
||||
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
||||
VAppTemplate template = getVCloudApi().getVAppTemplateClient().getVAppTemplate(item.getEntity().getHref());
|
||||
VAppTemplate template = getVCloudApi().getVAppTemplateApi().getVAppTemplate(item.getEntity().getHref());
|
||||
if (template != null) {
|
||||
// the UUID in the href is the only way to actually link templates
|
||||
assertEquals(template.getHref(), item.getEntity().getHref());
|
||||
|
@ -71,14 +71,14 @@ public class VAppTemplateApiLiveTest extends BaseVCloudApiLiveTest {
|
|||
|
||||
@Test
|
||||
public void testGetOvfEnvelopeForVAppTemplate() throws Exception {
|
||||
Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
|
||||
Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
|
||||
for (ReferenceType cat : org.getCatalogs().values()) {
|
||||
Catalog response = getVCloudApi().getCatalogClient().getCatalog(cat.getHref());
|
||||
Catalog response = getVCloudApi().getCatalogApi().getCatalog(cat.getHref());
|
||||
for (ReferenceType resource : response.values()) {
|
||||
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||
CatalogItem item = getVCloudApi().getCatalogClient().getCatalogItem(resource.getHref());
|
||||
CatalogItem item = getVCloudApi().getCatalogApi().getCatalogItem(resource.getHref());
|
||||
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
||||
getVCloudApi().getVAppTemplateClient().getOvfEnvelopeForVAppTemplate(item.getEntity().getHref());
|
||||
getVCloudApi().getVAppTemplateApi().getOvfEnvelopeForVAppTemplate(item.getEntity().getHref());
|
||||
// null can be no longer available or auth exception
|
||||
}
|
||||
}
|
||||
|
@ -88,14 +88,14 @@ public class VAppTemplateApiLiveTest extends BaseVCloudApiLiveTest {
|
|||
|
||||
@Test
|
||||
public void testFindVAppTemplate() throws Exception {
|
||||
Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
|
||||
Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
|
||||
for (ReferenceType cat : org.getCatalogs().values()) {
|
||||
Catalog response = getVCloudApi().getCatalogClient().getCatalog(cat.getHref());
|
||||
Catalog response = getVCloudApi().getCatalogApi().getCatalog(cat.getHref());
|
||||
for (ReferenceType resource : response.values()) {
|
||||
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||
CatalogItem item = getVCloudApi().getCatalogClient().getCatalogItem(resource.getHref());
|
||||
CatalogItem item = getVCloudApi().getCatalogApi().getCatalogItem(resource.getHref());
|
||||
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
||||
VAppTemplate template = getVCloudApi().getVAppTemplateClient().findVAppTemplateInOrgCatalogNamed(
|
||||
VAppTemplate template = getVCloudApi().getVAppTemplateApi().findVAppTemplateInOrgCatalogNamed(
|
||||
org.getName(), response.getName(), item.getEntity().getName());
|
||||
if (template != null) {
|
||||
// the UUID in the href is the only way to actually link templates
|
||||
|
@ -122,19 +122,19 @@ public class VAppTemplateApiLiveTest extends BaseVCloudApiLiveTest {
|
|||
Predicate<URI> taskTester = retry(new TaskSuccess(getVCloudApi()), 600, 5, SECONDS);
|
||||
|
||||
// I have to undeploy first
|
||||
Task task = getVCloudApi().getVAppClient().undeployVApp(URI.create(node.getId()));
|
||||
Task task = getVCloudApi().getVAppApi().undeployVApp(URI.create(node.getId()));
|
||||
|
||||
// wait up to ten minutes per above
|
||||
assert taskTester.apply(task.getHref()) : node;
|
||||
|
||||
VApp vApp = getVCloudApi().getVAppClient().getVApp(URI.create(node.getId()));
|
||||
VApp vApp = getVCloudApi().getVAppApi().getVApp(URI.create(node.getId()));
|
||||
|
||||
// wait up to ten minutes per above
|
||||
assertEquals(vApp.getStatus(), Status.OFF);
|
||||
|
||||
// vdc is equiv to the node's location
|
||||
// vapp uri is the same as the node's id
|
||||
vappTemplate = getVCloudApi().getVAppTemplateClient().captureVAppAsTemplateInVDC(URI.create(node.getId()),
|
||||
vappTemplate = getVCloudApi().getVAppTemplateApi().captureVAppAsTemplateInVDC(URI.create(node.getId()),
|
||||
group, URI.create(node.getLocation().getId()));
|
||||
|
||||
assertEquals(vappTemplate.getName(), group);
|
||||
|
@ -144,9 +144,9 @@ public class VAppTemplateApiLiveTest extends BaseVCloudApiLiveTest {
|
|||
// wait up to ten minutes per above
|
||||
assert taskTester.apply(task.getHref()) : vappTemplate;
|
||||
|
||||
item = getVCloudApi().getCatalogClient().addVAppTemplateOrMediaImageToCatalogAndNameItem(
|
||||
item = getVCloudApi().getCatalogApi().addVAppTemplateOrMediaImageToCatalogAndNameItem(
|
||||
vappTemplate.getHref(),
|
||||
getVCloudApi().getCatalogClient().findCatalogInOrgNamed(null, null).getHref(), "fooname",
|
||||
getVCloudApi().getCatalogApi().findCatalogInOrgNamed(null, null).getHref(), "fooname",
|
||||
CatalogItemOptions.Builder.description("description").properties(ImmutableMap.of("foo", "bar")));
|
||||
|
||||
assertEquals(item.getName(), "fooname");
|
||||
|
@ -158,9 +158,9 @@ public class VAppTemplateApiLiveTest extends BaseVCloudApiLiveTest {
|
|||
|
||||
} finally {
|
||||
if (item != null)
|
||||
getVCloudApi().getCatalogClient().deleteCatalogItem(item.getHref());
|
||||
getVCloudApi().getCatalogApi().deleteCatalogItem(item.getHref());
|
||||
if (vappTemplate != null)
|
||||
getVCloudApi().getVAppTemplateClient().deleteVAppTemplate(vappTemplate.getHref());
|
||||
getVCloudApi().getVAppTemplateApi().deleteVAppTemplate(vappTemplate.getHref());
|
||||
if (node != null)
|
||||
client.destroyNode(node.getId());
|
||||
}
|
||||
|
|
|
@ -53,16 +53,16 @@ public class VmApiLiveTest extends BaseVCloudApiLiveTest {
|
|||
|
||||
@Test
|
||||
public void testGetThumbnailOfVm() throws Exception {
|
||||
Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
|
||||
Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
VDC response = getVCloudApi().getVDCClient().getVDC(vdc.getHref());
|
||||
VDC response = getVCloudApi().getVDCApi().getVDC(vdc.getHref());
|
||||
for (ReferenceType item : response.getResourceEntities().values()) {
|
||||
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
|
||||
try {
|
||||
VApp app = getVCloudApi().getVAppClient().getVApp(item.getHref());
|
||||
VApp app = getVCloudApi().getVAppApi().getVApp(item.getHref());
|
||||
assertNotNull(app);
|
||||
for (Vm vm : app.getChildren()) {
|
||||
assert getVCloudApi().getVmClient().getScreenThumbnailForVm(vm.getHref()) != null;
|
||||
assert getVCloudApi().getVmApi().getScreenThumbnailForVm(vm.getHref()) != null;
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
|
@ -74,16 +74,16 @@ public class VmApiLiveTest extends BaseVCloudApiLiveTest {
|
|||
|
||||
@Test
|
||||
public void testGetVm() throws Exception {
|
||||
Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
|
||||
Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
VDC response = getVCloudApi().getVDCClient().getVDC(vdc.getHref());
|
||||
VDC response = getVCloudApi().getVDCApi().getVDC(vdc.getHref());
|
||||
for (ReferenceType item : response.getResourceEntities().values()) {
|
||||
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
|
||||
try {
|
||||
VApp app = getVCloudApi().getVAppClient().getVApp(item.getHref());
|
||||
VApp app = getVCloudApi().getVAppApi().getVApp(item.getHref());
|
||||
assertNotNull(app);
|
||||
for (Vm vm : app.getChildren()) {
|
||||
assertEquals(getVCloudApi().getVmClient().getVm(vm.getHref()).getHref(), vm.getHref());
|
||||
assertEquals(getVCloudApi().getVmApi().getVm(vm.getHref()).getHref(), vm.getHref());
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class VmApiLiveTest extends BaseVCloudApiLiveTest {
|
|||
options.as(VCloudTemplateOptions.class).description(group);
|
||||
node = getOnlyElement(client.createNodesInGroup(group, 1, options));
|
||||
|
||||
VApp vapp = client.getContext().unwrapApi(VCloudApi.class).getVAppClient().getVApp(
|
||||
VApp vapp = client.getContext().unwrapApi(VCloudApi.class).getVAppApi().getVApp(
|
||||
node.getUri());
|
||||
assertEquals(vapp.getDescription(), group);
|
||||
|
||||
|
|
Loading…
Reference in New Issue