mirror of https://github.com/apache/jclouds.git
Issue 730: removed deprecated vcloud methods
This commit is contained in:
parent
1ec46fcc29
commit
302321ce18
|
@ -18,106 +18,17 @@
|
|||
*/
|
||||
package org.jclouds.vcloud;
|
||||
|
||||
import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.NETWORKCONNECTIONSECTION_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.NETWORK_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VAPPTEMPLATE_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VM_XML;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.ovf.Envelope;
|
||||
import org.jclouds.ovf.xml.EnvelopeHandler;
|
||||
import org.jclouds.predicates.validators.DnsNameValidator;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.Endpoint;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.ParamValidators;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
|
||||
import org.jclouds.vcloud.binders.BindCaptureVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindGuestCustomizationSectionToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindNetworkConnectionSectionToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.domain.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.domain.NetworkConnectionSection;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.TasksList;
|
||||
import org.jclouds.vcloud.domain.VApp;
|
||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.domain.VDC;
|
||||
import org.jclouds.vcloud.domain.Vm;
|
||||
import org.jclouds.vcloud.domain.network.OrgNetwork;
|
||||
import org.jclouds.vcloud.endpoints.OrgList;
|
||||
import org.jclouds.vcloud.features.CatalogAsyncClient;
|
||||
import org.jclouds.vcloud.features.NetworkAsyncClient;
|
||||
import org.jclouds.vcloud.features.OrgAsyncClient;
|
||||
import org.jclouds.vcloud.features.TaskAsyncClient;
|
||||
import org.jclouds.vcloud.features.VAppAsyncClient;
|
||||
import org.jclouds.vcloud.features.VAppTemplateAsyncClient;
|
||||
import org.jclouds.vcloud.features.VAppTemplateClient;
|
||||
import org.jclouds.vcloud.features.VDCAsyncClient;
|
||||
import org.jclouds.vcloud.features.VmAsyncClient;
|
||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||
import org.jclouds.vcloud.functions.OrgNameAndCatalogNameToEndpoint;
|
||||
import org.jclouds.vcloud.functions.OrgNameAndVDCNameToEndpoint;
|
||||
import org.jclouds.vcloud.functions.OrgNameCatalogNameItemNameToEndpoint;
|
||||
import org.jclouds.vcloud.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint;
|
||||
import org.jclouds.vcloud.functions.OrgNameToEndpoint;
|
||||
import org.jclouds.vcloud.functions.OrgNameToTasksListEndpoint;
|
||||
import org.jclouds.vcloud.functions.OrgNameVDCNameNetworkNameToEndpoint;
|
||||
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
|
||||
import org.jclouds.vcloud.options.CaptureVAppOptions;
|
||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||
import org.jclouds.vcloud.xml.CatalogItemHandler;
|
||||
import org.jclouds.vcloud.xml.OrgHandler;
|
||||
import org.jclouds.vcloud.xml.OrgListHandler;
|
||||
import org.jclouds.vcloud.xml.OrgNetworkHandler;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
import org.jclouds.vcloud.xml.TasksListHandler;
|
||||
import org.jclouds.vcloud.xml.VAppHandler;
|
||||
import org.jclouds.vcloud.xml.VAppTemplateHandler;
|
||||
import org.jclouds.vcloud.xml.VDCHandler;
|
||||
import org.jclouds.vcloud.xml.VmHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to VCloud resources via their REST API.
|
||||
|
@ -129,142 +40,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
*/
|
||||
@RequestFilters(SetVCloudTokenCookie.class)
|
||||
public interface VCloudAsyncClient {
|
||||
/**
|
||||
* @see VCloudClient#getOrg
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(OrgHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
@Consumes(ORG_XML)
|
||||
ListenableFuture<? extends Org> getOrg(@EndpointParam URI orgId);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#getOrgNamed
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(OrgHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
@Consumes(ORG_XML)
|
||||
ListenableFuture<? extends Org> findOrgNamed(
|
||||
@Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#getCatalog
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
ListenableFuture<? extends Catalog> getCatalog(@EndpointParam URI catalogId);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#findCatalogInOrgNamed
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
ListenableFuture<? extends Catalog> findCatalogInOrgNamed(
|
||||
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String orgName,
|
||||
@Nullable @EndpointParam(parser = OrgNameAndCatalogNameToEndpoint.class) String catalogName);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#getCatalogItem
|
||||
*/
|
||||
@GET
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends CatalogItem> getCatalogItem(@EndpointParam URI catalogItem);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#getCatalogItemInOrg
|
||||
*/
|
||||
@GET
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends CatalogItem> findCatalogItemInOrgCatalogNamed(
|
||||
@Nullable @EndpointParam(parser = OrgNameCatalogNameItemNameToEndpoint.class) String orgName,
|
||||
@Nullable @EndpointParam(parser = OrgNameCatalogNameItemNameToEndpoint.class) String catalogName,
|
||||
@EndpointParam(parser = OrgNameCatalogNameItemNameToEndpoint.class) String itemName);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#findNetworkInOrgVDCNamed
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_XML)
|
||||
@XMLResponseParser(OrgNetworkHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends OrgNetwork> findNetworkInOrgVDCNamed(
|
||||
@Nullable @EndpointParam(parser = OrgNameVDCNameNetworkNameToEndpoint.class) String orgName,
|
||||
@Nullable @EndpointParam(parser = OrgNameVDCNameNetworkNameToEndpoint.class) String catalogName,
|
||||
@EndpointParam(parser = OrgNameVDCNameNetworkNameToEndpoint.class) String networkName);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#getNetwork
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_XML)
|
||||
@XMLResponseParser(OrgNetworkHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends OrgNetwork> getNetwork(@EndpointParam URI network);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#getVDC(URI)
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(VDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends VDC> getVDC(@EndpointParam URI vdc);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#findVDCInOrgNamed(String, String)
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(VDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends VDC> findVDCInOrgNamed(
|
||||
@Nullable @EndpointParam(parser = OrgNameAndVDCNameToEndpoint.class) String orgName,
|
||||
@Nullable @EndpointParam(parser = OrgNameAndVDCNameToEndpoint.class) String vdcName);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#getTasksList
|
||||
*/
|
||||
@GET
|
||||
@Consumes(TASKSLIST_XML)
|
||||
@XMLResponseParser(TasksListHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends TasksList> getTasksList(@EndpointParam URI tasksListId);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#findTasksListInOrgNamed
|
||||
*/
|
||||
@GET
|
||||
@Consumes(TASKSLIST_XML)
|
||||
@XMLResponseParser(TasksListHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends TasksList> findTasksListInOrgNamed(
|
||||
@Nullable @EndpointParam(parser = OrgNameToTasksListEndpoint.class) String orgName);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#getTask
|
||||
*/
|
||||
@GET
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Task> getTask(@EndpointParam URI taskId);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#cancelTask
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cancel")
|
||||
ListenableFuture<Void> cancelTask(@EndpointParam URI taskId);
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to VApp Template features.
|
||||
*
|
||||
|
@ -337,288 +113,4 @@ public interface VCloudAsyncClient {
|
|||
@Delegate
|
||||
OrgAsyncClient getOrgClient();
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VmAsyncClient#getScreenThumbnailForVm
|
||||
*/
|
||||
@Deprecated
|
||||
@GET
|
||||
@Path("/screen")
|
||||
@Consumes("image/png")
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<InputStream> getThumbnailOfVm(@EndpointParam URI vm);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see OrgAsyncClient#listOrgs
|
||||
*/
|
||||
@Deprecated
|
||||
@GET
|
||||
@Endpoint(OrgList.class)
|
||||
@XMLResponseParser(OrgListHandler.class)
|
||||
@Consumes(VCloudMediaType.ORGLIST_XML)
|
||||
ListenableFuture<Map<String, ReferenceType>> listOrgs();
|
||||
|
||||
/**
|
||||
* @see VAppTemplateAsyncClient#getVAppTemplate
|
||||
*/
|
||||
@Deprecated
|
||||
@GET
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends VAppTemplate> getVAppTemplate(@EndpointParam URI vAppTemplate);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getOvfEnvelopeForVAppTemplate
|
||||
*/
|
||||
@Deprecated
|
||||
@GET
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
@Path("/ovf")
|
||||
@XMLResponseParser(EnvelopeHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Envelope> getOvfEnvelopeForVAppTemplate(@EndpointParam URI vAppTemplate);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateAsyncClient#findVAppTemplateInOrgCatalogNamed
|
||||
*/
|
||||
@Deprecated
|
||||
@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 VAppTemplateAsyncClient#createVAppInVDCByInstantiatingTemplate
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Path("/action/instantiateVAppTemplate")
|
||||
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
|
||||
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
|
||||
@PayloadParam("template") URI template,
|
||||
@PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
|
||||
InstantiateVAppTemplateOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#copyVAppToVDCAndName
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Path("/action/cloneVApp")
|
||||
@Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
||||
ListenableFuture<? extends Task> cloneVAppInVDC(@EndpointParam URI vdc, @PayloadParam("Source") URI toClone,
|
||||
@PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName, CloneVAppOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateAsyncClient#captureVAppInVDC
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Path("/action/captureVApp")
|
||||
@Produces("application/vnd.vmware.vcloud.captureVAppParams+xml")
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
@MapBinder(BindCaptureVAppParamsToXmlPayload.class)
|
||||
ListenableFuture<? extends VAppTemplate> captureVAppInVDC(@EndpointParam URI vdc,
|
||||
@PayloadParam("vApp") URI toCapture,
|
||||
@PayloadParam("templateName") @ParamValidators(DnsNameValidator.class) String templateName,
|
||||
CaptureVAppOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#findVAppInOrgVDCNamed
|
||||
*/
|
||||
@Deprecated
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends VApp> findVAppInOrgVDCNamed(
|
||||
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
|
||||
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
|
||||
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String vAppName);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#getVApp
|
||||
*/
|
||||
@Deprecated
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends VApp> getVApp(@EndpointParam URI vApp);
|
||||
|
||||
/**
|
||||
* @see VmAsyncClient#getVm
|
||||
*/
|
||||
@Deprecated
|
||||
@GET
|
||||
@Consumes(VM_XML)
|
||||
@XMLResponseParser(VmHandler.class)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Vm> getVm(@EndpointParam URI vm);
|
||||
|
||||
/**
|
||||
* @see VmAsyncClient#updateGuestCustomizationOfVm
|
||||
*/
|
||||
@Deprecated
|
||||
@PUT
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(GUESTCUSTOMIZATIONSECTION_XML)
|
||||
@Path("/guestCustomizationSection")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> updateGuestCustomizationOfVm(
|
||||
@EndpointParam URI vm,
|
||||
@BinderParam(BindGuestCustomizationSectionToXmlPayload.class) GuestCustomizationSection guestCustomizationSection);
|
||||
|
||||
/**
|
||||
* @see VmAsyncClient#updateNetworkConnectionOfVm
|
||||
*/
|
||||
@Deprecated
|
||||
@PUT
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(NETWORKCONNECTIONSECTION_XML)
|
||||
@Path("/networkConnectionSection")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> updateNetworkConnectionOfVm(
|
||||
@EndpointParam URI vm,
|
||||
@BinderParam(BindNetworkConnectionSectionToXmlPayload.class) NetworkConnectionSection networkConnectionSection);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#deployVApp
|
||||
* @see VmAsyncClient#deployVm
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(DEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/deploy")
|
||||
@MapBinder(BindDeployVAppParamsToXmlPayload.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> deployVAppOrVm(@EndpointParam URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#deployAndPowerOnVApp
|
||||
* @see VmAsyncClient#deployAndPowerOnVm
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(DEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/deploy")
|
||||
@MapBinder(BindDeployVAppParamsToXmlPayload.class)
|
||||
@PayloadParams(keys = "powerOn", values = "true")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> deployAndPowerOnVAppOrVm(@EndpointParam URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#undeployVApp
|
||||
* @see VmAsyncClient#undeployVm
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(UNDEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/undeploy")
|
||||
@MapBinder(BindUndeployVAppParamsToXmlPayload.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> undeployVAppOrVm(@EndpointParam URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#undeployAndSaveStateOfVApp
|
||||
* @see VmAsyncClient#undeployAndSaveStateOfVm
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(UNDEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/undeploy")
|
||||
@MapBinder(BindUndeployVAppParamsToXmlPayload.class)
|
||||
@PayloadParams(keys = "saveState", values = "true")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> undeployAndSaveStateOfVAppOrVm(@EndpointParam URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#powerOnVApp
|
||||
* @see VmAsyncClient#powerOnVm
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOn")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> powerOnVAppOrVm(@EndpointParam URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#powerOffVApp
|
||||
* @see VmAsyncClient#powerOffVm
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOff")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> powerOffVAppOrVm(@EndpointParam URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#shutdownVApp
|
||||
* @see VmAsyncClient#shutdownVm
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Path("/power/action/shutdown")
|
||||
ListenableFuture<Void> shutdownVAppOrVm(@EndpointParam URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#resetVApp
|
||||
* @see VmAsyncClient#resetVm
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/reset")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> resetVAppOrVm(@EndpointParam URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#rebootVApp
|
||||
* @see VmAsyncClient#rebootVm
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Path("/power/action/reboot")
|
||||
ListenableFuture<Void> rebootVAppOrVm(@EndpointParam URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#suspendVApp
|
||||
* @see VmAsyncClient#suspendVm
|
||||
*/
|
||||
@Deprecated
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/suspend")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> suspendVAppOrVm(@EndpointParam URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
* @see VAppAsyncClient#deleteVApp
|
||||
*/
|
||||
@Deprecated
|
||||
@DELETE
|
||||
@Consumes(TASK_XML)
|
||||
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> deleteVApp(@EndpointParam URI id);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,29 +18,10 @@
|
|||
*/
|
||||
package org.jclouds.vcloud;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.ovf.Envelope;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.domain.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.domain.NetworkConnectionSection;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.TasksList;
|
||||
import org.jclouds.vcloud.domain.VApp;
|
||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.domain.VDC;
|
||||
import org.jclouds.vcloud.domain.Vm;
|
||||
import org.jclouds.vcloud.domain.network.OrgNetwork;
|
||||
import org.jclouds.vcloud.features.CatalogClient;
|
||||
import org.jclouds.vcloud.features.NetworkClient;
|
||||
import org.jclouds.vcloud.features.OrgClient;
|
||||
|
@ -49,9 +30,6 @@ import org.jclouds.vcloud.features.VAppClient;
|
|||
import org.jclouds.vcloud.features.VAppTemplateClient;
|
||||
import org.jclouds.vcloud.features.VDCClient;
|
||||
import org.jclouds.vcloud.features.VmClient;
|
||||
import org.jclouds.vcloud.options.CaptureVAppOptions;
|
||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||
|
||||
/**
|
||||
* Provides access to VCloud resources via their REST API.
|
||||
|
@ -111,267 +89,4 @@ public interface VCloudClient {
|
|||
@Delegate
|
||||
OrgClient getOrgClient();
|
||||
|
||||
/**
|
||||
* @see VmClient#getThumbnail
|
||||
*/
|
||||
@Deprecated
|
||||
InputStream getThumbnailOfVm(URI vm);
|
||||
|
||||
/**
|
||||
* @see OrgClient#listOrgs
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, ReferenceType> listOrgs();
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#createVAppInVDCByInstantiatingTemplate
|
||||
*/
|
||||
@Deprecated
|
||||
VApp instantiateVAppTemplateInVDC(URI vDC, URI template, String appName, InstantiateVAppTemplateOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppClient#copyVAppToVDCAndName
|
||||
*/
|
||||
@Deprecated
|
||||
Task cloneVAppInVDC(URI vDC, URI toClone, String newName, CloneVAppOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppClient#captureAsTemplateInVDC
|
||||
*/
|
||||
@Deprecated
|
||||
VAppTemplate captureVAppInVDC(URI vDC, URI toClone, String templateName, CaptureVAppOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#get
|
||||
*/
|
||||
@Deprecated
|
||||
VAppTemplate getVAppTemplate(URI vAppTemplate);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getOvfEnvelope
|
||||
*/
|
||||
@Deprecated
|
||||
Envelope getOvfEnvelopeForVAppTemplate(URI vAppTemplate);
|
||||
|
||||
/**
|
||||
* @see VmClient#updateGuestCustomization
|
||||
*/
|
||||
@Deprecated
|
||||
Task updateGuestCustomizationOfVm(URI vm, GuestCustomizationSection guestCustomizationSection);
|
||||
|
||||
/**
|
||||
* @see VmClient#updateNetworkConnection
|
||||
*/
|
||||
@Deprecated
|
||||
Task updateNetworkConnectionOfVm(URI vm, NetworkConnectionSection guestCustomizationSection);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#findInOrgCatalogNamed
|
||||
*/
|
||||
@Deprecated
|
||||
VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName,
|
||||
String itemName);
|
||||
|
||||
/**
|
||||
* @see VAppClient#findInOrgVDCNamed
|
||||
*/
|
||||
@Deprecated
|
||||
VApp findVAppInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String vAppName);
|
||||
|
||||
/**
|
||||
* @see VAppClient#get
|
||||
*/
|
||||
@Deprecated
|
||||
VApp getVApp(URI vApp);
|
||||
|
||||
/**
|
||||
* @see VmClient#get
|
||||
*/
|
||||
@Deprecated
|
||||
Vm getVm(URI vm);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VAppClient#deploy
|
||||
* @see VmClient#deploy
|
||||
*/
|
||||
@Deprecated
|
||||
Task deployVAppOrVm(URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VAppClient#deployAndPowerOn
|
||||
* @see VmClient#deployAndPowerOn
|
||||
*/
|
||||
@Deprecated
|
||||
Task deployAndPowerOnVAppOrVm(URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VAppClient#undeploy
|
||||
* @see VmClient#undeploy
|
||||
*/
|
||||
@Deprecated
|
||||
Task undeployVAppOrVm(URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VAppClient#undeployAndSaveState
|
||||
* @see VmClient#undeployAndSaveState
|
||||
*/
|
||||
@Deprecated
|
||||
Task undeployAndSaveStateOfVAppOrVm(URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VAppClient#powerOn
|
||||
* @see VmClient#powerOn
|
||||
*/
|
||||
@Deprecated
|
||||
Task powerOnVAppOrVm(URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VAppClient#powerOff
|
||||
* @see VmClient#powerOff
|
||||
*/
|
||||
@Deprecated
|
||||
Task powerOffVAppOrVm(URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VAppClient#shutdown
|
||||
* @see VmClient#shutdown
|
||||
*/
|
||||
@Deprecated
|
||||
void shutdownVAppOrVm(URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VAppClient#reset
|
||||
* @see VmClient#reset
|
||||
*/
|
||||
@Deprecated
|
||||
Task resetVAppOrVm(URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VAppClient#reboot
|
||||
* @see VmClient#reboot
|
||||
*/
|
||||
@Deprecated
|
||||
void rebootVAppOrVm(URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VAppClient#suspend
|
||||
* @see VmClient#suspend
|
||||
*/
|
||||
@Deprecated
|
||||
Task suspendVAppOrVm(URI vAppOrVmId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VAppClient#delete
|
||||
*/
|
||||
@Deprecated
|
||||
Task deleteVApp(URI vAppId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see CatalogClient#getCatalog
|
||||
*/
|
||||
@Deprecated
|
||||
Catalog getCatalog(URI catalogId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see CatalogClient#getCatalogItem
|
||||
*/
|
||||
@Deprecated
|
||||
Catalog findCatalogInOrgNamed(@Nullable String orgName, @Nullable String catalogName);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see CatalogClient#getCatalogItem
|
||||
*/
|
||||
@Deprecated
|
||||
CatalogItem getCatalogItem(URI catalogItem);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see CatalogClient#findCatalogItemInOrgCatalogNamed
|
||||
*/
|
||||
@Deprecated
|
||||
CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName, String itemName);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see TaskClient#getTasksList
|
||||
*/
|
||||
@Deprecated
|
||||
TasksList getTasksList(URI tasksListId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see TaskClient#findTasksListInOrgNamed
|
||||
*/
|
||||
@Deprecated
|
||||
TasksList findTasksListInOrgNamed(String orgName);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see TaskClient#getTask
|
||||
*/
|
||||
@Deprecated
|
||||
Task getTask(URI taskId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see TaskClient#cancelTask
|
||||
*/
|
||||
@Deprecated
|
||||
void cancelTask(URI taskId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VDCClient#getVDC
|
||||
*/
|
||||
@Deprecated
|
||||
VDC getVDC(URI vdc);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VDCClient#findVDCInOrgNamed
|
||||
*/
|
||||
@Deprecated
|
||||
VDC findVDCInOrgNamed(String orgName, String vdcName);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see NetworkClient#findNetworkInOrgVDCNamed
|
||||
*/
|
||||
@Deprecated
|
||||
OrgNetwork findNetworkInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String networkName);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see NetworkClient#getNetwork
|
||||
*/
|
||||
@Deprecated
|
||||
OrgNetwork getNetwork(URI network);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see OrgClient#getOrg
|
||||
*/
|
||||
@Deprecated
|
||||
Org getOrg(URI orgId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see OrgClient#findOrgNamed
|
||||
*/
|
||||
@Deprecated
|
||||
Org findOrgNamed(@Nullable String name);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class AllCatalogItemsInCatalog implements Function<Catalog, Iterable<? ex
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Future<CatalogItem> apply(ReferenceType from) {
|
||||
return (Future<CatalogItem>) aclient.getCatalogItem(from.getHref());
|
||||
return (Future<CatalogItem>) aclient.getCatalogClient().getCatalogItem(from.getHref());
|
||||
}
|
||||
|
||||
}, executor, null, logger, "catalogItems in " + from.getHref());
|
||||
|
|
|
@ -61,7 +61,7 @@ public class AllCatalogsInOrg implements Function<Org, Iterable<? extends Catalo
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Future<Catalog> apply(ReferenceType from) {
|
||||
return (Future<Catalog>) aclient.getCatalog(from.getHref());
|
||||
return (Future<Catalog>) aclient.getCatalogClient().getCatalog(from.getHref());
|
||||
}
|
||||
|
||||
}, executor, null, logger, "catalogs in " + org.getName());
|
||||
|
|
|
@ -61,7 +61,7 @@ public class AllVDCsInOrg implements Function<Org, Iterable<? extends org.jcloud
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Future<org.jclouds.vcloud.domain.VDC> apply(ReferenceType from) {
|
||||
return (Future<org.jclouds.vcloud.domain.VDC>) aclient.getVDC(from.getHref());
|
||||
return (Future<org.jclouds.vcloud.domain.VDC>) aclient.getVDCClient().getVDC(from.getHref());
|
||||
}
|
||||
|
||||
}, executor, null, logger, "vdcs in org " + org.getName());
|
||||
|
|
|
@ -84,7 +84,7 @@ public class OrgsForLocations implements Function<Iterable<? extends Location>,
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Future<Org> apply(URI from) {
|
||||
return (Future<Org>) aclient.getOrg(from);
|
||||
return (Future<Org>) aclient.getOrgClient().getOrg(from);
|
||||
}
|
||||
|
||||
}, executor, null, logger, "organizations for uris");
|
||||
|
|
|
@ -58,7 +58,7 @@ public class OrgsForNames implements Function<Iterable<String>, Iterable<? exten
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Future<Org> apply(String from) {
|
||||
return (Future<Org>) aclient.findOrgNamed(from);
|
||||
return (Future<Org>) aclient.getOrgClient().findOrgNamed(from);
|
||||
}
|
||||
|
||||
}, executor, null, logger, "organizations for names");
|
||||
|
|
|
@ -1,447 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you 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;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.jclouds.compute.BaseVersionedServiceLiveTest;
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.VApp;
|
||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.domain.VDC;
|
||||
import org.jclouds.vcloud.domain.Vm;
|
||||
import org.jclouds.vcloud.domain.network.OrgNetwork;
|
||||
import org.jclouds.vcloud.reference.VCloudConstants;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* Tests behavior of deprecated {@code VCloudClient} features
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Deprecated
|
||||
@Test(groups = "live", singleThreaded = true)
|
||||
public class DeprecatedVCloudClientLiveTest extends BaseVersionedServiceLiveTest {
|
||||
|
||||
protected VCloudClient connection;
|
||||
protected RestContext<VCloudClient,VCloudAsyncClient> context;
|
||||
|
||||
@Test
|
||||
public void testOrg() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
assertNotNull(org);
|
||||
assertNotNull(org.getName());
|
||||
assert org.getCatalogs().size() >= 1;
|
||||
assert org.getTasksList() != null;
|
||||
assert org.getVDCs().size() >= 1;
|
||||
assertEquals(connection.findOrgNamed(org.getName()), org);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPropertiesCanOverrideDefaultOrg() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
RestContext<VCloudClient, VCloudAsyncClient> newContext = null;
|
||||
try {
|
||||
newContext = createContextWithProperties(overrideDefaults(ImmutableMap.of(
|
||||
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, Pattern.quote(org.getName()))));
|
||||
assertEquals(newContext.getApi().findOrgNamed(null), org);
|
||||
} finally {
|
||||
newContext.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Properties overrideDefaults(Map<String, String> overrides) {
|
||||
Properties properties = setupProperties();
|
||||
properties.putAll(overrides);
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCatalog() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType cat : org.getCatalogs().values()) {
|
||||
Catalog response = connection.getCatalog(cat.getHref());
|
||||
assertNotNull(response);
|
||||
assertNotNull(response.getName());
|
||||
assertNotNull(response.getHref());
|
||||
assertEquals(connection.findCatalogInOrgNamed(org.getName(), response.getName()), response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPropertiesCanOverrideDefaultCatalog() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType cat : org.getCatalogs().values()) {
|
||||
RestContext<VCloudClient, VCloudAsyncClient> newContext = null;
|
||||
try {
|
||||
newContext = createContextWithProperties(overrideDefaults(ImmutableMap.of(
|
||||
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, Pattern.quote(org.getName()),
|
||||
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_CATALOG, Pattern.quote(cat.getName()))));
|
||||
assertEquals(newContext.getApi().findCatalogInOrgNamed(null, null), connection.getCatalog(cat.getHref()));
|
||||
} finally {
|
||||
newContext.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetOrgNetwork() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType resource : org.getNetworks().values()) {
|
||||
if (resource.getType().equals(VCloudMediaType.NETWORK_XML)) {
|
||||
OrgNetwork item = connection.getNetwork(resource.getHref());
|
||||
assertNotNull(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetVDCNetwork() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
VDC response = connection.getVDC(vdc.getHref());
|
||||
for (ReferenceType resource : response.getAvailableNetworks().values()) {
|
||||
if (resource.getType().equals(VCloudMediaType.NETWORK_XML)) {
|
||||
try {
|
||||
OrgNetwork net = connection.getNetwork(resource.getHref());
|
||||
assertNotNull(net);
|
||||
assertNotNull(net.getName());
|
||||
assertNotNull(net.getHref());
|
||||
assertEquals(
|
||||
connection.findNetworkInOrgVDCNamed(org.getName(), response.getName(), net.getName()), net);
|
||||
} catch (AuthorizationException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPropertiesCanOverrideDefaultNetwork() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
VDC response = connection.getVDC(vdc.getHref());
|
||||
for (ReferenceType net : response.getAvailableNetworks().values()) {
|
||||
RestContext<VCloudClient, VCloudAsyncClient> newContext = null;
|
||||
try {
|
||||
newContext = createContextWithProperties(overrideDefaults(ImmutableMap.of(
|
||||
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, Pattern.quote(org.getName()),
|
||||
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_VDC, Pattern.quote(vdc.getName()),
|
||||
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK, Pattern.quote(net.getName()))));
|
||||
assertEquals(newContext.getApi().findNetworkInOrgVDCNamed(null, null, net.getName()),
|
||||
connection.getNetwork(net.getHref()));
|
||||
} finally {
|
||||
newContext.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCatalogItem() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType cat : org.getCatalogs().values()) {
|
||||
Catalog response = connection.getCatalog(cat.getHref());
|
||||
for (ReferenceType resource : response.values()) {
|
||||
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||
CatalogItem item = connection.getCatalogItem(resource.getHref());
|
||||
verifyCatalogItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void verifyCatalogItem(CatalogItem item) {
|
||||
assertNotNull(item);
|
||||
assertNotNull(item);
|
||||
assertNotNull(item.getEntity());
|
||||
assertNotNull(item.getHref());
|
||||
assertNotNull(item.getProperties());
|
||||
assertNotNull(item.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindCatalogItem() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType cat : org.getCatalogs().values()) {
|
||||
Catalog response = connection.getCatalog(cat.getHref());
|
||||
for (ReferenceType resource : response.values()) {
|
||||
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||
CatalogItem item = connection.findCatalogItemInOrgCatalogNamed(org.getName(), response.getName(),
|
||||
resource.getName());
|
||||
verifyCatalogItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultVDC() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
VDC response = connection.getVDC(vdc.getHref());
|
||||
assertNotNull(response);
|
||||
assertNotNull(response.getName());
|
||||
assertNotNull(response.getHref());
|
||||
assertNotNull(response.getResourceEntities());
|
||||
assertNotNull(response.getAvailableNetworks());
|
||||
assertEquals(connection.getVDC(response.getHref()), response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPropertiesCanOverrideDefaultVDC() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
RestContext<VCloudClient, VCloudAsyncClient> newContext = null;
|
||||
try {
|
||||
newContext = createContextWithProperties(overrideDefaults(ImmutableMap.of(
|
||||
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(),
|
||||
VCloudConstants.PROPERTY_VCLOUD_DEFAULT_VDC, vdc.getName())));
|
||||
assertEquals(newContext.getApi().findVDCInOrgNamed(null, null), connection.getVDC(vdc.getHref()));
|
||||
} finally {
|
||||
newContext.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultTasksList() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
org.jclouds.vcloud.domain.TasksList response = connection.findTasksListInOrgNamed(org.getName());
|
||||
assertNotNull(response);
|
||||
assertNotNull(response.getLocation());
|
||||
assertNotNull(response.getTasks());
|
||||
assertEquals(connection.getTasksList(response.getLocation()).getLocation(), response.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTask() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
org.jclouds.vcloud.domain.TasksList response = connection.findTasksListInOrgNamed(org.getName());
|
||||
assertNotNull(response);
|
||||
assertNotNull(response.getLocation());
|
||||
assertNotNull(response.getTasks());
|
||||
if (response.getTasks().size() > 0) {
|
||||
Task task = response.getTasks().last();
|
||||
assertEquals(connection.getTask(task.getHref()).getHref(), task.getHref());
|
||||
}
|
||||
}
|
||||
}
|
||||
protected Iterable<Org> orgs;
|
||||
|
||||
@BeforeGroups(groups = { "live" })
|
||||
public void setupClient() {
|
||||
setupCredentials();
|
||||
context = createContextWithProperties(setupProperties());
|
||||
connection = context.getApi();
|
||||
orgs = listOrgs();
|
||||
}
|
||||
|
||||
public RestContext<VCloudClient, VCloudAsyncClient> createContextWithProperties(Properties overrides) {
|
||||
return new ComputeServiceContextFactory(setupRestProperties()).createContext(provider,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getProviderSpecificContext();
|
||||
}
|
||||
|
||||
@AfterGroups(groups = { "live" })
|
||||
public void teardownClient() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
protected Iterable<Org> listOrgs() {
|
||||
return Iterables.transform(connection.listOrgs().values(), new Function<ReferenceType, Org>(){
|
||||
|
||||
@Override
|
||||
public Org apply(ReferenceType arg0) {
|
||||
return connection.getOrg(arg0.getHref());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListOrgs() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
assertNotNull(org);
|
||||
assertNotNull(org.getName());
|
||||
assertNotNull(org.getHref());
|
||||
assertEquals(connection.getOrg(org.getHref()).getName(), org.getName());
|
||||
assertEquals(connection.findOrgNamed(org.getName()).getName(), org.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetVAppTemplate() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType cat : org.getCatalogs().values()) {
|
||||
Catalog response = connection.getCatalog(cat.getHref());
|
||||
for (ReferenceType resource : response.values()) {
|
||||
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||
CatalogItem item = connection.getCatalogItem(resource.getHref());
|
||||
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
||||
VAppTemplate template = connection.getVAppTemplate(item.getEntity().getHref());
|
||||
if (template != null){
|
||||
assertEquals(template.getName(),item.getEntity().getName());
|
||||
} else {
|
||||
// null can be no longer available or auth exception
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetOvfEnvelopeForVAppTemplate() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType cat : org.getCatalogs().values()) {
|
||||
Catalog response = connection.getCatalog(cat.getHref());
|
||||
for (ReferenceType resource : response.values()) {
|
||||
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||
try {
|
||||
CatalogItem item = connection.getCatalogItem(resource.getHref());
|
||||
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
||||
assertNotNull(connection.getOvfEnvelopeForVAppTemplate(item.getEntity().getHref()));
|
||||
}
|
||||
} catch (AuthorizationException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetVApp() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
VDC response = connection.getVDC(vdc.getHref());
|
||||
for (ReferenceType item : response.getResourceEntities().values()) {
|
||||
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
|
||||
connection.getVApp(item.getHref());
|
||||
// null can be no longer available or auth exception
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetThumbnailOfVm() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
VDC response = connection.getVDC(vdc.getHref());
|
||||
for (ReferenceType item : response.getResourceEntities().values()) {
|
||||
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
|
||||
VApp app = connection.getVApp(item.getHref());
|
||||
if (app != null) {
|
||||
for (Vm vm : app.getChildren()) {
|
||||
assert connection.getThumbnailOfVm(vm.getHref()) != null;
|
||||
}
|
||||
} else {
|
||||
// null can be no longer available or auth exception
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetVm() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
VDC response = connection.getVDC(vdc.getHref());
|
||||
for (ReferenceType item : response.getResourceEntities().values()) {
|
||||
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
|
||||
VApp app = connection.getVApp(item.getHref());
|
||||
if (app != null) {
|
||||
for (Vm vmRef : app.getChildren()) {
|
||||
Vm vm = connection.getVm(vmRef.getHref());
|
||||
assertEquals(vm.getName(), vmRef.getName());
|
||||
}
|
||||
} else {
|
||||
// null can be no longer available or auth exception
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindVAppTemplate() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType cat : org.getCatalogs().values()) {
|
||||
Catalog response = connection.getCatalog(cat.getHref());
|
||||
for (ReferenceType resource : response.values()) {
|
||||
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
|
||||
CatalogItem item = connection.getCatalogItem(resource.getHref());
|
||||
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
||||
VAppTemplate template = connection.findVAppTemplateInOrgCatalogNamed(org.getName(), response.getName(),
|
||||
item.getEntity().getName());
|
||||
if (template != null){
|
||||
assertEquals(template.getName(),item.getEntity().getName());
|
||||
} else {
|
||||
// null can be no longer available or auth exception
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -18,43 +18,12 @@
|
|||
*/
|
||||
package org.jclouds.vcloud;
|
||||
|
||||
import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URI;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.ReturnInputStream;
|
||||
import org.jclouds.ovf.xml.EnvelopeHandler;
|
||||
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
|
||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.domain.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.domain.network.FenceMode;
|
||||
import org.jclouds.vcloud.domain.network.NetworkConfig;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.options.CaptureVAppOptions;
|
||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||
import org.jclouds.vcloud.utils.TestUtils;
|
||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||
import org.jclouds.vcloud.xml.CatalogItemHandler;
|
||||
import org.jclouds.vcloud.xml.OrgHandler;
|
||||
import org.jclouds.vcloud.xml.OrgListHandler;
|
||||
import org.jclouds.vcloud.xml.OrgNetworkHandler;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
import org.jclouds.vcloud.xml.TasksListHandler;
|
||||
import org.jclouds.vcloud.xml.VAppHandler;
|
||||
import org.jclouds.vcloud.xml.VAppTemplateHandler;
|
||||
import org.jclouds.vcloud.xml.VDCHandler;
|
||||
import org.jclouds.vcloud.xml.VmHandler;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -102,712 +71,6 @@ public class VCloudAsyncClientTest extends BaseVCloudAsyncClientTest<VCloudAsync
|
|||
assert asyncClient.getOrgClient() != null;
|
||||
}
|
||||
|
||||
public void testGetThumbnailOfVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getThumbnailOfVm", URI.class);
|
||||
HttpRequest request = processor
|
||||
.createRequest(method, URI.create("http://vcloud.example.com/api/v1.0/vApp/vm-12"));
|
||||
|
||||
assertRequestLineEquals(request, "GET http://vcloud.example.com/api/v1.0/vApp/vm-12/screen HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: image/png\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ReturnInputStream.class);
|
||||
assertSaxResponseParserClassEquals(method, null);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "ignoreOnWindows", description = "see http://code.google.com/p/jclouds/issues/detail?id=402")
|
||||
public void testUpdateGuestConfiguration() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("updateGuestCustomizationOfVm", URI.class,
|
||||
GuestCustomizationSection.class);
|
||||
GuestCustomizationSection guest = new GuestCustomizationSection(URI
|
||||
.create("http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection"));
|
||||
guest.setCustomizationScript("cat > /tmp/foo.txt<<EOF\nI love candy\nEOF");
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
URI.create("http://vcloud.example.com/api/v1.0/vApp/vm-12"), guest);
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"PUT http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
|
||||
"/guestCustomizationSection.xml")), "application/vnd.vmware.vcloud.guestCustomizationSection+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testInstantiateVAppTemplateInVDCURIOptions() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
||||
String.class, InstantiateVAppTemplateOptions[].class);
|
||||
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/vAppTemplate/3"), "my-vapp",
|
||||
addNetworkConfig(new NetworkConfig("aloha", URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), FenceMode.NAT_ROUTED)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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");
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
|
||||
"/instantiationparams-network.xml")), "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml",
|
||||
false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, VAppHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||
public void testInstantiateVAppTemplateInOrgOptionsIllegalName() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
||||
String.class, InstantiateVAppTemplateOptions[].class);
|
||||
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",
|
||||
addNetworkConfig(new NetworkConfig(null, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), null)));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void testCloneVAppInVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class);
|
||||
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/vapp/4181"), "my-vapp");
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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");
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp-default.xml")),
|
||||
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void testCloneVAppInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class);
|
||||
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/vapp/201"), "new-linux-server",
|
||||
new CloneVAppOptions().deploy().powerOn().description("The description of the new vApp"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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");
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp.xml")),
|
||||
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testCaptureVAppInVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("captureVAppInVDC", URI.class, URI.class, String.class,
|
||||
CaptureVAppOptions[].class);
|
||||
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/vapp/4181"), "my-template");
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/captureVApp HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
|
||||
assertPayloadEquals(request, Strings2
|
||||
.toStringAndClose(getClass().getResourceAsStream("/captureVApp-default.xml")),
|
||||
"application/vnd.vmware.vcloud.captureVAppParams+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testCaptureVAppInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("captureVAppInVDC", URI.class, URI.class, String.class,
|
||||
CaptureVAppOptions[].class);
|
||||
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/vapp/201"), "my-template", new CaptureVAppOptions()
|
||||
.withDescription("The description of the new vApp Template"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/captureVApp HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/captureVApp.xml")),
|
||||
"application/vnd.vmware.vcloud.captureVAppParams+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testlistOrgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("listOrgs");
|
||||
HttpRequest request = processor.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.orgList+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, OrgListHandler.class);
|
||||
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getOrg", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, OrgHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testFindOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("findOrgNamed", String.class);
|
||||
HttpRequest request = processor.createRequest(method, "org");
|
||||
|
||||
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");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, OrgHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getCatalog", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, CatalogHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testCatalogInOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("findCatalogInOrgNamed", String.class, String.class);
|
||||
HttpRequest request = processor.createRequest(method, "org", "catalog");
|
||||
|
||||
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");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, CatalogHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getNetwork", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, OrgNetworkHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testFindNetworkInOrgVDCNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("findNetworkInOrgVDCNamed", String.class, String.class,
|
||||
String.class);
|
||||
HttpRequest request = processor.createRequest(method, "org", "vdc", "network");
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/network/1990 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, OrgNetworkHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getCatalogItem", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testFindCatalogItemInOrgCatalogNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("findCatalogItemInOrgCatalogNamed", String.class, String.class,
|
||||
String.class);
|
||||
HttpRequest request = processor.createRequest(method, "org", "catalog", "item");
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("findVAppTemplateInOrgCatalogNamed", String.class,
|
||||
String.class, String.class);
|
||||
HttpRequest request = processor.createRequest(method, "org", "catalog", "template");
|
||||
|
||||
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");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getVAppTemplate", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testGetOvfEnvelopeForVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getOvfEnvelopeForVAppTemplate", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2/ovf HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: text/xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, EnvelopeHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testFindVDCInOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class);
|
||||
HttpRequest request = processor.createRequest(method, "org", "vdc");
|
||||
|
||||
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");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, VDCHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = NoSuchElementException.class)
|
||||
public void testFindVDCInOrgNamedBadVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class);
|
||||
processor.createRequest(method, "org", "vdc1");
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = NoSuchElementException.class)
|
||||
public void testFindVDCInOrgNamedBadOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class);
|
||||
processor.createRequest(method, "org1", "vdc");
|
||||
}
|
||||
|
||||
public void testFindVDCInOrgNamedNullOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class);
|
||||
HttpRequest request = processor.createRequest(method, null, "vdc");
|
||||
|
||||
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");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, VDCHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testFindVDCInOrgNamedNullOrgAndVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class);
|
||||
HttpRequest request = processor.createRequest(method, null, null);
|
||||
|
||||
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");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, VDCHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getVDC", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, VDCHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getTasksList", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TasksListHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testFindTasksListInOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("findTasksListInOrgNamed", String.class);
|
||||
HttpRequest request = processor.createRequest(method, "org");
|
||||
|
||||
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");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TasksListHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testDeployVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("deployVAppOrVm", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||
assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
|
||||
"application/vnd.vmware.vcloud.deployVAppParams+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testDeployAndPowerOnVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("deployAndPowerOnVAppOrVm", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||
assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>",
|
||||
"application/vnd.vmware.vcloud.deployVAppParams+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testGetVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getVApp", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, VAppHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testGetVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getVm", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vm/1"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vm/1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vm+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, VmHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testRebootVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("rebootVAppOrVm", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reboot HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||
assertSaxResponseParserClassEquals(method, null);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testUndeployVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("undeployVAppOrVm", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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");
|
||||
assertPayloadEquals(request, "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
|
||||
"application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testUndeployAndSaveStateOfVAppOrVmSaveState() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("undeployAndSaveStateOfVAppOrVm", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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");
|
||||
assertPayloadEquals(request,
|
||||
"<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>",
|
||||
"application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testDeleteVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("deleteVApp", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testPowerOnVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("powerOnVAppOrVm", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testPowerOffVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("powerOffVAppOrVm", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testResetVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("resetVAppOrVm", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testSuspendVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("suspendVAppOrVm", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testShutdownVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("shutdownVAppOrVm", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||
assertSaxResponseParserClassEquals(method, null);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getTask", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("cancelTask", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.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");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||
assertSaxResponseParserClassEquals(method, null);
|
||||
assertExceptionParserClassEquals(method, null);
|
||||
|
||||
checkFilters(request);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
@Override
|
||||
protected void setupFactory() throws IOException {
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you 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.bluelock.vcloud.zone01;
|
||||
|
||||
import org.jclouds.vcloud.DeprecatedVCloudClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Deprecated
|
||||
@Test(groups = "live", singleThreaded = true, testName = "DeprecatedBluelockVCloudZone01ClientLiveTest")
|
||||
public class DeprecatedBluelockVCloudZone01ClientLiveTest extends DeprecatedVCloudClientLiveTest {
|
||||
public DeprecatedBluelockVCloudZone01ClientLiveTest() {
|
||||
provider = "bluelock-vcloud-zone01";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you 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.stratogen.vcloud.mycloud;
|
||||
|
||||
import org.jclouds.vcloud.DeprecatedVCloudClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Deprecated
|
||||
@Test(groups = "live", singleThreaded = true, testName = "DeprecatedStratoGenVCloudMyCloudClientLiveTest")
|
||||
public class DeprecatedStratoGenVCloudMyCloudClientLiveTest extends DeprecatedVCloudClientLiveTest {
|
||||
public DeprecatedStratoGenVCloudMyCloudClientLiveTest() {
|
||||
provider = "stratogen-vcloud-mycloud";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue