mirror of https://github.com/apache/jclouds.git
Issue 280: split off incompatible vcloudexpress vapp template from vcloud
This commit is contained in:
parent
ec1d97ec16
commit
7058b73c2c
|
@ -30,8 +30,8 @@ import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrat
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.vcloud.VCloudClient;
|
import org.jclouds.vcloud.VCloudClient;
|
||||||
import org.jclouds.vcloud.compute.internal.VCloudComputeClientImpl;
|
import org.jclouds.vcloud.compute.internal.VCloudComputeClientImpl;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.Status;
|
||||||
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.jclouds.vcloud.VCloudExpressClient;
|
||||||
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
|
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class BlueLockVCloudExpressComputeClient extends VCloudExpressComputeClie
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> parseAndValidateResponse(VAppTemplate template, VApp vAppResponse) {
|
protected Map<String, String> parseAndValidateResponse(VCloudExpressVAppTemplate template, VApp vAppResponse) {
|
||||||
Credentials credentials = credentialsProvider.execute(template);
|
Credentials credentials = credentialsProvider.execute(template);
|
||||||
Map<String, String> toReturn = super.parseResponse(template, vAppResponse);
|
Map<String, String> toReturn = super.parseResponse(template, vAppResponse);
|
||||||
toReturn.put("username", credentials.identity);
|
toReturn.put("username", credentials.identity);
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.jclouds.vcloud.bluelock.compute.functions.BlueLockVCloudImageForVAppT
|
||||||
import org.jclouds.vcloud.bluelock.compute.strategy.DefaultLoginCredentialsFromBlueLockFAQ;
|
import org.jclouds.vcloud.bluelock.compute.strategy.DefaultLoginCredentialsFromBlueLockFAQ;
|
||||||
import org.jclouds.vcloud.compute.VCloudComputeClient;
|
import org.jclouds.vcloud.compute.VCloudComputeClient;
|
||||||
import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
|
import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
|
||||||
import org.jclouds.vcloud.compute.functions.ImageForVAppTemplate;
|
import org.jclouds.vcloud.compute.functions.ImageForVCloudExpressVAppTemplate;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
|
@ -45,7 +45,7 @@ public class BlueLockVCloudDirectorComputeServiceContextModule extends VCloudCom
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
super.configure();
|
super.configure();
|
||||||
bind(ImageForVAppTemplate.class).to(BlueLockVCloudImageForVAppTemplate.class);
|
bind(ImageForVCloudExpressVAppTemplate.class).to(BlueLockVCloudImageForVAppTemplate.class);
|
||||||
bind(VCloudComputeClient.class).to(BlueLockVCloudDirectorComputeClient.class);
|
bind(VCloudComputeClient.class).to(BlueLockVCloudDirectorComputeClient.class);
|
||||||
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(DefaultLoginCredentialsFromBlueLockFAQ.class);
|
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(DefaultLoginCredentialsFromBlueLockFAQ.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.jclouds.vcloud.bluelock.compute.functions.BlueLockVCloudImageForVAppT
|
||||||
import org.jclouds.vcloud.bluelock.compute.strategy.DefaultLoginCredentialsFromBlueLockFAQ;
|
import org.jclouds.vcloud.bluelock.compute.strategy.DefaultLoginCredentialsFromBlueLockFAQ;
|
||||||
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
|
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
|
||||||
import org.jclouds.vcloud.compute.config.VCloudExpressComputeServiceContextModule;
|
import org.jclouds.vcloud.compute.config.VCloudExpressComputeServiceContextModule;
|
||||||
import org.jclouds.vcloud.compute.functions.ImageForVAppTemplate;
|
import org.jclouds.vcloud.compute.functions.ImageForVCloudExpressVAppTemplate;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
|
@ -45,7 +45,7 @@ public class BlueLockVCloudExpressComputeServiceContextModule extends VCloudExpr
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
super.configure();
|
super.configure();
|
||||||
bind(ImageForVAppTemplate.class).to(BlueLockVCloudImageForVAppTemplate.class);
|
bind(ImageForVCloudExpressVAppTemplate.class).to(BlueLockVCloudImageForVAppTemplate.class);
|
||||||
bind(VCloudExpressComputeClient.class).to(BlueLockVCloudExpressComputeClient.class);
|
bind(VCloudExpressComputeClient.class).to(BlueLockVCloudExpressComputeClient.class);
|
||||||
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(DefaultLoginCredentialsFromBlueLockFAQ.class);
|
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(DefaultLoginCredentialsFromBlueLockFAQ.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,8 @@ import org.jclouds.compute.domain.internal.SizeImpl;
|
||||||
import org.jclouds.compute.predicates.ImagePredicates;
|
import org.jclouds.compute.predicates.ImagePredicates;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.vcloud.compute.domain.VCloudImage;
|
import org.jclouds.vcloud.compute.domain.VCloudExpressImage;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
|
@ -77,7 +77,7 @@ public class ParseSizeFromImageSupplier implements Supplier<Set<? extends Size>>
|
||||||
@Override
|
@Override
|
||||||
public Size apply(Image from) {
|
public Size apply(Image from) {
|
||||||
try {
|
try {
|
||||||
VAppTemplate template = VCloudImage.class.cast(from).getVAppTemplate();
|
VCloudExpressVAppTemplate template = VCloudExpressImage.class.cast(from).getVAppTemplate();
|
||||||
Matcher matcher = getMatcherAndFind(template.getName());
|
Matcher matcher = getMatcherAndFind(template.getName());
|
||||||
double cores = Double.parseDouble(matcher.group(1));
|
double cores = Double.parseDouble(matcher.group(1));
|
||||||
int ram = Integer.parseInt(matcher.group(2));
|
int ram = Integer.parseInt(matcher.group(2));
|
||||||
|
|
|
@ -24,14 +24,14 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
import org.jclouds.vcloud.compute.functions.FindLocationForResource;
|
import org.jclouds.vcloud.compute.functions.FindLocationForResource;
|
||||||
import org.jclouds.vcloud.compute.functions.ImageForVAppTemplate;
|
import org.jclouds.vcloud.compute.functions.ImageForVCloudExpressVAppTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class BlueLockVCloudImageForVAppTemplate extends ImageForVAppTemplate {
|
public class BlueLockVCloudImageForVAppTemplate extends ImageForVCloudExpressVAppTemplate {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected BlueLockVCloudImageForVAppTemplate(FindLocationForResource findLocationForResource,
|
protected BlueLockVCloudImageForVAppTemplate(FindLocationForResource findLocationForResource,
|
||||||
|
|
|
@ -26,7 +26,7 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -42,9 +42,9 @@ public class DefaultLoginCredentialsFromBlueLockFAQ implements
|
||||||
@Override
|
@Override
|
||||||
public Credentials execute(Object resourceToAuthenticate) {
|
public Credentials execute(Object resourceToAuthenticate) {
|
||||||
checkNotNull(resourceToAuthenticate);
|
checkNotNull(resourceToAuthenticate);
|
||||||
checkArgument(resourceToAuthenticate instanceof VAppTemplate,
|
checkArgument(resourceToAuthenticate instanceof VCloudExpressVAppTemplate,
|
||||||
"Resource must be an VAppTemplate (for Terremark)");
|
"Resource must be an VAppTemplate (for Terremark)");
|
||||||
VAppTemplate template = (VAppTemplate) resourceToAuthenticate;
|
VCloudExpressVAppTemplate template = (VCloudExpressVAppTemplate) resourceToAuthenticate;
|
||||||
if (template.getDescription().indexOf("Windows") >= 0) {
|
if (template.getDescription().indexOf("Windows") >= 0) {
|
||||||
return new Credentials("expressuser", "ExpressPassword#1");
|
return new Credentials("expressuser", "ExpressPassword#1");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -25,7 +25,6 @@ import static org.jclouds.vcloud.VCloudMediaType.NETWORK_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.VAPPTEMPLATE_XML;
|
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
|
||||||
|
|
||||||
|
@ -50,14 +49,12 @@ import org.jclouds.vcloud.domain.Org;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.TasksList;
|
import org.jclouds.vcloud.domain.TasksList;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
|
||||||
import org.jclouds.vcloud.domain.VDC;
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
import org.jclouds.vcloud.domain.network.OrgNetwork;
|
import org.jclouds.vcloud.domain.network.OrgNetwork;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
import org.jclouds.vcloud.functions.OrgNameAndCatalogNameToEndpoint;
|
import org.jclouds.vcloud.functions.OrgNameAndCatalogNameToEndpoint;
|
||||||
import org.jclouds.vcloud.functions.OrgNameAndVDCNameToEndpoint;
|
import org.jclouds.vcloud.functions.OrgNameAndVDCNameToEndpoint;
|
||||||
import org.jclouds.vcloud.functions.OrgNameCatalogNameItemNameToEndpoint;
|
import org.jclouds.vcloud.functions.OrgNameCatalogNameItemNameToEndpoint;
|
||||||
import org.jclouds.vcloud.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint;
|
|
||||||
import org.jclouds.vcloud.functions.OrgNameToEndpoint;
|
import org.jclouds.vcloud.functions.OrgNameToEndpoint;
|
||||||
import org.jclouds.vcloud.functions.OrgNameToTasksListEndpoint;
|
import org.jclouds.vcloud.functions.OrgNameToTasksListEndpoint;
|
||||||
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
|
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
|
||||||
|
@ -68,7 +65,6 @@ import org.jclouds.vcloud.xml.OrgNetworkHandler;
|
||||||
import org.jclouds.vcloud.xml.TaskHandler;
|
import org.jclouds.vcloud.xml.TaskHandler;
|
||||||
import org.jclouds.vcloud.xml.TasksListHandler;
|
import org.jclouds.vcloud.xml.TasksListHandler;
|
||||||
import org.jclouds.vcloud.xml.VAppHandler;
|
import org.jclouds.vcloud.xml.VAppHandler;
|
||||||
import org.jclouds.vcloud.xml.VAppTemplateHandler;
|
|
||||||
import org.jclouds.vcloud.xml.VDCHandler;
|
import org.jclouds.vcloud.xml.VDCHandler;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
@ -122,27 +118,6 @@ public interface CommonVCloudAsyncClient {
|
||||||
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String orgName,
|
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String orgName,
|
||||||
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String catalogName);
|
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String catalogName);
|
||||||
|
|
||||||
/**
|
|
||||||
* @see VCloudClient#getVAppTemplate
|
|
||||||
*/
|
|
||||||
@GET
|
|
||||||
@Consumes(VAPPTEMPLATE_XML)
|
|
||||||
@XMLResponseParser(VAppTemplateHandler.class)
|
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<? extends VAppTemplate> getVAppTemplate(@EndpointParam URI vAppTemplate);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see VCloudClient#findVAppTemplateInOrgCatalogNameds
|
|
||||||
*/
|
|
||||||
@GET
|
|
||||||
@Consumes(VAPPTEMPLATE_XML)
|
|
||||||
@XMLResponseParser(VAppTemplateHandler.class)
|
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
|
||||||
ListenableFuture<? extends VAppTemplate> findVAppTemplateInOrgCatalogNamed(
|
|
||||||
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String orgName,
|
|
||||||
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String catalogName,
|
|
||||||
@EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String itemName);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VCloudClient#getCatalogItem
|
* @see VCloudClient#getCatalogItem
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.jclouds.vcloud.domain.Org;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.TasksList;
|
import org.jclouds.vcloud.domain.TasksList;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
|
||||||
import org.jclouds.vcloud.domain.VDC;
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
import org.jclouds.vcloud.domain.network.OrgNetwork;
|
import org.jclouds.vcloud.domain.network.OrgNetwork;
|
||||||
|
|
||||||
|
@ -92,25 +91,6 @@ public interface CommonVCloudClient {
|
||||||
*/
|
*/
|
||||||
CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName, String itemName);
|
CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName, String itemName);
|
||||||
|
|
||||||
VAppTemplate getVAppTemplate(URI vAppTemplate);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the vapp template corresponding to a catalog item in the catalog associated with the
|
|
||||||
* specified name. Note that the org and catalog parameters can be null to choose default.
|
|
||||||
*
|
|
||||||
* @param orgName
|
|
||||||
* organization name, or null for the default
|
|
||||||
* @param catalogName
|
|
||||||
* catalog name, or null for the default
|
|
||||||
* @param itemName
|
|
||||||
* item you wish to lookup
|
|
||||||
*
|
|
||||||
* @throws NoSuchElementException
|
|
||||||
* if you specified an org, catalog, or catalog item name that isn't present
|
|
||||||
*/
|
|
||||||
VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName,
|
|
||||||
String itemName);
|
|
||||||
|
|
||||||
OrgNetwork findNetworkInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String networkName);
|
OrgNetwork findNetworkInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String networkName);
|
||||||
|
|
||||||
OrgNetwork getNetwork(URI network);
|
OrgNetwork getNetwork(URI network);
|
||||||
|
|
|
@ -20,31 +20,39 @@
|
||||||
package org.jclouds.vcloud;
|
package org.jclouds.vcloud;
|
||||||
|
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
||||||
|
import static org.jclouds.vcloud.VCloudMediaType.VAPPTEMPLATE_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
|
|
||||||
import org.jclouds.predicates.validators.DnsNameValidator;
|
import org.jclouds.predicates.validators.DnsNameValidator;
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
import org.jclouds.rest.annotations.MapBinder;
|
import org.jclouds.rest.annotations.MapBinder;
|
||||||
import org.jclouds.rest.annotations.MapPayloadParam;
|
import org.jclouds.rest.annotations.MapPayloadParam;
|
||||||
import org.jclouds.rest.annotations.ParamValidators;
|
import org.jclouds.rest.annotations.ParamValidators;
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
|
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||||
import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
|
import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
|
||||||
import org.jclouds.vcloud.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
|
import org.jclouds.vcloud.binders.BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
|
import org.jclouds.vcloud.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint;
|
||||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
import org.jclouds.vcloud.xml.TaskHandler;
|
import org.jclouds.vcloud.xml.TaskHandler;
|
||||||
import org.jclouds.vcloud.xml.VAppHandler;
|
import org.jclouds.vcloud.xml.VAppHandler;
|
||||||
|
import org.jclouds.vcloud.xml.VAppTemplateHandler;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
@ -52,12 +60,34 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides access to VCloud resources via their REST API.
|
* Provides access to VCloud resources via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
|
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx"
|
||||||
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@RequestFilters(SetVCloudTokenCookie.class)
|
@RequestFilters(SetVCloudTokenCookie.class)
|
||||||
public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
|
public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VCloudClient#getVAppTemplate
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(VAPPTEMPLATE_XML)
|
||||||
|
@XMLResponseParser(VAppTemplateHandler.class)
|
||||||
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
|
ListenableFuture<? extends VAppTemplate> getVAppTemplate(@EndpointParam URI vAppTemplate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VCloudClient#findVAppTemplateInOrgCatalogNamed
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(VAPPTEMPLATE_XML)
|
||||||
|
@XMLResponseParser(VAppTemplateHandler.class)
|
||||||
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
|
ListenableFuture<? extends VAppTemplate> findVAppTemplateInOrgCatalogNamed(
|
||||||
|
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String orgName,
|
||||||
|
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String catalogName,
|
||||||
|
@EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String itemName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VCloudClient#instantiateVAppTemplateInVDC
|
* @see VCloudClient#instantiateVAppTemplateInVDC
|
||||||
*/
|
*/
|
||||||
|
@ -66,11 +96,12 @@ public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
|
||||||
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
|
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
|
||||||
@Consumes(VAPP_XML)
|
@Consumes(VAPP_XML)
|
||||||
@XMLResponseParser(VAppHandler.class)
|
@XMLResponseParser(VAppHandler.class)
|
||||||
@MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
|
// TODO convert this.
|
||||||
|
@MapBinder(BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload.class)
|
||||||
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
|
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
|
||||||
@MapPayloadParam("template") URI template,
|
@MapPayloadParam("template") URI template,
|
||||||
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
|
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
|
||||||
InstantiateVAppTemplateOptions... options);
|
InstantiateVAppTemplateOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VCloudClient#cloneVAppInVDC
|
* @see VCloudClient#cloneVAppInVDC
|
||||||
|
@ -82,7 +113,7 @@ public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
|
||||||
@XMLResponseParser(TaskHandler.class)
|
@XMLResponseParser(TaskHandler.class)
|
||||||
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
||||||
ListenableFuture<? extends Task> cloneVAppInVDC(@EndpointParam URI vdc, @MapPayloadParam("vApp") URI toClone,
|
ListenableFuture<? extends Task> cloneVAppInVDC(@EndpointParam URI vdc, @MapPayloadParam("vApp") URI toClone,
|
||||||
@MapPayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName,
|
@MapPayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName,
|
||||||
CloneVAppOptions... options);
|
CloneVAppOptions... options);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,15 @@
|
||||||
package org.jclouds.vcloud;
|
package org.jclouds.vcloud;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
|
|
||||||
|
@ -40,9 +44,28 @@ import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface VCloudClient extends CommonVCloudClient {
|
public interface VCloudClient extends CommonVCloudClient {
|
||||||
|
|
||||||
|
|
||||||
VApp instantiateVAppTemplateInVDC(URI vDC, URI template, String appName, InstantiateVAppTemplateOptions... options);
|
VApp instantiateVAppTemplateInVDC(URI vDC, URI template, String appName, InstantiateVAppTemplateOptions... options);
|
||||||
|
|
||||||
Task cloneVAppInVDC(URI vDC, URI toClone, String newName, CloneVAppOptions... options);
|
Task cloneVAppInVDC(URI vDC, URI toClone, String newName, CloneVAppOptions... options);
|
||||||
|
|
||||||
|
VAppTemplate getVAppTemplate(URI vAppTemplate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the vapp template corresponding to a catalog item in the catalog
|
||||||
|
* associated with the specified name. Note that the org and catalog
|
||||||
|
* parameters can be null to choose default.
|
||||||
|
*
|
||||||
|
* @param orgName
|
||||||
|
* organization name, or null for the default
|
||||||
|
* @param catalogName
|
||||||
|
* catalog name, or null for the default
|
||||||
|
* @param itemName
|
||||||
|
* item you wish to lookup
|
||||||
|
*
|
||||||
|
* @throws NoSuchElementException
|
||||||
|
* if you specified an org, catalog, or catalog item name that
|
||||||
|
* isn't present
|
||||||
|
*/
|
||||||
|
VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName,
|
||||||
|
String itemName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.vcloud;
|
||||||
|
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.NETWORK_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.NETWORK_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
||||||
|
import static org.jclouds.vcloud.VCloudMediaType.VAPPTEMPLATE_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -42,17 +43,20 @@ import org.jclouds.rest.annotations.RequestFilters;
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||||
import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
|
import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
|
||||||
import org.jclouds.vcloud.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
|
import org.jclouds.vcloud.binders.BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
import org.jclouds.vcloud.domain.network.OrgNetwork;
|
import org.jclouds.vcloud.domain.network.OrgNetwork;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
|
import org.jclouds.vcloud.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint;
|
||||||
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
|
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
|
||||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler;
|
import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler;
|
||||||
import org.jclouds.vcloud.xml.TaskHandler;
|
import org.jclouds.vcloud.xml.TaskHandler;
|
||||||
import org.jclouds.vcloud.xml.VAppHandler;
|
import org.jclouds.vcloud.xml.VAppHandler;
|
||||||
|
import org.jclouds.vcloud.xml.VCloudExpressVAppTemplateHandler;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
@ -60,11 +64,34 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides access to VCloud resources via their REST API.
|
* Provides access to VCloud resources via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
|
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx"
|
||||||
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@RequestFilters(SetVCloudTokenCookie.class)
|
@RequestFilters(SetVCloudTokenCookie.class)
|
||||||
public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient {
|
public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VCloudClient#getVAppTemplate
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(VAPPTEMPLATE_XML)
|
||||||
|
@XMLResponseParser(VCloudExpressVAppTemplateHandler.class)
|
||||||
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
|
ListenableFuture<? extends VCloudExpressVAppTemplate> getVAppTemplate(@EndpointParam URI vAppTemplate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see VCloudClient#findVAppTemplateInOrgCatalogNamed
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(VAPPTEMPLATE_XML)
|
||||||
|
@XMLResponseParser(VCloudExpressVAppTemplateHandler.class)
|
||||||
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
|
ListenableFuture<? extends VCloudExpressVAppTemplate> findVAppTemplateInOrgCatalogNamed(
|
||||||
|
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String orgName,
|
||||||
|
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String catalogName,
|
||||||
|
@EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String itemName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VCloudClient#findNetworkInOrgVDCNamed
|
* @see VCloudClient#findNetworkInOrgVDCNamed
|
||||||
*/
|
*/
|
||||||
|
@ -74,9 +101,9 @@ public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient {
|
||||||
@XMLResponseParser(OrgNetworkFromVCloudExpressNetworkHandler.class)
|
@XMLResponseParser(OrgNetworkFromVCloudExpressNetworkHandler.class)
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<? extends OrgNetwork> findNetworkInOrgVDCNamed(
|
ListenableFuture<? extends OrgNetwork> findNetworkInOrgVDCNamed(
|
||||||
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
|
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
|
||||||
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
|
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
|
||||||
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String networkName);
|
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String networkName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VCloudClient#getNetwork
|
* @see VCloudClient#getNetwork
|
||||||
|
@ -96,11 +123,11 @@ public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient {
|
||||||
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
|
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
|
||||||
@Consumes(VAPP_XML)
|
@Consumes(VAPP_XML)
|
||||||
@XMLResponseParser(VAppHandler.class)
|
@XMLResponseParser(VAppHandler.class)
|
||||||
@MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
|
@MapBinder(BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload.class)
|
||||||
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
|
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
|
||||||
@MapPayloadParam("template") URI template,
|
@MapPayloadParam("template") URI template,
|
||||||
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
|
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
|
||||||
InstantiateVAppTemplateOptions... options);
|
InstantiateVAppTemplateOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VCloudExpressClient#cloneVAppInVDC
|
* @see VCloudExpressClient#cloneVAppInVDC
|
||||||
|
@ -112,7 +139,7 @@ public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient {
|
||||||
@XMLResponseParser(TaskHandler.class)
|
@XMLResponseParser(TaskHandler.class)
|
||||||
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
||||||
ListenableFuture<? extends Task> cloneVAppInVDC(@EndpointParam URI vdc, @MapPayloadParam("vApp") URI toClone,
|
ListenableFuture<? extends Task> cloneVAppInVDC(@EndpointParam URI vdc, @MapPayloadParam("vApp") URI toClone,
|
||||||
@MapPayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName,
|
@MapPayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName,
|
||||||
CloneVAppOptions... options);
|
CloneVAppOptions... options);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,15 @@
|
||||||
package org.jclouds.vcloud;
|
package org.jclouds.vcloud;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
|
|
||||||
|
@ -32,7 +36,8 @@ import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
* Provides access to VCloud resources via their REST API.
|
* Provides access to VCloud resources via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
|
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx"
|
||||||
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
|
||||||
|
@ -42,4 +47,24 @@ public interface VCloudExpressClient extends CommonVCloudClient {
|
||||||
|
|
||||||
Task cloneVAppInVDC(URI vDC, URI toClone, String newName, CloneVAppOptions... options);
|
Task cloneVAppInVDC(URI vDC, URI toClone, String newName, CloneVAppOptions... options);
|
||||||
|
|
||||||
|
VCloudExpressVAppTemplate getVAppTemplate(URI vAppTemplate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the vapp template corresponding to a catalog item in the catalog
|
||||||
|
* associated with the specified name. Note that the org and catalog
|
||||||
|
* parameters can be null to choose default.
|
||||||
|
*
|
||||||
|
* @param orgName
|
||||||
|
* organization name, or null for the default
|
||||||
|
* @param catalogName
|
||||||
|
* catalog name, or null for the default
|
||||||
|
* @param itemName
|
||||||
|
* item you wish to lookup
|
||||||
|
*
|
||||||
|
* @throws NoSuchElementException
|
||||||
|
* if you specified an org, catalog, or catalog item name that
|
||||||
|
* isn't present
|
||||||
|
*/
|
||||||
|
VCloudExpressVAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName,
|
||||||
|
String itemName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ import com.jamesmurty.utils.XMLBuilder;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder {
|
public class BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload implements MapBinder {
|
||||||
|
|
||||||
protected final String ns;
|
protected final String ns;
|
||||||
protected final String schema;
|
protected final String schema;
|
||||||
|
@ -71,7 +71,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder
|
||||||
private final String apiVersion;
|
private final String apiVersion;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public BindInstantiateVAppTemplateParamsToXmlPayload(BindToStringPayload stringBinder,
|
public BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload(BindToStringPayload stringBinder,
|
||||||
@Named(PROPERTY_API_VERSION) String apiVersion, @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns,
|
@Named(PROPERTY_API_VERSION) String apiVersion, @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns,
|
||||||
@Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema, @Named(PROPERTY_VCLOUD_DEFAULT_NETWORK) String network,
|
@Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema, @Named(PROPERTY_VCLOUD_DEFAULT_NETWORK) String network,
|
||||||
@Named(PROPERTY_VCLOUD_DEFAULT_FENCEMODE) String fenceMode) {
|
@Named(PROPERTY_VCLOUD_DEFAULT_FENCEMODE) String fenceMode) {
|
|
@ -22,6 +22,7 @@ package org.jclouds.vcloud.compute.config;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||||
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
|
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
|
@ -29,9 +30,12 @@ import org.jclouds.rest.internal.RestContextImpl;
|
||||||
import org.jclouds.vcloud.VCloudClient;
|
import org.jclouds.vcloud.VCloudClient;
|
||||||
import org.jclouds.vcloud.compute.CommonVCloudComputeClient;
|
import org.jclouds.vcloud.compute.CommonVCloudComputeClient;
|
||||||
import org.jclouds.vcloud.compute.VCloudComputeClient;
|
import org.jclouds.vcloud.compute.VCloudComputeClient;
|
||||||
|
import org.jclouds.vcloud.compute.functions.ImagesInOrg;
|
||||||
import org.jclouds.vcloud.compute.internal.VCloudComputeClientImpl;
|
import org.jclouds.vcloud.compute.internal.VCloudComputeClientImpl;
|
||||||
import org.jclouds.vcloud.compute.strategy.VCloudAddNodeWithTagStrategy;
|
import org.jclouds.vcloud.compute.strategy.VCloudAddNodeWithTagStrategy;
|
||||||
|
import org.jclouds.vcloud.domain.Org;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.Scopes;
|
import com.google.inject.Scopes;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
@ -53,6 +57,9 @@ public class VCloudComputeServiceContextModule extends CommonVCloudComputeServic
|
||||||
bind(new TypeLiteral<RestContext<VCloudClient, VCloudClient>>() {
|
bind(new TypeLiteral<RestContext<VCloudClient, VCloudClient>>() {
|
||||||
}).to(new TypeLiteral<RestContextImpl<VCloudClient, VCloudClient>>() {
|
}).to(new TypeLiteral<RestContextImpl<VCloudClient, VCloudClient>>() {
|
||||||
}).in(Scopes.SINGLETON);
|
}).in(Scopes.SINGLETON);
|
||||||
|
bind(new TypeLiteral<Function<Org, Iterable<? extends Image>>>() {
|
||||||
|
}).to(new TypeLiteral<ImagesInOrg>() {
|
||||||
|
});
|
||||||
bind(AddNodeWithTagStrategy.class).to(VCloudAddNodeWithTagStrategy.class);
|
bind(AddNodeWithTagStrategy.class).to(VCloudAddNodeWithTagStrategy.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ package org.jclouds.vcloud.compute.config;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||||
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
|
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
|
@ -29,9 +30,12 @@ import org.jclouds.rest.internal.RestContextImpl;
|
||||||
import org.jclouds.vcloud.VCloudExpressClient;
|
import org.jclouds.vcloud.VCloudExpressClient;
|
||||||
import org.jclouds.vcloud.compute.CommonVCloudComputeClient;
|
import org.jclouds.vcloud.compute.CommonVCloudComputeClient;
|
||||||
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
|
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
|
||||||
|
import org.jclouds.vcloud.compute.functions.ImagesInVCloudExpressOrg;
|
||||||
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
|
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
|
||||||
import org.jclouds.vcloud.compute.strategy.VCloudExpressAddNodeWithTagStrategy;
|
import org.jclouds.vcloud.compute.strategy.VCloudExpressAddNodeWithTagStrategy;
|
||||||
|
import org.jclouds.vcloud.domain.Org;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.Scopes;
|
import com.google.inject.Scopes;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
@ -53,6 +57,9 @@ public class VCloudExpressComputeServiceContextModule extends CommonVCloudComput
|
||||||
bind(new TypeLiteral<RestContext<VCloudExpressClient, VCloudExpressClient>>() {
|
bind(new TypeLiteral<RestContext<VCloudExpressClient, VCloudExpressClient>>() {
|
||||||
}).to(new TypeLiteral<RestContextImpl<VCloudExpressClient, VCloudExpressClient>>() {
|
}).to(new TypeLiteral<RestContextImpl<VCloudExpressClient, VCloudExpressClient>>() {
|
||||||
}).in(Scopes.SINGLETON);
|
}).in(Scopes.SINGLETON);
|
||||||
|
bind(new TypeLiteral<Function<Org, Iterable<? extends Image>>>() {
|
||||||
|
}).to(new TypeLiteral<ImagesInVCloudExpressOrg>() {
|
||||||
|
});
|
||||||
bind(AddNodeWithTagStrategy.class).to(VCloudExpressAddNodeWithTagStrategy.class);
|
bind(AddNodeWithTagStrategy.class).to(VCloudExpressAddNodeWithTagStrategy.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.compute.domain;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.jclouds.compute.domain.OperatingSystem;
|
||||||
|
import org.jclouds.compute.domain.internal.ImageImpl;
|
||||||
|
import org.jclouds.domain.Credentials;
|
||||||
|
import org.jclouds.domain.Location;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class VCloudExpressImage extends ImageImpl {
|
||||||
|
|
||||||
|
/** The serialVersionUID */
|
||||||
|
private static final long serialVersionUID = -8520373150950058296L;
|
||||||
|
|
||||||
|
private final VCloudExpressVAppTemplate template;
|
||||||
|
|
||||||
|
public VCloudExpressImage(VCloudExpressVAppTemplate template, String providerId, String name, String id, Location location, URI uri,
|
||||||
|
Map<String, String> userMetadata, OperatingSystem operatingSystem, String description,
|
||||||
|
@Nullable String version, @Nullable Credentials defaultCredentials) {
|
||||||
|
super(providerId, name, id, location, uri, userMetadata, operatingSystem, description, version,
|
||||||
|
defaultCredentials);
|
||||||
|
this.template = template;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VCloudExpressVAppTemplate getVAppTemplate() {
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -41,10 +41,10 @@ public class VCloudImage extends ImageImpl {
|
||||||
private final VAppTemplate template;
|
private final VAppTemplate template;
|
||||||
|
|
||||||
public VCloudImage(VAppTemplate template, String providerId, String name, String id, Location location, URI uri,
|
public VCloudImage(VAppTemplate template, String providerId, String name, String id, Location location, URI uri,
|
||||||
Map<String, String> userMetadata, OperatingSystem operatingSystem, String description,
|
Map<String, String> userMetadata, OperatingSystem operatingSystem, String description,
|
||||||
@Nullable String version, @Nullable Credentials defaultCredentials) {
|
@Nullable String version, @Nullable Credentials defaultCredentials) {
|
||||||
super(providerId, name, id, location, uri, userMetadata, operatingSystem, description, version,
|
super(providerId, name, id, location, uri, userMetadata, operatingSystem, description, version,
|
||||||
defaultCredentials);
|
defaultCredentials);
|
||||||
this.template = template;
|
this.template = template;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class ImageForVAppTemplate implements Function<VAppTemplate, Image> {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected ImageForVAppTemplate(FindLocationForResource findLocationForResource,
|
protected ImageForVAppTemplate(FindLocationForResource findLocationForResource,
|
||||||
PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider) {
|
PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider) {
|
||||||
this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
|
this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
|
||||||
this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider");
|
this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider");
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class ImageForVAppTemplate implements Function<VAppTemplate, Image> {
|
||||||
String name = getName(from.getName());
|
String name = getName(from.getName());
|
||||||
String desc = from.getDescription() != null ? from.getDescription() : from.getName();
|
String desc = from.getDescription() != null ? from.getDescription() : from.getName();
|
||||||
return new VCloudImage(from, from.getId().toASCIIString(), name, from.getId().toASCIIString(), location, from
|
return new VCloudImage(from, from.getId().toASCIIString(), name, from.getId().toASCIIString(), location, from
|
||||||
.getId(), ImmutableMap.<String, String> of(), os, desc, "", credentialsProvider.execute(from));
|
.getId(), ImmutableMap.<String, String> of(), os, desc, "", credentialsProvider.execute(from));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getName(String name) {
|
protected String getName(String name) {
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.compute.functions;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static org.jclouds.compute.util.ComputeServiceUtils.parseOsFamilyOrNull;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
|
import org.jclouds.compute.domain.OperatingSystem;
|
||||||
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
|
import org.jclouds.domain.Location;
|
||||||
|
import org.jclouds.vcloud.compute.domain.VCloudExpressImage;
|
||||||
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class ImageForVCloudExpressVAppTemplate implements Function<VCloudExpressVAppTemplate, Image> {
|
||||||
|
private final FindLocationForResource findLocationForResource;
|
||||||
|
private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
|
||||||
|
private NamedResource parent;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected ImageForVCloudExpressVAppTemplate(FindLocationForResource findLocationForResource,
|
||||||
|
PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider) {
|
||||||
|
this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
|
||||||
|
this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageForVCloudExpressVAppTemplate withParent(NamedResource parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Image apply(VCloudExpressVAppTemplate from) {
|
||||||
|
OsFamily osFamily = parseOsFamilyOrNull(checkNotNull(from, "vapp template").getName());
|
||||||
|
String osName = null;
|
||||||
|
String osArch = null;
|
||||||
|
String osVersion = null;
|
||||||
|
String osDescription = from.getName();
|
||||||
|
boolean is64Bit = from.getName().indexOf("64") != -1;
|
||||||
|
OperatingSystem os = new OperatingSystem(osFamily, osName, osVersion, osArch, osDescription, is64Bit);
|
||||||
|
|
||||||
|
Location location = findLocationForResource.apply(checkNotNull(parent, "parent"));
|
||||||
|
String name = getName(from.getName());
|
||||||
|
String desc = from.getDescription() != null ? from.getDescription() : from.getName();
|
||||||
|
return new VCloudExpressImage(from, from.getId().toASCIIString(), name, from.getId().toASCIIString(), location, from
|
||||||
|
.getId(), ImmutableMap.<String, String> of(), os, desc, "", credentialsProvider.execute(from));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getName(String name) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.compute.functions;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Provider;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
|
import org.jclouds.vcloud.domain.CatalogItem;
|
||||||
|
import org.jclouds.vcloud.domain.Org;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
import org.jclouds.vcloud.functions.AllCatalogItemsInOrg;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class ImagesInVCloudExpressOrg implements Function<Org, Iterable<? extends Image>> {
|
||||||
|
|
||||||
|
private final AllCatalogItemsInOrg allCatalogItemsInOrg;
|
||||||
|
private final Function<Iterable<? extends CatalogItem>, Iterable<? extends VCloudExpressVAppTemplate>> vAppTemplatesForCatalogItems;
|
||||||
|
private final Provider<ImageForVCloudExpressVAppTemplate> imageForVAppTemplateProvider;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ImagesInVCloudExpressOrg(AllCatalogItemsInOrg allCatalogItemsInOrg,
|
||||||
|
Provider<ImageForVCloudExpressVAppTemplate> imageForVAppTemplateProvider,
|
||||||
|
Function<Iterable<? extends CatalogItem>, Iterable<? extends VCloudExpressVAppTemplate>> vAppTemplatesForCatalogItems) {
|
||||||
|
this.imageForVAppTemplateProvider = imageForVAppTemplateProvider;
|
||||||
|
this.allCatalogItemsInOrg = allCatalogItemsInOrg;
|
||||||
|
this.vAppTemplatesForCatalogItems = vAppTemplatesForCatalogItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<? extends Image> apply(Org from) {
|
||||||
|
Iterable<? extends CatalogItem> catalogs = allCatalogItemsInOrg.apply(from);
|
||||||
|
Iterable<? extends VCloudExpressVAppTemplate> vAppTemplates = vAppTemplatesForCatalogItems.apply(catalogs);
|
||||||
|
return Iterables.transform(vAppTemplates, imageForVAppTemplateProvider.get().withParent(from));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.compute.functions;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
|
import org.jclouds.vcloud.functions.VCloudExpressVAppTemplatesForResourceEntities;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class ImagesInVCloudExpressVDC implements Function<VDC, Iterable<? extends Image>> {
|
||||||
|
private final VCloudExpressVAppTemplatesForResourceEntities vAppTemplatesForResourceEntities;
|
||||||
|
private final ImageForVCloudExpressVAppTemplate imageForVAppTemplateProvider;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public ImagesInVCloudExpressVDC(VCloudExpressVAppTemplatesForResourceEntities vAppTemplatesForResourceEntities,
|
||||||
|
ImageForVCloudExpressVAppTemplate imageForVAppTemplateProvider) {
|
||||||
|
this.vAppTemplatesForResourceEntities = checkNotNull(vAppTemplatesForResourceEntities, "vAppTemplatesForResourceEntities");
|
||||||
|
this.imageForVAppTemplateProvider = checkNotNull(imageForVAppTemplateProvider, "imageForVAppTemplateProvider");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<? extends Image> apply(VDC from) {
|
||||||
|
Iterable<? extends VCloudExpressVAppTemplate> vAppTemplates = vAppTemplatesForResourceEntities.apply(checkNotNull(from, "vdc")
|
||||||
|
.getResourceEntities().values());
|
||||||
|
return Iterables.transform(vAppTemplates, imageForVAppTemplateProvider.withParent(from));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -42,15 +42,16 @@ public class ImagesInVDC implements Function<VDC, Iterable<? extends Image>> {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ImagesInVDC(VAppTemplatesForResourceEntities vAppTemplatesForResourceEntities,
|
public ImagesInVDC(VAppTemplatesForResourceEntities vAppTemplatesForResourceEntities,
|
||||||
ImageForVAppTemplate imageForVAppTemplateProvider) {
|
ImageForVAppTemplate imageForVAppTemplateProvider) {
|
||||||
this.vAppTemplatesForResourceEntities = checkNotNull(vAppTemplatesForResourceEntities, "vAppTemplatesForResourceEntities");
|
this.vAppTemplatesForResourceEntities = checkNotNull(vAppTemplatesForResourceEntities,
|
||||||
|
"vAppTemplatesForResourceEntities");
|
||||||
this.imageForVAppTemplateProvider = checkNotNull(imageForVAppTemplateProvider, "imageForVAppTemplateProvider");
|
this.imageForVAppTemplateProvider = checkNotNull(imageForVAppTemplateProvider, "imageForVAppTemplateProvider");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<? extends Image> apply(VDC from) {
|
public Iterable<? extends Image> apply(VDC from) {
|
||||||
Iterable<? extends VAppTemplate> vAppTemplates = vAppTemplatesForResourceEntities.apply(checkNotNull(from, "vdc")
|
Iterable<? extends VAppTemplate> vAppTemplates = vAppTemplatesForResourceEntities.apply(checkNotNull(from, "vdc")
|
||||||
.getResourceEntities().values());
|
.getResourceEntities().values());
|
||||||
return Iterables.transform(vAppTemplates, imageForVAppTemplateProvider.withParent(from));
|
return Iterables.transform(vAppTemplates, imageForVAppTemplateProvider.withParent(from));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,9 @@ import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.vcloud.CommonVCloudClient;
|
import org.jclouds.vcloud.CommonVCloudClient;
|
||||||
import org.jclouds.vcloud.compute.CommonVCloudComputeClient;
|
import org.jclouds.vcloud.compute.CommonVCloudComputeClient;
|
||||||
|
import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -48,7 +47,7 @@ import com.google.inject.Inject;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class CommonVCloudComputeClientImpl implements CommonVCloudComputeClient {
|
public class CommonVCloudComputeClientImpl<T> implements CommonVCloudComputeClient {
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
@ -62,7 +61,7 @@ public class CommonVCloudComputeClientImpl implements CommonVCloudComputeClient
|
||||||
this.taskTester = successTester;
|
this.taskTester = successTester;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<String, String> parseAndValidateResponse(VAppTemplate template, VApp vAppResponse) {
|
protected Map<String, String> parseAndValidateResponse(T template, VApp vAppResponse) {
|
||||||
Map<String, String> response = parseResponse(template, vAppResponse);
|
Map<String, String> response = parseResponse(template, vAppResponse);
|
||||||
checkState(response.containsKey("id"), "bad configuration: [id] should be in response");
|
checkState(response.containsKey("id"), "bad configuration: [id] should be in response");
|
||||||
checkState(response.containsKey("username"), "bad configuration: [username] should be in response");
|
checkState(response.containsKey("username"), "bad configuration: [username] should be in response");
|
||||||
|
@ -70,7 +69,7 @@ public class CommonVCloudComputeClientImpl implements CommonVCloudComputeClient
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<String, String> parseResponse(VAppTemplate template, VApp vAppResponse) {
|
protected Map<String, String> parseResponse(T template, VApp vAppResponse) {
|
||||||
Map<String, String> config = Maps.newLinkedHashMap();// Allows nulls
|
Map<String, String> config = Maps.newLinkedHashMap();// Allows nulls
|
||||||
config.put("id", vAppResponse.getId().toASCIIString());
|
config.put("id", vAppResponse.getId().toASCIIString());
|
||||||
config.put("username", null);
|
config.put("username", null);
|
||||||
|
@ -137,7 +136,7 @@ public class CommonVCloudComputeClientImpl implements CommonVCloudComputeClient
|
||||||
|
|
||||||
public TaskException(String type, VApp vApp, Task task) {
|
public TaskException(String type, VApp vApp, Task task) {
|
||||||
super(String.format("failed to %s vApp %s status %s;task %s status %s", type, vApp.getName(),
|
super(String.format("failed to %s vApp %s status %s;task %s status %s", type, vApp.getName(),
|
||||||
vApp.getStatus(), task.getLocation(), task.getStatus()), vApp);
|
vApp.getStatus(), task.getLocation(), task.getStatus()), vApp);
|
||||||
this.task = task;
|
this.task = task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,9 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.compute.domain.NodeState;
|
import org.jclouds.compute.domain.NodeState;
|
||||||
import org.jclouds.vcloud.VCloudClient;
|
import org.jclouds.vcloud.VCloudClient;
|
||||||
import org.jclouds.vcloud.compute.VCloudComputeClient;
|
import org.jclouds.vcloud.compute.VCloudComputeClient;
|
||||||
|
import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
import org.jclouds.vcloud.domain.VDC;
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
|
@ -44,28 +44,28 @@ import com.google.inject.Inject;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class VCloudComputeClientImpl extends CommonVCloudComputeClientImpl implements VCloudComputeClient {
|
public class VCloudComputeClientImpl extends CommonVCloudComputeClientImpl<VAppTemplate> implements VCloudComputeClient {
|
||||||
|
|
||||||
protected final Map<Status, NodeState> vAppStatusToNodeState;
|
protected final Map<Status, NodeState> vAppStatusToNodeState;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public VCloudComputeClientImpl(VCloudClient client, Predicate<URI> successTester,
|
public VCloudComputeClientImpl(VCloudClient client, Predicate<URI> successTester,
|
||||||
Map<Status, NodeState> vAppStatusToNodeState) {
|
Map<Status, NodeState> vAppStatusToNodeState) {
|
||||||
super(client, successTester);
|
super(client, successTester);
|
||||||
this.vAppStatusToNodeState = vAppStatusToNodeState;
|
this.vAppStatusToNodeState = vAppStatusToNodeState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> start(@Nullable URI VDC, URI templateId, String name,
|
public Map<String, String> start(@Nullable URI VDC, URI templateId, String name,
|
||||||
InstantiateVAppTemplateOptions options, int... portsToOpen) {
|
InstantiateVAppTemplateOptions options, int... portsToOpen) {
|
||||||
checkNotNull(options, "options");
|
checkNotNull(options, "options");
|
||||||
logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);
|
logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);
|
||||||
|
|
||||||
VDC vdc = client.getVDC(VDC);
|
VDC vdc = client.getVDC(VDC);
|
||||||
VAppTemplate template = client.getVAppTemplate(templateId);
|
VAppTemplate template = VCloudClient.class.cast(client).getVAppTemplate(templateId);
|
||||||
|
|
||||||
VApp vAppResponse = VCloudClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getId(), template.getId(),
|
VApp vAppResponse = VCloudClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getId(), template.getId(),
|
||||||
name, options);
|
name, options);
|
||||||
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
|
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
|
||||||
|
|
||||||
logger.debug(">> deploying vApp(%s)", vAppResponse.getName());
|
logger.debug(">> deploying vApp(%s)", vAppResponse.getName());
|
||||||
|
|
|
@ -30,10 +30,10 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.compute.domain.NodeState;
|
import org.jclouds.compute.domain.NodeState;
|
||||||
import org.jclouds.vcloud.VCloudExpressClient;
|
import org.jclouds.vcloud.VCloudExpressClient;
|
||||||
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
|
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
|
||||||
|
import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
|
||||||
import org.jclouds.vcloud.domain.VDC;
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
|
|
||||||
|
@ -44,28 +44,29 @@ import com.google.inject.Inject;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class VCloudExpressComputeClientImpl extends CommonVCloudComputeClientImpl implements VCloudExpressComputeClient {
|
public class VCloudExpressComputeClientImpl extends CommonVCloudComputeClientImpl<VCloudExpressVAppTemplate> implements
|
||||||
|
VCloudExpressComputeClient {
|
||||||
|
|
||||||
protected final Map<Status, NodeState> vAppStatusToNodeState;
|
protected final Map<Status, NodeState> vAppStatusToNodeState;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public VCloudExpressComputeClientImpl(VCloudExpressClient client, Predicate<URI> successTester,
|
public VCloudExpressComputeClientImpl(VCloudExpressClient client, Predicate<URI> successTester,
|
||||||
Map<Status, NodeState> vAppStatusToNodeState) {
|
Map<Status, NodeState> vAppStatusToNodeState) {
|
||||||
super(client, successTester);
|
super(client, successTester);
|
||||||
this.vAppStatusToNodeState = vAppStatusToNodeState;
|
this.vAppStatusToNodeState = vAppStatusToNodeState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> start(@Nullable URI VDC, URI templateId, String name,
|
public Map<String, String> start(@Nullable URI VDC, URI templateId, String name,
|
||||||
InstantiateVAppTemplateOptions options, int... portsToOpen) {
|
InstantiateVAppTemplateOptions options, int... portsToOpen) {
|
||||||
checkNotNull(options, "options");
|
checkNotNull(options, "options");
|
||||||
logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);
|
logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);
|
||||||
|
|
||||||
VDC vdc = client.getVDC(VDC);
|
VDC vdc = client.getVDC(VDC);
|
||||||
VAppTemplate template = client.getVAppTemplate(templateId);
|
VCloudExpressVAppTemplate template = VCloudExpressClient.class.cast(client).getVAppTemplate(templateId);
|
||||||
|
|
||||||
VApp vAppResponse = VCloudExpressClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getId(),
|
VApp vAppResponse = VCloudExpressClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getId(),
|
||||||
template.getId(), name, options);
|
template.getId(), name, options);
|
||||||
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
|
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
|
||||||
|
|
||||||
logger.debug(">> deploying vApp(%s)", vAppResponse.getName());
|
logger.debug(">> deploying vApp(%s)", vAppResponse.getName());
|
||||||
|
|
|
@ -33,27 +33,41 @@ import org.jclouds.rest.ConfiguresRestClient;
|
||||||
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
||||||
import org.jclouds.vcloud.VCloudExpressAsyncClient;
|
import org.jclouds.vcloud.VCloudExpressAsyncClient;
|
||||||
import org.jclouds.vcloud.VCloudExpressClient;
|
import org.jclouds.vcloud.VCloudExpressClient;
|
||||||
|
import org.jclouds.vcloud.domain.CatalogItem;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
import org.jclouds.vcloud.domain.VCloudSession;
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
|
import org.jclouds.vcloud.functions.VCloudExpressVAppTemplatesForCatalogItems;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
import domain.VCloudExpressLoginAsyncClient;
|
import domain.VCloudExpressLoginAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the VCloud authentication service connection, including logging and http transport.
|
* Configures the VCloud authentication service connection, including logging
|
||||||
|
* and http transport.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@RequiresHttp
|
@RequiresHttp
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
public abstract class BaseVCloudExpressRestClientModule<S extends VCloudExpressClient, A extends VCloudExpressAsyncClient>
|
public abstract class BaseVCloudExpressRestClientModule<S extends VCloudExpressClient, A extends VCloudExpressAsyncClient>
|
||||||
extends CommonVCloudRestClientModule<S, A> {
|
extends CommonVCloudRestClientModule<S, A> {
|
||||||
|
|
||||||
public BaseVCloudExpressRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) {
|
public BaseVCloudExpressRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) {
|
||||||
super(syncClientType, asyncClientType);
|
super(syncClientType, asyncClientType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
bind(new TypeLiteral<Function<Iterable<? extends CatalogItem>, Iterable<? extends VCloudExpressVAppTemplate>>>() {
|
||||||
|
}).to(new TypeLiteral<VCloudExpressVAppTemplatesForCatalogItems>() {
|
||||||
|
});
|
||||||
|
super.configure();
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected VCloudExpressLoginAsyncClient provideVCloudLogin(AsyncClientFactory factory) {
|
protected VCloudExpressLoginAsyncClient provideVCloudLogin(AsyncClientFactory factory) {
|
||||||
|
@ -63,22 +77,22 @@ public abstract class BaseVCloudExpressRestClientModule<S extends VCloudExpressC
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||||
final VCloudExpressLoginAsyncClient login) {
|
final VCloudExpressLoginAsyncClient login) {
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<VCloudSession>(authException, seconds,
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<VCloudSession>(authException, seconds,
|
||||||
new Supplier<VCloudSession>() {
|
new Supplier<VCloudSession>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VCloudSession get() {
|
public VCloudSession get() {
|
||||||
try {
|
try {
|
||||||
return login.login().get(10, TimeUnit.SECONDS);
|
return login.login().get(10, TimeUnit.SECONDS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
propagate(e);
|
propagate(e);
|
||||||
assert false : e;
|
assert false : e;
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,27 +33,41 @@ import org.jclouds.rest.ConfiguresRestClient;
|
||||||
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
||||||
import org.jclouds.vcloud.VCloudAsyncClient;
|
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||||
import org.jclouds.vcloud.VCloudClient;
|
import org.jclouds.vcloud.VCloudClient;
|
||||||
|
import org.jclouds.vcloud.domain.CatalogItem;
|
||||||
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
import org.jclouds.vcloud.domain.VCloudSession;
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
|
import org.jclouds.vcloud.functions.VAppTemplatesForCatalogItems;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
import domain.VCloudLoginAsyncClient;
|
import domain.VCloudLoginAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the VCloud authentication service connection, including logging and http transport.
|
* Configures the VCloud authentication service connection, including logging
|
||||||
|
* and http transport.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@RequiresHttp
|
@RequiresHttp
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
public abstract class BaseVCloudRestClientModule<S extends VCloudClient, A extends VCloudAsyncClient> extends
|
public abstract class BaseVCloudRestClientModule<S extends VCloudClient, A extends VCloudAsyncClient> extends
|
||||||
CommonVCloudRestClientModule<S, A> {
|
CommonVCloudRestClientModule<S, A> {
|
||||||
|
|
||||||
public BaseVCloudRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) {
|
public BaseVCloudRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) {
|
||||||
super(syncClientType, asyncClientType);
|
super(syncClientType, asyncClientType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
bind(new TypeLiteral<Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>>>() {
|
||||||
|
}).to(new TypeLiteral<VAppTemplatesForCatalogItems>() {
|
||||||
|
});
|
||||||
|
super.configure();
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected VCloudLoginAsyncClient provideVCloudLogin(AsyncClientFactory factory) {
|
protected VCloudLoginAsyncClient provideVCloudLogin(AsyncClientFactory factory) {
|
||||||
|
@ -63,21 +77,21 @@ public abstract class BaseVCloudRestClientModule<S extends VCloudClient, A exten
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||||
final VCloudLoginAsyncClient login) {
|
final VCloudLoginAsyncClient login) {
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<VCloudSession>(authException, seconds,
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<VCloudSession>(authException, seconds,
|
||||||
new Supplier<VCloudSession>() {
|
new Supplier<VCloudSession>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VCloudSession get() {
|
public VCloudSession get() {
|
||||||
try {
|
try {
|
||||||
return login.login().get(10, TimeUnit.SECONDS);
|
return login.login().get(10, TimeUnit.SECONDS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
propagate(e);
|
propagate(e);
|
||||||
assert false : e;
|
assert false : e;
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.domain.Image;
|
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.http.HttpErrorHandler;
|
import org.jclouds.http.HttpErrorHandler;
|
||||||
import org.jclouds.http.RequiresHttp;
|
import org.jclouds.http.RequiresHttp;
|
||||||
|
@ -65,12 +64,10 @@ import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSu
|
||||||
import org.jclouds.vcloud.CommonVCloudAsyncClient;
|
import org.jclouds.vcloud.CommonVCloudAsyncClient;
|
||||||
import org.jclouds.vcloud.CommonVCloudClient;
|
import org.jclouds.vcloud.CommonVCloudClient;
|
||||||
import org.jclouds.vcloud.VCloudToken;
|
import org.jclouds.vcloud.VCloudToken;
|
||||||
import org.jclouds.vcloud.compute.functions.ImagesInOrg;
|
|
||||||
import org.jclouds.vcloud.domain.Catalog;
|
import org.jclouds.vcloud.domain.Catalog;
|
||||||
import org.jclouds.vcloud.domain.CatalogItem;
|
import org.jclouds.vcloud.domain.CatalogItem;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Org;
|
import org.jclouds.vcloud.domain.Org;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
|
||||||
import org.jclouds.vcloud.domain.VCloudSession;
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.VDC;
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
import org.jclouds.vcloud.endpoints.Network;
|
import org.jclouds.vcloud.endpoints.Network;
|
||||||
|
@ -80,7 +77,6 @@ import org.jclouds.vcloud.functions.AllCatalogsInOrg;
|
||||||
import org.jclouds.vcloud.functions.AllVDCsInOrg;
|
import org.jclouds.vcloud.functions.AllVDCsInOrg;
|
||||||
import org.jclouds.vcloud.functions.OrgsForLocations;
|
import org.jclouds.vcloud.functions.OrgsForLocations;
|
||||||
import org.jclouds.vcloud.functions.OrgsForNames;
|
import org.jclouds.vcloud.functions.OrgsForNames;
|
||||||
import org.jclouds.vcloud.functions.VAppTemplatesForCatalogItems;
|
|
||||||
import org.jclouds.vcloud.handlers.ParseVCloudErrorFromHttpResponse;
|
import org.jclouds.vcloud.handlers.ParseVCloudErrorFromHttpResponse;
|
||||||
import org.jclouds.vcloud.predicates.TaskSuccess;
|
import org.jclouds.vcloud.predicates.TaskSuccess;
|
||||||
|
|
||||||
|
@ -123,15 +119,9 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
bind(new TypeLiteral<Function<Iterable<? extends Location>, Iterable<? extends Org>>>() {
|
bind(new TypeLiteral<Function<Iterable<? extends Location>, Iterable<? extends Org>>>() {
|
||||||
}).to(new TypeLiteral<OrgsForLocations>() {
|
}).to(new TypeLiteral<OrgsForLocations>() {
|
||||||
});
|
});
|
||||||
bind(new TypeLiteral<Function<Org, Iterable<? extends Image>>>() {
|
|
||||||
}).to(new TypeLiteral<ImagesInOrg>() {
|
|
||||||
});
|
|
||||||
bind(new TypeLiteral<Function<Catalog, Iterable<? extends CatalogItem>>>() {
|
bind(new TypeLiteral<Function<Catalog, Iterable<? extends CatalogItem>>>() {
|
||||||
}).to(new TypeLiteral<AllCatalogItemsInCatalog>() {
|
}).to(new TypeLiteral<AllCatalogItemsInCatalog>() {
|
||||||
});
|
});
|
||||||
bind(new TypeLiteral<Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>>>() {
|
|
||||||
}).to(new TypeLiteral<VAppTemplatesForCatalogItems>() {
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
|
|
|
@ -25,14 +25,15 @@ import org.jclouds.vcloud.VCloudExpressAsyncClient;
|
||||||
import org.jclouds.vcloud.VCloudExpressClient;
|
import org.jclouds.vcloud.VCloudExpressClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the VCloud authentication service connection, including logging and http transport.
|
* Configures the VCloud authentication service connection, including logging
|
||||||
|
* and http transport.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@RequiresHttp
|
@RequiresHttp
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
public class VCloudExpressRestClientModule extends
|
public class VCloudExpressRestClientModule extends
|
||||||
BaseVCloudExpressRestClientModule<VCloudExpressClient, VCloudExpressAsyncClient> {
|
BaseVCloudExpressRestClientModule<VCloudExpressClient, VCloudExpressAsyncClient> {
|
||||||
|
|
||||||
public VCloudExpressRestClientModule() {
|
public VCloudExpressRestClientModule() {
|
||||||
super(VCloudExpressClient.class, VCloudExpressAsyncClient.class);
|
super(VCloudExpressClient.class, VCloudExpressAsyncClient.class);
|
||||||
|
|
|
@ -19,14 +19,68 @@
|
||||||
|
|
||||||
package org.jclouds.vcloud.domain;
|
package org.jclouds.vcloud.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.jclouds.vcloud.domain.internal.VDCImpl;
|
||||||
|
|
||||||
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A VAppTemplate is an abstract description of a vApp. It is created when you
|
||||||
|
* upload an OVF package to a vDC.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ImplementedBy(VDCImpl.class)
|
||||||
public interface VAppTemplate extends NamedResource {
|
public interface VAppTemplate extends NamedResource {
|
||||||
|
/**
|
||||||
|
* Reference to the VDC containing this template.
|
||||||
|
*
|
||||||
|
* @since vcloud api 1.0
|
||||||
|
* @return org, or null if this is a version before 1.0 where the vdc isn't
|
||||||
|
* present
|
||||||
|
*/
|
||||||
|
NamedResource getVDC();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return creation status of the VAppTemplate.
|
||||||
|
*
|
||||||
|
* @since vcloud api 1.0
|
||||||
|
*/
|
||||||
Status getStatus();
|
Status getStatus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* optional description
|
||||||
|
*
|
||||||
|
* @since vcloud api 1.0
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
String getDescription();
|
String getDescription();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* read-only container for Task elements. Each element in the container
|
||||||
|
* represents a queued, running, or failed task owned by this object.
|
||||||
|
*
|
||||||
|
* @since vcloud api 1.0
|
||||||
|
*/
|
||||||
|
List<Task> getTasks();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return true if the OVF descriptor for the template has been uploaded to
|
||||||
|
* the containing vDC.
|
||||||
|
* @since vcloud api 1.0
|
||||||
|
*/
|
||||||
|
boolean isOvfDescriptorUploaded();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* read-only identifier created on import
|
||||||
|
*
|
||||||
|
* @since vcloud api 1.0
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
String getVAppScopedLocalId();
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public interface VCloudExpressVAppTemplate extends NamedResource {
|
||||||
|
|
||||||
|
Status getStatus();
|
||||||
|
|
||||||
|
String getDescription();
|
||||||
|
|
||||||
|
}
|
|
@ -7,7 +7,7 @@
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.vdc/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -19,39 +19,95 @@
|
||||||
|
|
||||||
package org.jclouds.vcloud.domain.internal;
|
package org.jclouds.vcloud.domain.internal;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.jclouds.vcloud.VCloudExpressMediaType;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.Status;
|
||||||
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Locations of resources in vCloud
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate {
|
public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate {
|
||||||
|
|
||||||
/** The serialVersionUID */
|
|
||||||
private static final long serialVersionUID = 8464716396538298809L;
|
|
||||||
private final String description;
|
|
||||||
private final Status status;
|
private final Status status;
|
||||||
|
private final NamedResource vdc;
|
||||||
|
@Nullable
|
||||||
|
private final String description;
|
||||||
|
private final List<Task> tasks = Lists.newArrayList();
|
||||||
|
private final boolean ovfDescriptorUploaded;
|
||||||
|
private final String vAppScopedLocalId;
|
||||||
|
|
||||||
public VAppTemplateImpl(String name, URI id, @Nullable String description, @Nullable Status status) {
|
public VAppTemplateImpl(String name, String type, URI id, Status status, NamedResource vdc,
|
||||||
super(name, VCloudExpressMediaType.VAPPTEMPLATE_XML, id);
|
@Nullable String description, Iterable<Task> tasks, boolean ovfDescriptorUploaded,
|
||||||
|
@Nullable String vAppScopedLocalId) {
|
||||||
|
super(name, type, id);
|
||||||
|
this.status = checkNotNull(status, "status");
|
||||||
|
this.vdc = vdc;// TODO: once <1.0 is killed check not null
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.status = status;
|
Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
|
||||||
|
this.vAppScopedLocalId = vAppScopedLocalId;
|
||||||
|
this.ovfDescriptorUploaded = ovfDescriptorUploaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Status getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public NamedResource getVDC() {
|
||||||
|
return vdc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Status getStatus() {
|
/**
|
||||||
return status;
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Task> getTasks() {
|
||||||
|
return tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getVAppScopedLocalId() {
|
||||||
|
return vAppScopedLocalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isOvfDescriptorUploaded() {
|
||||||
|
return ovfDescriptorUploaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,7 +115,11 @@ public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = super.hashCode();
|
int result = super.hashCode();
|
||||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
||||||
|
result = prime * result + (ovfDescriptorUploaded ? 1231 : 1237);
|
||||||
result = prime * result + ((status == null) ? 0 : status.hashCode());
|
result = prime * result + ((status == null) ? 0 : status.hashCode());
|
||||||
|
result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
|
||||||
|
result = prime * result + ((vAppScopedLocalId == null) ? 0 : vAppScopedLocalId.hashCode());
|
||||||
|
result = prime * result + ((vdc == null) ? 0 : vdc.hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,17 +137,35 @@ public class VAppTemplateImpl extends NamedResourceImpl implements VAppTemplate
|
||||||
return false;
|
return false;
|
||||||
} else if (!description.equals(other.description))
|
} else if (!description.equals(other.description))
|
||||||
return false;
|
return false;
|
||||||
|
if (ovfDescriptorUploaded != other.ovfDescriptorUploaded)
|
||||||
|
return false;
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
if (other.status != null)
|
if (other.status != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!status.equals(other.status))
|
} else if (!status.equals(other.status))
|
||||||
return false;
|
return false;
|
||||||
|
if (tasks == null) {
|
||||||
|
if (other.tasks != null)
|
||||||
|
return false;
|
||||||
|
} else if (!tasks.equals(other.tasks))
|
||||||
|
return false;
|
||||||
|
if (vAppScopedLocalId == null) {
|
||||||
|
if (other.vAppScopedLocalId != null)
|
||||||
|
return false;
|
||||||
|
} else if (!vAppScopedLocalId.equals(other.vAppScopedLocalId))
|
||||||
|
return false;
|
||||||
|
if (vdc == null) {
|
||||||
|
if (other.vdc != null)
|
||||||
|
return false;
|
||||||
|
} else if (!vdc.equals(other.vdc))
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "VAppTemplateImpl [description=" + description + ", status=" + status + "]";
|
return "[id=" + getId() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status="
|
||||||
|
+ status + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.domain.internal;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.jclouds.vcloud.VCloudExpressMediaType;
|
||||||
|
import org.jclouds.vcloud.domain.Status;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class VCloudExpressVAppTemplateImpl extends NamedResourceImpl implements VCloudExpressVAppTemplate {
|
||||||
|
|
||||||
|
/** The serialVersionUID */
|
||||||
|
private static final long serialVersionUID = 8464716396538298809L;
|
||||||
|
private final String description;
|
||||||
|
private final Status status;
|
||||||
|
|
||||||
|
public VCloudExpressVAppTemplateImpl(String name, URI id, @Nullable String description, @Nullable Status status) {
|
||||||
|
super(name, VCloudExpressMediaType.VAPPTEMPLATE_XML, id);
|
||||||
|
this.description = description;
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Status getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
||||||
|
result = prime * result + ((status == null) ? 0 : status.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (!super.equals(obj))
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
VCloudExpressVAppTemplateImpl other = (VCloudExpressVAppTemplateImpl) obj;
|
||||||
|
if (description == null) {
|
||||||
|
if (other.description != null)
|
||||||
|
return false;
|
||||||
|
} else if (!description.equals(other.description))
|
||||||
|
return false;
|
||||||
|
if (status == null) {
|
||||||
|
if (other.status != null)
|
||||||
|
return false;
|
||||||
|
} else if (!status.equals(other.status))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "VAppTemplateImpl [description=" + description + ", status=" + status + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -34,6 +34,7 @@ import org.jclouds.Constants;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.vcloud.CommonVCloudAsyncClient;
|
import org.jclouds.vcloud.CommonVCloudAsyncClient;
|
||||||
|
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||||
import org.jclouds.vcloud.VCloudMediaType;
|
import org.jclouds.vcloud.VCloudMediaType;
|
||||||
import org.jclouds.vcloud.domain.CatalogItem;
|
import org.jclouds.vcloud.domain.CatalogItem;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
|
@ -46,7 +47,7 @@ import com.google.common.base.Predicate;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class VAppTemplatesForCatalogItems implements
|
public class VAppTemplatesForCatalogItems implements
|
||||||
Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>> {
|
Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>> {
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
public Logger logger = Logger.NULL;
|
public Logger logger = Logger.NULL;
|
||||||
|
@ -55,7 +56,7 @@ public class VAppTemplatesForCatalogItems implements
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
VAppTemplatesForCatalogItems(CommonVCloudAsyncClient aclient,
|
VAppTemplatesForCatalogItems(CommonVCloudAsyncClient aclient,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
||||||
this.aclient = aclient;
|
this.aclient = aclient;
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +75,8 @@ public class VAppTemplatesForCatalogItems implements
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public Future<VAppTemplate> apply(CatalogItem from) {
|
public Future<VAppTemplate> apply(CatalogItem from) {
|
||||||
return (Future<VAppTemplate>) aclient.getVAppTemplate(from.getEntity().getId());
|
return (Future<VAppTemplate>) VCloudAsyncClient.class.cast(aclient).getVAppTemplate(
|
||||||
|
from.getEntity().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}, executor, null, logger, "vappTemplates in");
|
}, executor, null, logger, "vappTemplates in");
|
||||||
|
|
|
@ -34,8 +34,8 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.Constants;
|
import org.jclouds.Constants;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.vcloud.VCloudExpressAsyncClient;
|
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||||
import org.jclouds.vcloud.VCloudExpressMediaType;
|
import org.jclouds.vcloud.VCloudMediaType;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
|
|
||||||
|
@ -47,16 +47,16 @@ import com.google.common.base.Predicate;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class VAppTemplatesForResourceEntities implements
|
public class VAppTemplatesForResourceEntities implements
|
||||||
Function<Iterable<? extends NamedResource>, Iterable<? extends VAppTemplate>> {
|
Function<Iterable<? extends NamedResource>, Iterable<? extends VAppTemplate>> {
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
public Logger logger = Logger.NULL;
|
public Logger logger = Logger.NULL;
|
||||||
private final VCloudExpressAsyncClient aclient;
|
private final VCloudAsyncClient aclient;
|
||||||
private final ExecutorService executor;
|
private final ExecutorService executor;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
VAppTemplatesForResourceEntities(VCloudExpressAsyncClient aclient,
|
VAppTemplatesForResourceEntities(VCloudAsyncClient aclient,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
||||||
this.aclient = aclient;
|
this.aclient = aclient;
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class VAppTemplatesForResourceEntities implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(NamedResource input) {
|
public boolean apply(NamedResource input) {
|
||||||
return input.getType().equals(VCloudExpressMediaType.VAPPTEMPLATE_XML);
|
return input.getType().equals(VCloudMediaType.VAPPTEMPLATE_XML);
|
||||||
}
|
}
|
||||||
|
|
||||||
}), new Function<NamedResource, Future<VAppTemplate>>() {
|
}), new Function<NamedResource, Future<VAppTemplate>>() {
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.vcloud.VCloudExpressAsyncClient;
|
import org.jclouds.vcloud.VCloudExpressAsyncClient;
|
||||||
import org.jclouds.vcloud.VCloudExpressMediaType;
|
import org.jclouds.vcloud.VCloudExpressMediaType;
|
||||||
import org.jclouds.vcloud.domain.CatalogItem;
|
import org.jclouds.vcloud.domain.CatalogItem;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
@ -46,7 +46,7 @@ import com.google.common.base.Predicate;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class VCloudExpressVAppTemplatesForCatalogItems implements
|
public class VCloudExpressVAppTemplatesForCatalogItems implements
|
||||||
Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>> {
|
Function<Iterable<? extends CatalogItem>, Iterable<? extends VCloudExpressVAppTemplate>> {
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
public Logger logger = Logger.NULL;
|
public Logger logger = Logger.NULL;
|
||||||
|
@ -61,7 +61,7 @@ public class VCloudExpressVAppTemplatesForCatalogItems implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<? extends VAppTemplate> apply(Iterable<? extends CatalogItem> from) {
|
public Iterable<? extends VCloudExpressVAppTemplate> apply(Iterable<? extends CatalogItem> from) {
|
||||||
return transformParallel(filter(from, new Predicate<CatalogItem>() {
|
return transformParallel(filter(from, new Predicate<CatalogItem>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,12 +69,12 @@ public class VCloudExpressVAppTemplatesForCatalogItems implements
|
||||||
return input.getEntity().getType().equals(VCloudExpressMediaType.VAPPTEMPLATE_XML);
|
return input.getEntity().getType().equals(VCloudExpressMediaType.VAPPTEMPLATE_XML);
|
||||||
}
|
}
|
||||||
|
|
||||||
}), new Function<CatalogItem, Future<VAppTemplate>>() {
|
}), new Function<CatalogItem, Future<VCloudExpressVAppTemplate>>() {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public Future<VAppTemplate> apply(CatalogItem from) {
|
public Future<VCloudExpressVAppTemplate> apply(CatalogItem from) {
|
||||||
return (Future<VAppTemplate>) aclient.getVAppTemplate(from.getEntity().getId());
|
return (Future<VCloudExpressVAppTemplate>) aclient.getVAppTemplate(from.getEntity().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}, executor, null, logger, "vappTemplates in");
|
}, executor, null, logger, "vappTemplates in");
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.functions;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static com.google.common.collect.Iterables.filter;
|
||||||
|
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.Constants;
|
||||||
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.vcloud.VCloudExpressAsyncClient;
|
||||||
|
import org.jclouds.vcloud.VCloudExpressMediaType;
|
||||||
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class VCloudExpressVAppTemplatesForResourceEntities implements
|
||||||
|
Function<Iterable<? extends NamedResource>, Iterable<? extends VCloudExpressVAppTemplate>> {
|
||||||
|
@Resource
|
||||||
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
|
public Logger logger = Logger.NULL;
|
||||||
|
private final VCloudExpressAsyncClient aclient;
|
||||||
|
private final ExecutorService executor;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
VCloudExpressVAppTemplatesForResourceEntities(VCloudExpressAsyncClient aclient,
|
||||||
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
||||||
|
this.aclient = aclient;
|
||||||
|
this.executor = executor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<? extends VCloudExpressVAppTemplate> apply(Iterable<? extends NamedResource> from) {
|
||||||
|
return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate<NamedResource>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(NamedResource input) {
|
||||||
|
return input.getType().equals(VCloudExpressMediaType.VAPPTEMPLATE_XML);
|
||||||
|
}
|
||||||
|
|
||||||
|
}), new Function<NamedResource, Future<VCloudExpressVAppTemplate>>() {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public Future<VCloudExpressVAppTemplate> apply(NamedResource from) {
|
||||||
|
return (Future<VCloudExpressVAppTemplate>) aclient.getVAppTemplate(from.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}, executor, null, logger, "vappTemplates in");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -55,24 +55,25 @@ public class ParseVCloudErrorFromHttpResponse implements HttpErrorHandler {
|
||||||
try {
|
try {
|
||||||
String content = parseErrorFromContentOrNull(command, response);
|
String content = parseErrorFromContentOrNull(command, response);
|
||||||
switch (response.getStatusCode()) {
|
switch (response.getStatusCode()) {
|
||||||
case 401:
|
case 401:
|
||||||
exception = new AuthorizationException(command.getRequest(), content);
|
case 403:
|
||||||
break;
|
exception = new AuthorizationException(command.getRequest(), content);
|
||||||
case 404:
|
break;
|
||||||
if (!command.getRequest().getMethod().equals("DELETE")) {
|
case 404:
|
||||||
String path = command.getRequest().getEndpoint().getPath();
|
if (!command.getRequest().getMethod().equals("DELETE")) {
|
||||||
Matcher matcher = RESOURCE_PATTERN.matcher(path);
|
String path = command.getRequest().getEndpoint().getPath();
|
||||||
String message;
|
Matcher matcher = RESOURCE_PATTERN.matcher(path);
|
||||||
if (matcher.find()) {
|
String message;
|
||||||
message = String.format("%s %s not found", matcher.group(1), matcher.group(2));
|
if (matcher.find()) {
|
||||||
} else {
|
message = String.format("%s %s not found", matcher.group(1), matcher.group(2));
|
||||||
message = path;
|
} else {
|
||||||
}
|
message = path;
|
||||||
exception = new ResourceNotFoundException(message);
|
|
||||||
}
|
}
|
||||||
break;
|
exception = new ResourceNotFoundException(message);
|
||||||
default:
|
}
|
||||||
exception = new HttpResponseException(command, response, content);
|
break;
|
||||||
|
default:
|
||||||
|
exception = new HttpResponseException(command, response, content);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
releasePayload(response);
|
releasePayload(response);
|
||||||
|
|
|
@ -33,16 +33,20 @@ import org.xml.sax.Attributes;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
public static NamedResource newNamedResource(Attributes attributes, String defaultType) {
|
||||||
|
String uri = attributes.getValue(attributes.getIndex("href"));
|
||||||
|
String type = attributes.getValue(attributes.getIndex("type"));
|
||||||
|
return new NamedResourceImpl(attributes.getValue(attributes.getIndex("name")), type != null ? type : defaultType,
|
||||||
|
URI.create(uri));
|
||||||
|
}
|
||||||
|
|
||||||
public static NamedResource newNamedResource(Attributes attributes) {
|
public static NamedResource newNamedResource(Attributes attributes) {
|
||||||
String uri = attributes.getValue(attributes.getIndex("href"));
|
return newNamedResource(attributes, null);
|
||||||
return new NamedResourceImpl(attributes.getValue(attributes.getIndex("name")), attributes.getValue(attributes
|
|
||||||
.getIndex("type")), URI.create(uri));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Task.Error newError(Attributes attributes) {
|
public static Task.Error newError(Attributes attributes) {
|
||||||
return new ErrorImpl(attrOrNull(attributes, "message"), attrOrNull(attributes, "majorErrorCode"), attrOrNull(
|
return new ErrorImpl(attrOrNull(attributes, "message"), attrOrNull(attributes, "majorErrorCode"), attrOrNull(
|
||||||
attributes, "minorErrorCode"));
|
attributes, "minorErrorCode"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String attrOrNull(Attributes attributes, String attr) {
|
public static String attrOrNull(Attributes attributes, String attr) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.SortedMap;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
|
import org.jclouds.vcloud.VCloudMediaType;
|
||||||
import org.jclouds.vcloud.domain.Catalog;
|
import org.jclouds.vcloud.domain.Catalog;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
|
@ -62,13 +63,13 @@ public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
|
||||||
|
|
||||||
public Catalog getResult() {
|
public Catalog getResult() {
|
||||||
return new CatalogImpl(catalog.getName(), catalog.getType(), catalog.getId(), org, description, contents, tasks,
|
return new CatalogImpl(catalog.getName(), catalog.getType(), catalog.getId(), org, description, contents, tasks,
|
||||||
published);
|
published);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
|
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
|
||||||
if (qName.equals("Catalog")) {
|
if (qName.equals("Catalog")) {
|
||||||
catalog = Utils.newNamedResource(attributes);
|
catalog = Utils.newNamedResource(attributes, VCloudMediaType.CATALOG_XML);
|
||||||
} else if (qName.equals("CatalogItem")) {
|
} else if (qName.equals("CatalogItem")) {
|
||||||
Utils.putNamedResource(contents, attributes);
|
Utils.putNamedResource(contents, attributes);
|
||||||
} else if (qName.equals("Link") && "up".equals(Utils.attrOrNull(attributes, "rel"))) {
|
} else if (qName.equals("Link") && "up".equals(Utils.attrOrNull(attributes, "rel"))) {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.vdc/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -19,41 +19,82 @@
|
||||||
|
|
||||||
package org.jclouds.vcloud.xml;
|
package org.jclouds.vcloud.xml;
|
||||||
|
|
||||||
|
import static org.jclouds.vcloud.util.Utils.newNamedResource;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.Status;
|
||||||
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
import org.jclouds.vcloud.domain.internal.VAppTemplateImpl;
|
import org.jclouds.vcloud.domain.internal.VAppTemplateImpl;
|
||||||
import org.jclouds.vcloud.util.Utils;
|
import org.jclouds.vcloud.util.Utils;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class VAppTemplateHandler extends ParseSax.HandlerWithResult<VAppTemplate> {
|
public class VAppTemplateHandler extends ParseSax.HandlerWithResult<VAppTemplate> {
|
||||||
private StringBuilder currentText = new StringBuilder();
|
|
||||||
|
|
||||||
private NamedResource catalog;
|
protected final TaskHandler taskHandler;
|
||||||
private String description;
|
|
||||||
private Status status;
|
@Inject
|
||||||
|
public VAppTemplateHandler(TaskHandler taskHandler) {
|
||||||
|
this.taskHandler = taskHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected StringBuilder currentText = new StringBuilder();
|
||||||
|
|
||||||
|
protected NamedResource template;
|
||||||
|
protected Status status;
|
||||||
|
protected NamedResource vdc;
|
||||||
|
protected String description;
|
||||||
|
protected List<Task> tasks = Lists.newArrayList();
|
||||||
|
protected boolean ovfDescriptorUploaded = true;
|
||||||
|
protected String vAppScopedLocalId;
|
||||||
|
|
||||||
|
private boolean inChildren;
|
||||||
|
|
||||||
public VAppTemplate getResult() {
|
public VAppTemplate getResult() {
|
||||||
return new VAppTemplateImpl(catalog.getName(), catalog.getId(), description, status);
|
return new VAppTemplateImpl(template.getName(), template.getType(), template.getId(), status, vdc, description,
|
||||||
|
tasks, ovfDescriptorUploaded, vAppScopedLocalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
|
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
|
||||||
if (qName.equals("VAppTemplate")) {
|
if (qName.equals("Children")) {
|
||||||
catalog = Utils.newNamedResource(attributes);
|
inChildren = true;
|
||||||
if (attributes.getIndex("status") != -1)
|
} else if (qName.equals("VAppTemplate")) {
|
||||||
status = Status.fromValue(attributes.getValue(attributes.getIndex("status")));
|
template = newNamedResource(attributes);
|
||||||
|
String status = Utils.attrOrNull(attributes, "status");
|
||||||
|
if (status != null)
|
||||||
|
this.status = Status.fromValue(Integer.parseInt(status));
|
||||||
|
} else if (qName.equals("Link") && "up".equals(Utils.attrOrNull(attributes, "rel")) && !inChildren) {
|
||||||
|
vdc = newNamedResource(attributes);
|
||||||
|
} else {
|
||||||
|
taskHandler.startElement(uri, localName, qName, attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void endElement(String uri, String name, String qName) {
|
public void endElement(String uri, String name, String qName) {
|
||||||
if (qName.equals("Description")) {
|
taskHandler.endElement(uri, name, qName);
|
||||||
|
if (qName.equals("Children")) {
|
||||||
|
inChildren = false;
|
||||||
|
} else if (qName.equals("Task") && !inChildren) {
|
||||||
|
this.tasks.add(taskHandler.getResult());
|
||||||
|
} else if (qName.equals("Description") && !inChildren) {
|
||||||
description = currentOrNull();
|
description = currentOrNull();
|
||||||
|
} else if (qName.equals("VAppScopedLocalId")) {
|
||||||
|
vAppScopedLocalId = currentOrNull();
|
||||||
|
} else if (qName.equals("ovfDescriptorUploaded")) {
|
||||||
|
ovfDescriptorUploaded = Boolean.parseBoolean(currentOrNull());
|
||||||
}
|
}
|
||||||
currentText = new StringBuilder();
|
currentText = new StringBuilder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.xml;
|
||||||
|
|
||||||
|
import org.jclouds.http.functions.ParseSax;
|
||||||
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
|
import org.jclouds.vcloud.domain.Status;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
import org.jclouds.vcloud.domain.internal.VCloudExpressVAppTemplateImpl;
|
||||||
|
import org.jclouds.vcloud.util.Utils;
|
||||||
|
import org.xml.sax.Attributes;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class VCloudExpressVAppTemplateHandler extends ParseSax.HandlerWithResult<VCloudExpressVAppTemplate> {
|
||||||
|
private StringBuilder currentText = new StringBuilder();
|
||||||
|
|
||||||
|
private NamedResource catalog;
|
||||||
|
private String description;
|
||||||
|
private Status status;
|
||||||
|
|
||||||
|
public VCloudExpressVAppTemplate getResult() {
|
||||||
|
return new VCloudExpressVAppTemplateImpl(catalog.getName(), catalog.getId(), description, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
|
||||||
|
if (qName.equals("VAppTemplate")) {
|
||||||
|
catalog = Utils.newNamedResource(attributes);
|
||||||
|
if (attributes.getIndex("status") != -1)
|
||||||
|
status = Status.fromValue(attributes.getValue(attributes.getIndex("status")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void endElement(String uri, String name, String qName) {
|
||||||
|
if (qName.equals("Description")) {
|
||||||
|
description = currentOrNull();
|
||||||
|
}
|
||||||
|
currentText = new StringBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void characters(char ch[], int start, int length) {
|
||||||
|
currentText.append(ch, start, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String currentOrNull() {
|
||||||
|
String returnVal = currentText.toString().trim();
|
||||||
|
return returnVal.equals("") ? null : returnVal;
|
||||||
|
}
|
||||||
|
}
|
|
@ -111,33 +111,38 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
|
||||||
Catalog response = connection.getCatalog(cat.getId());
|
Catalog response = connection.getCatalog(cat.getId());
|
||||||
for (NamedResource resource : response.values()) {
|
for (NamedResource resource : response.values()) {
|
||||||
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||||
CatalogItem item = connection.findCatalogItemInOrgCatalogNamed(null, null, resource.getName());
|
CatalogItem item = connection.getCatalogItem(resource.getId());
|
||||||
assertNotNull(item);
|
verifyCatalogItem(item);
|
||||||
assertNotNull(item.getEntity());
|
|
||||||
assertNotNull(item.getId());
|
|
||||||
assertNotNull(item.getProperties());
|
|
||||||
assertNotNull(item.getType());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void verifyCatalogItem(CatalogItem item) {
|
||||||
|
assertNotNull(item);
|
||||||
|
assertNotNull(item);
|
||||||
|
assertNotNull(item.getEntity());
|
||||||
|
assertNotNull(item.getId());
|
||||||
|
assertNotNull(item.getProperties());
|
||||||
|
assertNotNull(item.getType());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetVAppTemplate() throws Exception {
|
public void testFindCatalogItem() throws Exception {
|
||||||
Org org = connection.findOrgNamed(null);
|
Org org = connection.findOrgNamed(null);
|
||||||
for (NamedResource cat : org.getCatalogs().values()) {
|
for (NamedResource cat : org.getCatalogs().values()) {
|
||||||
Catalog response = connection.getCatalog(cat.getId());
|
Catalog response = connection.getCatalog(cat.getId());
|
||||||
for (NamedResource resource : response.values()) {
|
for (NamedResource resource : response.values()) {
|
||||||
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||||
CatalogItem item = connection.getCatalogItem(resource.getId());
|
CatalogItem item = connection.findCatalogItemInOrgCatalogNamed(org.getName(), response.getName(),
|
||||||
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
resource.getName());
|
||||||
assertNotNull(connection.findVAppTemplateInOrgCatalogNamed(null, null, item.getEntity().getName()));
|
verifyCatalogItem(item);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultVDC() throws Exception {
|
public void testDefaultVDC() throws Exception {
|
||||||
Org org = connection.findOrgNamed(null);
|
Org org = connection.findOrgNamed(null);
|
||||||
|
@ -196,7 +201,7 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
|
||||||
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
|
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
|
||||||
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
|
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
|
||||||
context = new ComputeServiceContextFactory().createContext(provider, identity, credential,
|
context = new ComputeServiceContextFactory().createContext(provider, identity, credential,
|
||||||
ImmutableSet.<Module> of(new Log4JLoggingModule()), props).getProviderSpecificContext();
|
ImmutableSet.<Module> of(new Log4JLoggingModule()), props).getProviderSpecificContext();
|
||||||
|
|
||||||
connection = context.getApi();
|
connection = context.getApi();
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,16 +92,16 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
public void testInstantiateVAppTemplateInVDCURI() throws SecurityException, NoSuchMethodException, IOException {
|
public void testInstantiateVAppTemplateInVDCURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
||||||
String.class, InstantiateVAppTemplateOptions[].class);
|
String.class, InstantiateVAppTemplateOptions[].class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"), "my-vapp");
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"), "my-vapp");
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
|
||||||
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/newvapp.xml")),
|
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/newvapp.xml")),
|
||||||
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
|
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, VAppHandler.class);
|
assertSaxResponseParserClassEquals(method, VAppHandler.class);
|
||||||
|
@ -111,20 +111,19 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInstantiateVAppTemplateInVDCURIOptions() throws SecurityException, NoSuchMethodException,
|
public void testInstantiateVAppTemplateInVDCURIOptions() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
||||||
String.class, InstantiateVAppTemplateOptions[].class);
|
String.class, InstantiateVAppTemplateOptions[].class);
|
||||||
HttpRequest request = processor
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.createRequest(method, URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"), "my-vapp",
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"), "my-vapp", processorCount(1).memory(
|
||||||
processorCount(1).memory(512).disk(1024).inNetwork(
|
512).disk(1024).inNetwork(URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1990")));
|
||||||
URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1990")));
|
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
|
||||||
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/newvapp-cpumemdisk.xml")),
|
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/newvapp-cpumemdisk.xml")),
|
||||||
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
|
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, VAppHandler.class);
|
assertSaxResponseParserClassEquals(method, VAppHandler.class);
|
||||||
|
@ -135,26 +134,26 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||||
public void testInstantiateVAppTemplateInOrgOptionsIllegalName() throws SecurityException, NoSuchMethodException,
|
public void testInstantiateVAppTemplateInOrgOptionsIllegalName() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
||||||
String.class, InstantiateVAppTemplateOptions[].class);
|
String.class, InstantiateVAppTemplateOptions[].class);
|
||||||
processor.createRequest(method, URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
processor.createRequest(method, URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "CentOS 01", processorCount(1).memory(512)
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "CentOS 01", processorCount(1).memory(512)
|
||||||
.disk(1024).inNetwork(URI.create("https://vcenterprise.bluelock.com/network/1990")));
|
.disk(1024).inNetwork(URI.create("https://vcenterprise.bluelock.com/network/1990")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCloneVAppInVDC() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCloneVAppInVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
Method method = VCloudAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
||||||
CloneVAppOptions[].class);
|
CloneVAppOptions[].class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), "my-vapp");
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), "my-vapp");
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/cloneVApp-default.xml")),
|
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/cloneVApp-default.xml")),
|
||||||
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||||
|
@ -165,17 +164,17 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
public void testCloneVAppInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCloneVAppInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
Method method = VCloudAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
||||||
CloneVAppOptions[].class);
|
CloneVAppOptions[].class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "new-linux-server",
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "new-linux-server", new CloneVAppOptions()
|
||||||
new CloneVAppOptions().deploy().powerOn().withDescription("The description of the new vApp"));
|
.deploy().powerOn().withDescription("The description of the new vApp"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/cloneVApp.xml")),
|
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/cloneVApp.xml")),
|
||||||
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||||
|
@ -187,7 +186,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
|
public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getOrg", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getOrg", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
|
||||||
|
@ -218,7 +217,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getCatalog", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getCatalog", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
|
||||||
|
@ -249,7 +248,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getNetwork", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getNetwork", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/2"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/network/2"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/network/2 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/network/2 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
|
||||||
|
@ -265,7 +264,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getCatalogItem", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getCatalogItem", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
|
||||||
|
@ -280,7 +279,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
public void testFindCatalogItemInOrgCatalogNamed() throws SecurityException, NoSuchMethodException, IOException {
|
public void testFindCatalogItemInOrgCatalogNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("findCatalogItemInOrgCatalogNamed", String.class, String.class,
|
Method method = VCloudAsyncClient.class.getMethod("findCatalogItemInOrgCatalogNamed", String.class, String.class,
|
||||||
String.class);
|
String.class);
|
||||||
HttpRequest request = processor.createRequest(method, "org", "catalog", "item");
|
HttpRequest request = processor.createRequest(method, "org", "catalog", "item");
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1 HTTP/1.1");
|
||||||
|
@ -296,7 +295,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("findVAppTemplateInOrgCatalogNamed", String.class,
|
Method method = VCloudAsyncClient.class.getMethod("findVAppTemplateInOrgCatalogNamed", String.class,
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, "org", "catalog", "template");
|
HttpRequest request = processor.createRequest(method, "org", "catalog", "template");
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
|
||||||
|
@ -313,7 +312,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
|
public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getVAppTemplate", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getVAppTemplate", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
|
||||||
|
@ -386,7 +385,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getVDC", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getVDC", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
|
||||||
|
@ -402,7 +401,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getTasksList", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getTasksList", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
|
||||||
|
@ -433,7 +432,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testDeployVApp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeployVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("deployVApp", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("deployVApp", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
|
@ -449,7 +448,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testGetVApp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getVApp", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getVApp", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
|
||||||
|
@ -465,10 +464,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testUndeployVApp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUndeployVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("undeployVApp", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("undeployVApp", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -482,7 +481,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testDeleteVApp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeleteVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("deleteVApp", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("deleteVApp", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -498,10 +497,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testPowerOn() throws SecurityException, NoSuchMethodException, IOException {
|
public void testPowerOn() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("powerOnVApp", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("powerOnVApp", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOn HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOn HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -515,10 +514,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testPowerOff() throws SecurityException, NoSuchMethodException, IOException {
|
public void testPowerOff() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("powerOffVApp", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("powerOffVApp", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOff HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOff HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -532,10 +531,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testReset() throws SecurityException, NoSuchMethodException, IOException {
|
public void testReset() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("resetVApp", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("resetVApp", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reset HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reset HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -549,10 +548,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testSuspend() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSuspend() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("suspendVApp", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("suspendVApp", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/suspend HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/suspend HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -566,10 +565,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testShutdown() throws SecurityException, NoSuchMethodException, IOException {
|
public void testShutdown() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("shutdownVApp", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("shutdownVApp", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -583,7 +582,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getTask", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getTask", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/task/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/task/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
|
@ -599,7 +598,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("cancelTask", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("cancelTask", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/task/1/action/cancel HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/task/1/action/cancel HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -641,7 +640,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public static class VCloudRestClientModuleExtension extends VCloudRestClientModule {
|
public static class VCloudRestClientModuleExtension extends VCloudRestClientModule {
|
||||||
@Override
|
@Override
|
||||||
protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService,
|
protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService,
|
||||||
@Named(PROPERTY_API_VERSION) String version) {
|
@Named(PROPERTY_API_VERSION) String version) {
|
||||||
return URI.create("https://vcenterprise.bluelock.com/api/v1.0/login");
|
return URI.create("https://vcenterprise.bluelock.com/api/v1.0/login");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,13 +683,13 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||||
final VCloudLoginAsyncClient login) {
|
final VCloudLoginAsyncClient login) {
|
||||||
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
|
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, NamedResource> getOrgs() {
|
public Map<String, NamedResource> getOrgs() {
|
||||||
return ImmutableMap.<String, NamedResource> of("org", new NamedResourceImpl("org",
|
return ImmutableMap.<String, NamedResource> of("org", new NamedResourceImpl("org",
|
||||||
VCloudMediaType.ORG_XML, URI.create("https://vcenterprise.bluelock.com/api/v1.0/org/1")));
|
VCloudMediaType.ORG_XML, URI.create("https://vcenterprise.bluelock.com/api/v1.0/org/1")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -711,44 +710,19 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
|
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
|
||||||
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) {
|
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) {
|
||||||
|
|
||||||
return Suppliers
|
return Suppliers.<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> ofInstance(ImmutableMap
|
||||||
.<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> ofInstance(ImmutableMap
|
.<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> of("org",
|
||||||
.<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> of(
|
|
||||||
"org",
|
|
||||||
|
|
||||||
ImmutableMap
|
ImmutableMap.<String, org.jclouds.vcloud.domain.VDC> of("vdc", new VDCImpl("vdc", null, URI
|
||||||
.<String, org.jclouds.vcloud.domain.VDC> of(
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), null, null, "description", null,
|
||||||
"vdc",
|
null, null, null, null, ImmutableMap.<String, NamedResource> of("vapp", new NamedResourceImpl(
|
||||||
new VDCImpl(
|
"vapp", "application/vnd.vmware.vcloud.vApp+xml", URI
|
||||||
"vdc",
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")), "network",
|
||||||
null,
|
new NamedResourceImpl("network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
|
||||||
URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdcItem/2"))), null, 0, 0, 0,
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"),
|
false))));
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"description",
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
ImmutableMap
|
|
||||||
.<String, NamedResource> of(
|
|
||||||
"vapp",
|
|
||||||
new NamedResourceImpl(
|
|
||||||
"vapp",
|
|
||||||
"application/vnd.vmware.vcloud.vApp+xml",
|
|
||||||
URI
|
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")),
|
|
||||||
"network",
|
|
||||||
new NamedResourceImpl(
|
|
||||||
"network",
|
|
||||||
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
|
||||||
URI
|
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdcItem/2"))),
|
|
||||||
null, 0, 0, 0, false))));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -762,18 +736,15 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Org> get() {
|
public Map<String, Org> get() {
|
||||||
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI
|
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"), "org", "description", ImmutableMap
|
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"), "org", "description", ImmutableMap
|
||||||
.<String, NamedResource> of("catalog", new NamedResourceImpl("catalog",
|
.<String, NamedResource> of("catalog", new NamedResourceImpl("catalog", VCloudMediaType.CATALOG_XML,
|
||||||
VCloudMediaType.CATALOG_XML, URI
|
URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"))), ImmutableMap
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"))), ImmutableMap
|
.<String, NamedResource> of("vdc", new NamedResourceImpl("vdc", VCloudMediaType.VDC_XML, URI
|
||||||
.<String, NamedResource> of("vdc", new NamedResourceImpl("vdc", VCloudMediaType.VDC_XML, URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"))), ImmutableMap
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"))), ImmutableMap
|
.<String, NamedResource> of("network", new NamedResourceImpl("network", VCloudMediaType.NETWORK_XML,
|
||||||
.<String, NamedResource> of("network", new NamedResourceImpl("network",
|
URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1"))), new NamedResourceImpl(
|
||||||
VCloudMediaType.NETWORK_XML, URI
|
"tasksList", VCloudMediaType.TASKSLIST_XML, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/1"))),
|
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")), ImmutableList.<Task> of()));
|
||||||
new NamedResourceImpl("tasksList", VCloudMediaType.TASKSLIST_XML, URI
|
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")), ImmutableList
|
|
||||||
.<Task> of()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,14 +760,13 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
return ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> of("org",
|
return ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> of("org",
|
||||||
|
|
||||||
ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of("catalog", new CatalogImpl("catalog", "type",
|
ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of("catalog", new CatalogImpl("catalog", "type",
|
||||||
URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), null, "description",
|
URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), null, "description", ImmutableMap
|
||||||
ImmutableMap.<String, NamedResource> of("item", new NamedResourceImpl("item",
|
.<String, NamedResource> of("item", new NamedResourceImpl("item",
|
||||||
"application/vnd.vmware.vcloud.catalogItem+xml", URI
|
"application/vnd.vmware.vcloud.catalogItem+xml", URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1")),
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1")), "template",
|
||||||
"template", new NamedResourceImpl("template",
|
new NamedResourceImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
|
||||||
"application/vnd.vmware.vcloud.vAppTemplate+xml", URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))),
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))),
|
ImmutableList.<Task> of(), true)));
|
||||||
ImmutableList.<Task> of(), true)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,26 +778,14 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
|
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
|
||||||
return ImmutableMap
|
return ImmutableMap.<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> of(
|
||||||
.<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> of(
|
"org", ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>> of(
|
||||||
"org",
|
"catalog", ImmutableMap.<String, org.jclouds.vcloud.domain.CatalogItem> of("template",
|
||||||
ImmutableMap
|
new CatalogItemImpl("template", URI
|
||||||
.<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>> of(
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"), "description",
|
||||||
"catalog",
|
new NamedResourceImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
|
||||||
ImmutableMap
|
URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")),
|
||||||
.<String, org.jclouds.vcloud.domain.CatalogItem> of(
|
ImmutableMap.<String, String> of()))));
|
||||||
"template",
|
|
||||||
new CatalogItemImpl(
|
|
||||||
"template",
|
|
||||||
URI
|
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"),
|
|
||||||
"description",
|
|
||||||
new NamedResourceImpl(
|
|
||||||
"template",
|
|
||||||
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
|
||||||
URI
|
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")),
|
|
||||||
ImmutableMap.<String, String> of()))));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,13 @@
|
||||||
package org.jclouds.vcloud;
|
package org.jclouds.vcloud;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import org.jclouds.rest.AuthorizationException;
|
||||||
|
import org.jclouds.vcloud.domain.Catalog;
|
||||||
|
import org.jclouds.vcloud.domain.CatalogItem;
|
||||||
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
|
import org.jclouds.vcloud.domain.Org;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,4 +43,44 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
|
||||||
credential = checkNotNull(System.getProperty("vcloud.credential"), "vcloud.credential");
|
credential = checkNotNull(System.getProperty("vcloud.credential"), "vcloud.credential");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetVAppTemplate() throws Exception {
|
||||||
|
Org org = connection.findOrgNamed(null);
|
||||||
|
for (NamedResource cat : org.getCatalogs().values()) {
|
||||||
|
Catalog response = connection.getCatalog(cat.getId());
|
||||||
|
for (NamedResource resource : response.values()) {
|
||||||
|
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||||
|
CatalogItem item = connection.getCatalogItem(resource.getId());
|
||||||
|
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
||||||
|
try {
|
||||||
|
assertNotNull(connection.getVAppTemplate(item.getEntity().getId()));
|
||||||
|
} catch (AuthorizationException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindVAppTemplate() throws Exception {
|
||||||
|
Org org = connection.findOrgNamed(null);
|
||||||
|
for (NamedResource cat : org.getCatalogs().values()) {
|
||||||
|
Catalog response = connection.getCatalog(cat.getId());
|
||||||
|
for (NamedResource resource : response.values()) {
|
||||||
|
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||||
|
CatalogItem item = connection.getCatalogItem(resource.getId());
|
||||||
|
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
||||||
|
try {
|
||||||
|
assertNotNull(connection.findVAppTemplateInOrgCatalogNamed(org.getName(), response.getName(), item
|
||||||
|
.getEntity().getName()));
|
||||||
|
} catch (AuthorizationException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler;
|
||||||
import org.jclouds.vcloud.xml.TaskHandler;
|
import org.jclouds.vcloud.xml.TaskHandler;
|
||||||
import org.jclouds.vcloud.xml.TasksListHandler;
|
import org.jclouds.vcloud.xml.TasksListHandler;
|
||||||
import org.jclouds.vcloud.xml.VAppHandler;
|
import org.jclouds.vcloud.xml.VAppHandler;
|
||||||
import org.jclouds.vcloud.xml.VAppTemplateHandler;
|
import org.jclouds.vcloud.xml.VCloudExpressVAppTemplateHandler;
|
||||||
import org.jclouds.vcloud.xml.VDCHandler;
|
import org.jclouds.vcloud.xml.VDCHandler;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
|
assertSaxResponseParserClassEquals(method, VCloudExpressVAppTemplateHandler.class);
|
||||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||||
|
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
|
@ -321,7 +321,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
|
assertSaxResponseParserClassEquals(method, VCloudExpressVAppTemplateHandler.class);
|
||||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||||
|
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
|
|
|
@ -20,7 +20,12 @@
|
||||||
package org.jclouds.vcloud;
|
package org.jclouds.vcloud;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import org.jclouds.vcloud.domain.Catalog;
|
||||||
|
import org.jclouds.vcloud.domain.CatalogItem;
|
||||||
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
|
import org.jclouds.vcloud.domain.Org;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,5 +42,36 @@ public class VCloudExpressClientLiveTest extends
|
||||||
identity = checkNotNull(System.getProperty("vcloudexpress.identity"), "vcloudexpress.identity");
|
identity = checkNotNull(System.getProperty("vcloudexpress.identity"), "vcloudexpress.identity");
|
||||||
credential = checkNotNull(System.getProperty("vcloudexpress.credential"), "vcloudexpress.credential");
|
credential = checkNotNull(System.getProperty("vcloudexpress.credential"), "vcloudexpress.credential");
|
||||||
}
|
}
|
||||||
|
@Test
|
||||||
|
public void testGetVAppTemplate() throws Exception {
|
||||||
|
Org org = connection.findOrgNamed(null);
|
||||||
|
for (NamedResource cat : org.getCatalogs().values()) {
|
||||||
|
Catalog response = connection.getCatalog(cat.getId());
|
||||||
|
for (NamedResource resource : response.values()) {
|
||||||
|
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||||
|
CatalogItem item = connection.getCatalogItem(resource.getId());
|
||||||
|
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
||||||
|
assertNotNull(connection.getVAppTemplate(item.getEntity().getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindVAppTemplate() throws Exception {
|
||||||
|
Org org = connection.findOrgNamed(null);
|
||||||
|
for (NamedResource cat : org.getCatalogs().values()) {
|
||||||
|
Catalog response = connection.getCatalog(cat.getId());
|
||||||
|
for (NamedResource resource : response.values()) {
|
||||||
|
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||||
|
CatalogItem item = connection.getCatalogItem(resource.getId());
|
||||||
|
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
||||||
|
assertNotNull(connection.findVAppTemplateInOrgCatalogNamed(org.getName(), response.getName(), item
|
||||||
|
.getEntity().getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,8 @@ public class BindInstantiateVAppTemplateParamsToXmlPayloadTest {
|
||||||
request.setPayload(expected);
|
request.setPayload(expected);
|
||||||
replay(request);
|
replay(request);
|
||||||
|
|
||||||
BindInstantiateVAppTemplateParamsToXmlPayload binder = injector
|
BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload binder = injector
|
||||||
.getInstance(BindInstantiateVAppTemplateParamsToXmlPayload.class);
|
.getInstance(BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload.class);
|
||||||
|
|
||||||
Map<String, String> map = Maps.newHashMap();
|
Map<String, String> map = Maps.newHashMap();
|
||||||
map.put("name", "my-vapp");
|
map.put("name", "my-vapp");
|
||||||
|
@ -91,8 +91,8 @@ public class BindInstantiateVAppTemplateParamsToXmlPayloadTest {
|
||||||
request.setPayload(expected);
|
request.setPayload(expected);
|
||||||
replay(request);
|
replay(request);
|
||||||
|
|
||||||
BindInstantiateVAppTemplateParamsToXmlPayload binder = injector
|
BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload binder = injector
|
||||||
.getInstance(BindInstantiateVAppTemplateParamsToXmlPayload.class);
|
.getInstance(BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload.class);
|
||||||
|
|
||||||
Map<String, String> map = Maps.newHashMap();
|
Map<String, String> map = Maps.newHashMap();
|
||||||
map.put("name", "my-vapp");
|
map.put("name", "my-vapp");
|
||||||
|
@ -113,8 +113,8 @@ public class BindInstantiateVAppTemplateParamsToXmlPayloadTest {
|
||||||
request.setPayload(expected);
|
request.setPayload(expected);
|
||||||
replay(request);
|
replay(request);
|
||||||
|
|
||||||
BindInstantiateVAppTemplateParamsToXmlPayload binder = injector
|
BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload binder = injector
|
||||||
.getInstance(BindInstantiateVAppTemplateParamsToXmlPayload.class);
|
.getInstance(BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload.class);
|
||||||
|
|
||||||
Map<String, String> map = Maps.newHashMap();
|
Map<String, String> map = Maps.newHashMap();
|
||||||
map.put("name", "my-vapp");
|
map.put("name", "my-vapp");
|
||||||
|
|
|
@ -50,7 +50,7 @@ import com.google.inject.name.Names;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "vcloud.BindInstantiateVAppTemplateParamsToXmlPayloadTest")
|
@Test(groups = "unit", testName = "vcloud.BindInstantiateVAppTemplateParamsToXmlPayloadTest")
|
||||||
public class VCloudExpressBindInstantiateVAppTemplateParamsToXmlPayloadTest {
|
public class BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayloadTest {
|
||||||
Injector injector = Guice.createInjector(new AbstractModule() {
|
Injector injector = Guice.createInjector(new AbstractModule() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,8 +69,8 @@ public class VCloudExpressBindInstantiateVAppTemplateParamsToXmlPayloadTest {
|
||||||
request.setPayload(expected);
|
request.setPayload(expected);
|
||||||
replay(request);
|
replay(request);
|
||||||
|
|
||||||
BindInstantiateVAppTemplateParamsToXmlPayload binder = injector
|
BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload binder = injector
|
||||||
.getInstance(BindInstantiateVAppTemplateParamsToXmlPayload.class);
|
.getInstance(BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload.class);
|
||||||
|
|
||||||
Map<String, String> map = Maps.newHashMap();
|
Map<String, String> map = Maps.newHashMap();
|
||||||
map.put("name", "my-vapp");
|
map.put("name", "my-vapp");
|
||||||
|
@ -92,8 +92,8 @@ public class VCloudExpressBindInstantiateVAppTemplateParamsToXmlPayloadTest {
|
||||||
request.setPayload(expected);
|
request.setPayload(expected);
|
||||||
replay(request);
|
replay(request);
|
||||||
|
|
||||||
BindInstantiateVAppTemplateParamsToXmlPayload binder = injector
|
BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload binder = injector
|
||||||
.getInstance(BindInstantiateVAppTemplateParamsToXmlPayload.class);
|
.getInstance(BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload.class);
|
||||||
|
|
||||||
Map<String, String> map = Maps.newHashMap();
|
Map<String, String> map = Maps.newHashMap();
|
||||||
map.put("name", "my-vapp");
|
map.put("name", "my-vapp");
|
||||||
|
@ -115,8 +115,8 @@ public class VCloudExpressBindInstantiateVAppTemplateParamsToXmlPayloadTest {
|
||||||
request.setPayload(expected);
|
request.setPayload(expected);
|
||||||
replay(request);
|
replay(request);
|
||||||
|
|
||||||
BindInstantiateVAppTemplateParamsToXmlPayload binder = injector
|
BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload binder = injector
|
||||||
.getInstance(BindInstantiateVAppTemplateParamsToXmlPayload.class);
|
.getInstance(BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload.class);
|
||||||
|
|
||||||
Map<String, String> map = Maps.newHashMap();
|
Map<String, String> map = Maps.newHashMap();
|
||||||
map.put("name", "my-vapp");
|
map.put("name", "my-vapp");
|
|
@ -39,8 +39,8 @@ import org.jclouds.net.IPSocket;
|
||||||
import org.jclouds.rest.RestContextFactory;
|
import org.jclouds.rest.RestContextFactory;
|
||||||
import org.jclouds.vcloud.VCloudClient;
|
import org.jclouds.vcloud.VCloudClient;
|
||||||
import org.jclouds.vcloud.domain.ResourceType;
|
import org.jclouds.vcloud.domain.ResourceType;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.Status;
|
||||||
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
import org.testng.annotations.AfterTest;
|
import org.testng.annotations.AfterTest;
|
||||||
|
@ -98,7 +98,7 @@ public class VCloudComputeClientLiveTest {
|
||||||
|
|
||||||
VAppTemplate template = client.findVAppTemplateInOrgCatalogNamed(null, null, templateName);
|
VAppTemplate template = client.findVAppTemplateInOrgCatalogNamed(null, null, templateName);
|
||||||
InstantiateVAppTemplateOptions options = processorCount(1).memory(512).disk(10 * 1025 * 1024).productProperties(
|
InstantiateVAppTemplateOptions options = processorCount(1).memory(512).disk(10 * 1025 * 1024).productProperties(
|
||||||
ImmutableMap.of("foo", "bar"));
|
ImmutableMap.of("foo", "bar"));
|
||||||
|
|
||||||
id = URI.create(computeClient.start(null, template.getId(), templateName, options).get("id"));
|
id = URI.create(computeClient.start(null, template.getId(), templateName, options).get("id"));
|
||||||
Expectation expectation = expectationMap.get(toTest);
|
Expectation expectation = expectationMap.get(toTest);
|
||||||
|
@ -110,7 +110,7 @@ public class VCloudComputeClientLiveTest {
|
||||||
|
|
||||||
private String getCompatibleServerName(OsFamily toTest) {
|
private String getCompatibleServerName(OsFamily toTest) {
|
||||||
String serverName = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, toTest.toString()).substring(0,
|
String serverName = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, toTest.toString()).substring(0,
|
||||||
toTest.toString().length() <= 15 ? toTest.toString().length() : 14);
|
toTest.toString().length() <= 15 ? toTest.toString().length() : 14);
|
||||||
return serverName;
|
return serverName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,20 +121,19 @@ public class VCloudComputeClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyConfigurationOfVApp(VApp vApp, String serverName, String expectedOs, int processorCount,
|
private void verifyConfigurationOfVApp(VApp vApp, String serverName, String expectedOs, int processorCount,
|
||||||
int memory, long hardDisk) {
|
int memory, long hardDisk) {
|
||||||
// assertEquals(vApp.getName(), serverName);
|
// assertEquals(vApp.getName(), serverName);
|
||||||
// assertEquals(vApp.getOperatingSystemDescription(), expectedOs);
|
// assertEquals(vApp.getOperatingSystemDescription(), expectedOs);
|
||||||
assertEquals(Iterables
|
assertEquals(Iterables
|
||||||
.getOnlyElement(filter(vApp.getResourceAllocations(), resourceType(ResourceType.PROCESSOR)))
|
.getOnlyElement(filter(vApp.getResourceAllocations(), resourceType(ResourceType.PROCESSOR)))
|
||||||
.getVirtualQuantity(), processorCount);
|
.getVirtualQuantity(), processorCount);
|
||||||
assertEquals(Iterables.getOnlyElement(
|
assertEquals(Iterables.getOnlyElement(
|
||||||
filter(vApp.getResourceAllocations(), resourceType(ResourceType.SCSI_CONTROLLER))).getVirtualQuantity(),
|
filter(vApp.getResourceAllocations(), resourceType(ResourceType.SCSI_CONTROLLER))).getVirtualQuantity(), 1);
|
||||||
1);
|
|
||||||
assertEquals(Iterables.getOnlyElement(filter(vApp.getResourceAllocations(), resourceType(ResourceType.MEMORY)))
|
assertEquals(Iterables.getOnlyElement(filter(vApp.getResourceAllocations(), resourceType(ResourceType.MEMORY)))
|
||||||
.getVirtualQuantity(), memory);
|
.getVirtualQuantity(), memory);
|
||||||
assertEquals(Iterables.getOnlyElement(
|
assertEquals(Iterables.getOnlyElement(
|
||||||
filter(vApp.getResourceAllocations(), resourceType(ResourceType.DISK_DRIVE))).getVirtualQuantity(),
|
filter(vApp.getResourceAllocations(), resourceType(ResourceType.DISK_DRIVE))).getVirtualQuantity(),
|
||||||
hardDisk);
|
hardDisk);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterTest
|
@AfterTest
|
||||||
|
@ -154,14 +153,14 @@ public class VCloudComputeClientLiveTest {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty(PROPERTY_TRUST_ALL_CERTS, "true");
|
properties.setProperty(PROPERTY_TRUST_ALL_CERTS, "true");
|
||||||
Injector injector = new RestContextFactory().createContextBuilder("vcloud", identity, credential,
|
Injector injector = new RestContextFactory().createContextBuilder("vcloud", identity, credential,
|
||||||
ImmutableSet.<Module> of(new Log4JLoggingModule()), properties).buildInjector();
|
ImmutableSet.<Module> of(new Log4JLoggingModule()), properties).buildInjector();
|
||||||
|
|
||||||
computeClient = injector.getInstance(VCloudComputeClient.class);
|
computeClient = injector.getInstance(VCloudComputeClient.class);
|
||||||
client = injector.getInstance(VCloudClient.class);
|
client = injector.getInstance(VCloudClient.class);
|
||||||
addressTester = injector.getInstance(Key.get(new TypeLiteral<Predicate<IPSocket>>() {
|
addressTester = injector.getInstance(Key.get(new TypeLiteral<Predicate<IPSocket>>() {
|
||||||
}));
|
}));
|
||||||
expectationMap = ImmutableMap.<OsFamily, Expectation> builder().put(OsFamily.CENTOS,
|
expectationMap = ImmutableMap.<OsFamily, Expectation> builder().put(OsFamily.CENTOS,
|
||||||
new Expectation(4194304 / 2 * 10, "Red Hat Enterprise Linux 5 (64-bit)")).build();
|
new Expectation(4194304 / 2 * 10, "Red Hat Enterprise Linux 5 (64-bit)")).build();
|
||||||
provider = "vcloudtest";
|
provider = "vcloudtest";
|
||||||
templateName = "Ubuntu JeOS 9.10 (32-bit)";
|
templateName = "Ubuntu JeOS 9.10 (32-bit)";
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.jclouds.vcloud.VCloudExpressClient;
|
||||||
import org.jclouds.vcloud.domain.ResourceType;
|
import org.jclouds.vcloud.domain.ResourceType;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
import org.testng.annotations.AfterTest;
|
import org.testng.annotations.AfterTest;
|
||||||
import org.testng.annotations.BeforeGroups;
|
import org.testng.annotations.BeforeGroups;
|
||||||
|
@ -93,7 +93,7 @@ public class VCloudExpressComputeClientLiveTest {
|
||||||
int processorCount = 1;
|
int processorCount = 1;
|
||||||
int memory = 512;
|
int memory = 512;
|
||||||
|
|
||||||
VAppTemplate template = client.findVAppTemplateInOrgCatalogNamed(null, null, templateName);
|
VCloudExpressVAppTemplate template = client.findVAppTemplateInOrgCatalogNamed(null, null, templateName);
|
||||||
InstantiateVAppTemplateOptions options = processorCount(1).memory(512).disk(10 * 1025 * 1024).productProperties(
|
InstantiateVAppTemplateOptions options = processorCount(1).memory(512).disk(10 * 1025 * 1024).productProperties(
|
||||||
ImmutableMap.of("foo", "bar"));
|
ImmutableMap.of("foo", "bar"));
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,13 @@ import java.net.URI;
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.http.functions.ParseSax.Factory;
|
import org.jclouds.http.functions.ParseSax.Factory;
|
||||||
import org.jclouds.http.functions.config.SaxParserModule;
|
import org.jclouds.http.functions.config.SaxParserModule;
|
||||||
|
import org.jclouds.vcloud.VCloudMediaType;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
import org.jclouds.vcloud.domain.internal.VAppTemplateImpl;
|
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
|
@ -42,28 +44,21 @@ import com.google.inject.Injector;
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "vcloud.VAppTemplateHandlerTest")
|
@Test(groups = "unit", testName = "vcloud.VAppTemplateHandlerTest")
|
||||||
public class VAppTemplateHandlerTest {
|
public class VAppTemplateHandlerTest {
|
||||||
|
public void testVCloud1_0() {
|
||||||
private Injector injector;
|
InputStream is = getClass().getResourceAsStream("/vAppTemplate.xml");
|
||||||
|
Injector injector = Guice.createInjector(new SaxParserModule());
|
||||||
private Factory factory;
|
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||||
|
|
||||||
public void testTerremark() {
|
|
||||||
InputStream is = getClass().getResourceAsStream("/vAppTemplate-trmk.xml");
|
|
||||||
injector = Guice.createInjector(new SaxParserModule());
|
|
||||||
factory = injector.getInstance(ParseSax.Factory.class);
|
|
||||||
VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
|
VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
|
||||||
assertEquals(result, new VAppTemplateImpl("CentOS 5.3 (32-bit)", URI
|
assertEquals(result.getName(), "Ubuntu Template");
|
||||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vAppTemplate/5"),
|
assertEquals(result.getId(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921"));
|
||||||
"description of CentOS 5.3 (32-bit)", null));
|
assertEquals(result.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml");
|
||||||
|
assertEquals(result.getStatus(), Status.OFF);
|
||||||
|
assertEquals(result.getVDC(), new NamedResourceImpl(null, VCloudMediaType.VDC_XML, URI
|
||||||
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439")));
|
||||||
|
assertEquals(result.getDescription(), null);
|
||||||
|
assertEquals(result.getTasks(), ImmutableList.of());
|
||||||
|
assertEquals(result.getVAppScopedLocalId(), "02_ubuntu_template");
|
||||||
|
assert result.isOvfDescriptorUploaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHosting() {
|
|
||||||
InputStream is = getClass().getResourceAsStream("/vAppTemplate-hosting.xml");
|
|
||||||
injector = Guice.createInjector(new SaxParserModule());
|
|
||||||
factory = injector.getInstance(ParseSax.Factory.class);
|
|
||||||
VAppTemplate result = (VAppTemplate) factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
|
|
||||||
assertEquals(result, new VAppTemplateImpl("cPanel (Linux) 64 Bit", URI
|
|
||||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/4"), "cPanel (Linux) 64 Bit",
|
|
||||||
Status.RESOLVED));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.xml;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import org.jclouds.http.functions.ParseSax;
|
||||||
|
import org.jclouds.http.functions.ParseSax.Factory;
|
||||||
|
import org.jclouds.http.functions.config.SaxParserModule;
|
||||||
|
import org.jclouds.vcloud.domain.Status;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
import org.jclouds.vcloud.domain.internal.VCloudExpressVAppTemplateImpl;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.inject.Guice;
|
||||||
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests behavior of {@code VAppTemplateHandler}
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(groups = "unit", testName = "vcloud.VAppTemplateHandlerTest")
|
||||||
|
public class VCloudExpressVAppTemplateHandlerTest {
|
||||||
|
|
||||||
|
private Injector injector;
|
||||||
|
|
||||||
|
private Factory factory;
|
||||||
|
|
||||||
|
public void testTerremark() {
|
||||||
|
InputStream is = getClass().getResourceAsStream("/express/vAppTemplate-trmk.xml");
|
||||||
|
injector = Guice.createInjector(new SaxParserModule());
|
||||||
|
factory = injector.getInstance(ParseSax.Factory.class);
|
||||||
|
VCloudExpressVAppTemplate result = factory.create(injector.getInstance(VCloudExpressVAppTemplateHandler.class)).parse(is);
|
||||||
|
assertEquals(result, new VCloudExpressVAppTemplateImpl("CentOS 5.3 (32-bit)", URI
|
||||||
|
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vAppTemplate/5"),
|
||||||
|
"description of CentOS 5.3 (32-bit)", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testHosting() {
|
||||||
|
InputStream is = getClass().getResourceAsStream("/express/vAppTemplate-hosting.xml");
|
||||||
|
injector = Guice.createInjector(new SaxParserModule());
|
||||||
|
factory = injector.getInstance(ParseSax.Factory.class);
|
||||||
|
VCloudExpressVAppTemplate result = (VCloudExpressVAppTemplate) factory.create(injector.getInstance(VCloudExpressVAppTemplateHandler.class)).parse(is);
|
||||||
|
assertEquals(result, new VCloudExpressVAppTemplateImpl("cPanel (Linux) 64 Bit", URI
|
||||||
|
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/4"), "cPanel (Linux) 64 Bit",
|
||||||
|
Status.RESOLVED));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,143 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<VAppTemplate xmlns="http://www.vmware.com/vcloud/v1"
|
||||||
|
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
|
||||||
|
ovfDescriptorUploaded="true" status="8" name="Ubuntu Template"
|
||||||
|
type="application/vnd.vmware.vcloud.vAppTemplate+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
|
||||||
|
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439" />
|
||||||
|
<Link rel="catalogItem" type="application/vnd.vmware.vcloud.catalogItem+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2090447518" />
|
||||||
|
<Link rel="remove"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921" />
|
||||||
|
<Link rel="edit" type="application/vnd.vmware.vcloud.vAppTemplate+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921" />
|
||||||
|
<Link rel="enable"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/action/enableDownload" />
|
||||||
|
<Link rel="disable"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/action/disableDownload" />
|
||||||
|
<Link rel="ovf" type="text/xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/ovf" />
|
||||||
|
<Description />
|
||||||
|
<Children>
|
||||||
|
<Vm name="Ubuntu1004" type="application/vnd.vmware.vcloud.vAppTemplate+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194">
|
||||||
|
<Link rel="up" type="application/vnd.vmware.vcloud.vAppTemplate+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921" />
|
||||||
|
<Description />
|
||||||
|
<NetworkConnectionSection
|
||||||
|
type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194/networkConnectionSection/"
|
||||||
|
ovf:required="false">
|
||||||
|
<ovf:Info>Specifies the available VM network connections</ovf:Info>
|
||||||
|
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
|
||||||
|
<NetworkConnection network="vAppNet-vApp Internal">
|
||||||
|
<NetworkConnectionIndex>0</NetworkConnectionIndex>
|
||||||
|
<IpAddress>192.168.2.100</IpAddress>
|
||||||
|
<IsConnected>true</IsConnected>
|
||||||
|
<MACAddress>00:50:56:8c:00:13</MACAddress>
|
||||||
|
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
|
||||||
|
</NetworkConnection>
|
||||||
|
</NetworkConnectionSection>
|
||||||
|
<GuestCustomizationSection
|
||||||
|
type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194/guestCustomizationSection/"
|
||||||
|
ovf:required="false">
|
||||||
|
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
|
||||||
|
<Enabled>true</Enabled>
|
||||||
|
<ChangeSid>false</ChangeSid>
|
||||||
|
<VirtualMachineId>172837194</VirtualMachineId>
|
||||||
|
<JoinDomainEnabled>false</JoinDomainEnabled>
|
||||||
|
<UseOrgSettings>false</UseOrgSettings>
|
||||||
|
<AdminPasswordEnabled>true</AdminPasswordEnabled>
|
||||||
|
<AdminPasswordAuto>true</AdminPasswordAuto>
|
||||||
|
<AdminPassword>%3eD%gmF</AdminPassword>
|
||||||
|
<ResetPasswordRequired>false</ResetPasswordRequired>
|
||||||
|
<CustomizationScript>#!/bin/bash if [ "$1" = "postcustomization" ]; then echo "post customization" touch /root/.postcustomization sleep 30 #regenerate keys /bin/rm /etc/ssh/ssh_host_* /usr/sbin/dpkg-reconfigure openssh-server echo "completed" fi</CustomizationScript>
|
||||||
|
<ComputerName>Ubuntu1004</ComputerName>
|
||||||
|
</GuestCustomizationSection>
|
||||||
|
<VAppScopedLocalId>02_ubuntu_template</VAppScopedLocalId>
|
||||||
|
</Vm>
|
||||||
|
</Children>
|
||||||
|
<ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
|
||||||
|
vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/networkSection/"
|
||||||
|
vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
|
||||||
|
<ovf:Info>The list of logical networks</ovf:Info>
|
||||||
|
<ovf:Network ovf:name="vAppNet-vApp Internal">
|
||||||
|
<ovf:Description />
|
||||||
|
</ovf:Network>
|
||||||
|
</ovf:NetworkSection>
|
||||||
|
<NetworkConfigSection
|
||||||
|
type="application/vnd.vmware.vcloud.networkConfigSection+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/networkConfigSection/"
|
||||||
|
ovf:required="false">
|
||||||
|
<ovf:Info>The configuration parameters for logical networks</ovf:Info>
|
||||||
|
<NetworkConfig networkName="vAppNet-vApp Internal">
|
||||||
|
<Description />
|
||||||
|
<Configuration>
|
||||||
|
<IpScope>
|
||||||
|
<IsInherited>false</IsInherited>
|
||||||
|
<Gateway>192.168.2.1</Gateway>
|
||||||
|
<Netmask>255.255.255.0</Netmask>
|
||||||
|
<Dns1>8.8.8.8</Dns1>
|
||||||
|
<IpRanges>
|
||||||
|
<IpRange>
|
||||||
|
<StartAddress>192.168.2.100</StartAddress>
|
||||||
|
<EndAddress>192.168.2.199</EndAddress>
|
||||||
|
</IpRange>
|
||||||
|
</IpRanges>
|
||||||
|
<AllocatedIpAddresses>
|
||||||
|
<IpAddress>192.168.2.100</IpAddress>
|
||||||
|
</AllocatedIpAddresses>
|
||||||
|
</IpScope>
|
||||||
|
<FenceMode>isolated</FenceMode>
|
||||||
|
<Features>
|
||||||
|
<DhcpService>
|
||||||
|
<IsEnabled>false</IsEnabled>
|
||||||
|
<DefaultLeaseTime>7200</DefaultLeaseTime>
|
||||||
|
<MaxLeaseTime>7200</MaxLeaseTime>
|
||||||
|
<IpRange />
|
||||||
|
</DhcpService>
|
||||||
|
<FirewallService>
|
||||||
|
<IsEnabled>true</IsEnabled>
|
||||||
|
</FirewallService>
|
||||||
|
<NatService>
|
||||||
|
<IsEnabled>true</IsEnabled>
|
||||||
|
<NatType>ipTranslation</NatType>
|
||||||
|
<Policy>allowTraffic</Policy>
|
||||||
|
<NatRule>
|
||||||
|
<OneToOneVmRule>
|
||||||
|
<MappingMode>automatic</MappingMode>
|
||||||
|
<VAppScopedVmId>02_ubuntu_template</VAppScopedVmId>
|
||||||
|
<VmNicId>0</VmNicId>
|
||||||
|
</OneToOneVmRule>
|
||||||
|
</NatRule>
|
||||||
|
</NatService>
|
||||||
|
</Features>
|
||||||
|
</Configuration>
|
||||||
|
<IsDeployed>false</IsDeployed>
|
||||||
|
</NetworkConfig>
|
||||||
|
</NetworkConfigSection>
|
||||||
|
<LeaseSettingsSection
|
||||||
|
type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/leaseSettingsSection/"
|
||||||
|
ovf:required="false">
|
||||||
|
<ovf:Info>Lease settings section</ovf:Info>
|
||||||
|
<Link rel="edit"
|
||||||
|
type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/leaseSettingsSection/" />
|
||||||
|
<StorageLeaseInSeconds>0</StorageLeaseInSeconds>
|
||||||
|
</LeaseSettingsSection>
|
||||||
|
<CustomizationSection
|
||||||
|
type="application/vnd.vmware.vcloud.customizationSection+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/customizationSection/"
|
||||||
|
ovf:required="false">
|
||||||
|
<ovf:Info>VApp template customization section</ovf:Info>
|
||||||
|
<CustomizeOnInstantiate>true</CustomizeOnInstantiate>
|
||||||
|
<Link rel="edit"
|
||||||
|
type="application/vnd.vmware.vcloud.customizationSection+xml"
|
||||||
|
href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/customizationSection/" />
|
||||||
|
</CustomizationSection>
|
||||||
|
</VAppTemplate>
|
|
@ -38,7 +38,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
|
|
||||||
import org.jclouds.rest.binders.BindToStringPayload;
|
import org.jclouds.rest.binders.BindToStringPayload;
|
||||||
import org.jclouds.vcloud.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
|
import org.jclouds.vcloud.binders.BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload;
|
||||||
import org.jclouds.vcloud.domain.ResourceType;
|
import org.jclouds.vcloud.domain.ResourceType;
|
||||||
|
|
||||||
import com.jamesmurty.utils.XMLBuilder;
|
import com.jamesmurty.utils.XMLBuilder;
|
||||||
|
@ -50,7 +50,7 @@ import com.jamesmurty.utils.XMLBuilder;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class TerremarkBindInstantiateVAppTemplateParamsToXmlPayload extends
|
public class TerremarkBindInstantiateVAppTemplateParamsToXmlPayload extends
|
||||||
BindInstantiateVAppTemplateParamsToXmlPayload {
|
BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public TerremarkBindInstantiateVAppTemplateParamsToXmlPayload(BindToStringPayload stringBinder,
|
public TerremarkBindInstantiateVAppTemplateParamsToXmlPayload(BindToStringPayload stringBinder,
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.jclouds.vcloud.domain.TaskStatus;
|
||||||
import org.jclouds.vcloud.domain.TasksList;
|
import org.jclouds.vcloud.domain.TasksList;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkECloudClient;
|
import org.jclouds.vcloud.terremark.TerremarkECloudClient;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
|
||||||
|
@ -79,7 +79,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> parseAndValidateResponse(VAppTemplate template, VApp vAppResponse) {
|
protected Map<String, String> parseAndValidateResponse(VCloudExpressVAppTemplate template, VApp vAppResponse) {
|
||||||
Credentials credentials = credentialsProvider.execute(template);
|
Credentials credentials = credentialsProvider.execute(template);
|
||||||
Map<String, String> toReturn = super.parseResponse(template, vAppResponse);
|
Map<String, String> toReturn = super.parseResponse(template, vAppResponse);
|
||||||
toReturn.put("username", credentials.identity);
|
toReturn.put("username", credentials.identity);
|
||||||
|
@ -97,7 +97,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
|
||||||
if (portsToOpen.length > 0 && !options.shouldBlockOnDeploy())
|
if (portsToOpen.length > 0 && !options.shouldBlockOnDeploy())
|
||||||
throw new IllegalArgumentException("We cannot open ports on terremark unless we can deploy the vapp");
|
throw new IllegalArgumentException("We cannot open ports on terremark unless we can deploy the vapp");
|
||||||
String password = null;
|
String password = null;
|
||||||
VAppTemplate template = client.getVAppTemplate(templateId);
|
VCloudExpressVAppTemplate template = client.getVAppTemplate(templateId);
|
||||||
if (template.getDescription().indexOf("Windows") != -1) {
|
if (template.getDescription().indexOf("Windows") != -1) {
|
||||||
password = passwordGenerator.get();
|
password = passwordGenerator.get();
|
||||||
options.getProperties().put("password", password);
|
options.getProperties().put("password", password);
|
||||||
|
|
|
@ -29,7 +29,7 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
@ -44,8 +44,8 @@ public class ParseVAppTemplateDescriptionToGetDefaultLoginCredentials implements
|
||||||
@Override
|
@Override
|
||||||
public Credentials execute(Object resourceToAuthenticate) {
|
public Credentials execute(Object resourceToAuthenticate) {
|
||||||
checkNotNull(resourceToAuthenticate);
|
checkNotNull(resourceToAuthenticate);
|
||||||
checkArgument(resourceToAuthenticate instanceof VAppTemplate, "Resource must be an VAppTemplate (for Terremark)");
|
checkArgument(resourceToAuthenticate instanceof VCloudExpressVAppTemplate, "Resource must be an VAppTemplate (for Terremark)");
|
||||||
VAppTemplate template = (VAppTemplate) resourceToAuthenticate;
|
VCloudExpressVAppTemplate template = (VCloudExpressVAppTemplate) resourceToAuthenticate;
|
||||||
String search = template.getDescription() != null ? template.getDescription() : template.getName();
|
String search = template.getDescription() != null ? template.getDescription() : template.getName();
|
||||||
if (search.indexOf("Windows") >= 0) {
|
if (search.indexOf("Windows") >= 0) {
|
||||||
return new Credentials("Administrator", null);
|
return new Credentials("Administrator", null);
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.vcloud.compute.functions.ImagesInOrg;
|
import org.jclouds.vcloud.compute.functions.ImagesInVCloudExpressOrg;
|
||||||
import org.jclouds.vcloud.domain.Org;
|
import org.jclouds.vcloud.domain.Org;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -51,12 +51,12 @@ public class VAppTemplatesInOrgs implements Supplier<Set<? extends Image>> {
|
||||||
|
|
||||||
private final Supplier<Set<? extends Location>> locations;
|
private final Supplier<Set<? extends Location>> locations;
|
||||||
private final Function<Iterable<? extends Location>, Iterable<? extends Org>> organizatonsForLocations;
|
private final Function<Iterable<? extends Location>, Iterable<? extends Org>> organizatonsForLocations;
|
||||||
private final ImagesInOrg imagesInOrg;
|
private final ImagesInVCloudExpressOrg imagesInOrg;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
VAppTemplatesInOrgs(Supplier<Set<? extends Location>> locations,
|
VAppTemplatesInOrgs(Supplier<Set<? extends Location>> locations,
|
||||||
Function<Iterable<? extends Location>, Iterable<? extends Org>> organizatonsForLocations,
|
Function<Iterable<? extends Location>, Iterable<? extends Org>> organizatonsForLocations,
|
||||||
ImagesInOrg imagesInOrg) {
|
ImagesInVCloudExpressOrg imagesInOrg) {
|
||||||
this.locations = locations;
|
this.locations = locations;
|
||||||
this.organizatonsForLocations = organizatonsForLocations;
|
this.organizatonsForLocations = organizatonsForLocations;
|
||||||
this.imagesInOrg = imagesInOrg;
|
this.imagesInOrg = imagesInOrg;
|
||||||
|
|
|
@ -56,7 +56,7 @@ import org.jclouds.vcloud.domain.ResourceType;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
import org.jclouds.vcloud.domain.VDC;
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||||
import org.jclouds.vcloud.predicates.TaskSuccess;
|
import org.jclouds.vcloud.predicates.TaskSuccess;
|
||||||
|
@ -171,7 +171,7 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
|
||||||
if (customizationOptions.canCustomizePassword())
|
if (customizationOptions.canCustomizePassword())
|
||||||
instantiateOptions.withPassword("robotsarefun");
|
instantiateOptions.withPassword("robotsarefun");
|
||||||
|
|
||||||
VAppTemplate vAppTemplate = tmClient.getVAppTemplate(item.getEntity().getId());
|
VCloudExpressVAppTemplate vAppTemplate = tmClient.getVAppTemplate(item.getEntity().getId());
|
||||||
|
|
||||||
// instantiate, noting vApp returned has minimal details
|
// instantiate, noting vApp returned has minimal details
|
||||||
vApp = tmClient.instantiateVAppTemplateInVDC(vdc.getId(), vAppTemplate.getId(), serverName, instantiateOptions);
|
vApp = tmClient.instantiateVAppTemplateInVDC(vdc.getId(), vAppTemplate.getId(), serverName, instantiateOptions);
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.jclouds.compute.domain.NodeState;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
|
||||||
import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptionToGetDefaultLoginCredentials;
|
import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptionToGetDefaultLoginCredentials;
|
||||||
import org.jclouds.vcloud.terremark.domain.TerremarkVDC;
|
import org.jclouds.vcloud.terremark.domain.TerremarkVDC;
|
||||||
|
@ -56,7 +56,7 @@ public class TerremarkVCloudComputeClientTest {
|
||||||
public void testStartWindows() throws IOException {
|
public void testStartWindows() throws IOException {
|
||||||
InputStream is = getClass().getResourceAsStream("/terremark/windows_description.txt");
|
InputStream is = getClass().getResourceAsStream("/terremark/windows_description.txt");
|
||||||
String description = new String(ByteStreams.toByteArray(is));
|
String description = new String(ByteStreams.toByteArray(is));
|
||||||
VAppTemplate template = createMock(VAppTemplate.class);
|
VCloudExpressVAppTemplate template = createMock(VCloudExpressVAppTemplate.class);
|
||||||
TerremarkVDC vdc = createMock(TerremarkVDC.class);
|
TerremarkVDC vdc = createMock(TerremarkVDC.class);
|
||||||
URI templateURI = URI.create("template");
|
URI templateURI = URI.create("template");
|
||||||
URI vdcURI = URI.create("vdc");
|
URI vdcURI = URI.create("vdc");
|
||||||
|
|
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
|
@ -44,7 +44,7 @@ public class PopulateDefaultLoginCredentialsForVAppTemplateTest {
|
||||||
public void testRhel() throws IOException {
|
public void testRhel() throws IOException {
|
||||||
InputStream is = getClass().getResourceAsStream("/terremark/rhel_description.txt");
|
InputStream is = getClass().getResourceAsStream("/terremark/rhel_description.txt");
|
||||||
String description = new String(ByteStreams.toByteArray(is));
|
String description = new String(ByteStreams.toByteArray(is));
|
||||||
VAppTemplate template = createMock(VAppTemplate.class);
|
VCloudExpressVAppTemplate template = createMock(VCloudExpressVAppTemplate.class);
|
||||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||||
replay(template);
|
replay(template);
|
||||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
||||||
|
@ -58,7 +58,7 @@ public class PopulateDefaultLoginCredentialsForVAppTemplateTest {
|
||||||
public void testLamp() throws IOException {
|
public void testLamp() throws IOException {
|
||||||
InputStream is = getClass().getResourceAsStream("/terremark/lamp_description.txt");
|
InputStream is = getClass().getResourceAsStream("/terremark/lamp_description.txt");
|
||||||
String description = new String(ByteStreams.toByteArray(is));
|
String description = new String(ByteStreams.toByteArray(is));
|
||||||
VAppTemplate template = createMock(VAppTemplate.class);
|
VCloudExpressVAppTemplate template = createMock(VCloudExpressVAppTemplate.class);
|
||||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||||
replay(template);
|
replay(template);
|
||||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
||||||
|
@ -72,7 +72,7 @@ public class PopulateDefaultLoginCredentialsForVAppTemplateTest {
|
||||||
public void testFt() throws IOException {
|
public void testFt() throws IOException {
|
||||||
InputStream is = getClass().getResourceAsStream("/terremark/ft_description.txt");
|
InputStream is = getClass().getResourceAsStream("/terremark/ft_description.txt");
|
||||||
String description = new String(ByteStreams.toByteArray(is));
|
String description = new String(ByteStreams.toByteArray(is));
|
||||||
VAppTemplate template = createMock(VAppTemplate.class);
|
VCloudExpressVAppTemplate template = createMock(VCloudExpressVAppTemplate.class);
|
||||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||||
replay(template);
|
replay(template);
|
||||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
||||||
|
@ -86,7 +86,7 @@ public class PopulateDefaultLoginCredentialsForVAppTemplateTest {
|
||||||
public void testWindows() throws IOException {
|
public void testWindows() throws IOException {
|
||||||
InputStream is = getClass().getResourceAsStream("/terremark/windows_description.txt");
|
InputStream is = getClass().getResourceAsStream("/terremark/windows_description.txt");
|
||||||
String description = new String(ByteStreams.toByteArray(is));
|
String description = new String(ByteStreams.toByteArray(is));
|
||||||
VAppTemplate template = createMock(VAppTemplate.class);
|
VCloudExpressVAppTemplate template = createMock(VCloudExpressVAppTemplate.class);
|
||||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||||
replay(template);
|
replay(template);
|
||||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
||||||
|
|
Loading…
Reference in New Issue