mirror of https://github.com/apache/jclouds.git
Add VmClient tests from existing VAppClient tests
This commit is contained in:
parent
8becbd0394
commit
a13e63c0ef
|
@ -19,25 +19,19 @@
|
|||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ANY_IMAGE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CONTROL_ACCESS;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.LEASE_SETTINGS_SECTION;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.MEDIA_PARAMS;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONFIG_SECTION;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OVF_RASD_ITEM;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OWNER;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.PRODUCT_SECTION_LIST;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.RECOMPOSE_VAPP_PARAMS;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.RELOCATE_VM_PARAMS;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.STARTUP_SECTION;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.UNDEPLOY_VAPP_PARAMS;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VM;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VM_PENDING_ANSWER;
|
||||
|
||||
import java.net.URI;
|
||||
|
@ -50,8 +44,6 @@ import javax.ws.rs.PUT;
|
|||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.dmtf.ovf.NetworkSection;
|
||||
import org.jclouds.dmtf.ovf.StartupSection;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
|
@ -61,24 +53,19 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.jclouds.rest.binders.BindToXMLPayload;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VApp;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vm;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RecomposeVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection;
|
||||
|
@ -90,213 +77,163 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
|
||||
/**
|
||||
* @author grkvlt@apache.org
|
||||
* @see VAppClient
|
||||
* @see VmClient
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationToRequest.class)
|
||||
public interface VmAsyncClient {
|
||||
|
||||
/**
|
||||
* @see VAppClient#getVApp(URI)
|
||||
* @see VmClient#getVm(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPP)
|
||||
@Consumes(VM)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<VApp> getVApp(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Vm> getVm(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyVApp(URI, VApp)
|
||||
* @see VmClient#modifyVm(URI, Vm)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(VAPP)
|
||||
@Produces(VM)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> modifyVApp(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) VApp vApp);
|
||||
ListenableFuture<Task> modifyVm(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) Vm vApp);
|
||||
|
||||
/**
|
||||
* @see VAppClient#deleteVApp(URI)
|
||||
* @see VmClient#deleteVm(URI)
|
||||
*/
|
||||
@DELETE
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> deleteVApp(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> deleteVm(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#consolidateVm(URI)
|
||||
* @see VmClient#consolidateVm(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/consolidate")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> consolidateVm(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> consolidateVm(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyControlAccess(URI, ControlAccessParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/controlAccess")
|
||||
@Produces(CONTROL_ACCESS)
|
||||
@Consumes(CONTROL_ACCESS)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<ControlAccessParams> modifyControlAccess(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
|
||||
|
||||
/**
|
||||
* @see VAppClient#deploy(URI, DeployVAppParams)
|
||||
* @see VmClient#deploy(URI, DeployVAppParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/deploy")
|
||||
@Produces(DEPLOY_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> deploy(@EndpointParam URI vAppURI,
|
||||
ListenableFuture<Task> deploy(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) DeployVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VAppClient#discardSuspendedState(URI)
|
||||
* @see VmClient#discardSuspendedState(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/discardSuspendedState")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#enterMaintenanceMode(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/enterMaintenanceMode")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> enterMaintenanceMode(@EndpointParam URI vAppURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#exitMaintenanceMode(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/exitMaintenanceMode")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> exitMaintenanceMode(@EndpointParam URI vAppURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#installVMwareTools(URI)
|
||||
* @see VmClient#installVMwareTools(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/installVMwareTools")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> installVMwareTools(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> installVMwareTools(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#recompose(URI, RecomposeVAppParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/recomposeVApp")
|
||||
@Produces(RECOMPOSE_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> recompose(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) RecomposeVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VAppClient#relocateVm(URI, RelocateParams)
|
||||
* @see VmClient#relocateVm(URI, RelocateParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/relocate")
|
||||
@Produces(RELOCATE_VM_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> relocateVm(@EndpointParam URI vAppURI,
|
||||
ListenableFuture<Task> relocateVm(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) RelocateParams params);
|
||||
|
||||
/**
|
||||
* @see VAppClient#undeploy(URI, UndeployVAppParams)
|
||||
* @see VmClient#undeploy(URI, UndeployVAppParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/undeploy")
|
||||
@Produces(UNDEPLOY_VAPP_PARAMS)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> undeploy(@EndpointParam URI vAppURI,
|
||||
ListenableFuture<Task> undeploy(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VAppClient#upgradeHardwareVersion(URI)
|
||||
* @see VmClient#upgradeHardwareVersion(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/upgradeHardwareVersion")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getControlAccess(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/controlAccess")
|
||||
@Consumes(CONTROL_ACCESS)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ControlAccessParams> getControlAccess(@EndpointParam URI vAppURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#powerOff(URI)
|
||||
* @see VmClient#powerOff(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/powerOff")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> powerOff(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> powerOff(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#powerOn(URI)
|
||||
* @see VmClient#powerOn(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/powerOn")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> powerOn(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> powerOn(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#reboot(URI)
|
||||
* @see VmClient#reboot(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/powerOff")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> reboot(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> reboot(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#reset(URI)
|
||||
* @see VmClient#reset(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/reset")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> reset(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> reset(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#shutdown(URI)
|
||||
* @see VmClient#shutdown(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/shutdown")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> shutdown(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> shutdown(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#suspend(URI)
|
||||
* @see VmClient#suspend(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/suspend")
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> suspend(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<Task> suspend(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getGuestCustomizationSection(URI)
|
||||
* @see VmClient#getGuestCustomizationSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/guestCustomizationSection")
|
||||
|
@ -306,7 +243,7 @@ public interface VmAsyncClient {
|
|||
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyGuestCustomizationSection(URI, GuestCustomizationSection)
|
||||
* @see VmClient#modifyGuestCustomizationSection(URI, GuestCustomizationSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/guestCustomizationSection")
|
||||
|
@ -317,28 +254,7 @@ public interface VmAsyncClient {
|
|||
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getLeaseSettingsSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/leaseSettingsSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI vAppURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyLeaseSettingsSection(URI, LeaseSettingsSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/leaseSettingsSection")
|
||||
@Produces(LEASE_SETTINGS_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> modifyLeaseSettingsSection(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection section);
|
||||
|
||||
/**
|
||||
* @see VAppClient#ejectMedia(URI, MediaInsertOrEjectParams)
|
||||
* @see VmClient#ejectMedia(URI, MediaInsertOrEjectParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/media/action/ejectMedia")
|
||||
|
@ -349,7 +265,7 @@ public interface VmAsyncClient {
|
|||
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
/**
|
||||
* @see VAppClient#insertMedia(URI, MediaInsertOrEjectParams)
|
||||
* @see VmClient#insertMedia(URI, MediaInsertOrEjectParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/media/action/insertMedia")
|
||||
|
@ -360,28 +276,7 @@ public interface VmAsyncClient {
|
|||
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getNetworkConfigSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/networkConfigSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI vAppURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyNetworkConfigSection(URI, NetworkConfigSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/networkConfigSection")
|
||||
@Produces(NETWORK_CONFIG_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> modifyNetworkConfigSection(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getNetworkConnectionSection(URI)
|
||||
* @see VmClient#getNetworkConnectionSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/networkConnectionSection")
|
||||
|
@ -391,7 +286,7 @@ public interface VmAsyncClient {
|
|||
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyNetworkConnectionSection(URI, NetworkConnectionSection)
|
||||
* @see VmClient#modifyNetworkConnectionSection(URI, NetworkConnectionSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/networkConnectionSection")
|
||||
|
@ -402,17 +297,7 @@ public interface VmAsyncClient {
|
|||
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getNetworkSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/networkSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam URI vAppURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getOperatingSystemSection(URI)
|
||||
* @see VmClient#getOperatingSystemSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/operatingSystemSection")
|
||||
|
@ -422,7 +307,7 @@ public interface VmAsyncClient {
|
|||
ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyOperatingSystemSection(URI, OperatingSystemSection)
|
||||
* @see VmClient#modifyOperatingSystemSection(URI, OperatingSystemSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/operatingSystemSection")
|
||||
|
@ -433,70 +318,49 @@ public interface VmAsyncClient {
|
|||
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getOwner(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/owner")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Owner> getOwner(@EndpointParam URI vAppURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyOwner(URI, Owner)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/owner")
|
||||
@Produces(OWNER)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> modifyOwner(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) Owner owner);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getProductSections(URI)
|
||||
* @see VmClient#getProductSections(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/productSections")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyProductSections(URI, ProductSectionList)
|
||||
* @see VmClient#modifyProductSections(URI, ProductSectionList)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/productSections")
|
||||
@Produces(PRODUCT_SECTION_LIST)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> modifyProductSections(@EndpointParam URI vAppURI,
|
||||
ListenableFuture<Task> modifyProductSections(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getPendingQuestion(URI)
|
||||
* @see VmClient#getPendingQuestion(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/question")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#answerQuestion(URI, VmQuestionAnswer)
|
||||
* @see VmClient#answerQuestion(URI, VmQuestionAnswer)
|
||||
*/
|
||||
@POST
|
||||
@Path("/question/action/answer")
|
||||
@Produces(VM_PENDING_ANSWER)
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Void> answerQuestion(@EndpointParam URI vAppURI,
|
||||
ListenableFuture<Void> answerQuestion(@EndpointParam URI vmURI,
|
||||
@BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getRuntimeInfoSection(URI)
|
||||
* @see VmClient#getRuntimeInfoSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/runtimeInfoSection")
|
||||
|
@ -506,48 +370,27 @@ public interface VmAsyncClient {
|
|||
ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getScreenImage(URI)
|
||||
* @see VmClient#getScreenImage(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/screen")
|
||||
@Consumes(ANY_IMAGE)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
@ResponseParser(ReturnPayloadBytes.class)
|
||||
ListenableFuture<byte[]> getScreenImage(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<byte[]> getScreenImage(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getScreenTicket(URI)
|
||||
* @see VmClient#getScreenTicket(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/screen/action/acquireTicket")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam URI vAppURI);
|
||||
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getStartupSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/startupSection")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<StartupSection> getStartupSection(@EndpointParam URI vAppURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyStartupSection(URI, StartupSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/startupSection")
|
||||
@Produces(STARTUP_SECTION)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> modifyStartupSection(@EndpointParam URI vAppURI,
|
||||
@BinderParam(BindToXMLPayload.class) StartupSection section);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getVirtualHardwareSection(URI)
|
||||
* @see VmClient#getVirtualHardwareSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection")
|
||||
|
@ -557,7 +400,7 @@ public interface VmAsyncClient {
|
|||
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyVirtualHardwareSection(URI, VirtualHardwareSection)
|
||||
* @see VmClient#modifyVirtualHardwareSection(URI, VirtualHardwareSection)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection")
|
||||
|
@ -568,7 +411,7 @@ public interface VmAsyncClient {
|
|||
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getVirtualHardwareSectionCpu(URI)
|
||||
* @see VmClient#getVirtualHardwareSectionCpu(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/cpu")
|
||||
|
@ -578,7 +421,7 @@ public interface VmAsyncClient {
|
|||
ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData)
|
||||
* @see VmClient#modifyVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection/cpu")
|
||||
|
@ -589,7 +432,7 @@ public interface VmAsyncClient {
|
|||
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getVirtualHardwareSectionDisks(URI)
|
||||
* @see VmClient#getVirtualHardwareSectionDisks(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/disks")
|
||||
|
@ -599,7 +442,7 @@ public interface VmAsyncClient {
|
|||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyVirtualHardwareSectionDisks(URI, RasdItemsList)
|
||||
* @see VmClient#modifyVirtualHardwareSectionDisks(URI, RasdItemsList)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection/disks")
|
||||
|
@ -610,7 +453,7 @@ public interface VmAsyncClient {
|
|||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getVirtualHardwareSectionMedia(URI)
|
||||
* @see VmClient#getVirtualHardwareSectionMedia(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/media")
|
||||
|
@ -620,7 +463,7 @@ public interface VmAsyncClient {
|
|||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getVirtualHardwareSectionMemory(URI)
|
||||
* @see VmClient#getVirtualHardwareSectionMemory(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/memory")
|
||||
|
@ -630,7 +473,7 @@ public interface VmAsyncClient {
|
|||
ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData)
|
||||
* @see VmClient#modifyVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection/memory")
|
||||
|
@ -641,7 +484,7 @@ public interface VmAsyncClient {
|
|||
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getVirtualHardwareSectionNetworkCards(URI)
|
||||
* @see VmClient#getVirtualHardwareSectionNetworkCards(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/networkCards")
|
||||
|
@ -651,7 +494,7 @@ public interface VmAsyncClient {
|
|||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyVirtualHardwareSectionNetworkCards(URI, RasdItemsList)
|
||||
* @see VmClient#modifyVirtualHardwareSectionNetworkCards(URI, RasdItemsList)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection/networkCards")
|
||||
|
@ -662,7 +505,7 @@ public interface VmAsyncClient {
|
|||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getVirtualHardwareSectionSerialPorts(URI)
|
||||
* @see VmClient#getVirtualHardwareSectionSerialPorts(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/virtualHardwareSection/serialPorts")
|
||||
|
@ -672,7 +515,7 @@ public interface VmAsyncClient {
|
|||
ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI);
|
||||
|
||||
/**
|
||||
* @see VAppClient#modifyVirtualHardwareSectionSerialPorts(URI, RasdItemsList)
|
||||
* @see VmClient#modifyVirtualHardwareSectionSerialPorts(URI, RasdItemsList)
|
||||
*/
|
||||
@PUT
|
||||
@Path("/virtualHardwareSection/serialPorts")
|
||||
|
@ -683,9 +526,8 @@ public interface VmAsyncClient {
|
|||
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Metadata} features
|
||||
* Asynchronous access to {@Vm} {@link Metadata} features.
|
||||
*/
|
||||
@Delegate
|
||||
MetadataAsyncClient.Writeable getMetadataClient();
|
||||
|
||||
}
|
||||
|
|
|
@ -22,108 +22,61 @@ import java.net.URI;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.dmtf.ovf.NetworkSection;
|
||||
import org.jclouds.dmtf.ovf.StartupSection;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VApp;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vm;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RecomposeVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link VApp} objects.
|
||||
* Provides synchronous access to {@link Vm} objects.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
* @see VAppAsyncClient
|
||||
* @see VmAsyncClient
|
||||
* @version 1.5
|
||||
*/
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
public interface VmClient {
|
||||
|
||||
/**
|
||||
* Retrieves a vApp/VM.
|
||||
*
|
||||
* The vApp/VM could be in one of these statuses:
|
||||
* <ul>
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#FAILED_CREATION FAILED_CREATION(-1)} -
|
||||
* Transient entity state, e.g., model object is created but the corresponding VC backing does not
|
||||
* exist yet. This is further sub-categorized in the respective entities.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED UNRESOLVED(0)} -
|
||||
* Entity is whole, e.g., VM creation is complete and all the required model objects and VC backings are
|
||||
* created.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#RESOLVED RESOLVED(1)} -
|
||||
* Entity is resolved.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#DEPLOYED DEPLOYED(2)} -
|
||||
* Entity is deployed.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#SUSPENDED SUSPENDED(3)} -
|
||||
* All VMs of the vApp are suspended.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_ON POWERED_ON(4)} -
|
||||
* All VMs of the vApp are powered on.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#WAITING_FOR_INPUT WAITING_FOR_INPUT(5)} -
|
||||
* VM is pending response on a question.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNKNOWN UNKNOWN(6)} -
|
||||
* Entity state could not be retrieved from the inventory, e.g., VM power state is null.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRECOGNIZED UNRECOGNIZED(7)} -
|
||||
* Entity state was retrieved from the inventory but could not be mapped to an internal state.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_OFF POWERED_OFF(8)} -
|
||||
* All VMs of the vApp are powered off.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#INCONSISTENT_STATE INCONSISTENT_STATE(9)} -
|
||||
* Apply to VM status, if a vm is {@code POWERED_ON}, or {@code WAITING_FOR_INPUT}, but is
|
||||
* undeployed, it is in an inconsistent state.
|
||||
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#MIXED MIXED(10)} -
|
||||
* vApp status is set to {@code MIXED} when the VMs in the vApp are in different power states
|
||||
* </ul>
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}
|
||||
* </pre>
|
||||
* Retrieves a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#getVApp(URI)
|
||||
*/
|
||||
VApp getVApp(URI vAppURI);
|
||||
Vm getVm(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the name/description of a vApp/VM.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}
|
||||
* </pre>
|
||||
* Modifies the name/description of a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#modifyVApp(URI, VApp)
|
||||
*/
|
||||
Task modifyVApp(URI vAppURI, VApp vApp);
|
||||
Task modifyVm(URI vmURI, Vm vm);
|
||||
|
||||
/**
|
||||
* Deletes a vApp/VM.
|
||||
*
|
||||
* <pre>
|
||||
* DELETE /vApp/{id}
|
||||
* </pre>
|
||||
* Deletes a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#deleteVApp(URI)
|
||||
*/
|
||||
Task deleteVApp(URI vAppURI);
|
||||
Task deleteVm(URI vmURI);
|
||||
|
||||
/**
|
||||
* Consolidates a vm.
|
||||
* Consolidates a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/action/consolidate
|
||||
|
@ -131,76 +84,23 @@ public interface VmClient {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Task consolidateVm(URI vAppURI);
|
||||
Task consolidateVm(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the control access of a vApp.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/action/controlAccess
|
||||
* </pre>
|
||||
* Deploys a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#deploy(URI, DeployVAppParams)
|
||||
*/
|
||||
ControlAccessParams modifyControlAccess(URI vAppURI, ControlAccessParams params);
|
||||
Task deploy(URI vmURI, DeployVAppParams params);
|
||||
|
||||
/**
|
||||
* Deploys a vApp/VM.
|
||||
*
|
||||
* Deployment means allocation of all resource for a vApp/VM like CPU and memory
|
||||
* from a vDC resource pool. Deploying a vApp automatically deploys all of the
|
||||
* virtual machines it contains. As of version 1.5 the operation supports force
|
||||
* customization passed with {@link DeployVAppParamsType#setForceCustomization(Boolean)}
|
||||
* parameter.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/action/deploy
|
||||
* </pre>
|
||||
* Discard suspended state of a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#discardSuspendedState(URI)
|
||||
*/
|
||||
Task deploy(URI vAppURI, DeployVAppParams params);
|
||||
|
||||
/**
|
||||
* Discard suspended state of a vApp/VM.
|
||||
*
|
||||
* Discarding suspended state of a vApp automatically discarded suspended
|
||||
* states of all of the virtual machines it contains.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/action/discardSuspendedState
|
||||
* </pre>
|
||||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task discardSuspendedState(URI vAppURI);
|
||||
|
||||
/**
|
||||
* Place the vApp into maintenance mode.
|
||||
*
|
||||
* While in maintenance mode, a system admin can operate on the vApp as
|
||||
* usual, but end users are restricted to read-only operations. Any
|
||||
* user-initiated tasks running when the vApp enters maintenance mode will
|
||||
* continue.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/action/enterMaintenanceMode
|
||||
* </pre>
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
void enterMaintenanceMode(URI vAppURI);
|
||||
|
||||
/**
|
||||
* Take the vApp out of maintenance mode.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/action/exitMaintenanceMode
|
||||
* </pre>
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
void exitMaintenanceMode(URI vAppURI);
|
||||
Task discardSuspendedState(URI vmURI);
|
||||
|
||||
/**
|
||||
* Installs VMware tools to the virtual machine.
|
||||
|
@ -213,28 +113,10 @@ public interface VmClient {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Task installVMwareTools(URI vAppURI);
|
||||
Task installVMwareTools(URI vmURI);
|
||||
|
||||
/**
|
||||
* Recompose a vApp by removing its own VMs and/or adding new ones from other
|
||||
* vApps or vApp templates.
|
||||
*
|
||||
* To remove VMs you should put their references in elements. The way you add
|
||||
* VMs is the same as described in compose vApp operation
|
||||
* {@link VdcClient#composeVApp(URI, org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams)}.
|
||||
* The status of vApp will be in {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED}
|
||||
* until the recompose task is finished.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/action/recomposeVApp
|
||||
* </pre>
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
Task recompose(URI vAppURI, RecomposeVAppParams params);
|
||||
|
||||
/**
|
||||
* Relocates a vm.
|
||||
* Relocates a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/action/relocate
|
||||
|
@ -242,22 +124,15 @@ public interface VmClient {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Task relocateVm(URI vAppURI, RelocateParams params);
|
||||
Task relocateVm(URI vmURI, RelocateParams params);
|
||||
|
||||
/**
|
||||
* Undeploy a vApp/VM.
|
||||
*
|
||||
* Undeployment means deallocation of all resources for a vApp/VM like CPU
|
||||
* and memory from a vDC resource pool. Undeploying a vApp automatically
|
||||
* undeploys all of the virtual machines it contains.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/action/undeploy
|
||||
* </pre>
|
||||
* Undeploy a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#undeploy(URI, UndeployVAppParams)
|
||||
*/
|
||||
Task undeploy(URI vAppURI, UndeployVAppParams params);
|
||||
Task undeploy(URI vmURI, UndeployVAppParams params);
|
||||
|
||||
/**
|
||||
* Upgrade virtual hardware version of a VM to the highest supported virtual
|
||||
|
@ -269,117 +144,70 @@ public interface VmClient {
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Task upgradeHardwareVersion(URI vAppURI);
|
||||
Task upgradeHardwareVersion(URI vmURI);
|
||||
|
||||
/**
|
||||
* Retrieves the control access information for a vApp.
|
||||
*
|
||||
* The vApp could be shared to everyone or could be shared to specific user,
|
||||
* by modifying the control access values.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/controlAccess
|
||||
* </pre>
|
||||
* Powers off a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#powerOff(URI)
|
||||
*/
|
||||
ControlAccessParams getControlAccess(URI vAppURI);
|
||||
Task powerOff(URI vmURI);
|
||||
|
||||
/**
|
||||
* Powers off a vApp/VM.
|
||||
*
|
||||
* If the operation is used over a vApp then all VMs are powered off. This operation is allowed only when the vApp/VM is powered on.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/power/action/powerOff
|
||||
* </pre>
|
||||
* Powers on a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#powerOn(URI)
|
||||
*/
|
||||
Task powerOff(URI vAppURI);
|
||||
Task powerOn(URI vmURI);
|
||||
|
||||
/**
|
||||
* Powers on a vApp/VM.
|
||||
*
|
||||
* If the operation is used over a vApp then all VMs are powered on. This
|
||||
* operation is allowed only when the vApp/VM is powered off.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/power/action/powerOn
|
||||
* </pre>
|
||||
* Reboots a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#reboot(URI)
|
||||
*/
|
||||
Task powerOn(URI vAppURI);
|
||||
Task reboot(URI vmURI);
|
||||
|
||||
/**
|
||||
* Reboots a vApp/VM.
|
||||
*
|
||||
* The vApp/VM should be started in order to reboot it.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/power/action/reboot
|
||||
* </pre>
|
||||
* Resets a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#reset(URI)
|
||||
*/
|
||||
Task reboot(URI vAppURI);
|
||||
Task reset(URI vmURI);
|
||||
|
||||
/**
|
||||
* Resets a vApp/VM.
|
||||
*
|
||||
* If the operation is used over a vApp then all VMs are reset. This
|
||||
* operation is allowed only when the vApp/VM is powered on.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/power/action/reset
|
||||
* </pre>
|
||||
* Shuts down a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#shutdown(URI)
|
||||
*/
|
||||
Task reset(URI vAppURI);
|
||||
Task shutdown(URI vmURI);
|
||||
|
||||
/**
|
||||
* Shutdowns a vApp/VM.
|
||||
*
|
||||
* If the operation is used over a vApp then all VMs are shutdown. This
|
||||
* operation is allowed only when the vApp/VM is powered on.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/power/action/shutdown
|
||||
* </pre>
|
||||
* Suspends a {@link Vm}.
|
||||
*
|
||||
* @since 0.9
|
||||
* @see VAppClient#suspend(URI)
|
||||
*/
|
||||
Task shutdown(URI vAppURI);
|
||||
Task suspend(URI vmURI);
|
||||
|
||||
/**
|
||||
* Suspends a vApp/VM.
|
||||
*
|
||||
* If the operation is used over a vApp then all VMs are suspended. This
|
||||
* operation is allowed only when the vApp/VM is powered on.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vApp/{id}/power/action/suspend
|
||||
* </pre>
|
||||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task suspend(URI vAppURI);
|
||||
|
||||
/**
|
||||
* Retrieves the guest customization section of a VM.
|
||||
* Retrieves the guest customization section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/guestCustomizationSection
|
||||
* </pre>
|
||||
*
|
||||
* @since 1.0
|
||||
* @see VAppClient#
|
||||
*/
|
||||
GuestCustomizationSection getGuestCustomizationSection(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the guest customization section of a VM.
|
||||
* Modifies the guest customization section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/guestCustomizationSection
|
||||
|
@ -390,29 +218,7 @@ public interface VmClient {
|
|||
Task modifyGuestCustomizationSection(URI vmURI, GuestCustomizationSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the lease settings section of a vApp or vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/leaseSettingsSection
|
||||
* </pre>
|
||||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
LeaseSettingsSection getLeaseSettingsSection(URI vAppURI);
|
||||
|
||||
/**
|
||||
* Modifies the lease settings section of a vApp or vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/leaseSettingsSection
|
||||
* </pre>
|
||||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task modifyLeaseSettingsSection(URI vAppURI, LeaseSettingsSection section);
|
||||
|
||||
/**
|
||||
* Ejects a media from a VM.
|
||||
* Ejects media from a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/media/action/ejectMedia
|
||||
|
@ -423,7 +229,7 @@ public interface VmClient {
|
|||
Task ejectMedia(URI vmURI, MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
/**
|
||||
* Inserts a media into a VM.
|
||||
* Insert media into a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/media/action/insertMedia
|
||||
|
@ -434,29 +240,7 @@ public interface VmClient {
|
|||
Task insertMedia(URI vmURI, MediaInsertOrEjectParams mediaParams);
|
||||
|
||||
/**
|
||||
* Retrieves the network config section of a vApp or vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/networkConfigSection
|
||||
* </pre>
|
||||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
NetworkConfigSection getNetworkConfigSection(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the network config section of a vApp.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/networkConfigSection
|
||||
* </pre>
|
||||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task modifyNetworkConfigSection(URI vmURI, NetworkConfigSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the network connection section of a VM.
|
||||
* Retrieves the network connection section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/networkConnectionSection
|
||||
|
@ -467,7 +251,7 @@ public interface VmClient {
|
|||
NetworkConnectionSection getNetworkConnectionSection(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the network connection section of a VM.
|
||||
* Modifies the network connection section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/networkConnectionSection
|
||||
|
@ -478,18 +262,7 @@ public interface VmClient {
|
|||
Task modifyNetworkConnectionSection(URI vmURI, NetworkConnectionSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the network section of a vApp or vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/networkSection
|
||||
* </pre>
|
||||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
NetworkSection getNetworkSection(URI vAppURI);
|
||||
|
||||
/**
|
||||
* Retrieves the operating system section of a VM.
|
||||
* Retrieves the operating system section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/operatingSystemSection
|
||||
|
@ -500,7 +273,7 @@ public interface VmClient {
|
|||
OperatingSystemSection getOperatingSystemSection(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the operating system section of a VM.
|
||||
* Modifies the operating system section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/operatingSystemSection
|
||||
|
@ -511,51 +284,23 @@ public interface VmClient {
|
|||
Task modifyOperatingSystemSection(URI vmURI, OperatingSystemSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the owner of a vApp.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/owner
|
||||
* </pre>
|
||||
* Retrieves {@link Vm} product sections.
|
||||
*
|
||||
* @since 1.5
|
||||
* @see VAppClient#getProductSections(URI)
|
||||
*/
|
||||
Owner getOwner(URI vAppURI);
|
||||
ProductSectionList getProductSections(URI vmURI);
|
||||
|
||||
/**
|
||||
* Changes VApp owner.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/owner
|
||||
* </pre>
|
||||
* Modifies the product section information of a {@link Vm}.
|
||||
*
|
||||
* @since 1.5
|
||||
* @see VAppClient#modifyProductSections(URI, ProductSectionList)
|
||||
*/
|
||||
void modifyOwner(URI vAppURI, Owner owner);
|
||||
Task modifyProductSections(URI vmURI, ProductSectionList sectionList);
|
||||
|
||||
/**
|
||||
* Retrieves VAppTemplate/VM product sections.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/productSections
|
||||
* </pre>
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
ProductSectionList getProductSections(URI vAppURI);
|
||||
|
||||
/**
|
||||
* Modifies the product section information of a vApp/VM.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/productSections
|
||||
* </pre>
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
Task modifyProductSections(URI vAppURI, ProductSectionList sectionList);
|
||||
|
||||
/**
|
||||
* Retrieves a pending question for a VM.
|
||||
* Retrieves a pending question for a {@link Vm}.
|
||||
*
|
||||
* The user should answer to the question by operation {@link #answerQuestion(URI, VmQuestionAnswer)}.
|
||||
* Usually questions will be asked when the VM is powering on.
|
||||
|
@ -566,10 +311,10 @@ public interface VmClient {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
VmPendingQuestion getPendingQuestion(URI vAppURI);
|
||||
VmPendingQuestion getPendingQuestion(URI vmURI);
|
||||
|
||||
/**
|
||||
* Answer on a pending question.
|
||||
* Answer a pending question on a {@link Vm}.
|
||||
*
|
||||
* The answer IDs of choice and question should match the ones returned from operation {@link #getPendingQuestion(URI)}.
|
||||
*
|
||||
|
@ -579,10 +324,10 @@ public interface VmClient {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
void answerQuestion(URI vAppURI, VmQuestionAnswer answer);
|
||||
void answerQuestion(URI vmURI, VmQuestionAnswer answer);
|
||||
|
||||
/**
|
||||
* Retrieves the runtime info section of a VM.
|
||||
* Retrieves the runtime info section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/runtimeInfoSection
|
||||
|
@ -593,7 +338,7 @@ public interface VmClient {
|
|||
RuntimeInfoSection getRuntimeInfoSection(URI vmURI);
|
||||
|
||||
/**
|
||||
* Retrieves the thumbnail of the screen of a VM.
|
||||
* Retrieves the thumbnail of the screen of a {@link Vm}.
|
||||
*
|
||||
* The content type of the response may vary (e.g. {@code image/png}, {@code image/gif}).
|
||||
*
|
||||
|
@ -603,10 +348,10 @@ public interface VmClient {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
byte[] getScreenImage(URI vAppURI);
|
||||
byte[] getScreenImage(URI vmURI);
|
||||
|
||||
/**
|
||||
* Retrieve a screen ticket for remote console connection to a VM.
|
||||
* Retrieve a screen ticket for remote console connection to a {@link Vm}.
|
||||
*
|
||||
* A screen ticket is a string that includes the virtual machine's IP address, its managed object reference, and a string
|
||||
* that has been encoded as described in RFC 2396. Each VM element in a vApp includes a link where rel="screen:acquireTicket".
|
||||
|
@ -619,32 +364,10 @@ public interface VmClient {
|
|||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
ScreenTicket getScreenTicket(URI vAppURI);
|
||||
ScreenTicket getScreenTicket(URI vmURI);
|
||||
|
||||
/**
|
||||
* Retrieves the startup section of a VApp.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/startupSection
|
||||
* </pre>
|
||||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
StartupSection getStartupSection(URI vAppURI);
|
||||
|
||||
/**
|
||||
* Modifies the startup section of a VApp.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/startupSection
|
||||
* </pre>
|
||||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
Task modifyStartupSection(URI vAppURI, StartupSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the virtual hardware section of a VM.
|
||||
* Retrieves the virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/virtualHardwareSection
|
||||
|
@ -655,7 +378,7 @@ public interface VmClient {
|
|||
VirtualHardwareSection getVirtualHardwareSection(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the virtual hardware section of a VM.
|
||||
* Modifies the virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/virtualHardwareSection
|
||||
|
@ -666,7 +389,7 @@ public interface VmClient {
|
|||
Task modifyVirtualHardwareSection(URI vmURI, VirtualHardwareSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the CPU properties in virtual hardware section of a VM.
|
||||
* Retrieves the CPU properties in virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/virtualHardwareSection/cpu
|
||||
|
@ -677,7 +400,7 @@ public interface VmClient {
|
|||
RasdItem getVirtualHardwareSectionCpu(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the CPU properties in virtual hardware section of a VM.
|
||||
* Modifies the CPU properties in virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/virtualHardwareSection/cpu
|
||||
|
@ -688,7 +411,7 @@ public interface VmClient {
|
|||
Task modifyVirtualHardwareSectionCpu(URI vmURI, RasdItem rasd);
|
||||
|
||||
/**
|
||||
* Retrieves a list of ResourceAllocationSettingData items for disks from virtual hardware section of a VM.
|
||||
* Retrieves a list of items for disks from virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/virtualHardwareSection/disks
|
||||
|
@ -699,7 +422,7 @@ public interface VmClient {
|
|||
RasdItemsList getVirtualHardwareSectionDisks(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the disks list in virtual hardware section of a VM.
|
||||
* Modifies the disks list in virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/virtualHardwareSection/disks
|
||||
|
@ -710,7 +433,7 @@ public interface VmClient {
|
|||
Task modifyVirtualHardwareSectionDisks(URI vmURI, RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* Retrieves the list of ResourceAllocationSettingData items that represents the floppies and CD/DVD drives in a VM.
|
||||
* Retrieves the list of items that represents the floppies and CD/DVD drives in a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/virtualHardwareSection/media
|
||||
|
@ -721,7 +444,7 @@ public interface VmClient {
|
|||
RasdItemsList getVirtualHardwareSectionMedia(URI vmURI);
|
||||
|
||||
/**
|
||||
* Retrieves the ResourceAllocationSettingData item that contains memory information from virtual hardware section of a VM.
|
||||
* Retrieves the item that contains memory information from virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/virtualHardwareSection/memory
|
||||
|
@ -732,7 +455,7 @@ public interface VmClient {
|
|||
RasdItem getVirtualHardwareSectionMemory(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the memory properties in virtual hardware section of a VM.
|
||||
* Modifies the memory properties in virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/virtualHardwareSection/memory
|
||||
|
@ -743,7 +466,7 @@ public interface VmClient {
|
|||
Task modifyVirtualHardwareSectionMemory(URI vmURI, RasdItem rasd);
|
||||
|
||||
/**
|
||||
* Retrieves a list of ResourceAllocationSettingData items for network cards from virtual hardware section of a VM.
|
||||
* Retrieves a list of items for network cards from virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/virtualHardwareSection/networkCards
|
||||
|
@ -754,7 +477,7 @@ public interface VmClient {
|
|||
RasdItemsList getVirtualHardwareSectionNetworkCards(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the network cards list in virtual hardware section of a VM.
|
||||
* Modifies the network cards list in virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/virtualHardwareSection/networkCards
|
||||
|
@ -765,7 +488,7 @@ public interface VmClient {
|
|||
Task modifyVirtualHardwareSectionNetworkCards(URI vmURI, RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* Retrieves a list of ResourceAllocationSettingData items for serial ports from virtual hardware section of a VM.
|
||||
* Retrieves a list of items for serial ports from virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vApp/{id}/virtualHardwareSection/serialPorts
|
||||
|
@ -776,7 +499,7 @@ public interface VmClient {
|
|||
RasdItemsList getVirtualHardwareSectionSerialPorts(URI vmURI);
|
||||
|
||||
/**
|
||||
* Modifies the serial ports list in virtual hardware section of a VM.
|
||||
* Modifies the serial ports list in virtual hardware section of a {@link Vm}.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vApp/{id}/virtualHardwareSection/serialPorts
|
||||
|
@ -787,7 +510,7 @@ public interface VmClient {
|
|||
Task modifyVirtualHardwareSectionSerialPorts(URI vmURI, RasdItemsList rasdItemsList);
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Metadata} features
|
||||
* Synchronous access to {@link Vm} {@link Metadata} features.
|
||||
*/
|
||||
@Delegate
|
||||
MetadataClient.Writeable getMetadataClient();
|
||||
|
|
|
@ -37,23 +37,25 @@ import org.jclouds.dmtf.cim.CimBoolean;
|
|||
import org.jclouds.dmtf.cim.CimString;
|
||||
import org.jclouds.dmtf.cim.CimUnsignedInt;
|
||||
import org.jclouds.dmtf.cim.CimUnsignedLong;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AbstractVAppType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ResourceEntity.Status;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VApp;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vm;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
|
||||
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.MetadataClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.VAppClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.VmClient;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.jclouds.vcloud.director.v1_5.predicates.ReferencePredicates;
|
||||
import org.jclouds.xml.internal.JAXBParser;
|
||||
|
@ -76,9 +78,10 @@ import com.google.common.collect.Iterables;
|
|||
*/
|
||||
public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
public static final String VAPP = "vApp";
|
||||
public static final String VAPP_TEMPLATE = "vAppTemplate";
|
||||
public static final String VDC = "vdc";
|
||||
public static final String VAPP = "VApp";
|
||||
public static final String VAPP_TEMPLATE = "VAppTemplate";
|
||||
public static final String VDC = "Vdc";
|
||||
public static final String VM = "Vm";
|
||||
|
||||
/*
|
||||
* Convenience reference to API clients.
|
||||
|
@ -89,6 +92,7 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
|
|||
protected VAppClient vAppClient;
|
||||
protected VAppTemplateClient vAppTemplateClient;
|
||||
protected VdcClient vdcClient;
|
||||
protected VmClient vmClient;
|
||||
protected MetadataClient.Writeable metadataClient;
|
||||
|
||||
/*
|
||||
|
@ -97,9 +101,10 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
|
|||
|
||||
protected Vdc vdc;
|
||||
protected Vm vm;
|
||||
protected URI vAppURI;
|
||||
protected VApp vApp;
|
||||
protected VAppTemplate vAppTemplate;
|
||||
protected URI vmURI;
|
||||
protected URI vAppURI;
|
||||
|
||||
/**
|
||||
* Retrieves the required clients from the REST API context
|
||||
|
@ -116,6 +121,7 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
|
|||
vAppClient = context.getApi().getVAppClient();
|
||||
vAppTemplateClient = context.getApi().getVAppTemplateClient();
|
||||
vdcClient = context.getApi().getVdcClient();
|
||||
vmClient = context.getApi().getVmClient();
|
||||
|
||||
setupEnvironment();
|
||||
}
|
||||
|
@ -148,6 +154,7 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
|
|||
// Get the Vm
|
||||
List<Vm> vms = vApp.getChildren().getVms();
|
||||
vm = Iterables.getOnlyElement(vms);
|
||||
vmURI = vm.getHref();
|
||||
assertFalse(vms.isEmpty(), "The VApp must have a Vm");
|
||||
}
|
||||
|
||||
|
@ -237,84 +244,116 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
|
|||
}
|
||||
|
||||
/**
|
||||
* Power on a {@link VApp}s {@link Vm}s.
|
||||
*
|
||||
* @see #powerOn(URI)
|
||||
* Power on a {@link VApp}.
|
||||
*/
|
||||
protected VApp powerOn(final VApp testVApp) {
|
||||
return powerOn(testVApp.getHref());
|
||||
}
|
||||
|
||||
/**
|
||||
* Power on a {@link VApp}s {@link Vm}s.
|
||||
*/
|
||||
protected VApp powerOn(final URI testVAppURI) {
|
||||
VApp testVApp = vAppClient.getVApp(testVAppURI);
|
||||
Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms());
|
||||
Status status = vm.getStatus();
|
||||
protected VApp powerOnVApp(final URI testVAppURI) {
|
||||
VApp test = vAppClient.getVApp(testVAppURI);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.POWERED_ON) {
|
||||
Task powerOn = vAppClient.powerOn(vm.getHref());
|
||||
assertTaskSucceedsLong(powerOn);
|
||||
}
|
||||
assertVAppStatus(testVAppURI, Status.POWERED_ON);
|
||||
return testVApp;
|
||||
test = vAppClient.getVApp(testVAppURI);
|
||||
assertStatus(VAPP, test, Status.POWERED_ON);
|
||||
return test;
|
||||
}
|
||||
|
||||
/**
|
||||
* Power off a {@link VApp}s {@link Vm}s.
|
||||
*
|
||||
* @see #powerOff(URI)
|
||||
* Power on a {@link Vm}.
|
||||
*/
|
||||
protected VApp powerOff(final VApp testVApp) {
|
||||
return powerOff(testVApp.getHref());
|
||||
protected Vm powerOnVm(final URI testVmURI) {
|
||||
Vm test = vmClient.getVm(testVmURI);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.POWERED_ON) {
|
||||
Task powerOn = vmClient.powerOn(vm.getHref());
|
||||
assertTaskSucceedsLong(powerOn);
|
||||
}
|
||||
test = vmClient.getVm(testVmURI);
|
||||
assertStatus(VM, test, Status.POWERED_ON);
|
||||
return test;
|
||||
}
|
||||
|
||||
/**
|
||||
* Power off a {@link VApp}s {@link Vm}s.
|
||||
* Power off a {@link VApp}.
|
||||
*/
|
||||
protected VApp powerOff(final URI testVAppURI) {
|
||||
VApp testVApp = vAppClient.getVApp(testVAppURI);
|
||||
Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms());
|
||||
Status status = vm.getStatus();
|
||||
protected VApp powerOffVApp(final URI testVAppURI) {
|
||||
VApp test = vAppClient.getVApp(testVAppURI);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.POWERED_OFF) {
|
||||
Task powerOff = vAppClient.powerOff(vm.getHref());
|
||||
assertTaskSucceedsLong(powerOff);
|
||||
}
|
||||
assertVAppStatus(testVAppURI, Status.POWERED_OFF);
|
||||
return testVApp;
|
||||
test = vAppClient.getVApp(testVAppURI);
|
||||
assertStatus(VAPP, test, Status.POWERED_OFF);
|
||||
return test;
|
||||
}
|
||||
|
||||
/**
|
||||
* Suspend a {@link VApp}s {@link Vm}s.
|
||||
*
|
||||
* @see #suspend(URI)
|
||||
* Power off a {@link Vm}.
|
||||
*/
|
||||
protected VApp suspend(final VApp testVApp) {
|
||||
return powerOff(testVApp.getHref());
|
||||
protected Vm powerOffVm(final URI testVmURI) {
|
||||
Vm test = vmClient.getVm(testVmURI);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.POWERED_OFF) {
|
||||
Task powerOff = vmClient.powerOff(vm.getHref());
|
||||
assertTaskSucceedsLong(powerOff);
|
||||
}
|
||||
test = vmClient.getVm(testVmURI);
|
||||
assertStatus(VM, test, Status.POWERED_OFF);
|
||||
return test;
|
||||
}
|
||||
|
||||
/**
|
||||
* Suspend a {@link VApp}s {@link Vm}s.
|
||||
* Suspend a {@link VApp}.
|
||||
*/
|
||||
protected VApp suspend(final URI testVAppURI) {
|
||||
VApp testVApp = vAppClient.getVApp(testVAppURI);
|
||||
Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms());
|
||||
Status status = vm.getStatus();
|
||||
protected VApp suspendVApp(final URI testVAppURI) {
|
||||
VApp test = vAppClient.getVApp(testVAppURI);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.SUSPENDED) {
|
||||
Task suspend = vAppClient.suspend(vm.getHref());
|
||||
assertTaskSucceedsLong(suspend);
|
||||
}
|
||||
assertVAppStatus(testVAppURI, Status.SUSPENDED);
|
||||
return testVApp;
|
||||
test = vAppClient.getVApp(testVAppURI);
|
||||
assertStatus(VAPP, test, Status.SUSPENDED);
|
||||
return test;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the {@link VApp}s {@link Vm}s current status.
|
||||
* Suspend a {@link Vm}.
|
||||
*/
|
||||
protected Vm suspendVm(final URI testVmURI) {
|
||||
Vm test = vmClient.getVm(testVmURI);
|
||||
Status status = test.getStatus();
|
||||
if (status != Status.SUSPENDED) {
|
||||
Task suspend = vmClient.suspend(vm.getHref());
|
||||
assertTaskSucceedsLong(suspend);
|
||||
}
|
||||
test = vmClient.getVm(testVmURI);
|
||||
assertStatus(VM, test, Status.SUSPENDED);
|
||||
return test;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the {@link VApp}s current status.
|
||||
*/
|
||||
protected void assertVAppStatus(final URI testVAppURI, final Status status) {
|
||||
VApp testVApp = vAppClient.getVApp(testVAppURI);
|
||||
Vm vm = Iterables.getOnlyElement(testVApp.getChildren().getVms());
|
||||
assertEquals(vm.getStatus(), status, String.format(OBJ_FIELD_EQ, VAPP, "status", status.toString(), vm.getStatus().toString()));
|
||||
assertStatus(VAPP, testVApp, status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the {@link Vm}s current status.
|
||||
*/
|
||||
protected void assertVmStatus(final URI testVmURI, final Status status) {
|
||||
Vm testVm = vmClient.getVm(testVmURI);
|
||||
assertStatus(VM, testVm, status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a {@link VApp} or {@link Vm}s status.
|
||||
*/
|
||||
protected static void assertStatus(final String type, final AbstractVAppType testVApp, final Status status) {
|
||||
assertEquals(testVApp.getStatus(), status, String.format(OBJ_FIELD_EQ, type, "status", status.toString(), testVApp.getStatus().toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,9 +39,7 @@ import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RecomposeVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection;
|
||||
|
@ -56,9 +54,6 @@ import org.testng.annotations.BeforeClass;
|
|||
import org.testng.annotations.Test;
|
||||
import org.testng.internal.annotations.Sets;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
|
||||
/**
|
||||
* Allows us to test the {@link VAppClient} via its side effects.
|
||||
*
|
||||
|
@ -127,22 +122,6 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
|
|||
assertEquals(client.getVAppClient().deleteVApp(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testConsolidateVApp() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("POST", vAppId + "/action/consolidate")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/consolidateVAppTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Task expected = consolidateVAppTask();
|
||||
|
||||
assertEquals(client.getVAppClient().consolidateVm(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testControlAccess() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -226,22 +205,6 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
|
|||
client.getVAppClient().exitMaintenanceMode(vAppURI);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testInstallVMwareTools() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("POST", vAppId + "/action/installVMwareTools")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/installVMwareToolsTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Task expected = installVMwareToolsTask();
|
||||
|
||||
assertEquals(client.getVAppClient().installVMwareTools(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testRecomposeVApp() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -262,26 +225,6 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
|
|||
assertEquals(client.getVAppClient().recompose(vAppURI, params), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testRelocate() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("POST", vAppId + "/action/relocate")
|
||||
.xmlFilePayload("/vApp/relocateParams.xml", VCloudDirectorMediaType.RELOCATE_VM_PARAMS)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/relocateTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RelocateParams params = RelocateParams.builder()
|
||||
.build();
|
||||
|
||||
Task expected = relocateTask();
|
||||
|
||||
assertEquals(client.getVAppClient().relocateVm(vAppURI, params), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testUndeploy() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -302,22 +245,6 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
|
|||
assertEquals(client.getVAppClient().undeploy(vAppURI, params), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testUpgradeHardwareVersion() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("POST", vAppId + "/action/upgradeHardwareVersion")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/upgradeHardwareVersionTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Task expected = upgradeHardwareVersionTask();
|
||||
|
||||
assertEquals(client.getVAppClient().upgradeHardwareVersion(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testPowerOff() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -430,42 +357,6 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
|
|||
assertEquals(client.getVAppClient().getControlAccess(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetGuestCustomizationSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/guestCustomizationSection")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getGuestCustomizationSection.xml", VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
GuestCustomizationSection expected = getGuestCustomizationSection();
|
||||
|
||||
assertEquals(client.getVAppClient().getGuestCustomizationSection(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testModifyGuestCustomizationSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("PUT", vAppId + "/guestCustomizationSection")
|
||||
.xmlFilePayload("/vApp/modifyGuestCustomizationSection.xml", VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/modifyGuestCustomizationSectionTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
GuestCustomizationSection section = getGuestCustomizationSection().toBuilder()
|
||||
.build();
|
||||
|
||||
Task expected = modifyGuestCustomizationSectionTask();
|
||||
|
||||
assertEquals(client.getVAppClient().modifyGuestCustomizationSection(vAppURI, section), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetLeaseSettingsSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -502,46 +393,6 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
|
|||
assertEquals(client.getVAppClient().modifyLeaseSettingsSection(vAppURI, section), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testEjectMedia() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("PUT", vAppId + "/media/action/ejectMedia")
|
||||
.xmlFilePayload("/vApp/ejectMediaParams.xml", VCloudDirectorMediaType.MEDIA_PARAMS)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/ejectMediaTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
|
||||
.build();
|
||||
|
||||
Task expected = ejectMediaTask();
|
||||
|
||||
assertEquals(client.getVAppClient().ejectMedia(vAppURI, params), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testInsertMedia() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("PUT", vAppId + "/media/action/insertMedia")
|
||||
.xmlFilePayload("/vApp/insertMediaParams.xml", VCloudDirectorMediaType.MEDIA_PARAMS)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/insertMediaTask.xml", VCloudDirectorMediaType.VAPP)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
|
||||
.build();
|
||||
|
||||
Task expected = insertMediaTask();
|
||||
|
||||
assertEquals(client.getVAppClient().insertMedia(vAppURI, params), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetNetworkConfigSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -578,42 +429,6 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
|
|||
assertEquals(client.getVAppClient().modifyNetworkConfigSection(vAppURI, section), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetNetworkConnectionSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/networkConnectionSection")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getNetworkConnectionSection.xml", VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
NetworkConnectionSection expected = getNetworkConnectionSection();
|
||||
|
||||
assertEquals(client.getVAppClient().getNetworkConnectionSection(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testModifyNetworkConnectionSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("PUT", vAppId + "/networkConnectionSection")
|
||||
.xmlFilePayload("/vApp/modifyNetworkConnectionSection.xml", VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/modifyNetworkConnectionSectionTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
NetworkConnectionSection section = getNetworkConnectionSection().toBuilder()
|
||||
.build();
|
||||
|
||||
Task expected = modifyNetworkConnectionSectionTask();
|
||||
|
||||
assertEquals(client.getVAppClient().modifyNetworkConnectionSection(vAppURI, section), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetNetworkSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -630,42 +445,6 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
|
|||
assertEquals(client.getVAppClient().getNetworkSection(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetOperatingSystemSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/operatingSystemSection")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getOperatingSystemSection.xml", VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
OperatingSystemSection expected = getOperatingSystemSection();
|
||||
|
||||
assertEquals(client.getVAppClient().getOperatingSystemSection(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testModifyOperatingSystemSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("PUT", vAppId + "/operatingSystemSection")
|
||||
.xmlFilePayload("/vApp/modifyOperatingSystemSection.xml", VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/modifyOperatingSystemSectionTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
OperatingSystemSection section = getOperatingSystemSection().toBuilder()
|
||||
.build();
|
||||
|
||||
Task expected = modifyOperatingSystemSectionTask();
|
||||
|
||||
assertEquals(client.getVAppClient().modifyOperatingSystemSection(vAppURI, section), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetOwner() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -732,89 +511,6 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
|
|||
assertEquals(client.getVAppClient().modifyProductSections(vAppURI, null), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetPendingQuestion() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/question")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getPendingQuestion.xml", VCloudDirectorMediaType.VM_PENDING_QUESTION)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
VmPendingQuestion expected = getPendingQuestion();
|
||||
|
||||
assertEquals(client.getVAppClient().getPendingQuestion(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testAnswerQuestion() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("PUT", vAppId + "/question/action/answer")
|
||||
.xmlFilePayload("/vApp/answerQuestion.xml", VCloudDirectorMediaType.VM_PENDING_ANSWER)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.httpResponseBuilder().statusCode(204).build());
|
||||
|
||||
VmQuestionAnswer answer = null; // = VmQuestionAnswer.builder();
|
||||
// .build;
|
||||
|
||||
client.getVAppClient().answerQuestion(vAppURI, answer);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetRuntimeInfoSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/runtimeInfoSection")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getRuntimeInfoSection.xml", VCloudDirectorMediaType.RUNTIME_INFO_SECTION)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RuntimeInfoSection expected = getRuntimeInfoSection();
|
||||
|
||||
assertEquals(client.getVAppClient().getRuntimeInfoSection(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetScreenImage() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/screen")
|
||||
.acceptMedia(VCloudDirectorMediaType.ANY_IMAGE)
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.httpResponseBuilder()
|
||||
.headers(Multimaps.forMap(ImmutableMap.of("Content-Type", "image/png")))
|
||||
.message(new String(getScreenImage()))
|
||||
.build());
|
||||
|
||||
byte[] expected = getScreenImage();
|
||||
|
||||
assertEquals(client.getVAppClient().getScreenImage(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetScreenTicket() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("POST", vAppId + "/screen/action/acquireTicket")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getScreenTicket.xml", VCloudDirectorMediaType.SCREEN_TICKET)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
ScreenTicket expected = getScreenTicket();
|
||||
|
||||
assertEquals(client.getVAppClient().getScreenTicket(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetStartupSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -851,238 +547,6 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
|
|||
assertEquals(client.getVAppClient().modifyStartupSection(vAppURI, section), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetVirtualHardwareSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/virtualHardwareSection")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getVirtualHardwareSection.xml", VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
VirtualHardwareSection expected = getVirtualHardwareSection();
|
||||
|
||||
assertEquals(client.getVAppClient().getVirtualHardwareSection(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testModifyVirtualHardwareSection() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("PUT", vAppId + "/virtualHardwareSection")
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSection.xml", VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
VirtualHardwareSection section = getVirtualHardwareSection().toBuilder()
|
||||
.build();
|
||||
|
||||
Task expected = modifyVirtualHardwareSectionTask();
|
||||
|
||||
assertEquals(client.getVAppClient().modifyVirtualHardwareSection(vAppURI, section), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetVirtualHardwareSectionCpu() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/virtualHardwareSection/cpu")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getVirtualHardwareSectionCpu.xml", VCloudDirectorMediaType.OVF_RASD_ITEM)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RasdItem expected = getVirtualHardwareSectionCpu();
|
||||
|
||||
assertEquals(client.getVAppClient().getVirtualHardwareSectionCpu(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testModifyVirtualHardwareSectionCpu() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("", vAppId + "/virtualHardwareSection/cpu")
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionCpu.xml", VCloudDirectorMediaType.OVF_RASD_ITEM)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionCpuTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RasdItem cpu = getVirtualHardwareSectionCpu(); // .toBuilder();
|
||||
// .build();
|
||||
|
||||
Task expected = modifyVirtualHardwareSectionCpuTask();
|
||||
|
||||
assertEquals(client.getVAppClient().modifyVirtualHardwareSectionCpu(vAppURI, cpu), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetVirtualHardwareSectionDisks() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/virtualHardwareSection/disks")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getVirtualHardwareSectionDisks.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RasdItemsList expected = getVirtualHardwareSectionDisks();
|
||||
|
||||
assertEquals(client.getVAppClient().getVirtualHardwareSectionDisks(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testModifyVirtualHardwareSectionDisks() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("PUT", vAppId + "/virtualHardwareSection/disks")
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionDisks.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionDisksTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RasdItemsList disks = getVirtualHardwareSectionDisks().toBuilder()
|
||||
.build();
|
||||
|
||||
Task expected = modifyVirtualHardwareSectionDisksTask();
|
||||
|
||||
assertEquals(client.getVAppClient().modifyVirtualHardwareSectionDisks(vAppURI, disks), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetVirtualHardwareSectionMedia() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/virtualHardwareSection/media")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getVirtualHardwareSectionMedia.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RasdItemsList expected = getVirtualHardwareSectionMedia();
|
||||
|
||||
assertEquals(client.getVAppClient().getVirtualHardwareSectionMedia(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetVirtualHardwareSectionMemory() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/virtualHardwareSection/memory")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getVirtualHardwareSectionMemory.xml", VCloudDirectorMediaType.OVF_RASD_ITEM)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RasdItem expected = getVirtualHardwareSectionMemory();
|
||||
|
||||
assertEquals(client.getVAppClient().getVirtualHardwareSectionMemory(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testModifyVirtualHardwareSectionMemory() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("PUT", vAppId + "/virtualHardwareSection/memory")
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionMemory.xml", VCloudDirectorMediaType.VAPP)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionMemoryTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RasdItem memory = getVirtualHardwareSectionCpu(); // .toBuilder();
|
||||
// .build();
|
||||
|
||||
Task expected = modifyVirtualHardwareSectionMemoryTask();
|
||||
|
||||
assertEquals(client.getVAppClient().modifyVirtualHardwareSectionMemory(vAppURI, memory), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetVirtualHardwareSectionNetworkCards() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/virtualHardwareSection/networkCards")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getVirtualHardwareSectionNetworkCards.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RasdItemsList expected = getVirtualHardwareSectionNetworkCards();
|
||||
|
||||
assertEquals(client.getVAppClient().getVirtualHardwareSectionNetworkCards(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testModifyVirtualHardwareSectionNetworkCards() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("PUT", vAppId + "/virtualHardwareSection/networkCards")
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionNetworkCards.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionNetworkCardsTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RasdItemsList networkCards = getVirtualHardwareSectionNetworkCards().toBuilder()
|
||||
.build();
|
||||
|
||||
Task expected = modifyVirtualHardwareSectionNetworkCardsTask();
|
||||
|
||||
assertEquals(client.getVAppClient().modifyVirtualHardwareSectionNetworkCards(vAppURI, networkCards), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetVirtualHardwareSectionSerialPorts() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", vAppId + "/virtualHardwareSection/serialPorts")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/getVirtualHardwareSectionSerialPorts.xml", VCloudDirectorMediaType.VAPP)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RasdItemsList expected = getVirtualHardwareSectionSerialPorts();
|
||||
|
||||
assertEquals(client.getVAppClient().getVirtualHardwareSectionSerialPorts(vAppURI), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testModifyVirtualHardwareSectionSerialPorts() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("PUT", vAppId + "/virtualHardwareSection/serialPorts")
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionSerialPorts.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionSerialPortsTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
RasdItemsList serialPorts = getVirtualHardwareSectionSerialPorts().toBuilder()
|
||||
.build();
|
||||
|
||||
Task expected = modifyVirtualHardwareSectionSerialPortsTask();
|
||||
|
||||
assertEquals(client.getVAppClient().modifyVirtualHardwareSectionSerialPorts(vAppURI, serialPorts), expected);
|
||||
}
|
||||
|
||||
public static VApp getVApp() {
|
||||
// FIXME Does not match XML
|
||||
VApp vApp = VApp.builder()
|
||||
|
|
|
@ -30,9 +30,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.N
|
|||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.TASK_COMPLETE_TIMELY;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ADMIN_USER;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.MEDIA;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkControlAccessParams;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkGuestCustomizationSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkLeaseSettingsSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadata;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataFor;
|
||||
|
@ -40,36 +38,23 @@ import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataKeyAbs
|
|||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataValue;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataValueFor;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkNetworkConfigSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkNetworkConnectionSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkNetworkSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOperatingSystemSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOwner;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkProductSectionList;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkRasdItemsList;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkResourceAllocationSettingData;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkRuntimeInfoSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkScreenTicket;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkStartupSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVApp;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVirtualHardwareSection;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVmPendingQuestion;
|
||||
import static org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates.relEquals;
|
||||
import static org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates.typeEquals;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.dmtf.cim.OSType;
|
||||
import org.jclouds.dmtf.cim.ResourceAllocationSettingData;
|
||||
import org.jclouds.dmtf.ovf.MsgType;
|
||||
import org.jclouds.dmtf.ovf.NetworkSection;
|
||||
import org.jclouds.dmtf.ovf.ProductSection;
|
||||
|
@ -86,42 +71,23 @@ import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ResourceEntity.Status;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VApp;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswerChoice;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection.IpAddressAllocationMode;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RecomposeVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Tests behavior of the {@link VAppClient}.
|
||||
|
@ -274,7 +240,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
@Test(description = "POST /vApp/{id}/power/action/powerOn", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testPowerOnVApp() {
|
||||
// Power off VApp
|
||||
vApp = powerOff(vApp);
|
||||
vApp = powerOffVApp(vApp.getHref());
|
||||
|
||||
// The method under test
|
||||
Task powerOnVApp = vAppClient.powerOn(vApp.getHref());
|
||||
|
@ -290,7 +256,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
@Test(description = "POST /vApp/{id}/power/action/reboot", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testReboot() {
|
||||
// Power on VApp
|
||||
vApp = powerOn(vApp);
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
|
||||
// The method under test
|
||||
Task reboot = vAppClient.reboot(vApp.getHref());
|
||||
|
@ -306,7 +272,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
@Test(description = "POST /vApp/{id}/power/action/shutdown", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testShutdown() {
|
||||
// Power on VApp
|
||||
vApp = powerOn(vApp);
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
|
||||
// The method under test
|
||||
Task shutdown = vAppClient.shutdown(vAppURI);
|
||||
|
@ -319,13 +285,13 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertVAppStatus(vAppURI, Status.POWERED_OFF);
|
||||
|
||||
// Power on the VApp again
|
||||
vApp = powerOn(vApp);
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/suspend", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testSuspend() {
|
||||
// Power on VApp
|
||||
vApp = powerOn(vApp);
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
|
||||
// The method under test
|
||||
Task suspend = vAppClient.suspend(vAppURI);
|
||||
|
@ -338,13 +304,13 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertVAppStatus(vAppURI, Status.SUSPENDED);
|
||||
|
||||
// Power on the VApp again
|
||||
vApp = powerOn(vApp);
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/power/action/reset", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testReset() {
|
||||
// Power on VApp
|
||||
vApp = powerOn(vApp);
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
|
||||
// The method under test
|
||||
Task reset = vAppClient.reset(vAppURI);
|
||||
|
@ -360,7 +326,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
@Test(description = "POST /vApp/{id}/action/undeploy", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testUndeployVApp() {
|
||||
// Power on VApp
|
||||
vApp = powerOn(vApp);
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
|
||||
UndeployVAppParams params = UndeployVAppParams.builder().build();
|
||||
|
||||
|
@ -379,7 +345,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
@Test(description = "POST /vApp/{id}/power/action/powerOff", dependsOnMethods = { "testUndeployVApp" })
|
||||
public void testPowerOffVApp() {
|
||||
// Power on VApp
|
||||
vApp = powerOn(vApp);
|
||||
vApp = powerOnVApp(vApp.getHref());
|
||||
|
||||
// The method under test
|
||||
Task powerOffVApp = vAppClient.powerOff(vApp.getHref());
|
||||
|
@ -392,16 +358,6 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertVAppStatus(vAppURI, Status.POWERED_OFF);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/action/consolidate", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testConsolidateVApp() {
|
||||
// Power on VApp
|
||||
vApp = powerOn(vApp);
|
||||
|
||||
// The method under test
|
||||
Task consolidateVApp = vAppClient.consolidateVm(vApp.getHref());
|
||||
assertTrue(retryTaskSuccess.apply(consolidateVApp), String.format(TASK_COMPLETE_TIMELY, "consolidateVApp"));
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/action/controlAccess", dependsOnMethods = { "testGetVApp" })
|
||||
public void testControlAccessUser() {
|
||||
ControlAccessParams params = ControlAccessParams.builder()
|
||||
|
@ -441,7 +397,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
@Test(description = "POST /vApp/{id}/action/discardSuspendedState", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testDiscardSuspendedState() {
|
||||
// Suspend the VApp
|
||||
vApp = suspend(vAppURI);
|
||||
vApp = suspendVApp(vApp.getHref());
|
||||
|
||||
// The method under test
|
||||
Task discardSuspendedState = vAppClient.discardSuspendedState(vApp.getHref());
|
||||
|
@ -500,16 +456,6 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/action/installVMwareTools", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testInstallVMwareTools() {
|
||||
// First ensure the vApp is powered n
|
||||
vApp = powerOn(vApp);
|
||||
|
||||
// The method under test
|
||||
Task installVMwareTools = vAppClient.installVMwareTools(vm.getHref());
|
||||
assertTrue(retryTaskSuccess.apply(installVMwareTools), String.format(TASK_COMPLETE_TIMELY, "installVMwareTools"));
|
||||
}
|
||||
|
||||
// FIXME "Could not bind object to request[method=POST, endpoint=https://mycloud.greenhousedata.com/api/vApp/vapp-e124f3f0-adb9-4268-ad49-e54fb27e40af/action/recomposeVApp,
|
||||
// headers={Accept=[application/vnd.vmware.vcloud.task+xml]}, payload=[content=true, contentMetadata=[contentDisposition=null, contentEncoding=null, contentLanguage=null,
|
||||
// contentLength=0, contentMD5=null, contentType=application/vnd.vmware.vcloud.recomposeVAppParams+xml], written=false]]: Could not marshall object"
|
||||
|
@ -522,29 +468,6 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertTrue(retryTaskSuccess.apply(recomposeVApp), String.format(TASK_COMPLETE_TIMELY, "recomposeVApp"));
|
||||
}
|
||||
|
||||
// NOTE This test is disabled, as it is not possible to look up datastores using the User API
|
||||
@Test(description = "POST /vApp/{id}/action/relocate", dependsOnMethods = { "testGetVApp" })
|
||||
public void testRelocate() {
|
||||
// Relocate to the last of the available datastores
|
||||
QueryResultRecords records = context.getApi().getQueryClient().queryAll("datastore");
|
||||
QueryResultRecordType datastore = Iterables.getLast(records.getRecords());
|
||||
RelocateParams params = RelocateParams.builder().datastore(Reference.builder().href(datastore.getHref()).build()).build();
|
||||
|
||||
// The method under test
|
||||
Task relocate = vAppClient.relocateVm(vApp.getHref(), params);
|
||||
assertTrue(retryTaskSuccess.apply(relocate), String.format(TASK_COMPLETE_TIMELY, "relocate"));
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/action/upgradeHardwareVersion", dependsOnMethods = { "testGetVApp" })
|
||||
public void testUpgradeHardwareVersion() {
|
||||
// Power off VApp
|
||||
vApp = powerOff(vApp);
|
||||
|
||||
// The method under test
|
||||
Task upgradeHardwareVersion = vAppClient.upgradeHardwareVersion(vm.getHref());
|
||||
assertTrue(retryTaskSuccess.apply(upgradeHardwareVersion), String.format(TASK_COMPLETE_TIMELY, "upgradeHardwareVersion"));
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/controlAccess", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetControlAccess() {
|
||||
// The method under test
|
||||
|
@ -554,47 +477,6 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
checkControlAccessParams(controlAccess);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetGuestCustomizationSection() {
|
||||
getGuestCustomizationSection(new Function<URI, GuestCustomizationSection>() {
|
||||
@Override
|
||||
public GuestCustomizationSection apply(URI uri) {
|
||||
return vAppClient.getGuestCustomizationSection(uri);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetGuestCustomizationSection" })
|
||||
public void testModifyGuestCustomizationSection() {
|
||||
// Copy existing section and update fields
|
||||
GuestCustomizationSection oldSection = vAppClient.getGuestCustomizationSection(vm.getHref());
|
||||
GuestCustomizationSection newSection = oldSection.toBuilder()
|
||||
.computerName(name("n"))
|
||||
.enabled(Boolean.FALSE)
|
||||
.adminPassword(null) // Not allowed
|
||||
.build();
|
||||
|
||||
// The method under test
|
||||
Task modifyGuestCustomizationSection = vAppClient.modifyGuestCustomizationSection(vm.getHref(), newSection);
|
||||
assertTrue(retryTaskSuccess.apply(modifyGuestCustomizationSection), String.format(TASK_COMPLETE_TIMELY, "modifyGuestCustomizationSection"));
|
||||
|
||||
// Retrieve the modified section
|
||||
GuestCustomizationSection modified = vAppClient.getGuestCustomizationSection(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkGuestCustomizationSection(modified);
|
||||
|
||||
// Check the modified section fields are set correctly
|
||||
assertEquals(modified.getComputerName(), newSection.getComputerName());
|
||||
assertFalse(modified.isEnabled());
|
||||
|
||||
// Reset the admin password in the retrieved GuestCustomizationSection for equality check
|
||||
modified = modified.toBuilder().adminPassword(null).build();
|
||||
|
||||
// Check the section was modified correctly
|
||||
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "GuestCustomizationSection"));
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetLeaseSettingsSection() {
|
||||
// The method under test
|
||||
|
@ -653,31 +535,6 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "LeaseSettingsSection"));
|
||||
}
|
||||
|
||||
// FIXME "Error: The requested operation on media "com.vmware.vcloud.entity.media:abfcb4b7-809f-4b50-a0aa-8c97bf09a5b0" is not supported in the current state."
|
||||
@Test(description = "PUT /vApp/{id}/media/action/insertMedia", dependsOnMethods = { "testGetVApp" })
|
||||
public void testInsertMedia() {
|
||||
// Setup media params from configured media id
|
||||
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
|
||||
.media(Reference.builder().href(mediaURI).type(MEDIA).build())
|
||||
.build();
|
||||
|
||||
// The method under test
|
||||
Task insertMedia = vAppClient.insertMedia(vm.getHref(), params);
|
||||
assertTrue(retryTaskSuccess.apply(insertMedia), String.format(TASK_COMPLETE_TIMELY, "insertMedia"));
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vApp/{id}/media/action/ejectMedia", dependsOnMethods = { "testInsertMedia" })
|
||||
public void testEjectMedia() {
|
||||
// Setup media params from configured media id
|
||||
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
|
||||
.media(Reference.builder().href(mediaURI).type(MEDIA).build())
|
||||
.build();
|
||||
|
||||
// The method under test
|
||||
Task ejectMedia = vAppClient.ejectMedia(vm.getHref(), params);
|
||||
assertTrue(retryTaskSuccess.apply(ejectMedia), String.format(TASK_COMPLETE_TIMELY, "ejectMedia"));
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/networkConfigSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetNetworkConfigSection() {
|
||||
// The method under test
|
||||
|
@ -711,49 +568,6 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "NetworkConfigSection"));
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetNetworkConnectionSection() {
|
||||
getNetworkConnectionSection(new Function<URI, NetworkConnectionSection>() {
|
||||
@Override
|
||||
public NetworkConnectionSection apply(URI uri) {
|
||||
return vAppClient.getNetworkConnectionSection(uri);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// FIXME "Task error: Unable to perform this action. Contact your cloud administrator."
|
||||
@Test(description = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetNetworkConnectionSection" })
|
||||
public void testModifyNetworkConnectionSection() {
|
||||
// Look up a network in the Vdc
|
||||
Set<Reference> networks = vdc.getAvailableNetworks();
|
||||
Reference network = Iterables.getLast(networks);
|
||||
|
||||
// Copy existing section and update fields
|
||||
NetworkConnectionSection oldSection = vAppClient.getNetworkConnectionSection(vm.getHref());
|
||||
NetworkConnectionSection newSection = oldSection.toBuilder()
|
||||
.networkConnection(NetworkConnection.builder()
|
||||
.ipAddressAllocationMode(IpAddressAllocationMode.DHCP.toString())
|
||||
.network(network.getName())
|
||||
.build())
|
||||
.build();
|
||||
|
||||
// The method under test
|
||||
Task modifyNetworkConnectionSection = vAppClient.modifyNetworkConnectionSection(vm.getHref(), newSection);
|
||||
assertTrue(retryTaskSuccess.apply(modifyNetworkConnectionSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConnectionSection"));
|
||||
|
||||
// Retrieve the modified section
|
||||
NetworkConnectionSection modified = vAppClient.getNetworkConnectionSection(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkNetworkConnectionSection(modified);
|
||||
|
||||
// Check the modified section has an extra network connection
|
||||
assertEquals(modified.getNetworkConnections().size(), newSection.getNetworkConnections().size() + 1);
|
||||
|
||||
// Check the section was modified correctly
|
||||
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "NetworkConnectionSection"));
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/networkSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetNetworkSection() {
|
||||
// The method under test
|
||||
|
@ -763,38 +577,6 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
checkNetworkSection(section);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetOperatingSystemSection() {
|
||||
// The method under test
|
||||
OperatingSystemSection section = vAppClient.getOperatingSystemSection(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkOperatingSystemSection(section);
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetOperatingSystemSection", "testModifyVirtualHardwareSection" })
|
||||
public void testModifyOperatingSystemSection() {
|
||||
// Create new OperatingSystemSection
|
||||
OperatingSystemSection newSection = OperatingSystemSection.builder()
|
||||
.info("") // NOTE Required OVF field, ignored
|
||||
.id(OSType.RHEL_64.getCode())
|
||||
.osType("rhel5_64Guest")
|
||||
.build();
|
||||
|
||||
// The method under test
|
||||
Task modifyOperatingSystemSection = vAppClient.modifyOperatingSystemSection(vm.getHref(), newSection);
|
||||
assertTrue(retryTaskSuccess.apply(modifyOperatingSystemSection), String.format(TASK_COMPLETE_TIMELY, "modifyOperatingSystemSection"));
|
||||
|
||||
// Retrieve the modified section
|
||||
OperatingSystemSection modified = vAppClient.getOperatingSystemSection(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkOperatingSystemSection(modified);
|
||||
|
||||
// Check the modified section fields are set correctly
|
||||
assertEquals(modified.getId(), newSection.getId());
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/owner", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetOwner() {
|
||||
// The method under test
|
||||
|
@ -861,78 +643,6 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertEquals(modified, newSections, String.format(ENTITY_EQUAL, "ProductSectionList"));
|
||||
}
|
||||
|
||||
// FIXME How do we force it to ask a question?
|
||||
@Test(description = "GET /vApp/{id}/question", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testGetPendingQuestion() {
|
||||
// Power on VApp
|
||||
vApp = powerOn(vAppURI);
|
||||
|
||||
// TODO how to test?
|
||||
|
||||
// The method under test
|
||||
VmPendingQuestion question = vAppClient.getPendingQuestion(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkVmPendingQuestion(question);
|
||||
}
|
||||
|
||||
@Test(description = "POST /vApp/{id}/question/action/answer", dependsOnMethods = { "testGetPendingQuestion" })
|
||||
public void testAnswerQuestion() {
|
||||
// TODO check that the question has been answered (e.g. asking for getPendingQuestion does not
|
||||
// include our answered question).
|
||||
|
||||
VmPendingQuestion question = vAppClient.getPendingQuestion(vm.getHref());
|
||||
List<VmQuestionAnswerChoice> answerChoices = question.getChoices();
|
||||
VmQuestionAnswerChoice answerChoice = Iterables.getFirst(answerChoices, null);
|
||||
assertNotNull(answerChoice, "Question "+question+" must have at least once answer-choice");
|
||||
|
||||
VmQuestionAnswer answer = VmQuestionAnswer.builder()
|
||||
.choiceId(answerChoice.getId())
|
||||
.questionId(question.getQuestionId())
|
||||
.build();
|
||||
|
||||
vAppClient.answerQuestion(vm.getHref(), answer);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/runtimeInfoSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetRuntimeInfoSection() {
|
||||
// The method under test
|
||||
RuntimeInfoSection section = vAppClient.getRuntimeInfoSection(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRuntimeInfoSection(section);
|
||||
}
|
||||
|
||||
// FIXME If still failing, consider escalating?
|
||||
@Test(description = "GET /vApp/{id}/screen", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testGetScreenImage() {
|
||||
// Power on VApp
|
||||
vApp = powerOn(vApp);
|
||||
|
||||
// The method under test
|
||||
byte[] image = vAppClient.getScreenImage(vm.getHref());
|
||||
|
||||
// Check returned bytes against PNG header magic number
|
||||
byte[] pngHeaderBytes = new byte[] { (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
|
||||
assertNotNull(image);
|
||||
assertTrue(image.length > pngHeaderBytes.length);
|
||||
for (int i = 0; i < pngHeaderBytes.length; i++) {
|
||||
assertEquals(image[i], pngHeaderBytes[i], String.format("Image differs from PNG format at byte %d of header", i));
|
||||
}
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/screen/action/acquireTicket", dependsOnMethods = { "testDeployVApp" })
|
||||
public void testGetScreenTicket() {
|
||||
// Power on VApp
|
||||
vApp = powerOn(vApp);
|
||||
|
||||
// The method under test
|
||||
ScreenTicket ticket = vAppClient.getScreenTicket(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkScreenTicket(ticket);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/startupSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetStartupSection() {
|
||||
// The method under test
|
||||
|
@ -963,242 +673,6 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertEquals(modified, newSection);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVApp" })
|
||||
public void testGetVirtualHardwareSection() {
|
||||
// Method under test
|
||||
VirtualHardwareSection hardware = vAppClient.getVirtualHardwareSection(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkVirtualHardwareSection(hardware);
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testModifyVirtualHardwareSection() {
|
||||
// Power off VApp
|
||||
vApp = powerOff(vApp);
|
||||
|
||||
// Copy existing section and update fields
|
||||
VirtualHardwareSection oldSection = vAppClient.getVirtualHardwareSection(vm.getHref());
|
||||
Set<? extends ResourceAllocationSettingData> oldItems = oldSection.getItems();
|
||||
Set<ResourceAllocationSettingData> newItems = Sets.newLinkedHashSet(oldItems);
|
||||
ResourceAllocationSettingData oldMemory = Iterables.find(oldItems, new Predicate<ResourceAllocationSettingData>() {
|
||||
@Override
|
||||
public boolean apply(ResourceAllocationSettingData rasd) {
|
||||
return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
|
||||
}
|
||||
});
|
||||
ResourceAllocationSettingData newMemory = oldMemory.toBuilder()
|
||||
.elementName("1024 MB of memory")
|
||||
.virtualQuantity(new BigInteger("1024"))
|
||||
.build();
|
||||
newItems.remove(oldMemory);
|
||||
newItems.add(newMemory);
|
||||
VirtualHardwareSection newSection = oldSection.toBuilder()
|
||||
.items(newItems)
|
||||
.build();
|
||||
|
||||
// The method under test
|
||||
Task modifyVirtualHardwareSection = vAppClient.modifyVirtualHardwareSection(vm.getHref(), newSection);
|
||||
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSection), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSection"));
|
||||
|
||||
// Retrieve the modified section
|
||||
VirtualHardwareSection modifiedSection = vAppClient.getVirtualHardwareSection(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkVirtualHardwareSection(modifiedSection);
|
||||
|
||||
// Check the modified section fields are set correctly
|
||||
ResourceAllocationSettingData modifiedMemory = Iterables.find(modifiedSection.getItems(),
|
||||
new Predicate<ResourceAllocationSettingData>() {
|
||||
@Override
|
||||
public boolean apply(ResourceAllocationSettingData rasd) {
|
||||
return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
|
||||
}
|
||||
});
|
||||
assertEquals(modifiedMemory.getVirtualQuantity(), new BigInteger("1024"));
|
||||
assertEquals(modifiedMemory, newMemory);
|
||||
assertEquals(modifiedSection, newSection);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionCpu() {
|
||||
// Method under test
|
||||
RasdItem rasd = vAppClient.getVirtualHardwareSectionCpu(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkResourceAllocationSettingData(rasd);
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" })
|
||||
public void testModifyVirtualHardwareSectionCpu() {
|
||||
// Copy existing section and update fields
|
||||
RasdItem oldItem = vAppClient.getVirtualHardwareSectionCpu(vm.getHref());
|
||||
RasdItem newItem = oldItem.toBuilder()
|
||||
.elementName("2 virtual CPU(s)")
|
||||
.virtualQuantity(new BigInteger("2"))
|
||||
.build();
|
||||
|
||||
// Method under test
|
||||
Task modifyVirtualHardwareSectionCpu = vAppClient.modifyVirtualHardwareSectionCpu(vm.getHref(), newItem);
|
||||
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionCpu), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionCpu"));
|
||||
|
||||
// Retrieve the modified section
|
||||
RasdItem modified = vAppClient.getVirtualHardwareSectionCpu(vm.getHref());
|
||||
|
||||
// Check the retrieved object
|
||||
checkResourceAllocationSettingData(modified);
|
||||
|
||||
// Check modified item
|
||||
assertEquals(modified.getVirtualQuantity(), new BigInteger("2"),
|
||||
String.format(OBJ_FIELD_EQ, "ResourceAllocationSettingData", "VirtualQuantity", "2", modified.getVirtualQuantity().toString()));
|
||||
assertEquals(modified, newItem);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionDisks() {
|
||||
// Method under test
|
||||
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionDisks(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(rasdItems);
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSectionDisks" })
|
||||
public void testModifyVirtualHardwareSectionDisks() {
|
||||
// Copy the existing items list and modify the name of an item
|
||||
RasdItemsList oldSection = vAppClient.getVirtualHardwareSectionDisks(vm.getHref());
|
||||
RasdItemsList newSection = oldSection.toBuilder().build();
|
||||
|
||||
// Method under test
|
||||
Task modifyVirtualHardwareSectionDisks = vAppClient.modifyVirtualHardwareSectionDisks(vm.getHref(), newSection);
|
||||
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionDisks), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionDisks"));
|
||||
|
||||
// Retrieve the modified section
|
||||
RasdItemsList modified = vAppClient.getVirtualHardwareSectionDisks(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(modified);
|
||||
|
||||
// TODO What is modifiable? What can we change, so we can assert the change took effect?
|
||||
// I tried changing "elementName" of one of the items, but it continued to have the old value when looked up post-modify.
|
||||
//
|
||||
// List<ResourceAllocationSettingData> newItems = new ArrayList<ResourceAllocationSettingData>(oldSection.getItems());
|
||||
// ResourceAllocationSettingData item0 = newItems.get(0);
|
||||
// String item0InstanceId = item0.getInstanceID().getValue();
|
||||
// String item0ElementName = item0.getElementName().getValue()+"-"+random.nextInt(Integer.MAX_VALUE);
|
||||
// newItems.set(0, item0.toBuilder().elementName(newCimString(item0ElementName)).build());
|
||||
// RasdItemsList newSection = oldSection.toBuilder()
|
||||
// .items(newItems)
|
||||
// .build();
|
||||
// ...
|
||||
// long weight = random.nextInt(Integer.MAX_VALUE);
|
||||
// ResourceAllocationSettingData newSection = origSection.toBuilder()
|
||||
// .weight(newCimUnsignedInt(weight))
|
||||
// .build();
|
||||
// ...
|
||||
// checkHasMatchingItem("virtualHardwareSection/disk", modified, item0InstanceId, item0ElementName);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/media", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionMedia() {
|
||||
// Method under test
|
||||
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionMedia(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(rasdItems);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionMemory() {
|
||||
// Method under test
|
||||
RasdItem rasd = vAppClient.getVirtualHardwareSectionCpu(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkResourceAllocationSettingData(rasd);
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" })
|
||||
public void testModifyVirtualHardwareSectionMemory() {
|
||||
RasdItem origItem = vAppClient.getVirtualHardwareSectionMemory(vm.getHref());
|
||||
RasdItem newItem = origItem.toBuilder()
|
||||
.elementName("1024 MB of memory")
|
||||
.virtualQuantity(new BigInteger("1024"))
|
||||
.build();
|
||||
|
||||
// Method under test
|
||||
Task modifyVirtualHardwareSectionMemory = vAppClient.modifyVirtualHardwareSectionMemory(vm.getHref(), newItem);
|
||||
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionMemory), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionMemory"));
|
||||
|
||||
// Retrieve the modified section
|
||||
RasdItem modified = vAppClient.getVirtualHardwareSectionMemory(vm.getHref());
|
||||
|
||||
// Check the retrieved object
|
||||
checkResourceAllocationSettingData(modified);
|
||||
|
||||
// Check modified item
|
||||
assertEquals(modified.getVirtualQuantity(), new BigInteger("1024"),
|
||||
String.format(OBJ_FIELD_EQ, "ResourceAllocationSettingData", "VirtualQuantity", "1024", modified.getVirtualQuantity().toString()));
|
||||
assertEquals(modified, newItem);
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionNetworkCards() {
|
||||
// Method under test
|
||||
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionNetworkCards(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(rasdItems);
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSectionNetworkCards" })
|
||||
public void testModifyVirtualHardwareSectionNetworkCards() {
|
||||
RasdItemsList oldSection = vAppClient.getVirtualHardwareSectionNetworkCards(vm.getHref());
|
||||
RasdItemsList newSection = oldSection.toBuilder().build();
|
||||
|
||||
// Method under test
|
||||
Task modifyVirtualHardwareSectionNetworkCards = vAppClient.modifyVirtualHardwareSectionNetworkCards(vm.getHref(), newSection);
|
||||
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionNetworkCards), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionNetworkCards"));
|
||||
|
||||
// Retrieve the modified section
|
||||
RasdItemsList modified = vAppClient.getVirtualHardwareSectionNetworkCards(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(modified);
|
||||
|
||||
// TODO What is modifiable? What can we change, so we can assert the change took effect?
|
||||
// I tried changing "elementName" of one of the items, but it continued to have the old value when looked up post-modify.
|
||||
// See the description in testModifyVirtualHardwareSectionDisks
|
||||
}
|
||||
|
||||
@Test(description = "GET /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||
public void testGetVirtualHardwareSectionSerialPorts() {
|
||||
// Method under test
|
||||
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionSerialPorts(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(rasdItems);
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSectionSerialPorts" })
|
||||
public void testModifyVirtualHardwareSectionSerialPorts() {
|
||||
RasdItemsList oldSection = vAppClient.getVirtualHardwareSectionSerialPorts(vm.getHref());
|
||||
RasdItemsList newSection = oldSection.toBuilder().build();
|
||||
|
||||
// Method under test
|
||||
Task modifyVirtualHardwareSectionSerialPorts = vAppClient.modifyVirtualHardwareSectionSerialPorts(vm.getHref(), newSection);
|
||||
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionSerialPorts), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionSerialPorts"));
|
||||
|
||||
// Retrieve the modified section
|
||||
RasdItemsList modified = vAppClient.getVirtualHardwareSectionSerialPorts(vm.getHref());
|
||||
|
||||
// Check the retrieved object is well formed
|
||||
checkRasdItemsList(modified);
|
||||
|
||||
// TODO What is modifiable? What can we change, so we can assert the change took effect?
|
||||
// I tried changing "elementName" of one of the items, but it continued to have the old value when looked up post-modify.
|
||||
// See the description in testModifyVirtualHardwareSectionDisks
|
||||
}
|
||||
|
||||
@Test(description = "PUT /vApp/{id}/metadata", dependsOnMethods = { "testGetVApp" })
|
||||
public void testSetMetadataValue() {
|
||||
key = name("key-");
|
||||
|
|
|
@ -385,7 +385,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
Reference network = Iterables.getLast(networks);
|
||||
|
||||
// Copy existing section and update fields
|
||||
NetworkConnectionSection oldSection = vAppClient.getNetworkConnectionSection(vm.getHref());
|
||||
NetworkConnectionSection oldSection = vAppTemplateClient.getNetworkConnectionSection(vm.getHref());
|
||||
NetworkConnectionSection newSection = oldSection.toBuilder()
|
||||
.networkConnection(NetworkConnection.builder()
|
||||
.ipAddressAllocationMode(IpAddressAllocationMode.DHCP.toString())
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue