From 8becbd03947ef7d08a5761419212730cc4e47b2c Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Thu, 26 Apr 2012 01:34:43 +0100 Subject: [PATCH 1/4] Create new VmClient and references using existing methods from VAppClient --- .../VCloudDirectorRestClientModule.java | 4 + .../v1_5/features/VAppAsyncClient.java | 312 +------ .../director/v1_5/features/VAppClient.java | 421 +--------- .../director/v1_5/features/VmAsyncClient.java | 691 +++++++++++++++ .../director/v1_5/features/VmClient.java | 794 ++++++++++++++++++ .../v1_5/user/VCloudDirectorAsyncClient.java | 7 + .../v1_5/user/VCloudDirectorClient.java | 7 + 7 files changed, 1536 insertions(+), 700 deletions(-) create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncClient.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmClient.java diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java index c6c4df7485..d8af02ac6e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java @@ -67,6 +67,8 @@ import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient; import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient; import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient; import org.jclouds.vcloud.director.v1_5.features.VdcClient; +import org.jclouds.vcloud.director.v1_5.features.VmAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.VmClient; import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogAsyncClient; import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient; import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncClient; @@ -122,6 +124,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule, Class> ADMIN_DELEGATE_MAP = ImmutableMap., Class>builder() @@ -166,6 +169,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule deleteVApp(@EndpointParam URI vAppURI); - /** - * @see VAppClient#consolidateVm(URI) - */ - @POST - @Path("/action/consolidate") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture consolidateVm(@EndpointParam URI vAppURI); - /** * @see VAppClient#modifyControlAccess(URI, ControlAccessParams) */ @@ -180,15 +171,6 @@ public interface VAppAsyncClient { @JAXBResponseParser ListenableFuture exitMaintenanceMode(@EndpointParam URI vAppURI); - /** - * @see VAppClient#installVMwareTools(URI) - */ - @POST - @Path("/action/installVMwareTools") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture installVMwareTools(@EndpointParam URI vAppURI); - /** * @see VAppClient#recompose(URI, RecomposeVAppParams) */ @@ -200,17 +182,6 @@ public interface VAppAsyncClient { ListenableFuture recompose(@EndpointParam URI vAppURI, @BinderParam(BindToXMLPayload.class) RecomposeVAppParams params); - /** - * @see VAppClient#relocateVm(URI, RelocateParams) - */ - @POST - @Path("/action/relocate") - @Produces(RELOCATE_VM_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture relocateVm(@EndpointParam URI vAppURI, - @BinderParam(BindToXMLPayload.class) RelocateParams params); - /** * @see VAppClient#undeploy(URI, UndeployVAppParams) */ @@ -222,15 +193,6 @@ public interface VAppAsyncClient { ListenableFuture undeploy(@EndpointParam URI vAppURI, @BinderParam(BindToXMLPayload.class) UndeployVAppParams params); - /** - * @see VAppClient#upgradeHardwareVersion(URI) - */ - @POST - @Path("/action/upgradeHardwareVersion") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture upgradeHardwareVersion(@EndpointParam URI vAppURI); - /** * @see VAppClient#getControlAccess(URI) */ @@ -295,27 +257,6 @@ public interface VAppAsyncClient { @JAXBResponseParser ListenableFuture suspend(@EndpointParam URI vAppURI); - /** - * @see VAppClient#getGuestCustomizationSection(URI) - */ - @GET - @Path("/guestCustomizationSection") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getGuestCustomizationSection(@EndpointParam URI vmURI); - - /** - * @see VAppClient#modifyGuestCustomizationSection(URI, GuestCustomizationSection) - */ - @PUT - @Path("/guestCustomizationSection") - @Produces(GUEST_CUSTOMIZATION_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture modifyGuestCustomizationSection(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) GuestCustomizationSection section); - /** * @see VAppClient#getLeaseSettingsSection(URI) */ @@ -337,28 +278,6 @@ public interface VAppAsyncClient { ListenableFuture modifyLeaseSettingsSection(@EndpointParam URI vAppURI, @BinderParam(BindToXMLPayload.class) LeaseSettingsSection section); - /** - * @see VAppClient#ejectMedia(URI, MediaInsertOrEjectParams) - */ - @POST - @Path("/media/action/ejectMedia") - @Produces(MEDIA_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture ejectMedia(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); - - /** - * @see VAppClient#insertMedia(URI, MediaInsertOrEjectParams) - */ - @POST - @Path("/media/action/insertMedia") - @Produces(MEDIA_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture insertMedia(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); - /** * @see VAppClient#getNetworkConfigSection(URI) */ @@ -380,27 +299,6 @@ public interface VAppAsyncClient { ListenableFuture modifyNetworkConfigSection(@EndpointParam URI vAppURI, @BinderParam(BindToXMLPayload.class) NetworkConfigSection section); - /** - * @see VAppClient#getNetworkConnectionSection(URI) - */ - @GET - @Path("/networkConnectionSection") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getNetworkConnectionSection(@EndpointParam URI vmURI); - - /** - * @see VAppClient#modifyNetworkConnectionSection(URI, NetworkConnectionSection) - */ - @PUT - @Path("/networkConnectionSection") - @Produces(NETWORK_CONNECTION_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture modifyNetworkConnectionSection(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) NetworkConnectionSection section); - /** * @see VAppClient#getNetworkSection(URI) */ @@ -411,27 +309,6 @@ public interface VAppAsyncClient { @ExceptionParser(ReturnNullOnNotFoundOr404.class) ListenableFuture getNetworkSection(@EndpointParam URI vAppURI); - /** - * @see VAppClient#getOperatingSystemSection(URI) - */ - @GET - @Path("/operatingSystemSection") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getOperatingSystemSection(@EndpointParam URI vmURI); - - /** - * @see VAppClient#modifyOperatingSystemSection(URI, OperatingSystemSection) - */ - @PUT - @Path("/operatingSystemSection") - @Produces(OPERATING_SYSTEM_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture modifyOperatingSystemSection(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) OperatingSystemSection section); - /** * @see VAppClient#getOwner(URI) */ @@ -474,56 +351,6 @@ public interface VAppAsyncClient { ListenableFuture modifyProductSections(@EndpointParam URI vAppURI, @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); - /** - * @see VAppClient#getPendingQuestion(URI) - */ - @GET - @Path("/question") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getPendingQuestion(@EndpointParam URI vAppURI); - - /** - * @see VAppClient#answerQuestion(URI, VmQuestionAnswer) - */ - @POST - @Path("/question/action/answer") - @Produces(VM_PENDING_ANSWER) - @Consumes - @JAXBResponseParser - ListenableFuture answerQuestion(@EndpointParam URI vAppURI, - @BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer); - - /** - * @see VAppClient#getRuntimeInfoSection(URI) - */ - @GET - @Path("/runtimeInfoSection") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getRuntimeInfoSection(@EndpointParam URI vmURI); - - /** - * @see VAppClient#getScreenImage(URI) - */ - @GET - @Path("/screen") - @Consumes(ANY_IMAGE) - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - @ResponseParser(ReturnPayloadBytes.class) - ListenableFuture getScreenImage(@EndpointParam URI vAppURI); - - /** - * @see VAppClient#getScreenTicket(URI) - */ - @POST - @Path("/screen/action/acquireTicket") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getScreenTicket(@EndpointParam URI vAppURI); /** * @see VAppClient#getStartupSection(URI) @@ -547,145 +374,8 @@ public interface VAppAsyncClient { @BinderParam(BindToXMLPayload.class) StartupSection section); /** - * @see VAppClient#getVirtualHardwareSection(URI) - */ - @GET - @Path("/virtualHardwareSection") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getVirtualHardwareSection(@EndpointParam URI vmURI); - - /** - * @see VAppClient#modifyVirtualHardwareSection(URI, VirtualHardwareSection) - */ - @PUT - @Path("/virtualHardwareSection") - @Produces(VIRTUAL_HARDWARE_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture modifyVirtualHardwareSection(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) VirtualHardwareSection section); - - /** - * @see VAppClient#getVirtualHardwareSectionCpu(URI) - */ - @GET - @Path("/virtualHardwareSection/cpu") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getVirtualHardwareSectionCpu(@EndpointParam URI vmURI); - - /** - * @see VAppClient#modifyVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData) - */ - @PUT - @Path("/virtualHardwareSection/cpu") - @Produces(OVF_RASD_ITEM) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture modifyVirtualHardwareSectionCpu(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) RasdItem rasd); - - /** - * @see VAppClient#getVirtualHardwareSectionDisks(URI) - */ - @GET - @Path("/virtualHardwareSection/disks") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getVirtualHardwareSectionDisks(@EndpointParam URI vmURI); - - /** - * @see VAppClient#modifyVirtualHardwareSectionDisks(URI, RasdItemsList) - */ - @PUT - @Path("/virtualHardwareSection/disks") - @Produces(OVF_RASD_ITEMS_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture modifyVirtualHardwareSectionDisks(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); - - /** - * @see VAppClient#getVirtualHardwareSectionMedia(URI) - */ - @GET - @Path("/virtualHardwareSection/media") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getVirtualHardwareSectionMedia(@EndpointParam URI vmURI); - - /** - * @see VAppClient#getVirtualHardwareSectionMemory(URI) - */ - @GET - @Path("/virtualHardwareSection/memory") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getVirtualHardwareSectionMemory(@EndpointParam URI vmURI); - - /** - * @see VAppClient#modifyVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData) - */ - @PUT - @Path("/virtualHardwareSection/memory") - @Produces(OVF_RASD_ITEM) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture modifyVirtualHardwareSectionMemory(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) RasdItem rasd); - - /** - * @see VAppClient#getVirtualHardwareSectionNetworkCards(URI) - */ - @GET - @Path("/virtualHardwareSection/networkCards") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI); - - /** - * @see VAppClient#modifyVirtualHardwareSectionNetworkCards(URI, RasdItemsList) - */ - @PUT - @Path("/virtualHardwareSection/networkCards") - @Produces(OVF_RASD_ITEMS_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture modifyVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); - - /** - * @see VAppClient#getVirtualHardwareSectionSerialPorts(URI) - */ - @GET - @Path("/virtualHardwareSection/serialPorts") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI); - - /** - * @see VAppClient#modifyVirtualHardwareSectionSerialPorts(URI, RasdItemsList) - */ - @PUT - @Path("/virtualHardwareSection/serialPorts") - @Produces(OVF_RASD_ITEMS_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture modifyVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI, - @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); - - /** - * @return asynchronous access to {@link Metadata} features + * Asynchronous access to {@link VApp} {@link Metadata} features */ @Delegate MetadataAsyncClient.Writeable getMetadataClient(); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppClient.java index f8dc431db4..431eb5583c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppClient.java @@ -27,26 +27,14 @@ 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.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. @@ -59,9 +47,9 @@ import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection; public interface VAppClient { /** - * Retrieves a vApp/VM. + * Retrieves a {@link VApp}. * - * The vApp/VM could be in one of these statuses: + * The {@link VApp} could be in one of these statuses: *
    *
  • {@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 @@ -101,7 +89,7 @@ public interface VAppClient { VApp getVApp(URI vAppURI); /** - * Modifies the name/description of a vApp/VM. + * Modifies the name/description of a {@link VApp}. * *
         * PUT /vApp/{id}
    @@ -112,7 +100,7 @@ public interface VAppClient {
        Task modifyVApp(URI vAppURI, VApp vApp);
     
        /**
    -    * Deletes a vApp/VM.
    +    * Deletes a {@link VApp}.
         *
         * 
         * DELETE /vApp/{id}
    @@ -123,18 +111,7 @@ public interface VAppClient {
        Task deleteVApp(URI vAppURI);
     
        /**
    -    * Consolidates a vm.
    -    *
    -    * 
    -    * POST /vApp/{id}/action/consolidate
    -    * 
    - * - * @since 1.5 - */ - Task consolidateVm(URI vAppURI); - - /** - * Modifies the control access of a vApp. + * Modifies the control access of a {@link VApp}. * *
         * POST /vApp/{id}/action/controlAccess
    @@ -145,7 +122,7 @@ public interface VAppClient {
        ControlAccessParams modifyControlAccess(URI vAppURI, ControlAccessParams params);
     
        /**
    -    * Deploys a vApp/VM.
    +    * Deploys a {@link VApp}.
         *
         * 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
    @@ -162,7 +139,7 @@ public interface VAppClient {
        Task deploy(URI vAppURI, DeployVAppParams params);
     
        /**
    -    * Discard suspended state of a vApp/VM.
    +    * Discard suspended state of a {@link VApp}.
         *
         * Discarding suspended state of a vApp automatically discarded suspended
         * states of all of the virtual machines it contains.
    @@ -176,7 +153,7 @@ public interface VAppClient {
        Task discardSuspendedState(URI vAppURI);
     
        /**
    -    * Place the vApp into maintenance mode.
    +    * Place the {@link 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
    @@ -192,7 +169,7 @@ public interface VAppClient {
        void enterMaintenanceMode(URI vAppURI);
     
        /**
    -    * Take the vApp out of maintenance mode.
    +    * Take the {@link VApp} out of maintenance mode.
         *
         * 
         * POST /vApp/{id}/action/exitMaintenanceMode
    @@ -203,20 +180,7 @@ public interface VAppClient {
        void exitMaintenanceMode(URI vAppURI);
     
        /**
    -    * Installs VMware tools to the virtual machine.
    -    *
    -    * It should be running in order for them to be installed.
    -    *
    -    * 
    -    * POST /vApp/{id}/action/installVMwareTools
    -    * 
    - * - * @since 1.5 - */ - Task installVMwareTools(URI vAppURI); - - /** - * Recompose a vApp by removing its own VMs and/or adding new ones from other + * Recompose a {@link 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 @@ -234,18 +198,7 @@ public interface VAppClient { Task recompose(URI vAppURI, RecomposeVAppParams params); /** - * Relocates a vm. - * - *
    -    * POST /vApp/{id}/action/relocate
    -    * 
    - * - * @since 1.5 - */ - Task relocateVm(URI vAppURI, RelocateParams params); - - /** - * Undeploy a vApp/VM. + * Undeploy a {@link VApp}. * * Undeployment means deallocation of all resources for a vApp/VM like CPU * and memory from a vDC resource pool. Undeploying a vApp automatically @@ -260,19 +213,7 @@ public interface VAppClient { Task undeploy(URI vAppURI, UndeployVAppParams params); /** - * Upgrade virtual hardware version of a VM to the highest supported virtual - * hardware version of provider vDC where the VM locates. - * - *
    -    * POST /vApp/{id}/action/upgradeHardwareVersion
    -    * 
    - * - * @since 1.5 - */ - Task upgradeHardwareVersion(URI vAppURI); - - /** - * Retrieves the control access information for a vApp. + * Retrieves the control access information for a {@link VApp}. * * The vApp could be shared to everyone or could be shared to specific user, * by modifying the control access values. @@ -286,7 +227,7 @@ public interface VAppClient { ControlAccessParams getControlAccess(URI vAppURI); /** - * Powers off a vApp/VM. + * Powers off a {@link VApp}. * * 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. * @@ -299,7 +240,7 @@ public interface VAppClient { Task powerOff(URI vAppURI); /** - * Powers on a vApp/VM. + * Powers on a {@link VApp}. * * 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. @@ -313,7 +254,7 @@ public interface VAppClient { Task powerOn(URI vAppURI); /** - * Reboots a vApp/VM. + * Reboots a {@link VApp}. * * The vApp/VM should be started in order to reboot it. * @@ -326,7 +267,7 @@ public interface VAppClient { Task reboot(URI vAppURI); /** - * Resets a vApp/VM. + * Resets a {@link VApp}. * * 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. @@ -340,7 +281,7 @@ public interface VAppClient { Task reset(URI vAppURI); /** - * Shutdowns a vApp/VM. + * Shuts down a {@link VApp}. * * 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. @@ -354,7 +295,7 @@ public interface VAppClient { Task shutdown(URI vAppURI); /** - * Suspends a vApp/VM. + * Suspends a {@link VApp}. * * 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. @@ -368,29 +309,7 @@ public interface VAppClient { Task suspend(URI vAppURI); /** - * Retrieves the guest customization section of a VM. - * - *
    -    * GET /vApp/{id}/guestCustomizationSection
    -    * 
    - * - * @since 1.0 - */ - GuestCustomizationSection getGuestCustomizationSection(URI vmURI); - - /** - * Modifies the guest customization section of a VM. - * - *
    -    * PUT /vApp/{id}/guestCustomizationSection
    -    * 
    - * - * @since 1.0 - */ - Task modifyGuestCustomizationSection(URI vmURI, GuestCustomizationSection section); - - /** - * Retrieves the lease settings section of a vApp or vApp template. + * Retrieves the lease settings section of a {@link VApp}. * *
         * GET /vApp/{id}/leaseSettingsSection
    @@ -401,7 +320,7 @@ public interface VAppClient {
        LeaseSettingsSection getLeaseSettingsSection(URI vAppURI);
     
        /**
    -    * Modifies the lease settings section of a vApp or vApp template.
    +    * Modifies the lease settings section of a {@link VApp}.
         *
         * 
         * PUT /vApp/{id}/leaseSettingsSection
    @@ -412,29 +331,7 @@ public interface VAppClient {
        Task modifyLeaseSettingsSection(URI vAppURI, LeaseSettingsSection section);
     
        /**
    -    * Ejects a media from a VM.
    -    *
    -    * 
    -    * PUT /vApp/{id}/media/action/ejectMedia
    -    * 
    - * - * @since 0.9 - */ - Task ejectMedia(URI vmURI, MediaInsertOrEjectParams mediaParams); - - /** - * Inserts a media into a VM. - * - *
    -    * PUT /vApp/{id}/media/action/insertMedia
    -    * 
    - * - * @since 0.9 - */ - Task insertMedia(URI vmURI, MediaInsertOrEjectParams mediaParams); - - /** - * Retrieves the network config section of a vApp or vApp template. + * Retrieves the network config section of a {@link VApp}. * *
         * GET /vApp/{id}/networkConfigSection
    @@ -442,10 +339,10 @@ public interface VAppClient {
         *
         * @since 0.9
         */
    -   NetworkConfigSection getNetworkConfigSection(URI vmURI);
    +   NetworkConfigSection getNetworkConfigSection(URI vAppURI);
     
        /**
    -    * Modifies the network config section of a vApp.
    +    * Modifies the network config section of a {@link VApp}.
         *
         * 
         * PUT /vApp/{id}/networkConfigSection
    @@ -453,32 +350,10 @@ public interface VAppClient {
         *
         * @since 0.9
         */
    -   Task modifyNetworkConfigSection(URI vmURI, NetworkConfigSection section);
    +   Task modifyNetworkConfigSection(URI vAppURI, NetworkConfigSection section);
     
        /**
    -    * Retrieves the network connection section of a VM.
    -    *
    -    * 
    -    * GET /vApp/{id}/networkConnectionSection
    -    * 
    - * - * @since 0.9 - */ - NetworkConnectionSection getNetworkConnectionSection(URI vmURI); - - /** - * Modifies the network connection section of a VM. - * - *
    -    * PUT /vApp/{id}/networkConnectionSection
    -    * 
    - * - * @since 0.9 - */ - Task modifyNetworkConnectionSection(URI vmURI, NetworkConnectionSection section); - - /** - * Retrieves the network section of a vApp or vApp template. + * Retrieves the network section of a {@link VApp}. * *
         * GET /vApp/{id}/networkSection
    @@ -489,29 +364,7 @@ public interface VAppClient {
        NetworkSection getNetworkSection(URI vAppURI);
     
        /**
    -    * Retrieves the operating system section of a VM.
    -    *
    -    * 
    -    * GET /vApp/{id}/operatingSystemSection
    -    * 
    - * - * @since 0.9 - */ - OperatingSystemSection getOperatingSystemSection(URI vmURI); - - /** - * Modifies the operating system section of a VM. - * - *
    -    * PUT /vApp/{id}/operatingSystemSection
    -    * 
    - * - * @since 0.9 - */ - Task modifyOperatingSystemSection(URI vmURI, OperatingSystemSection section); - - /** - * Retrieves the owner of a vApp. + * Retrieves the owner of a {@link VApp}. * *
         * GET /vApp/{id}/owner
    @@ -522,7 +375,7 @@ public interface VAppClient {
        Owner getOwner(URI vAppURI);
     
        /**
    -    * Changes VApp owner.
    +    * Changes {@link VApp} owner.
         *
         * 
         * PUT /vApp/{id}/owner
    @@ -533,7 +386,7 @@ public interface VAppClient {
        void modifyOwner(URI vAppURI, Owner owner);
     
        /**
    -    * Retrieves VAppTemplate/VM product sections.
    +    * Retrieves {@link VApp} product sections.
         *
         * 
         * GET /vApp/{id}/productSections
    @@ -544,7 +397,7 @@ public interface VAppClient {
        ProductSectionList getProductSections(URI vAppURI);
     
        /**
    -    * Modifies the product section information of a vApp/VM.
    +    * Modifies the product section information of a {@link VApp}.
         *
         * 
         * PUT /vApp/{id}/productSections
    @@ -555,74 +408,7 @@ public interface VAppClient {
        Task modifyProductSections(URI vAppURI, ProductSectionList sectionList);
     
        /**
    -    * Retrieves a pending question for a 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.
    -    *
    -    * 
    -    * GET /vApp/{id}/question
    -    * 
    - * - * @since 0.9 - */ - VmPendingQuestion getPendingQuestion(URI vAppURI); - - /** - * Answer on a pending question. - * - * The answer IDs of choice and question should match the ones returned from operation {@link #getPendingQuestion(URI)}. - * - *
    -    * POST /vApp/{id}/question/action/answer
    -    * 
    - * - * @since 0.9 - */ - void answerQuestion(URI vAppURI, VmQuestionAnswer answer); - - /** - * Retrieves the runtime info section of a VM. - * - *
    -    * GET /vApp/{id}/runtimeInfoSection
    -    * 
    - * - * @since 1.5 - */ - RuntimeInfoSection getRuntimeInfoSection(URI vmURI); - - /** - * Retrieves the thumbnail of the screen of a VM. - * - * The content type of the response may vary (e.g. {@code image/png}, {@code image/gif}). - * - *
    -    * GET /vApp/{id}/screen
    -    * 
    - * - * @since 0.9 - */ - byte[] getScreenImage(URI vAppURI); - - /** - * Retrieve a screen ticket for remote console connection to a 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". - * You can use that link to request a screen ticket that you can use with the vmware-vmrc utility to open a VMware Remote - * Console for the virtual machine represented by that VM element. The vApp should be running to get a valid screen ticket. - * - *
    -    * GET /vApp/{id}/screen/action/acquireTicket
    -    * 
    - * - * @since 0.9 - */ - ScreenTicket getScreenTicket(URI vAppURI); - - /** - * Retrieves the startup section of a VApp. + * Retrieves the startup section of a {@link VApp}. * *
         * GET /vApp/{id}/startupSection
    @@ -633,7 +419,7 @@ public interface VAppClient {
        StartupSection getStartupSection(URI vAppURI);
     
        /**
    -    * Modifies the startup section of a VApp.
    +    * Modifies the startup section of a {@link VApp}.
         *
         * 
         * PUT /vApp/{id}/startupSection
    @@ -644,150 +430,7 @@ public interface VAppClient {
        Task modifyStartupSection(URI vAppURI, StartupSection section);
     
        /**
    -    * Retrieves the virtual hardware section of a VM.
    -    *
    -    * 
    -    * GET /vApp/{id}/virtualHardwareSection
    -    * 
    - * - * @since 0.9 - */ - VirtualHardwareSection getVirtualHardwareSection(URI vmURI); - - /** - * Modifies the virtual hardware section of a VM. - * - *
    -    * PUT /vApp/{id}/virtualHardwareSection
    -    * 
    - * - * @since 0.9 - */ - Task modifyVirtualHardwareSection(URI vmURI, VirtualHardwareSection section); - - /** - * Retrieves the CPU properties in virtual hardware section of a VM. - * - *
    -    * GET /vApp/{id}/virtualHardwareSection/cpu
    -    * 
    - * - * @since 0.9 - */ - RasdItem getVirtualHardwareSectionCpu(URI vmURI); - - /** - * Modifies the CPU properties in virtual hardware section of a VM. - * - *
    -    * PUT /vApp/{id}/virtualHardwareSection/cpu
    -    * 
    - * - * @since 0.9 - */ - Task modifyVirtualHardwareSectionCpu(URI vmURI, RasdItem rasd); - - /** - * Retrieves a list of ResourceAllocationSettingData items for disks from virtual hardware section of a VM. - * - *
    -    * GET /vApp/{id}/virtualHardwareSection/disks
    -    * 
    - * - * @since 0.9 - */ - RasdItemsList getVirtualHardwareSectionDisks(URI vmURI); - - /** - * Modifies the disks list in virtual hardware section of a VM. - * - *
    -    * PUT /vApp/{id}/virtualHardwareSection/disks
    -    * 
    - * - * @since 0.9 - */ - Task modifyVirtualHardwareSectionDisks(URI vmURI, RasdItemsList rasdItemsList); - - /** - * Retrieves the list of ResourceAllocationSettingData items that represents the floppies and CD/DVD drives in a VM. - * - *
    -    * GET /vApp/{id}/virtualHardwareSection/media
    -    * 
    - * - * @since 0.9 - */ - RasdItemsList getVirtualHardwareSectionMedia(URI vmURI); - - /** - * Retrieves the ResourceAllocationSettingData item that contains memory information from virtual hardware section of a VM. - * - *
    -    * GET /vApp/{id}/virtualHardwareSection/memory
    -    * 
    - * - * @since 0.9 - */ - RasdItem getVirtualHardwareSectionMemory(URI vmURI); - - /** - * Modifies the memory properties in virtual hardware section of a VM. - * - *
    -    * PUT /vApp/{id}/virtualHardwareSection/memory
    -    * 
    - * - * @since 0.9 - */ - Task modifyVirtualHardwareSectionMemory(URI vmURI, RasdItem rasd); - - /** - * Retrieves a list of ResourceAllocationSettingData items for network cards from virtual hardware section of a VM. - * - *
    -    * GET /vApp/{id}/virtualHardwareSection/networkCards
    -    * 
    - * - * @since 0.9 - */ - RasdItemsList getVirtualHardwareSectionNetworkCards(URI vmURI); - - /** - * Modifies the network cards list in virtual hardware section of a VM. - * - *
    -    * PUT /vApp/{id}/virtualHardwareSection/networkCards
    -    * 
    - * - * @since 0.9 - */ - Task modifyVirtualHardwareSectionNetworkCards(URI vmURI, RasdItemsList rasdItemsList); - - /** - * Retrieves a list of ResourceAllocationSettingData items for serial ports from virtual hardware section of a VM. - * - *
    -    * GET /vApp/{id}/virtualHardwareSection/serialPorts
    -    * 
    - * - * @since 1.5 - */ - RasdItemsList getVirtualHardwareSectionSerialPorts(URI vmURI); - - /** - * Modifies the serial ports list in virtual hardware section of a VM. - * - *
    -    * PUT /vApp/{id}/virtualHardwareSection/serialPorts
    -    * 
    - * - * @since 1.5 - */ - Task modifyVirtualHardwareSectionSerialPorts(URI vmURI, RasdItemsList rasdItemsList); - - /** - * @return synchronous access to {@link Metadata} features + * Synchronous access to {@link VApp} {@link Metadata} features. */ @Delegate MetadataClient.Writeable getMetadataClient(); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncClient.java new file mode 100644 index 0000000000..aea8247d04 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncClient.java @@ -0,0 +1,691 @@ +/* + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.vcloud.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_PENDING_ANSWER; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import 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; +import org.jclouds.rest.annotations.ExceptionParser; +import org.jclouds.rest.annotations.JAXBResponseParser; +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.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; +import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; +import org.jclouds.vcloud.director.v1_5.functions.ReturnPayloadBytes; + +import com.google.common.util.concurrent.ListenableFuture; + +/** + * @author grkvlt@apache.org + * @see VAppClient + */ +@RequestFilters(AddVCloudAuthorizationToRequest.class) +public interface VmAsyncClient { + + /** + * @see VAppClient#getVApp(URI) + */ + @GET + @Consumes(VAPP) + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getVApp(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#modifyVApp(URI, VApp) + */ + @PUT + @Produces(VAPP) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyVApp(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) VApp vApp); + + /** + * @see VAppClient#deleteVApp(URI) + */ + @DELETE + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture deleteVApp(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#consolidateVm(URI) + */ + @POST + @Path("/action/consolidate") + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture consolidateVm(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#modifyControlAccess(URI, ControlAccessParams) + */ + @POST + @Path("/action/controlAccess") + @Produces(CONTROL_ACCESS) + @Consumes(CONTROL_ACCESS) + @JAXBResponseParser + ListenableFuture modifyControlAccess(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) ControlAccessParams params); + + /** + * @see VAppClient#deploy(URI, DeployVAppParams) + */ + @POST + @Path("/action/deploy") + @Produces(DEPLOY_VAPP_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture deploy(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) DeployVAppParams params); + + /** + * @see VAppClient#discardSuspendedState(URI) + */ + @POST + @Path("/action/discardSuspendedState") + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture discardSuspendedState(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#enterMaintenanceMode(URI) + */ + @POST + @Path("/action/enterMaintenanceMode") + @Consumes + @JAXBResponseParser + ListenableFuture enterMaintenanceMode(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#exitMaintenanceMode(URI) + */ + @POST + @Path("/action/exitMaintenanceMode") + @Consumes + @JAXBResponseParser + ListenableFuture exitMaintenanceMode(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#installVMwareTools(URI) + */ + @POST + @Path("/action/installVMwareTools") + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture installVMwareTools(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#recompose(URI, RecomposeVAppParams) + */ + @POST + @Path("/action/recomposeVApp") + @Produces(RECOMPOSE_VAPP_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture recompose(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) RecomposeVAppParams params); + + /** + * @see VAppClient#relocateVm(URI, RelocateParams) + */ + @POST + @Path("/action/relocate") + @Produces(RELOCATE_VM_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture relocateVm(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) RelocateParams params); + + /** + * @see VAppClient#undeploy(URI, UndeployVAppParams) + */ + @POST + @Path("/action/undeploy") + @Produces(UNDEPLOY_VAPP_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture undeploy(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) UndeployVAppParams params); + + /** + * @see VAppClient#upgradeHardwareVersion(URI) + */ + @POST + @Path("/action/upgradeHardwareVersion") + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture upgradeHardwareVersion(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#getControlAccess(URI) + */ + @GET + @Path("/controlAccess") + @Consumes(CONTROL_ACCESS) + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getControlAccess(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#powerOff(URI) + */ + @POST + @Path("/power/action/powerOff") + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture powerOff(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#powerOn(URI) + */ + @POST + @Path("/power/action/powerOn") + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture powerOn(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#reboot(URI) + */ + @POST + @Path("/power/action/powerOff") + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture reboot(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#reset(URI) + */ + @POST + @Path("/power/action/reset") + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture reset(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#shutdown(URI) + */ + @POST + @Path("/power/action/shutdown") + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture shutdown(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#suspend(URI) + */ + @POST + @Path("/power/action/suspend") + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture suspend(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#getGuestCustomizationSection(URI) + */ + @GET + @Path("/guestCustomizationSection") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getGuestCustomizationSection(@EndpointParam URI vmURI); + + /** + * @see VAppClient#modifyGuestCustomizationSection(URI, GuestCustomizationSection) + */ + @PUT + @Path("/guestCustomizationSection") + @Produces(GUEST_CUSTOMIZATION_SECTION) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyGuestCustomizationSection(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) GuestCustomizationSection section); + + /** + * @see VAppClient#getLeaseSettingsSection(URI) + */ + @GET + @Path("/leaseSettingsSection") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getLeaseSettingsSection(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#modifyLeaseSettingsSection(URI, LeaseSettingsSection) + */ + @PUT + @Path("/leaseSettingsSection") + @Produces(LEASE_SETTINGS_SECTION) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyLeaseSettingsSection(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) LeaseSettingsSection section); + + /** + * @see VAppClient#ejectMedia(URI, MediaInsertOrEjectParams) + */ + @POST + @Path("/media/action/ejectMedia") + @Produces(MEDIA_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture ejectMedia(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); + + /** + * @see VAppClient#insertMedia(URI, MediaInsertOrEjectParams) + */ + @POST + @Path("/media/action/insertMedia") + @Produces(MEDIA_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture insertMedia(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); + + /** + * @see VAppClient#getNetworkConfigSection(URI) + */ + @GET + @Path("/networkConfigSection") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getNetworkConfigSection(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#modifyNetworkConfigSection(URI, NetworkConfigSection) + */ + @PUT + @Path("/networkConfigSection") + @Produces(NETWORK_CONFIG_SECTION) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyNetworkConfigSection(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) NetworkConfigSection section); + + /** + * @see VAppClient#getNetworkConnectionSection(URI) + */ + @GET + @Path("/networkConnectionSection") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getNetworkConnectionSection(@EndpointParam URI vmURI); + + /** + * @see VAppClient#modifyNetworkConnectionSection(URI, NetworkConnectionSection) + */ + @PUT + @Path("/networkConnectionSection") + @Produces(NETWORK_CONNECTION_SECTION) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyNetworkConnectionSection(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) NetworkConnectionSection section); + + /** + * @see VAppClient#getNetworkSection(URI) + */ + @GET + @Path("/networkSection") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getNetworkSection(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#getOperatingSystemSection(URI) + */ + @GET + @Path("/operatingSystemSection") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getOperatingSystemSection(@EndpointParam URI vmURI); + + /** + * @see VAppClient#modifyOperatingSystemSection(URI, OperatingSystemSection) + */ + @PUT + @Path("/operatingSystemSection") + @Produces(OPERATING_SYSTEM_SECTION) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyOperatingSystemSection(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) OperatingSystemSection section); + + /** + * @see VAppClient#getOwner(URI) + */ + @GET + @Path("/owner") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getOwner(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#modifyOwner(URI, Owner) + */ + @PUT + @Path("/owner") + @Produces(OWNER) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyOwner(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) Owner owner); + + /** + * @see VAppClient#getProductSections(URI) + */ + @GET + @Path("/productSections") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getProductSections(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#modifyProductSections(URI, ProductSectionList) + */ + @PUT + @Path("/productSections") + @Produces(PRODUCT_SECTION_LIST) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyProductSections(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); + + /** + * @see VAppClient#getPendingQuestion(URI) + */ + @GET + @Path("/question") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getPendingQuestion(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#answerQuestion(URI, VmQuestionAnswer) + */ + @POST + @Path("/question/action/answer") + @Produces(VM_PENDING_ANSWER) + @Consumes + @JAXBResponseParser + ListenableFuture answerQuestion(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer); + + /** + * @see VAppClient#getRuntimeInfoSection(URI) + */ + @GET + @Path("/runtimeInfoSection") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getRuntimeInfoSection(@EndpointParam URI vmURI); + + /** + * @see VAppClient#getScreenImage(URI) + */ + @GET + @Path("/screen") + @Consumes(ANY_IMAGE) + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + @ResponseParser(ReturnPayloadBytes.class) + ListenableFuture getScreenImage(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#getScreenTicket(URI) + */ + @POST + @Path("/screen/action/acquireTicket") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getScreenTicket(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#getStartupSection(URI) + */ + @GET + @Path("/startupSection") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getStartupSection(@EndpointParam URI vAppURI); + + /** + * @see VAppClient#modifyStartupSection(URI, StartupSection) + */ + @PUT + @Path("/startupSection") + @Produces(STARTUP_SECTION) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyStartupSection(@EndpointParam URI vAppURI, + @BinderParam(BindToXMLPayload.class) StartupSection section); + + /** + * @see VAppClient#getVirtualHardwareSection(URI) + */ + @GET + @Path("/virtualHardwareSection") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getVirtualHardwareSection(@EndpointParam URI vmURI); + + /** + * @see VAppClient#modifyVirtualHardwareSection(URI, VirtualHardwareSection) + */ + @PUT + @Path("/virtualHardwareSection") + @Produces(VIRTUAL_HARDWARE_SECTION) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyVirtualHardwareSection(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) VirtualHardwareSection section); + + /** + * @see VAppClient#getVirtualHardwareSectionCpu(URI) + */ + @GET + @Path("/virtualHardwareSection/cpu") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getVirtualHardwareSectionCpu(@EndpointParam URI vmURI); + + /** + * @see VAppClient#modifyVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData) + */ + @PUT + @Path("/virtualHardwareSection/cpu") + @Produces(OVF_RASD_ITEM) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyVirtualHardwareSectionCpu(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) RasdItem rasd); + + /** + * @see VAppClient#getVirtualHardwareSectionDisks(URI) + */ + @GET + @Path("/virtualHardwareSection/disks") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getVirtualHardwareSectionDisks(@EndpointParam URI vmURI); + + /** + * @see VAppClient#modifyVirtualHardwareSectionDisks(URI, RasdItemsList) + */ + @PUT + @Path("/virtualHardwareSection/disks") + @Produces(OVF_RASD_ITEMS_LIST) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyVirtualHardwareSectionDisks(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); + + /** + * @see VAppClient#getVirtualHardwareSectionMedia(URI) + */ + @GET + @Path("/virtualHardwareSection/media") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getVirtualHardwareSectionMedia(@EndpointParam URI vmURI); + + /** + * @see VAppClient#getVirtualHardwareSectionMemory(URI) + */ + @GET + @Path("/virtualHardwareSection/memory") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getVirtualHardwareSectionMemory(@EndpointParam URI vmURI); + + /** + * @see VAppClient#modifyVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData) + */ + @PUT + @Path("/virtualHardwareSection/memory") + @Produces(OVF_RASD_ITEM) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyVirtualHardwareSectionMemory(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) RasdItem rasd); + + /** + * @see VAppClient#getVirtualHardwareSectionNetworkCards(URI) + */ + @GET + @Path("/virtualHardwareSection/networkCards") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI); + + /** + * @see VAppClient#modifyVirtualHardwareSectionNetworkCards(URI, RasdItemsList) + */ + @PUT + @Path("/virtualHardwareSection/networkCards") + @Produces(OVF_RASD_ITEMS_LIST) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); + + /** + * @see VAppClient#getVirtualHardwareSectionSerialPorts(URI) + */ + @GET + @Path("/virtualHardwareSection/serialPorts") + @Consumes + @JAXBResponseParser + @ExceptionParser(ReturnNullOnNotFoundOr404.class) + ListenableFuture getVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI); + + /** + * @see VAppClient#modifyVirtualHardwareSectionSerialPorts(URI, RasdItemsList) + */ + @PUT + @Path("/virtualHardwareSection/serialPorts") + @Produces(OVF_RASD_ITEMS_LIST) + @Consumes(TASK) + @JAXBResponseParser + ListenableFuture modifyVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); + + /** + * @return asynchronous access to {@link Metadata} features + */ + @Delegate + MetadataAsyncClient.Writeable getMetadataClient(); + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmClient.java new file mode 100644 index 0000000000..e927ec9e37 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmClient.java @@ -0,0 +1,794 @@ +/* + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.vcloud.director.v1_5.features; + +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.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. + * + * @author grkvlt@apache.org + * @see VAppAsyncClient + * @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: + *
      + *
    • {@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. + *
    • {@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. + *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#RESOLVED RESOLVED(1)} - + * Entity is resolved. + *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#DEPLOYED DEPLOYED(2)} - + * Entity is deployed. + *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#SUSPENDED SUSPENDED(3)} - + * All VMs of the vApp are suspended. + *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_ON POWERED_ON(4)} - + * All VMs of the vApp are powered on. + *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#WAITING_FOR_INPUT WAITING_FOR_INPUT(5)} - + * VM is pending response on a question. + *
    • {@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. + *
    • {@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. + *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_OFF POWERED_OFF(8)} - + * All VMs of the vApp are powered off. + *
    • {@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. + *
    • {@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 + *
    + * + *
    +    * GET /vApp/{id}
    +    * 
    + * + * @since 0.9 + */ + VApp getVApp(URI vAppURI); + + /** + * Modifies the name/description of a vApp/VM. + * + *
    +    * PUT /vApp/{id}
    +    * 
    + * + * @since 0.9 + */ + Task modifyVApp(URI vAppURI, VApp vApp); + + /** + * Deletes a vApp/VM. + * + *
    +    * DELETE /vApp/{id}
    +    * 
    + * + * @since 0.9 + */ + Task deleteVApp(URI vAppURI); + + /** + * Consolidates a vm. + * + *
    +    * POST /vApp/{id}/action/consolidate
    +    * 
    + * + * @since 1.5 + */ + Task consolidateVm(URI vAppURI); + + /** + * Modifies the control access of a vApp. + * + *
    +    * POST /vApp/{id}/action/controlAccess
    +    * 
    + * + * @since 0.9 + */ + ControlAccessParams modifyControlAccess(URI vAppURI, ControlAccessParams 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. + * + *
    +    * POST /vApp/{id}/action/deploy
    +    * 
    + * + * @since 0.9 + */ + 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. + * + *
    +    * POST /vApp/{id}/action/discardSuspendedState
    +    * 
    + * + * @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. + * + *
    +    * POST /vApp/{id}/action/enterMaintenanceMode
    +    * 
    + * + * @since 1.5 + */ + void enterMaintenanceMode(URI vAppURI); + + /** + * Take the vApp out of maintenance mode. + * + *
    +    * POST /vApp/{id}/action/exitMaintenanceMode
    +    * 
    + * + * @since 1.5 + */ + void exitMaintenanceMode(URI vAppURI); + + /** + * Installs VMware tools to the virtual machine. + * + * It should be running in order for them to be installed. + * + *
    +    * POST /vApp/{id}/action/installVMwareTools
    +    * 
    + * + * @since 1.5 + */ + Task installVMwareTools(URI vAppURI); + + /** + * 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. + * + *
    +    * POST /vApp/{id}/action/recomposeVApp
    +    * 
    + * + * @since 1.0 + */ + Task recompose(URI vAppURI, RecomposeVAppParams params); + + /** + * Relocates a vm. + * + *
    +    * POST /vApp/{id}/action/relocate
    +    * 
    + * + * @since 1.5 + */ + Task relocateVm(URI vAppURI, 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. + * + *
    +    * POST /vApp/{id}/action/undeploy
    +    * 
    + * + * @since 0.9 + */ + Task undeploy(URI vAppURI, UndeployVAppParams params); + + /** + * Upgrade virtual hardware version of a VM to the highest supported virtual + * hardware version of provider vDC where the VM locates. + * + *
    +    * POST /vApp/{id}/action/upgradeHardwareVersion
    +    * 
    + * + * @since 1.5 + */ + Task upgradeHardwareVersion(URI vAppURI); + + /** + * 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. + * + *
    +    * GET /vApp/{id}/controlAccess
    +    * 
    + * + * @since 0.9 + */ + ControlAccessParams getControlAccess(URI vAppURI); + + /** + * 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. + * + *
    +    * POST /vApp/{id}/power/action/powerOff
    +    * 
    + * + * @since 0.9 + */ + Task powerOff(URI vAppURI); + + /** + * 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. + * + *
    +    * POST /vApp/{id}/power/action/powerOn
    +    * 
    + * + * @since 0.9 + */ + Task powerOn(URI vAppURI); + + /** + * Reboots a vApp/VM. + * + * The vApp/VM should be started in order to reboot it. + * + *
    +    * POST /vApp/{id}/power/action/reboot
    +    * 
    + * + * @since 0.9 + */ + Task reboot(URI vAppURI); + + /** + * 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. + * + *
    +    * POST /vApp/{id}/power/action/reset
    +    * 
    + * + * @since 0.9 + */ + Task reset(URI vAppURI); + + /** + * 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. + * + *
    +    * POST /vApp/{id}/power/action/shutdown
    +    * 
    + * + * @since 0.9 + */ + Task shutdown(URI vAppURI); + + /** + * 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. + * + *
    +    * POST /vApp/{id}/power/action/suspend
    +    * 
    + * + * @since 0.9 + */ + Task suspend(URI vAppURI); + + /** + * Retrieves the guest customization section of a VM. + * + *
    +    * GET /vApp/{id}/guestCustomizationSection
    +    * 
    + * + * @since 1.0 + */ + GuestCustomizationSection getGuestCustomizationSection(URI vmURI); + + /** + * Modifies the guest customization section of a VM. + * + *
    +    * PUT /vApp/{id}/guestCustomizationSection
    +    * 
    + * + * @since 1.0 + */ + Task modifyGuestCustomizationSection(URI vmURI, GuestCustomizationSection section); + + /** + * Retrieves the lease settings section of a vApp or vApp template. + * + *
    +    * GET /vApp/{id}/leaseSettingsSection
    +    * 
    + * + * @since 0.9 + */ + LeaseSettingsSection getLeaseSettingsSection(URI vAppURI); + + /** + * Modifies the lease settings section of a vApp or vApp template. + * + *
    +    * PUT /vApp/{id}/leaseSettingsSection
    +    * 
    + * + * @since 0.9 + */ + Task modifyLeaseSettingsSection(URI vAppURI, LeaseSettingsSection section); + + /** + * Ejects a media from a VM. + * + *
    +    * PUT /vApp/{id}/media/action/ejectMedia
    +    * 
    + * + * @since 0.9 + */ + Task ejectMedia(URI vmURI, MediaInsertOrEjectParams mediaParams); + + /** + * Inserts a media into a VM. + * + *
    +    * PUT /vApp/{id}/media/action/insertMedia
    +    * 
    + * + * @since 0.9 + */ + Task insertMedia(URI vmURI, MediaInsertOrEjectParams mediaParams); + + /** + * Retrieves the network config section of a vApp or vApp template. + * + *
    +    * GET /vApp/{id}/networkConfigSection
    +    * 
    + * + * @since 0.9 + */ + NetworkConfigSection getNetworkConfigSection(URI vmURI); + + /** + * Modifies the network config section of a vApp. + * + *
    +    * PUT /vApp/{id}/networkConfigSection
    +    * 
    + * + * @since 0.9 + */ + Task modifyNetworkConfigSection(URI vmURI, NetworkConfigSection section); + + /** + * Retrieves the network connection section of a VM. + * + *
    +    * GET /vApp/{id}/networkConnectionSection
    +    * 
    + * + * @since 0.9 + */ + NetworkConnectionSection getNetworkConnectionSection(URI vmURI); + + /** + * Modifies the network connection section of a VM. + * + *
    +    * PUT /vApp/{id}/networkConnectionSection
    +    * 
    + * + * @since 0.9 + */ + Task modifyNetworkConnectionSection(URI vmURI, NetworkConnectionSection section); + + /** + * Retrieves the network section of a vApp or vApp template. + * + *
    +    * GET /vApp/{id}/networkSection
    +    * 
    + * + * @since 0.9 + */ + NetworkSection getNetworkSection(URI vAppURI); + + /** + * Retrieves the operating system section of a VM. + * + *
    +    * GET /vApp/{id}/operatingSystemSection
    +    * 
    + * + * @since 0.9 + */ + OperatingSystemSection getOperatingSystemSection(URI vmURI); + + /** + * Modifies the operating system section of a VM. + * + *
    +    * PUT /vApp/{id}/operatingSystemSection
    +    * 
    + * + * @since 0.9 + */ + Task modifyOperatingSystemSection(URI vmURI, OperatingSystemSection section); + + /** + * Retrieves the owner of a vApp. + * + *
    +    * GET /vApp/{id}/owner
    +    * 
    + * + * @since 1.5 + */ + Owner getOwner(URI vAppURI); + + /** + * Changes VApp owner. + * + *
    +    * PUT /vApp/{id}/owner
    +    * 
    + * + * @since 1.5 + */ + void modifyOwner(URI vAppURI, Owner owner); + + /** + * Retrieves VAppTemplate/VM product sections. + * + *
    +    * GET /vApp/{id}/productSections
    +    * 
    + * + * @since 1.5 + */ + ProductSectionList getProductSections(URI vAppURI); + + /** + * Modifies the product section information of a vApp/VM. + * + *
    +    * PUT /vApp/{id}/productSections
    +    * 
    + * + * @since 1.5 + */ + Task modifyProductSections(URI vAppURI, ProductSectionList sectionList); + + /** + * Retrieves a pending question for a 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. + * + *
    +    * GET /vApp/{id}/question
    +    * 
    + * + * @since 0.9 + */ + VmPendingQuestion getPendingQuestion(URI vAppURI); + + /** + * Answer on a pending question. + * + * The answer IDs of choice and question should match the ones returned from operation {@link #getPendingQuestion(URI)}. + * + *
    +    * POST /vApp/{id}/question/action/answer
    +    * 
    + * + * @since 0.9 + */ + void answerQuestion(URI vAppURI, VmQuestionAnswer answer); + + /** + * Retrieves the runtime info section of a VM. + * + *
    +    * GET /vApp/{id}/runtimeInfoSection
    +    * 
    + * + * @since 1.5 + */ + RuntimeInfoSection getRuntimeInfoSection(URI vmURI); + + /** + * Retrieves the thumbnail of the screen of a VM. + * + * The content type of the response may vary (e.g. {@code image/png}, {@code image/gif}). + * + *
    +    * GET /vApp/{id}/screen
    +    * 
    + * + * @since 0.9 + */ + byte[] getScreenImage(URI vAppURI); + + /** + * Retrieve a screen ticket for remote console connection to a 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". + * You can use that link to request a screen ticket that you can use with the vmware-vmrc utility to open a VMware Remote + * Console for the virtual machine represented by that VM element. The vApp should be running to get a valid screen ticket. + * + *
    +    * GET /vApp/{id}/screen/action/acquireTicket
    +    * 
    + * + * @since 0.9 + */ + ScreenTicket getScreenTicket(URI vAppURI); + + /** + * Retrieves the startup section of a VApp. + * + *
    +    * GET /vApp/{id}/startupSection
    +    * 
    + * + * @since 0.9 + */ + StartupSection getStartupSection(URI vAppURI); + + /** + * Modifies the startup section of a VApp. + * + *
    +    * PUT /vApp/{id}/startupSection
    +    * 
    + * + * @since 0.9 + */ + Task modifyStartupSection(URI vAppURI, StartupSection section); + + /** + * Retrieves the virtual hardware section of a VM. + * + *
    +    * GET /vApp/{id}/virtualHardwareSection
    +    * 
    + * + * @since 0.9 + */ + VirtualHardwareSection getVirtualHardwareSection(URI vmURI); + + /** + * Modifies the virtual hardware section of a VM. + * + *
    +    * PUT /vApp/{id}/virtualHardwareSection
    +    * 
    + * + * @since 0.9 + */ + Task modifyVirtualHardwareSection(URI vmURI, VirtualHardwareSection section); + + /** + * Retrieves the CPU properties in virtual hardware section of a VM. + * + *
    +    * GET /vApp/{id}/virtualHardwareSection/cpu
    +    * 
    + * + * @since 0.9 + */ + RasdItem getVirtualHardwareSectionCpu(URI vmURI); + + /** + * Modifies the CPU properties in virtual hardware section of a VM. + * + *
    +    * PUT /vApp/{id}/virtualHardwareSection/cpu
    +    * 
    + * + * @since 0.9 + */ + Task modifyVirtualHardwareSectionCpu(URI vmURI, RasdItem rasd); + + /** + * Retrieves a list of ResourceAllocationSettingData items for disks from virtual hardware section of a VM. + * + *
    +    * GET /vApp/{id}/virtualHardwareSection/disks
    +    * 
    + * + * @since 0.9 + */ + RasdItemsList getVirtualHardwareSectionDisks(URI vmURI); + + /** + * Modifies the disks list in virtual hardware section of a VM. + * + *
    +    * PUT /vApp/{id}/virtualHardwareSection/disks
    +    * 
    + * + * @since 0.9 + */ + Task modifyVirtualHardwareSectionDisks(URI vmURI, RasdItemsList rasdItemsList); + + /** + * Retrieves the list of ResourceAllocationSettingData items that represents the floppies and CD/DVD drives in a VM. + * + *
    +    * GET /vApp/{id}/virtualHardwareSection/media
    +    * 
    + * + * @since 0.9 + */ + RasdItemsList getVirtualHardwareSectionMedia(URI vmURI); + + /** + * Retrieves the ResourceAllocationSettingData item that contains memory information from virtual hardware section of a VM. + * + *
    +    * GET /vApp/{id}/virtualHardwareSection/memory
    +    * 
    + * + * @since 0.9 + */ + RasdItem getVirtualHardwareSectionMemory(URI vmURI); + + /** + * Modifies the memory properties in virtual hardware section of a VM. + * + *
    +    * PUT /vApp/{id}/virtualHardwareSection/memory
    +    * 
    + * + * @since 0.9 + */ + Task modifyVirtualHardwareSectionMemory(URI vmURI, RasdItem rasd); + + /** + * Retrieves a list of ResourceAllocationSettingData items for network cards from virtual hardware section of a VM. + * + *
    +    * GET /vApp/{id}/virtualHardwareSection/networkCards
    +    * 
    + * + * @since 0.9 + */ + RasdItemsList getVirtualHardwareSectionNetworkCards(URI vmURI); + + /** + * Modifies the network cards list in virtual hardware section of a VM. + * + *
    +    * PUT /vApp/{id}/virtualHardwareSection/networkCards
    +    * 
    + * + * @since 0.9 + */ + Task modifyVirtualHardwareSectionNetworkCards(URI vmURI, RasdItemsList rasdItemsList); + + /** + * Retrieves a list of ResourceAllocationSettingData items for serial ports from virtual hardware section of a VM. + * + *
    +    * GET /vApp/{id}/virtualHardwareSection/serialPorts
    +    * 
    + * + * @since 1.5 + */ + RasdItemsList getVirtualHardwareSectionSerialPorts(URI vmURI); + + /** + * Modifies the serial ports list in virtual hardware section of a VM. + * + *
    +    * PUT /vApp/{id}/virtualHardwareSection/serialPorts
    +    * 
    + * + * @since 1.5 + */ + Task modifyVirtualHardwareSectionSerialPorts(URI vmURI, RasdItemsList rasdItemsList); + + /** + * @return synchronous access to {@link Metadata} features + */ + @Delegate + MetadataClient.Writeable getMetadataClient(); +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncClient.java index 90b848b5e9..60cd65bfde 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorAsyncClient.java @@ -29,6 +29,7 @@ import org.jclouds.vcloud.director.v1_5.features.UploadAsyncClient; import org.jclouds.vcloud.director.v1_5.features.VAppAsyncClient; import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient; import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.VmAsyncClient; import com.google.inject.Provides; @@ -105,4 +106,10 @@ public interface VCloudDirectorAsyncClient { */ @Delegate VAppTemplateAsyncClient getVAppTemplateClient(); + + /** + * @return asynchronous access to {@link Vm} features + */ + @Delegate + VmAsyncClient getVmClient(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorClient.java index fda7a3686e..cf0c5803bc 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorClient.java @@ -33,6 +33,7 @@ import org.jclouds.vcloud.director.v1_5.features.UploadClient; 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 com.google.inject.Provides; @@ -109,4 +110,10 @@ public interface VCloudDirectorClient { */ @Delegate VAppTemplateClient getVAppTemplateClient(); + + /** + * @return synchronous access to {@link Vm} features + */ + @Delegate + VmClient getVmClient(); } From a13e63c0ef7421ab029cbdefde5ee7a85bd790aa Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Thu, 26 Apr 2012 02:46:36 +0100 Subject: [PATCH 2/4] Add VmClient tests from existing VAppClient tests --- .../director/v1_5/features/VmAsyncClient.java | 304 +--- .../director/v1_5/features/VmClient.java | 443 ++---- .../v1_5/AbstractVAppClientLiveTest.java | 139 +- .../v1_5/features/VAppClientExpectTest.java | 536 ------- .../v1_5/features/VAppClientLiveTest.java | 546 +------ .../features/VAppTemplateClientLiveTest.java | 2 +- .../v1_5/features/VmClientExpectTest.java | 1277 +++++++++++++++++ .../v1_5/features/VmClientLiveTest.java | 1015 +++++++++++++ 8 files changed, 2548 insertions(+), 1714 deletions(-) create mode 100644 labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientExpectTest.java create mode 100644 labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientLiveTest.java diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncClient.java index aea8247d04..f5169f262f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncClient.java @@ -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 getVApp(@EndpointParam URI vAppURI); + ListenableFuture getVm(@EndpointParam URI vmURI); /** - * @see VAppClient#modifyVApp(URI, VApp) + * @see VmClient#modifyVm(URI, Vm) */ @PUT - @Produces(VAPP) + @Produces(VM) @Consumes(TASK) @JAXBResponseParser - ListenableFuture modifyVApp(@EndpointParam URI vAppURI, - @BinderParam(BindToXMLPayload.class) VApp vApp); + ListenableFuture modifyVm(@EndpointParam URI vmURI, + @BinderParam(BindToXMLPayload.class) Vm vApp); /** - * @see VAppClient#deleteVApp(URI) + * @see VmClient#deleteVm(URI) */ @DELETE @Consumes(TASK) @JAXBResponseParser - ListenableFuture deleteVApp(@EndpointParam URI vAppURI); + ListenableFuture deleteVm(@EndpointParam URI vmURI); /** - * @see VAppClient#consolidateVm(URI) + * @see VmClient#consolidateVm(URI) */ @POST @Path("/action/consolidate") @Consumes(TASK) @JAXBResponseParser - ListenableFuture consolidateVm(@EndpointParam URI vAppURI); + ListenableFuture consolidateVm(@EndpointParam URI vmURI); /** - * @see VAppClient#modifyControlAccess(URI, ControlAccessParams) - */ - @POST - @Path("/action/controlAccess") - @Produces(CONTROL_ACCESS) - @Consumes(CONTROL_ACCESS) - @JAXBResponseParser - ListenableFuture 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 deploy(@EndpointParam URI vAppURI, + ListenableFuture 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 discardSuspendedState(@EndpointParam URI vAppURI); + ListenableFuture discardSuspendedState(@EndpointParam URI vmURI); /** - * @see VAppClient#enterMaintenanceMode(URI) - */ - @POST - @Path("/action/enterMaintenanceMode") - @Consumes - @JAXBResponseParser - ListenableFuture enterMaintenanceMode(@EndpointParam URI vAppURI); - - /** - * @see VAppClient#exitMaintenanceMode(URI) - */ - @POST - @Path("/action/exitMaintenanceMode") - @Consumes - @JAXBResponseParser - ListenableFuture exitMaintenanceMode(@EndpointParam URI vAppURI); - - /** - * @see VAppClient#installVMwareTools(URI) + * @see VmClient#installVMwareTools(URI) */ @POST @Path("/action/installVMwareTools") @Consumes(TASK) @JAXBResponseParser - ListenableFuture installVMwareTools(@EndpointParam URI vAppURI); + ListenableFuture installVMwareTools(@EndpointParam URI vmURI); /** - * @see VAppClient#recompose(URI, RecomposeVAppParams) - */ - @POST - @Path("/action/recomposeVApp") - @Produces(RECOMPOSE_VAPP_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture 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 relocateVm(@EndpointParam URI vAppURI, + ListenableFuture 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 undeploy(@EndpointParam URI vAppURI, + ListenableFuture 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 upgradeHardwareVersion(@EndpointParam URI vAppURI); + ListenableFuture upgradeHardwareVersion(@EndpointParam URI vmURI); /** - * @see VAppClient#getControlAccess(URI) - */ - @GET - @Path("/controlAccess") - @Consumes(CONTROL_ACCESS) - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getControlAccess(@EndpointParam URI vAppURI); - - /** - * @see VAppClient#powerOff(URI) + * @see VmClient#powerOff(URI) */ @POST @Path("/power/action/powerOff") @Consumes(TASK) @JAXBResponseParser - ListenableFuture powerOff(@EndpointParam URI vAppURI); + ListenableFuture powerOff(@EndpointParam URI vmURI); /** - * @see VAppClient#powerOn(URI) + * @see VmClient#powerOn(URI) */ @POST @Path("/power/action/powerOn") @Consumes(TASK) @JAXBResponseParser - ListenableFuture powerOn(@EndpointParam URI vAppURI); + ListenableFuture powerOn(@EndpointParam URI vmURI); /** - * @see VAppClient#reboot(URI) + * @see VmClient#reboot(URI) */ @POST @Path("/power/action/powerOff") @Consumes(TASK) @JAXBResponseParser - ListenableFuture reboot(@EndpointParam URI vAppURI); + ListenableFuture reboot(@EndpointParam URI vmURI); /** - * @see VAppClient#reset(URI) + * @see VmClient#reset(URI) */ @POST @Path("/power/action/reset") @Consumes(TASK) @JAXBResponseParser - ListenableFuture reset(@EndpointParam URI vAppURI); + ListenableFuture reset(@EndpointParam URI vmURI); /** - * @see VAppClient#shutdown(URI) + * @see VmClient#shutdown(URI) */ @POST @Path("/power/action/shutdown") @Consumes(TASK) @JAXBResponseParser - ListenableFuture shutdown(@EndpointParam URI vAppURI); + ListenableFuture shutdown(@EndpointParam URI vmURI); /** - * @see VAppClient#suspend(URI) + * @see VmClient#suspend(URI) */ @POST @Path("/power/action/suspend") @Consumes(TASK) @JAXBResponseParser - ListenableFuture suspend(@EndpointParam URI vAppURI); + ListenableFuture suspend(@EndpointParam URI vmURI); /** - * @see VAppClient#getGuestCustomizationSection(URI) + * @see VmClient#getGuestCustomizationSection(URI) */ @GET @Path("/guestCustomizationSection") @@ -306,7 +243,7 @@ public interface VmAsyncClient { ListenableFuture 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 getLeaseSettingsSection(@EndpointParam URI vAppURI); - - /** - * @see VAppClient#modifyLeaseSettingsSection(URI, LeaseSettingsSection) - */ - @PUT - @Path("/leaseSettingsSection") - @Produces(LEASE_SETTINGS_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture 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 getNetworkConfigSection(@EndpointParam URI vAppURI); - - /** - * @see VAppClient#modifyNetworkConfigSection(URI, NetworkConfigSection) - */ - @PUT - @Path("/networkConfigSection") - @Produces(NETWORK_CONFIG_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture 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 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 getNetworkSection(@EndpointParam URI vAppURI); - - /** - * @see VAppClient#getOperatingSystemSection(URI) + * @see VmClient#getOperatingSystemSection(URI) */ @GET @Path("/operatingSystemSection") @@ -422,7 +307,7 @@ public interface VmAsyncClient { ListenableFuture 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 getOwner(@EndpointParam URI vAppURI); - - /** - * @see VAppClient#modifyOwner(URI, Owner) - */ - @PUT - @Path("/owner") - @Produces(OWNER) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture 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 getProductSections(@EndpointParam URI vAppURI); + ListenableFuture 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 modifyProductSections(@EndpointParam URI vAppURI, + ListenableFuture 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 getPendingQuestion(@EndpointParam URI vAppURI); + ListenableFuture 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 answerQuestion(@EndpointParam URI vAppURI, + ListenableFuture 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 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 getScreenImage(@EndpointParam URI vAppURI); + ListenableFuture getScreenImage(@EndpointParam URI vmURI); /** - * @see VAppClient#getScreenTicket(URI) + * @see VmClient#getScreenTicket(URI) */ @POST @Path("/screen/action/acquireTicket") @Consumes @JAXBResponseParser @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getScreenTicket(@EndpointParam URI vAppURI); + ListenableFuture getScreenTicket(@EndpointParam URI vmURI); /** - * @see VAppClient#getStartupSection(URI) - */ - @GET - @Path("/startupSection") - @Consumes - @JAXBResponseParser - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getStartupSection(@EndpointParam URI vAppURI); - - /** - * @see VAppClient#modifyStartupSection(URI, StartupSection) - */ - @PUT - @Path("/startupSection") - @Produces(STARTUP_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture 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 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 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 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 getVirtualHardwareSectionMedia(@EndpointParam URI vmURI); /** - * @see VAppClient#getVirtualHardwareSectionMemory(URI) + * @see VmClient#getVirtualHardwareSectionMemory(URI) */ @GET @Path("/virtualHardwareSection/memory") @@ -630,7 +473,7 @@ public interface VmAsyncClient { ListenableFuture 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 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 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(); - } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmClient.java index e927ec9e37..e2c9de904a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmClient.java @@ -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: - *
      - *
    • {@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. - *
    • {@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. - *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#RESOLVED RESOLVED(1)} - - * Entity is resolved. - *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#DEPLOYED DEPLOYED(2)} - - * Entity is deployed. - *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#SUSPENDED SUSPENDED(3)} - - * All VMs of the vApp are suspended. - *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_ON POWERED_ON(4)} - - * All VMs of the vApp are powered on. - *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#WAITING_FOR_INPUT WAITING_FOR_INPUT(5)} - - * VM is pending response on a question. - *
    • {@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. - *
    • {@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. - *
    • {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_OFF POWERED_OFF(8)} - - * All VMs of the vApp are powered off. - *
    • {@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. - *
    • {@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 - *
    - * - *
    -    * GET /vApp/{id}
    -    * 
    + * 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. - * - *
    -    * PUT /vApp/{id}
    -    * 
    + * 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. - * - *
    -    * DELETE /vApp/{id}
    -    * 
    + * 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}. * *
         * 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.
    -    *
    -    * 
    -    * POST /vApp/{id}/action/controlAccess
    -    * 
    + * 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. - * - *
    -    * POST /vApp/{id}/action/deploy
    -    * 
    + * 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. - * - *
    -    * POST /vApp/{id}/action/discardSuspendedState
    -    * 
    - * - * @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. - * - *
    -    * POST /vApp/{id}/action/enterMaintenanceMode
    -    * 
    - * - * @since 1.5 - */ - void enterMaintenanceMode(URI vAppURI); - - /** - * Take the vApp out of maintenance mode. - * - *
    -    * POST /vApp/{id}/action/exitMaintenanceMode
    -    * 
    - * - * @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. - * - *
    -    * POST /vApp/{id}/action/recomposeVApp
    -    * 
    - * - * @since 1.0 - */ - Task recompose(URI vAppURI, RecomposeVAppParams params); - - /** - * Relocates a vm. + * Relocates a {@link Vm}. * *
         * 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.
    -    *
    -    * 
    -    * POST /vApp/{id}/action/undeploy
    -    * 
    + * 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. - * - *
    -    * GET /vApp/{id}/controlAccess
    -    * 
    + * 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. - * - *
    -    * POST /vApp/{id}/power/action/powerOff
    -    * 
    + * 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. - * - *
    -    * POST /vApp/{id}/power/action/powerOn
    -    * 
    + * 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. - * - *
    -    * POST /vApp/{id}/power/action/reboot
    -    * 
    + * 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. - * - *
    -    * POST /vApp/{id}/power/action/reset
    -    * 
    + * 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. - * - *
    -    * POST /vApp/{id}/power/action/shutdown
    -    * 
    + * 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. - * - *
    -    * POST /vApp/{id}/power/action/suspend
    -    * 
    - * - * @since 0.9 - */ - Task suspend(URI vAppURI); - - /** - * Retrieves the guest customization section of a VM. + * Retrieves the guest customization section of a {@link Vm}. * *
         * GET /vApp/{id}/guestCustomizationSection
         * 
    * * @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}. * *
         * 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.
    -    *
    -    * 
    -    * GET /vApp/{id}/leaseSettingsSection
    -    * 
    - * - * @since 0.9 - */ - LeaseSettingsSection getLeaseSettingsSection(URI vAppURI); - - /** - * Modifies the lease settings section of a vApp or vApp template. - * - *
    -    * PUT /vApp/{id}/leaseSettingsSection
    -    * 
    - * - * @since 0.9 - */ - Task modifyLeaseSettingsSection(URI vAppURI, LeaseSettingsSection section); - - /** - * Ejects a media from a VM. + * Ejects media from a {@link Vm}. * *
         * 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}.
         *
         * 
         * 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.
    -    *
    -    * 
    -    * GET /vApp/{id}/networkConfigSection
    -    * 
    - * - * @since 0.9 - */ - NetworkConfigSection getNetworkConfigSection(URI vmURI); - - /** - * Modifies the network config section of a vApp. - * - *
    -    * PUT /vApp/{id}/networkConfigSection
    -    * 
    - * - * @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}. * *
         * 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}.
         *
         * 
         * 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.
    -    *
    -    * 
    -    * GET /vApp/{id}/networkSection
    -    * 
    - * - * @since 0.9 - */ - NetworkSection getNetworkSection(URI vAppURI); - - /** - * Retrieves the operating system section of a VM. + * Retrieves the operating system section of a {@link Vm}. * *
         * 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}.
         *
         * 
         * PUT /vApp/{id}/operatingSystemSection
    @@ -511,51 +284,23 @@ public interface VmClient {
        Task modifyOperatingSystemSection(URI vmURI, OperatingSystemSection section);
     
        /**
    -    * Retrieves the owner of a vApp.
    -    *
    -    * 
    -    * GET /vApp/{id}/owner
    -    * 
    + * Retrieves {@link Vm} product sections. * * @since 1.5 + * @see VAppClient#getProductSections(URI) */ - Owner getOwner(URI vAppURI); + ProductSectionList getProductSections(URI vmURI); /** - * Changes VApp owner. - * - *
    -    * PUT /vApp/{id}/owner
    -    * 
    + * 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. - * - *
    -    * GET /vApp/{id}/productSections
    -    * 
    - * - * @since 1.5 - */ - ProductSectionList getProductSections(URI vAppURI); - - /** - * Modifies the product section information of a vApp/VM. - * - *
    -    * PUT /vApp/{id}/productSections
    -    * 
    - * - * @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}. * *
         * 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.
    -    *
    -    * 
    -    * GET /vApp/{id}/startupSection
    -    * 
    - * - * @since 0.9 - */ - StartupSection getStartupSection(URI vAppURI); - - /** - * Modifies the startup section of a VApp. - * - *
    -    * PUT /vApp/{id}/startupSection
    -    * 
    - * - * @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}. * *
         * 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}.
         *
         * 
         * 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}.
         *
         * 
         * 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}.
         *
         * 
         * 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}.
         *
         * 
         * 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}.
         *
         * 
         * 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}.
         *
         * 
         * 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}.
         *
         * 
         * 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}.
         *
         * 
         * 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}.
         *
         * 
         * 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}.
         *
         * 
         * 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}.
         *
         * 
         * 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}.
         *
         * 
         * 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();
    diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java
    index a0d47cb00c..8461649e28 100644
    --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java
    +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java
    @@ -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 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()));
        }
     
        /**
    diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java
    index 700fd453ca..6d9cbeb777 100644
    --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java
    +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java
    @@ -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()
    diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java
    index edb255169c..abb2fa6c51 100644
    --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java
    +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java
    @@ -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() {
    -         @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() {
    -         @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 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 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 oldItems = oldSection.getItems();
    -      Set newItems = Sets.newLinkedHashSet(oldItems);
    -      ResourceAllocationSettingData oldMemory = Iterables.find(oldItems, new Predicate() {
    -         @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() {
    -		         @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 newItems = new ArrayList(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-");
    diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java
    index 85b5607211..ccf16cd99c 100644
    --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java
    +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java
    @@ -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())
    diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientExpectTest.java
    new file mode 100644
    index 0000000000..66c50af7c8
    --- /dev/null
    +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientExpectTest.java
    @@ -0,0 +1,1277 @@
    +/*
    + * Licensed to jclouds, Inc. (jclouds) under one or more
    + * contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + *(Link.builder().regarding copyright ownership.  jclouds licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless(Link.builder().required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.jclouds.vcloud.director.v1_5.features;
    +
    +import static org.testng.Assert.assertEquals;
    +
    +import java.net.URI;
    +
    +import org.jclouds.dmtf.ovf.NetworkSection;
    +import org.jclouds.dmtf.ovf.StartupSection;
    +import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
    +import org.jclouds.vcloud.director.v1_5.domain.Error;
    +import org.jclouds.vcloud.director.v1_5.domain.Link;
    +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.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;
    +import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
    +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
    +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 VmClient} via its side effects.
    + * 
    + * @author grkvlt@apache.org
    + */
    +@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "VmClientExpectTest")
    +public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
    +   
    +   private String vmId = "vm-d0e2b6b9-4381-4ddc-9572-cdfae54059be";
    +   private URI vmURI = URI.create(endpoint + vmId);
    +   
    +   @BeforeClass
    +   public void before() {
    +   }
    +   
    +   @Test(enabled = false)//TODO
    +   public void testGetVm() {
    +      VCloudDirectorClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, 
    +            new VcloudHttpRequestPrimer()
    +               .apiCommand("GET", vmId)
    +               .acceptMedia(VCloudDirectorMediaType.VM)
    +               .httpRequestBuilder().build(), 
    +            new VcloudHttpResponsePrimer()
    +               .xmlFilePayload("/vm/vm.xml", VCloudDirectorMediaType.VM)
    +               .httpResponseBuilder().build());
    +      
    +      Vm expected = getVm();
    +
    +      assertEquals(client.getVmClient().getVm(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testModifyVm() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId)
    +            .xmlFilePayload("/vm/modifyVm.xml", VCloudDirectorMediaType.VM)
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vm/modifiedVm.xml", VCloudDirectorMediaType.VM)
    +            .httpResponseBuilder().build());
    +		         
    +		Vm modified = getVm();
    +		modified.setName("new-name");
    +		modified.setDescription("New Description");
    +		
    +		Task expected = modifyVmTask();
    +		
    +		assertEquals(client.getVmClient().modifyVm(vmURI, modified), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testDeleteVm() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("DELETE", vmId)
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vm/deleteVmTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +		
    +		Task expected = deleteVmTask();
    +		
    +		assertEquals(client.getVmClient().deleteVm(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testConsolidateVm() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/action/consolidate")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vm/consolidateVmTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +		
    +		Task expected = consolidateVmTask();
    +		
    +		assertEquals(client.getVmClient().consolidateVm(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testDeploy() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/action/deploy")
    +            .xmlFilePayload("/vm/deployParams.xml", VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS)
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/deployTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +      
    +      DeployVAppParams params = DeployVAppParams.builder()
    +            .build();
    +		
    +		Task expected = deployTask();
    +		
    +		assertEquals(client.getVmClient().deploy(vmURI, params), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testDiscardSuspendedState() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/action/discardSuspendedState")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/discardSuspendedStateTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +		
    +		Task expected = discardSuspendedStateTask();
    +		
    +		assertEquals(client.getVmClient().discardSuspendedState(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testInstallVMwareTools() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/action/installVMwareTools")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/installVMwareToolsTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +		
    +		Task expected = installVMwareToolsTask();
    +		
    +		assertEquals(client.getVmClient().installVMwareTools(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testRelocate() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/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.getVmClient().relocateVm(vmURI, params), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testUndeploy() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/action/undeploy")
    +            .xmlFilePayload("/vApp/undeployParams.xml", VCloudDirectorMediaType.UNDEPLOY_VAPP_PARAMS)
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/undeployTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +      
    +      UndeployVAppParams params = UndeployVAppParams.builder()
    +            .build();
    +		
    +		Task expected = undeployTask();
    +		
    +		assertEquals(client.getVmClient().undeploy(vmURI, params), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testUpgradeHardwareVersion() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/action/upgradeHardwareVersion")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/upgradeHardwareVersionTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +		
    +		Task expected = upgradeHardwareVersionTask();
    +		
    +		assertEquals(client.getVmClient().upgradeHardwareVersion(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testPowerOff() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/power/action/powerOff")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/powerOffTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +
    +      Task expected = powerOffTask();
    +
    +      assertEquals(client.getVmClient().powerOff(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testPowerOn() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/power/action/powerOn")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/powerOnTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +
    +      Task expected = powerOnTask();
    +
    +      assertEquals(client.getVmClient().powerOn(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testReboot() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/power/action/reboot")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/rebootTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +
    +      Task expected = rebootTask();
    +
    +      assertEquals(client.getVmClient().reboot(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testReset() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/power/action/reset")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/resetTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +
    +      Task expected = resetTask();
    +
    +      assertEquals(client.getVmClient().reset(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testShutdown() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/power/action/shutdown")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/shutdownTask.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +
    +      Task expected = shutdownTask();
    +
    +      assertEquals(client.getVmClient().shutdown(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testSuspend() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/power/action/suspend")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/suspend.xml", VCloudDirectorMediaType.TASK)
    +            .httpResponseBuilder().build());
    +		
    +		Task expected = suspendTask();
    +		
    +		assertEquals(client.getVmClient().suspend(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetGuestCustomizationSection() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/guestCustomizationSection")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getGuestCustomizationSection.xml", VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION)
    +            .httpResponseBuilder().build());
    +		
    +		GuestCustomizationSection expected = getGuestCustomizationSection();
    +		
    +		assertEquals(client.getVmClient().getGuestCustomizationSection(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testModifyGuestCustomizationSection() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/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.getVmClient().modifyGuestCustomizationSection(vmURI, section), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testEjectMedia() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/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.getVmClient().ejectMedia(vmURI, params), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testInsertMedia() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/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.getVmClient().insertMedia(vmURI, params), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetNetworkConnectionSection() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/networkConnectionSection")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getNetworkConnectionSection.xml", VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION)
    +            .httpResponseBuilder().build());
    +
    +      NetworkConnectionSection expected = getNetworkConnectionSection();
    +
    +         assertEquals(client.getVmClient().getNetworkConnectionSection(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testModifyNetworkConnectionSection() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/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.getVmClient().modifyNetworkConnectionSection(vmURI, section), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetOperatingSystemSection() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/operatingSystemSection")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getOperatingSystemSection.xml", VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION)
    +            .httpResponseBuilder().build());
    +
    +		OperatingSystemSection expected = getOperatingSystemSection();
    +		
    +		assertEquals(client.getVmClient().getOperatingSystemSection(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testModifyOperatingSystemSection() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/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.getVmClient().modifyOperatingSystemSection(vmURI, section), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetProductSections() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/productSections")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getProductSections.xml", VCloudDirectorMediaType.PRODUCT_SECTION_LIST)
    +            .httpResponseBuilder().build());
    +
    +         ProductSectionList expected = getProductSections();
    +
    +         assertEquals(client.getVmClient().getProductSections(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testModifyProductSections() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/productSections")
    +            .xmlFilePayload("/vApp/modifyProductSections.xml", VCloudDirectorMediaType.PRODUCT_SECTION_LIST)
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/modifyProductSections.xml", VCloudDirectorMediaType.VAPP)
    +            .httpResponseBuilder().build());
    +
    +         Task expected = modifyProductSectionsTask();
    +
    +         assertEquals(client.getVmClient().modifyProductSections(vmURI, null), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetPendingQuestion() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/question")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getPendingQuestion.xml", VCloudDirectorMediaType.VM_PENDING_QUESTION)
    +            .httpResponseBuilder().build());
    +
    +         VmPendingQuestion expected = getPendingQuestion();
    +
    +         assertEquals(client.getVmClient().getPendingQuestion(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testAnswerQuestion() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/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.getVmClient().answerQuestion(vmURI, answer);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetRuntimeInfoSection() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/runtimeInfoSection")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getRuntimeInfoSection.xml", VCloudDirectorMediaType.RUNTIME_INFO_SECTION)
    +            .httpResponseBuilder().build());
    +
    +      RuntimeInfoSection expected = getRuntimeInfoSection();
    +
    +      assertEquals(client.getVmClient().getRuntimeInfoSection(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetScreenImage() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/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.getVmClient().getScreenImage(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetScreenTicket() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("POST", vmId + "/screen/action/acquireTicket")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getScreenTicket.xml", VCloudDirectorMediaType.SCREEN_TICKET)
    +            .httpResponseBuilder().build());
    +		
    +		ScreenTicket expected = getScreenTicket();
    +		
    +		assertEquals(client.getVmClient().getScreenTicket(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetVirtualHardwareSection() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/virtualHardwareSection")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getVirtualHardwareSection.xml", VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION)
    +            .httpResponseBuilder().build());
    +
    +      VirtualHardwareSection expected = getVirtualHardwareSection();
    +
    +		assertEquals(client.getVmClient().getVirtualHardwareSection(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testModifyVirtualHardwareSection() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/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.getVmClient().modifyVirtualHardwareSection(vmURI, section), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetVirtualHardwareSectionCpu() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/virtualHardwareSection/cpu")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getVirtualHardwareSectionCpu.xml", VCloudDirectorMediaType.OVF_RASD_ITEM)
    +            .httpResponseBuilder().build());
    +
    +      RasdItem expected = getVirtualHardwareSectionCpu();
    +
    +         assertEquals(client.getVmClient().getVirtualHardwareSectionCpu(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testModifyVirtualHardwareSectionCpu() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("", vmId + "/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.getVmClient().modifyVirtualHardwareSectionCpu(vmURI, cpu), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetVirtualHardwareSectionDisks() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/virtualHardwareSection/disks")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getVirtualHardwareSectionDisks.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
    +            .httpResponseBuilder().build());
    +
    +         RasdItemsList expected = getVirtualHardwareSectionDisks();
    +
    +         assertEquals(client.getVmClient().getVirtualHardwareSectionDisks(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testModifyVirtualHardwareSectionDisks() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/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.getVmClient().modifyVirtualHardwareSectionDisks(vmURI, disks), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetVirtualHardwareSectionMedia() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/virtualHardwareSection/media")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getVirtualHardwareSectionMedia.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
    +            .httpResponseBuilder().build());
    +
    +      RasdItemsList expected = getVirtualHardwareSectionMedia();
    +
    +      assertEquals(client.getVmClient().getVirtualHardwareSectionMedia(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetVirtualHardwareSectionMemory() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/virtualHardwareSection/memory")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getVirtualHardwareSectionMemory.xml", VCloudDirectorMediaType.OVF_RASD_ITEM)
    +            .httpResponseBuilder().build());
    +
    +      RasdItem expected = getVirtualHardwareSectionMemory();
    +
    +         assertEquals(client.getVmClient().getVirtualHardwareSectionMemory(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testModifyVirtualHardwareSectionMemory() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/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.getVmClient().modifyVirtualHardwareSectionMemory(vmURI, memory), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetVirtualHardwareSectionNetworkCards() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/virtualHardwareSection/networkCards")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getVirtualHardwareSectionNetworkCards.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
    +            .httpResponseBuilder().build());
    +
    +         RasdItemsList expected = getVirtualHardwareSectionNetworkCards();
    +
    +         assertEquals(client.getVmClient().getVirtualHardwareSectionNetworkCards(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testModifyVirtualHardwareSectionNetworkCards() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/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.getVmClient().modifyVirtualHardwareSectionNetworkCards(vmURI, networkCards), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testGetVirtualHardwareSectionSerialPorts() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("GET", vmId + "/virtualHardwareSection/serialPorts")
    +            .acceptAnyMedia()
    +            .httpRequestBuilder().build(), 
    +         new VcloudHttpResponsePrimer()
    +            .xmlFilePayload("/vApp/getVirtualHardwareSectionSerialPorts.xml", VCloudDirectorMediaType.VAPP)
    +            .httpResponseBuilder().build());
    +
    +         RasdItemsList expected = getVirtualHardwareSectionSerialPorts();
    +
    +         assertEquals(client.getVmClient().getVirtualHardwareSectionSerialPorts(vmURI), expected);
    +   }
    +
    +   @Test(enabled = false)
    +   public void testModifyVirtualHardwareSectionSerialPorts() {
    +      VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, 
    +         new VcloudHttpRequestPrimer()
    +            .apiCommand("PUT", vmId + "/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.getVmClient().modifyVirtualHardwareSectionSerialPorts(vmURI, serialPorts), expected);
    +   }
    +
    +   public static Vm getVm() {
    +      // FIXME Does not match XML
    +      Vm vm = Vm.builder()
    +            .href(URI.create("https://mycloud.greenhousedata.com/api/vApp/vm-d0e2b6b9-4381-4ddc-9572-cdfae54059be"))
    +//            .link(Link.builder()
    +//                     .href(URI.create())
    +//                     .build())
    +            .build();
    +
    +//      
    +//      
    +//      
    +//      
    +//      
    +//      
    +//      
    +//      
    +//      
    +//      
    +//      
    +      
    +      return vm;
    +   }
    +
    +   public static Task modifyVmTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task deleteVmTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task consolidateVmTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static ControlAccessParams controlAccessParams() {
    +      ControlAccessParams params = ControlAccessParams.builder()
    +            .build();
    +
    +      return params;
    +   }
    +
    +   public static Task deployTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task discardSuspendedStateTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task installVMwareToolsTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task recomposeVmTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task relocateTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task undeployTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task upgradeHardwareVersionTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task powerOffTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task powerOnTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task rebootTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task resetTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task shutdownTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task suspendTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static ControlAccessParams getControlAccessParams() {
    +      ControlAccessParams params = ControlAccessParams.builder()
    +            .build();
    +
    +      return params;
    +   }
    +
    +   public static GuestCustomizationSection getGuestCustomizationSection() {
    +      GuestCustomizationSection section = GuestCustomizationSection.builder()
    +            .build();
    +
    +      return section;
    +   }
    +
    +   public static Task modifyGuestCustomizationSectionTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static LeaseSettingsSection getLeaseSettingsSection() {
    +      LeaseSettingsSection section = LeaseSettingsSection.builder()
    +            .build();
    +
    +      return section;
    +   }
    +
    +   public static Task modifyLeaseSettingsSectionTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task ejectMediaTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Task insertMediaTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static NetworkConfigSection getNetworkConfigSection() {
    +      NetworkConfigSection section = NetworkConfigSection.builder()
    +            .build();
    +
    +      return section;
    +   }
    +
    +   public static Task modifyNetworkConfigSectionTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static NetworkConnectionSection getNetworkConnectionSection() {
    +      NetworkConnectionSection section = NetworkConnectionSection.builder()
    +            .build();
    +
    +      return section;
    +   }
    +
    +   public static Task modifyNetworkConnectionSectionTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static NetworkSection getNetworkSection() {
    +      NetworkSection section = NetworkSection.builder()
    +            .build();
    +
    +      return section;
    +   }
    +
    +   public static OperatingSystemSection getOperatingSystemSection() {
    +      OperatingSystemSection section = OperatingSystemSection.builder()
    +            .build();
    +
    +      return section;
    +   }
    +
    +   public static Task modifyOperatingSystemSectionTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static Owner getOwner() {
    +      Owner owner = Owner.builder()
    +            .build();
    +
    +      return owner;
    +   }
    +
    +   public static Task modifyOwnerTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static ProductSectionList getProductSections() {
    +      ProductSectionList sectionItems = ProductSectionList.builder()
    +            .build();
    +
    +      return sectionItems;
    +   }
    +
    +   public static Task modifyProductSectionsTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static VmPendingQuestion getPendingQuestion() {
    +      VmPendingQuestion question = VmPendingQuestion.builder()
    +            .build();
    +
    +      return question;
    +   }
    +
    +   public static VmQuestionAnswer answerQuestion() {
    +      VmQuestionAnswer answer = null; // = VmQuestionAnswer.builder() 
    +//            .build();
    +
    +      return answer;
    +   }
    +
    +   public static RuntimeInfoSection getRuntimeInfoSection() {
    +      RuntimeInfoSection section = RuntimeInfoSection.builder()
    +            .build();
    +
    +      return section;
    +   }
    +
    +   public static byte[] getScreenImage() {
    +      byte[] image = new byte[0];
    +
    +      return image;
    +   }
    +
    +   public static ScreenTicket getScreenTicket() {
    +      ScreenTicket ticket = null; // = ScreenTicket.builder();
    +//            .build();
    +
    +      return ticket;
    +   }
    +
    +   public static StartupSection getStartupSection() {
    +      StartupSection section = null; // = StartupSection.builder();
    +//            .build();
    +
    +      return section;
    +   }
    +
    +   public static Task modifyStartupSectionTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static VirtualHardwareSection getVirtualHardwareSection() {
    +      VirtualHardwareSection section = VirtualHardwareSection.builder()
    +            .build();
    +
    +      return section;
    +   }
    +
    +   public static Task modifyVirtualHardwareSectionTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static RasdItem getVirtualHardwareSectionCpu() {
    +      RasdItem cpu = RasdItem.builder()
    +            .build();
    +
    +      return cpu;
    +   }
    +
    +   public static Task modifyVirtualHardwareSectionCpuTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static RasdItemsList getVirtualHardwareSectionDisks() {
    +      RasdItemsList disks = RasdItemsList.builder()
    +            .build();
    +
    +      return disks;
    +   }
    +
    +   public static Task modifyVirtualHardwareSectionDisksTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static RasdItemsList getVirtualHardwareSectionMedia() {
    +      RasdItemsList media = RasdItemsList.builder()
    +            .build();
    +
    +      return media;
    +   }
    +
    +   public static RasdItem getVirtualHardwareSectionMemory() {
    +      RasdItem memory = RasdItem.builder()
    +            .build();
    +
    +      return memory;
    +   }
    +
    +   public static Task modifyVirtualHardwareSectionMemoryTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static RasdItemsList getVirtualHardwareSectionNetworkCards() {
    +      RasdItemsList networkCards = RasdItemsList.builder()
    +            .build();
    +
    +      return networkCards;
    +   }
    +
    +   public static Task modifyVirtualHardwareSectionNetworkCardsTask() {
    +      Task task = Task.builder()
    +            .build();
    +
    +      return task;
    +   }
    +
    +   public static RasdItemsList getVirtualHardwareSectionSerialPorts() {
    +      RasdItemsList serialPorts = RasdItemsList.builder()
    +            .build();
    +
    +      return serialPorts;
    +   }
    +
    +   public static Task modifyVirtualHardwareSectionSerialPortsTask() {
    +      return task("id", "name", "description", "status", "operation", "operationName", "startTime");
    +   }
    +
    +   /** Used by other methods to create a custom {@link Task} object. */
    +   private static Task task(String taskId, String name, String description, String status, String operation, String operationName, String startTime) {
    +      Task task = Task.builder()
    +            .error(Error.builder().build())
    +            .org(Reference.builder().build())
    +            .owner(Reference.builder().build())
    +            .user(Reference.builder().build())
    +            .params(null)
    +            .progress(0)
    +            .status(status)
    +            .operation(operation)
    +            .operationName(operationName)
    +            .startTime(dateService.iso8601DateParse(startTime))
    +            .endTime(null)
    +            .expiryTime(null)
    +            .tasks(Sets.newLinkedHashSet())
    +            .description(description)
    +            .name(name)
    +            .id("urn:vcloud:" + taskId)
    +            .href(URI.create(endpoint + "/task/" + taskId))
    +            .links(Sets.newLinkedHashSet())
    +            .build();
    +
    +      return task;
    +   }
    +}
    diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientLiveTest.java
    new file mode 100644
    index 0000000000..19b8da7a04
    --- /dev/null
    +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientLiveTest.java
    @@ -0,0 +1,1015 @@
    +/*
    + * Licensed to jclouds, Inc. (jclouds) under one or more
    + * contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + *(Link.builder().regarding copyright ownership.  jclouds licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless(Link.builder().required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.jclouds.vcloud.director.v1_5.features;
    +
    +import static com.google.common.base.Predicates.and;
    +import static com.google.common.collect.Iterables.contains;
    +import static com.google.common.collect.Iterables.find;
    +import static com.google.common.collect.Iterables.getFirst;
    +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CORRECT_VALUE_OBJECT_FMT;
    +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_EQUAL;
    +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_EMPTY_OBJECT_FMT;
    +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.MEDIA;
    +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkGuestCustomizationSection;
    +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadata;
    +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataFor;
    +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataKeyAbsentFor;
    +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.checkNetworkConnectionSection;
    +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOperatingSystemSection;
    +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.checkVirtualHardwareSection;
    +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVm;
    +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.ProductSection;
    +import org.jclouds.io.Payloads;
    +import org.jclouds.vcloud.director.v1_5.AbstractVAppClientLiveTest;
    +import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
    +import org.jclouds.vcloud.director.v1_5.domain.Checks;
    +import org.jclouds.vcloud.director.v1_5.domain.Link;
    +import org.jclouds.vcloud.director.v1_5.domain.Media;
    +import org.jclouds.vcloud.director.v1_5.domain.Metadata;
    +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.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.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.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.DeployVAppParams;
    +import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams;
    +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.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 VmClient}.
    + *
    + * @author grkvlt@apache.org
    + */
    +@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VmClientLiveTest")
    +public class VmClientLiveTest extends AbstractVAppClientLiveTest {
    +
    +   private MetadataValue metadataValue;
    +   private String key;
    +   private URI testUserURI;
    +   private boolean mediaCreated = false;
    +   private boolean testUserCreated = false;
    +   
    +   @BeforeClass(alwaysRun = true, dependsOnMethods = { "setupRequiredClients" })
    +   protected void setupRequiredEntities() {
    +      Set links = vdcClient.getVdc(vdcURI).getLinks();
    +
    +      if (mediaURI == null) {
    +         Predicate addMediaLink = and(relEquals(Link.Rel.ADD), typeEquals(VCloudDirectorMediaType.MEDIA));
    +         
    +         if (contains(links, addMediaLink)) {
    +            Link addMedia = find(links, addMediaLink);
    +            byte[] iso = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
    +            
    +            Media sourceMedia = Media.builder()
    +                  .type(VCloudDirectorMediaType.MEDIA)
    +                  .name("Test media "+random.nextInt())
    +                  .size(iso.length)
    +                  .imageType(Media.ImageType.ISO)
    +                  .description("Test media generated by vmClient.iveTest")
    +                  .build();
    +            Media media = context.getApi().getMediaClient().createMedia(addMedia.getHref(), sourceMedia);
    +            
    +            Link uploadLink = getFirst(getFirst(media.getFiles(), null).getLinks(), null);
    +            context.getApi().getUploadClient().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
    +            
    +            media = context.getApi().getMediaClient().getMedia(media.getHref());
    +            
    +            if (media.getTasks().size() == 1) {
    +               Task uploadTask = Iterables.getOnlyElement(media.getTasks());
    +               Checks.checkTask(uploadTask);
    +               assertEquals(uploadTask.getStatus(), Task.Status.RUNNING);
    +               assertTrue(retryTaskSuccess.apply(uploadTask), String.format(TASK_COMPLETE_TIMELY, "uploadTask"));
    +               media = context.getApi().getMediaClient().getMedia(media.getHref());
    +            }
    +            
    +            mediaURI = media.getHref();
    +            mediaCreated = true;
    +         }
    +      }
    +      
    +      if (adminContext != null) {
    +         Link orgLink = find(links, and(relEquals("up"), typeEquals(VCloudDirectorMediaType.ORG)));
    +         testUserURI = adminContext.getApi().getUserClient().createUser(toAdminUri(orgLink), randomTestUser("VAppAccessTest")).getHref();
    +      } else {
    +         testUserURI = userURI;
    +      }
    +   }
    +   
    +   @Override
    +   @AfterClass(alwaysRun = true)
    +   public void cleanUp() {
    +      if (adminContext != null && mediaCreated && mediaURI != null) {
    +         try {
    +	         Task delete = context.getApi().getMediaClient().deleteMedia(mediaURI);
    +	         taskDoneEventually(delete);
    +         } catch (Exception e) {
    +            logger.warn("Error when deleting media: %s", e.getMessage());
    +         }
    +      }
    +      if (adminContext != null && testUserCreated && testUserURI != null) {
    +         try {
    +	         adminContext.getApi().getUserClient().deleteUser(testUserURI);
    +         } catch (Exception e) {
    +            logger.warn("Error when deleting user: %s", e.getMessage());
    +         }
    +      }
    +   }
    +
    +   /**
    +    * @see VmClient#getVm(URI)
    +    */
    +   @Test(description = "GET /vApp/{id}")
    +   public void testGetVm() {
    +      // The method under test
    +      vm = vmClient.getVm(vmURI);
    +
    +      // Check the retrieved object is well formed
    +      checkVm(vm);
    +
    +      // Check the required fields are set
    +      assertEquals(vm.isDeployed(), Boolean.FALSE, String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vm.isDeployed().toString()));
    +
    +      // Check status
    +      assertVmStatus(vm.getHref(), Status.POWERED_OFF);
    +   }
    +
    +   /**
    +    * @see VmClient#modifyVm(URI, Vm)
    +    */
    +   @Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVm" })
    +   public void testModifyVm() {
    +      Vm newVm = Vm.builder()
    +            .name(name("new-name-"))
    +            .description("New Description")
    +            .build();
    +
    +      // The method under test
    +      Task modifyVm = vmClient.modifyVm(vm.getHref(), newVm);
    +      assertTrue(retryTaskSuccess.apply(modifyVm), String.format(TASK_COMPLETE_TIMELY, "modifyVm"));
    +
    +      // Get the updated Vm
    +      vm = vmClient.getVm(vm.getHref());
    +
    +      // Check the required fields are set
    +      assertEquals(vm.getName(), newVm.getName(), String.format(OBJ_FIELD_EQ, VM, "Name", newVm.getName(), vm.getName()));
    +      assertEquals(vm.getDescription(), newVm.getDescription(), String.format(OBJ_FIELD_EQ, VM, "Description", newVm.getDescription(), vm.getDescription()));
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/action/deploy", dependsOnMethods = { "testGetVm" })
    +   public void testDeployVm() {
    +      DeployVAppParams params = DeployVAppParams.builder()
    +            .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS))
    +            .notForceCustomization()
    +            .notPowerOn()
    +            .build();
    +
    +      // The method under test
    +      Task deployVm = vmClient.deploy(vm.getHref(), params);
    +      assertTrue(retryTaskSuccessLong.apply(deployVm), String.format(TASK_COMPLETE_TIMELY, "deployVm"));
    +
    +      // Get the updated Vm
    +      vm = vmClient.getVm(vm.getHref());
    +
    +      // Check the required fields are set
    +      assertTrue(vm.isDeployed(), String.format(OBJ_FIELD_EQ, VM, "deployed", "TRUE", vm.isDeployed().toString()));
    +
    +      // Check status
    +      assertVmStatus(vmURI, Status.POWERED_OFF);
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/power/action/powerOn", dependsOnMethods = { "testDeployVm" })
    +   public void testPowerOnVm() {
    +      // Power off Vm
    +      vm = powerOffVm(vm.getHref());
    +
    +      // The method under test
    +      Task powerOnVm = vmClient.powerOn(vm.getHref());
    +      assertTaskSucceedsLong(powerOnVm);
    +
    +      // Get the updated Vm
    +      vm = vmClient.getVm(vm.getHref());
    +
    +      // Check status
    +      assertVmStatus(vm.getHref(), Status.POWERED_ON);
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/power/action/reboot", dependsOnMethods = { "testDeployVm" })
    +   public void testReboot() {
    +      // Power on Vm
    +      vm = powerOnVm(vm.getHref());
    + 
    +      // The method under test
    +      Task reboot = vmClient.reboot(vm.getHref());
    +      assertTaskSucceedsLong(reboot);
    +
    +      // Get the updated Vm
    +      vm = vmClient.getVm(vm.getHref());
    +
    +      // Check status
    +      assertVmStatus(vmURI, Status.POWERED_OFF);
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/power/action/shutdown", dependsOnMethods = { "testDeployVm" })
    +   public void testShutdown() {
    +      // Power on Vm
    +      vm = powerOnVm(vm.getHref());
    +
    +      // The method under test
    +      Task shutdown = vmClient.shutdown(vmURI);
    +      assertTaskSucceedsLong(shutdown);
    +
    +      // Get the updated Vm
    +      vm = vmClient.getVm(vmURI);
    +
    +      // Check status
    +      assertVmStatus(vmURI, Status.POWERED_OFF);
    +
    +      // Power on the Vm again
    +      vm = powerOnVm(vm.getHref());
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/power/action/suspend", dependsOnMethods = { "testDeployVm" })
    +   public void testSuspend() {
    +      // Power on Vm
    +      vm = powerOnVm(vm.getHref());
    +
    +      // The method under test
    +      Task suspend = vmClient.suspend(vmURI);
    +      assertTaskSucceedsLong(suspend);
    +
    +      // Get the updated Vm
    +      vm = vmClient.getVm(vm.getHref());
    +
    +      // Check status
    +      assertVmStatus(vmURI, Status.SUSPENDED);
    +
    +      // Power on the Vm again
    +      vm = powerOnVm(vm.getHref());
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/power/action/reset", dependsOnMethods = { "testDeployVm" })
    +   public void testReset() {
    +      // Power on Vm
    +      vm = powerOnVm(vm.getHref());
    +
    +      // The method under test
    +      Task reset = vmClient.reset(vmURI);
    +      assertTaskSucceedsLong(reset);
    +
    +      // Get the updated Vm
    +      vm = vmClient.getVm(vm.getHref());
    +
    +      // Check status
    +      assertVmStatus(vmURI, Status.POWERED_ON);
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/action/undeploy", dependsOnMethods = { "testDeployVm" })
    +   public void testUndeployVm() {
    +      // Power on Vm
    +      vm = powerOnVm(vm.getHref());
    +
    +      UndeployVAppParams params = UndeployVAppParams.builder().build();
    +
    +      // The method under test
    +      Task undeploy = vmClient.undeploy(vm.getHref(), params);
    +      assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
    +
    +      // Get the updated Vm
    +      vm = vmClient.getVm(vm.getHref());
    +
    +      // Check status
    +      assertFalse(vm.isDeployed(), String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vm.isDeployed().toString()));
    +      assertVmStatus(vmURI, Status.POWERED_OFF);
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/power/action/powerOff", dependsOnMethods = { "testUndeployVm" })
    +   public void testPowerOffVm() {
    +      // Power on Vm
    +      vm = powerOnVm(vm.getHref());
    +      
    +      // The method under test
    +      Task powerOffVm = vmClient.powerOff(vm.getHref());
    +      assertTrue(retryTaskSuccess.apply(powerOffVm), String.format(TASK_COMPLETE_TIMELY, "powerOffVm"));
    +
    +      // Get the updated Vm
    +      vm = vmClient.getVm(vmURI);
    +
    +      // Check status
    +      assertVmStatus(vmURI, Status.POWERED_OFF);
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/action/consolidate", dependsOnMethods = { "testDeployVm" })
    +   public void testConsolidateVm() {
    +      // Power on Vm
    +      vm = powerOnVm(vm.getHref());
    +
    +      // The method under test
    +      Task consolidateVm = vmClient.consolidateVm(vm.getHref());
    +      assertTrue(retryTaskSuccess.apply(consolidateVm), String.format(TASK_COMPLETE_TIMELY, "consolidateVm"));
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/action/discardSuspendedState", dependsOnMethods = { "testDeployVm" })
    +   public void testDiscardSuspendedState() {
    +      // Suspend the Vm
    +      vm = suspendVm(vm.getHref());
    +      
    +      // The method under test
    +      Task discardSuspendedState = vmClient.discardSuspendedState(vm.getHref());
    +      assertTrue(retryTaskSuccess.apply(discardSuspendedState), String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState"));
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/action/installVMwareTools", dependsOnMethods = { "testDeployVm" })
    +   public void testInstallVMwareTools() {
    +      // First ensure the vApp is powered n
    +      vm = powerOnVm(vm.getHref());
    +
    +      // The method under test
    +      Task installVMwareTools = vmClient.installVMwareTools(vm.getHref());
    +      assertTrue(retryTaskSuccess.apply(installVMwareTools), String.format(TASK_COMPLETE_TIMELY, "installVMwareTools"));
    +   }
    +
    +   // 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 = { "testGetVm" })
    +   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 = vmClient.relocateVm(vm.getHref(), params);
    +      assertTrue(retryTaskSuccess.apply(relocate), String.format(TASK_COMPLETE_TIMELY, "relocate"));
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/action/upgradeHardwareVersion", dependsOnMethods = { "testGetVm" })
    +   public void testUpgradeHardwareVersion() {
    +      // Power off Vm
    +      vm = powerOffVm(vm.getHref());
    +
    +      // The method under test
    +      Task upgradeHardwareVersion = vmClient.upgradeHardwareVersion(vm.getHref());
    +      assertTrue(retryTaskSuccess.apply(upgradeHardwareVersion), String.format(TASK_COMPLETE_TIMELY, "upgradeHardwareVersion"));
    +   }
    +
    +   @Test(description = "GET /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetVm" })
    +   public void testGetGuestCustomizationSection() {
    +      getGuestCustomizationSection(new Function() {
    +         @Override
    +         public GuestCustomizationSection apply(URI uri) {
    +            return vmClient.getGuestCustomizationSection(uri);
    +         }
    +      });
    +   }
    +
    +   @Test(description = "PUT /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetGuestCustomizationSection" })
    +   public void testModifyGuestCustomizationSection() {
    +      // Copy existing section and update fields
    +      GuestCustomizationSection oldSection = vmClient.getGuestCustomizationSection(vm.getHref());
    +      GuestCustomizationSection newSection = oldSection.toBuilder()
    +            .computerName(name("n"))
    +            .enabled(Boolean.FALSE)
    +            .adminPassword(null) // Not allowed
    +            .build();
    +
    +      // The method under test
    +      Task modifyGuestCustomizationSection = vmClient.modifyGuestCustomizationSection(vm.getHref(), newSection);
    +      assertTrue(retryTaskSuccess.apply(modifyGuestCustomizationSection), String.format(TASK_COMPLETE_TIMELY, "modifyGuestCustomizationSection"));
    +
    +      // Retrieve the modified section
    +      GuestCustomizationSection modified = vmClient.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"));
    +   }
    +
    +   // 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 = { "testGetVm" })
    +   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 = vmClient.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 = vmClient.ejectMedia(vm.getHref(), params);
    +      assertTrue(retryTaskSuccess.apply(ejectMedia), String.format(TASK_COMPLETE_TIMELY, "ejectMedia"));
    +   }
    +
    +   @Test(description = "GET /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetVm" })
    +   public void testGetNetworkConnectionSection() {
    +      getNetworkConnectionSection(new Function() {
    +         @Override
    +         public NetworkConnectionSection apply(URI uri) {
    +            return vmClient.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 networks = vdc.getAvailableNetworks();
    +      Reference network = Iterables.getLast(networks);
    +
    +      // Copy existing section and update fields
    +      NetworkConnectionSection oldSection = vmClient.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 = vmClient.modifyNetworkConnectionSection(vm.getHref(), newSection);
    +      assertTrue(retryTaskSuccess.apply(modifyNetworkConnectionSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConnectionSection"));
    +
    +      // Retrieve the modified section
    +      NetworkConnectionSection modified = vmClient.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}/operatingSystemSection", dependsOnMethods = { "testGetVm" })
    +   public void testGetOperatingSystemSection() {
    +      // The method under test
    +      OperatingSystemSection section = vmClient.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 = vmClient.modifyOperatingSystemSection(vm.getHref(), newSection);
    +      assertTrue(retryTaskSuccess.apply(modifyOperatingSystemSection), String.format(TASK_COMPLETE_TIMELY, "modifyOperatingSystemSection"));
    +
    +      // Retrieve the modified section
    +      OperatingSystemSection modified = vmClient.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}/productSections", dependsOnMethods = { "testGetVm" })
    +   public void testGetProductSections() {
    +      // The method under test
    +      ProductSectionList sectionList = vmClient.getProductSections(vm.getHref());
    +
    +      // Check the retrieved object is well formed
    +      checkProductSectionList(sectionList);
    +   }
    +
    +   @Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" })
    +   public void testModifyProductSections() {
    +      // Copy existing section and update fields
    +      ProductSectionList oldSections = vmClient.getProductSections(vm.getHref());
    +      ProductSectionList newSections = oldSections.toBuilder()
    +            .productSection(ProductSection.builder()
    +                  .info("Information about the installed software") // Default ovf:Info text
    +                  .required()
    +                  .product(MsgType.builder().value("jclouds").build())
    +                  .vendor(MsgType.builder().value("jclouds Inc.").build())
    +                  // NOTE other ProductSection elements not returned by vCloud
    +                  .build())
    +            .build();
    +
    +      // The method under test
    +      Task modifyProductSections = vmClient.modifyProductSections(vm.getHref(), newSections);
    +      assertTrue(retryTaskSuccess.apply(modifyProductSections), String.format(TASK_COMPLETE_TIMELY, "modifyProductSections"));
    +
    +      // Retrieve the modified section
    +      ProductSectionList modified = vmClient.getProductSections(vm.getHref());
    +
    +      // Check the retrieved object is well formed
    +      checkProductSectionList(modified);
    +
    +      // Check the modified object has an extra ProductSection
    +      assertEquals(modified.getProductSections().size(), oldSections.getProductSections().size() + 1);
    +
    +      // Check the section was modified correctly
    +      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 = { "testDeployVm" })
    +   public void testGetPendingQuestion() {
    +      // Power on Vm
    +      vm = powerOnVm(vm.getHref());
    +
    +      // TODO how to test?
    +
    +      // The method under test
    +      VmPendingQuestion question = vmClient.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 = vmClient.getPendingQuestion(vm.getHref());
    +      List 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();
    +      
    +      vmClient.answerQuestion(vm.getHref(), answer);
    +   }
    +
    +   @Test(description = "GET /vApp/{id}/runtimeInfoSection", dependsOnMethods = { "testGetVm" })
    +   public void testGetRuntimeInfoSection() {
    +      // The method under test
    +      RuntimeInfoSection section = vmClient.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 = { "testDeployVm" })
    +   public void testGetScreenImage() {
    +      // Power on Vm
    +      vm = powerOnVm(vm.getHref());
    +      
    +      // The method under test
    +      byte[] image = vmClient.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 = { "testDeployVm" })
    +   public void testGetScreenTicket() {
    +      // Power on Vm
    +      vm = powerOnVm(vm.getHref());
    +      
    +      // The method under test
    +      ScreenTicket ticket = vmClient.getScreenTicket(vm.getHref());
    +
    +      // Check the retrieved object is well formed
    +      checkScreenTicket(ticket);
    +   }
    +
    +   @Test(description = "GET /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVm" })
    +   public void testGetVirtualHardwareSection() {
    +      // Method under test
    +      VirtualHardwareSection hardware = vmClient.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 Vm
    +      vm = powerOffVm(vm.getHref());
    +
    +      // Copy existing section and update fields
    +      VirtualHardwareSection oldSection = vmClient.getVirtualHardwareSection(vm.getHref());
    +      Set oldItems = oldSection.getItems();
    +      Set newItems = Sets.newLinkedHashSet(oldItems);
    +      ResourceAllocationSettingData oldMemory = Iterables.find(oldItems, new Predicate() {
    +         @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 = vmClient.modifyVirtualHardwareSection(vm.getHref(), newSection);
    +      assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSection), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSection"));
    +
    +      // Retrieve the modified section
    +      VirtualHardwareSection modifiedSection = vmClient.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() {
    +		         @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 = vmClient.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 = vmClient.getVirtualHardwareSectionCpu(vm.getHref());
    +      RasdItem newItem = oldItem.toBuilder()
    +            .elementName("2 virtual CPU(s)")
    +            .virtualQuantity(new BigInteger("2"))
    +            .build();
    +      
    +      // Method under test
    +      Task modifyVirtualHardwareSectionCpu = vmClient.modifyVirtualHardwareSectionCpu(vm.getHref(), newItem);
    +      assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionCpu), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionCpu"));
    +
    +      // Retrieve the modified section
    +      RasdItem modified = vmClient.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 = vmClient.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 = vmClient.getVirtualHardwareSectionDisks(vm.getHref());
    +      RasdItemsList newSection = oldSection.toBuilder().build();
    +
    +      // Method under test
    +      Task modifyVirtualHardwareSectionDisks = vmClient.modifyVirtualHardwareSectionDisks(vm.getHref(), newSection);
    +      assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionDisks), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionDisks"));
    +
    +      // Retrieve the modified section
    +      RasdItemsList modified = vmClient.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 newItems = new ArrayList(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 = vmClient.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 = vmClient.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 = vmClient.getVirtualHardwareSectionMemory(vm.getHref());
    +      RasdItem newItem = origItem.toBuilder()
    +            .elementName("1024 MB of memory")
    +            .virtualQuantity(new BigInteger("1024"))
    +            .build();
    +      
    +      // Method under test
    +      Task modifyVirtualHardwareSectionMemory = vmClient.modifyVirtualHardwareSectionMemory(vm.getHref(), newItem);
    +      assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionMemory), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionMemory"));
    +
    +      // Retrieve the modified section
    +      RasdItem modified = vmClient.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 = vmClient.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 = vmClient.getVirtualHardwareSectionNetworkCards(vm.getHref());
    +      RasdItemsList newSection = oldSection.toBuilder().build();
    +
    +      // Method under test
    +      Task modifyVirtualHardwareSectionNetworkCards = vmClient.modifyVirtualHardwareSectionNetworkCards(vm.getHref(), newSection);
    +      assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionNetworkCards), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionNetworkCards"));
    +
    +      // Retrieve the modified section
    +      RasdItemsList modified = vmClient.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 = vmClient.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 = vmClient.getVirtualHardwareSectionSerialPorts(vm.getHref());
    +      RasdItemsList newSection = oldSection.toBuilder().build();
    +
    +      // Method under test
    +      Task modifyVirtualHardwareSectionSerialPorts = vmClient.modifyVirtualHardwareSectionSerialPorts(vm.getHref(), newSection);
    +      assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionSerialPorts), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionSerialPorts"));
    +
    +      // Retrieve the modified section
    +      RasdItemsList modified = vmClient.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 = { "testGetVm" })
    +   public void testSetMetadataValue() {
    +      key = name("key-");
    +      String value = name("value-");
    +      metadataValue = MetadataValue.builder().value(value).build();
    +      vmClient.getMetadataClient().setMetadata(vm.getHref(), key, metadataValue);
    +
    +      // Retrieve the value, and assert it was set correctly
    +      MetadataValue newMetadataValue = vmClient.getMetadataClient().getMetadataValue(vm.getHref(), key);
    +
    +      // Check the retrieved object is well formed
    +      checkMetadataValueFor(VAPP, newMetadataValue, value);
    +   }
    +   
    +   @Test(description = "GET /vApp/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" })
    +   public void testGetMetadata() {
    +      // Call the method being tested
    +      Metadata metadata = vmClient.getMetadataClient().getMetadata(vm.getHref());
    +      
    +      checkMetadata(metadata);
    +      
    +      // Check requirements for this test
    +      assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()), String.format(NOT_EMPTY_OBJECT_FMT, "MetadataEntry", "vm"));
    +   }
    +   
    +   @Test(description = "GET /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
    +   public void testGetOrgMetadataValue() {
    +      // Call the method being tested
    +      MetadataValue value = vmClient.getMetadataClient().getMetadataValue(vm.getHref(), key);
    +      
    +      String expected = metadataValue.getValue();
    +
    +      checkMetadataValue(value);
    +      assertEquals(value.getValue(), expected, String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", expected, value.getValue()));
    +   }
    +
    +   @Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
    +   public void testDeleteMetadataEntry() {
    +      // Delete the entry
    +      Task task = vmClient.getMetadataClient().deleteMetadataEntry(vm.getHref(), key);
    +      retryTaskSuccess.apply(task);
    +
    +      // Confirm the entry has been deleted
    +      Metadata newMetadata = vmClient.getMetadataClient().getMetadata(vm.getHref());
    +
    +      // Check the retrieved object is well formed
    +      checkMetadataKeyAbsentFor(VAPP, newMetadata, key);
    +   }
    +
    +   @Test(description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
    +   public void testMergeMetadata() {
    +      Metadata oldMetadata = vmClient.getMetadataClient().getMetadata(vm.getHref());
    +      Map oldMetadataMap = Checks.metadataToMap(oldMetadata);
    +
    +      // Store a value, to be deleted
    +      String key = name("key-");
    +      String value = name("value-");
    +      Metadata addedMetadata = Metadata.builder()
    +            .entry(MetadataEntry.builder().key(key).value(value).build())
    +            .build();
    +      Task task = vmClient.getMetadataClient().mergeMetadata(vm.getHref(), addedMetadata);
    +      retryTaskSuccess.apply(task);
    +
    +      // Confirm the entry contains everything that was there, and everything that was being added
    +      Metadata newMetadata = vmClient.getMetadataClient().getMetadata(vm.getHref());
    +      Map expectedMetadataMap = ImmutableMap.builder()
    +            .putAll(oldMetadataMap)
    +            .put(key, value)
    +            .build();
    +
    +      // Check the retrieved object is well formed
    +      checkMetadataFor(VAPP, newMetadata, expectedMetadataMap);
    +   }
    +
    +   /**
    +    * @see VmClient#deleteVm(URI)
    +    */
    +   @Test(description = "DELETE /vApp/{id}")
    +   public void testDeleteVm() {
    +      // Create a temporary VApp to delete
    +      VApp delete = instantiateVApp();
    +      DeployVAppParams params = DeployVAppParams.builder()
    +            .deploymentLeaseSeconds((int)TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS))
    +            .notForceCustomization()
    +            .powerOn()
    +            .build();
    +      Task deployVApp = vAppClient.deploy(delete.getHref(), params);
    +      assertTaskSucceedsLong(deployVApp);
    +
    +      // Get the updated VApp and the Vm
    +      delete = vAppClient.getVApp(delete.getHref());
    +      Vm temp = Iterables.getOnlyElement(delete.getChildren().getVms());
    +
    +      // The method under test
    +      Task deleteVm = vmClient.deleteVm(temp.getHref());
    +      assertTrue(retryTaskSuccess.apply(deleteVm), String.format(TASK_COMPLETE_TIMELY, "deleteVm"));
    +
    +      Vm deleted = vmClient.getVm(temp.getHref());
    +      assertNull(deleted, "The Vm "+temp.getName()+" should have been deleted");
    +   }
    +}
    
    From b09f35fa9df2e339446995f36bbdb709bdb7b7c5 Mon Sep 17 00:00:00 2001
    From: Andrew Donald Kennedy 
    Date: Thu, 26 Apr 2012 12:21:54 +0100
    Subject: [PATCH 3/4] Tidyup the AfterClass methods for VApp test groups to
     ensure environment always cleaned up
    
    ---
     .../vcloud/director/v1_5/domain/Media.java    |  6 ++--
     .../v1_5/AbstractVAppClientLiveTest.java      |  3 +-
     .../v1_5/features/VAppClientLiveTest.java     | 19 ++++++------
     .../features/VAppTemplateClientLiveTest.java  |  2 +-
     .../v1_5/features/VmClientExpectTest.java     |  2 --
     .../v1_5/features/VmClientLiveTest.java       |  7 ++---
     .../BaseVCloudDirectorClientLiveTest.java     | 29 +++++++------------
     7 files changed, 29 insertions(+), 39 deletions(-)
    
    diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java
    index 7eaa5aaced..f602e2f89e 100644
    --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java
    +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java
    @@ -39,8 +39,8 @@ import com.google.common.collect.ImmutableSet;
     import com.google.common.collect.Maps;
     
     /**
    - * Represents a media.
    - * 

    + * Represents removable media, such as a CD-ROM, DVD or Floppy disk. + * *

      * <complexType name="Media" />
      * 
    @@ -53,7 +53,7 @@ public class Media extends ResourceEntity { public static enum ImageType { @XmlEnumValue("iso") ISO("iso"), @XmlEnumValue("floppy") FLOPPY("floppy"), - UNRECOGNIZED("unrecognized"); + @XmlEnumValue("") UNRECOGNIZED("unrecognized"); public static final List ALL = ImmutableList.of(ISO, FLOPPY); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java index 8461649e28..6dc1020a79 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/AbstractVAppClientLiveTest.java @@ -189,8 +189,9 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien } @AfterClass(alwaysRun = true, description = "Cleans up the environment by deleting created VApps") - protected void cleanUp() { + protected void cleanUpEnvironment() { vdc = vdcClient.getVdc(vdcURI); // Refresh + // Find references in the Vdc with the VApp type and in the list of instantiated VApp names Iterable vApps = Iterables.filter(vdc.getResourceEntities(), Predicates.and(ReferencePredicates. typeEquals(VCloudDirectorMediaType.VAPP), ReferencePredicates. nameIn(vAppNames))); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java index abb2fa6c51..c5ec6a0b17 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientLiveTest.java @@ -116,10 +116,10 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { Media sourceMedia = Media.builder() .type(VCloudDirectorMediaType.MEDIA) - .name("Test media "+random.nextInt()) + .name(name("media")) .size(iso.length) .imageType(Media.ImageType.ISO) - .description("Test media generated by vAppClientLiveTest") + .description("Test media generated by VAppClientLiveTest") .build(); Media media = context.getApi().getMediaClient().createMedia(addMedia.getHref(), sourceMedia); @@ -149,22 +149,21 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { } } - @Override - @AfterClass(alwaysRun = true) + @AfterClass(alwaysRun = true, dependsOnMethods = { "cleanUpEnvironment" }) public void cleanUp() { if (adminContext != null && mediaCreated && mediaURI != null) { try { - Task delete = context.getApi().getMediaClient().deleteMedia(mediaURI); - taskDoneEventually(delete); + Task delete = context.getApi().getMediaClient().deleteMedia(mediaURI); + taskDoneEventually(delete); } catch (Exception e) { - logger.warn("Error when deleting media: %s", e.getMessage()); + logger.warn(e, "Error when deleting media"); } } if (adminContext != null && testUserCreated && testUserURI != null) { try { - adminContext.getApi().getUserClient().deleteUser(testUserURI); + adminContext.getApi().getUserClient().deleteUser(testUserURI); } catch (Exception e) { - logger.warn("Error when deleting user: %s", e.getMessage()); + logger.warn(e, "Error when deleting user"); } } } @@ -218,7 +217,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest { @Test(description = "POST /vApp/{id}/action/deploy", dependsOnMethods = { "testGetVApp" }) public void testDeployVApp() { DeployVAppParams params = DeployVAppParams.builder() - .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)) + .deploymentLeaseSeconds((int)TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)) .notForceCustomization() .notPowerOn() .build(); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java index ccf16cd99c..faf4c07531 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientLiveTest.java @@ -90,7 +90,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest { private String key; private String val; - @AfterClass(alwaysRun = true) + @AfterClass(alwaysRun = true, dependsOnMethods = { "cleanUpEnvironment" }) protected void tidyUp() { if (key != null) { try { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientExpectTest.java index 66c50af7c8..79ba42fee1 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientExpectTest.java @@ -33,7 +33,6 @@ 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.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; @@ -41,7 +40,6 @@ 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; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientLiveTest.java index 19b8da7a04..bcb4f09413 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmClientLiveTest.java @@ -134,10 +134,10 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest { Media sourceMedia = Media.builder() .type(VCloudDirectorMediaType.MEDIA) - .name("Test media "+random.nextInt()) + .name(name("media")) .size(iso.length) .imageType(Media.ImageType.ISO) - .description("Test media generated by vmClient.iveTest") + .description("Test media generated by VmClientLiveTest") .build(); Media media = context.getApi().getMediaClient().createMedia(addMedia.getHref(), sourceMedia); @@ -167,8 +167,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest { } } - @Override - @AfterClass(alwaysRun = true) + @AfterClass(alwaysRun = true, dependsOnMethods = { "cleanUpEnvironment" }) public void cleanUp() { if (adminContext != null && mediaCreated && mediaURI != null) { try { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java index 29148e5ff0..7cc8233b5e 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java @@ -43,12 +43,13 @@ import org.jclouds.rest.RestContext; import org.jclouds.vcloud.director.testng.FormatApiResultsListener; import org.jclouds.vcloud.director.v1_5.VCloudDirectorApiMetadata; import org.jclouds.vcloud.director.v1_5.VCloudDirectorContext; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncClient; import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient; import org.jclouds.vcloud.director.v1_5.domain.Link; 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.Role.DefaultRoles; import org.jclouds.vcloud.director.v1_5.domain.RoleReferences; import org.jclouds.vcloud.director.v1_5.domain.Session; import org.jclouds.vcloud.director.v1_5.domain.Task; @@ -56,8 +57,6 @@ import org.jclouds.vcloud.director.v1_5.domain.User; 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.ResourceEntity.Status; -import org.jclouds.vcloud.director.v1_5.domain.Role.DefaultRoles; import org.jclouds.vcloud.director.v1_5.domain.network.Network; import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConfiguration; import org.jclouds.vcloud.director.v1_5.domain.network.VAppNetworkConfiguration; @@ -104,7 +103,7 @@ import com.google.inject.Guice; public abstract class BaseVCloudDirectorClientLiveTest extends BaseContextLiveTest { @Resource - protected Logger logger = Logger.CONSOLE; + protected Logger logger = Logger.NULL; protected static final long TASK_TIMEOUT_SECONDS = 100L; protected static final long LONG_TASK_TIMEOUT_SECONDS = 300L; @@ -429,15 +428,12 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseContextLiveTe protected void cleanUpVApp(URI vAppURI) { VAppClient vAppClient = context.getApi().getVAppClient(); - VApp vApp; - try { - vApp = vAppClient.getVApp(vAppURI); // Refresh - logger.debug("Deleting VApp %s (%s)", vApp.getName(), vAppURI.getPath()); - } catch (VCloudDirectorException e) { - // Presumably vApp has already been deleted. Ignore. + VApp vApp = vAppClient.getVApp(vAppURI); // Refresh + if (vApp == null) { logger.info("Cannot find VApp at %s", vAppURI.getPath()); - return; + return; // Presumably vApp has already been deleted. Ignore. } + logger.debug("Deleting VApp %s (%s)", vApp.getName(), vAppURI.getPath()); // Wait for busy tasks to complete (don't care if it's failed or successful) // Otherwise, get error on delete "entity is busy completing an operation. @@ -463,7 +459,9 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseContextLiveTe // Undeploy the VApp if necessary if (vApp.isDeployed()) { try { - UndeployVAppParams params = UndeployVAppParams.builder().build(); + UndeployVAppParams params = UndeployVAppParams.builder() + .undeployPowerAction(UndeployVAppParams.PowerAction.SHUTDOWN) + .build(); Task undeployTask = vAppClient.undeploy(vAppURI, params); taskDoneEventually(undeployTask); } catch (Exception e) { @@ -478,12 +476,7 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseContextLiveTe vAppNames.remove(vApp.getName()); logger.info("Deleted VApp %s", vApp.getName()); } catch (Exception e) { - try { - vApp = vAppClient.getVApp(vAppURI); // Refresh - } catch (Exception e2) { - // Ignore - } - + vApp = vAppClient.getVApp(vAppURI); // Refresh logger.warn(e, "Deleting VApp %s failed (%s)", vApp.getName(), vAppURI.getPath()); } } From 4840fdaf3fd8b6e0b4901db5de4f3f591bcbf53a Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Thu, 26 Apr 2012 15:20:12 +0100 Subject: [PATCH 4/4] Add XmlRootElement annotation to Vm --- .../java/org/jclouds/vcloud/director/v1_5/domain/Vm.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vm.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vm.java index d961091764..ce7c33eeeb 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vm.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vm.java @@ -22,6 +22,7 @@ import static com.google.common.base.Objects.equal; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jclouds.dmtf.ovf.environment.EnvironmentType; @@ -30,15 +31,16 @@ import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; /** - * Represents a VM. + * Represents a virtual machine. * *
    - * <complexType name="Vm" />
    + * <complexType name="VmType" />
      * 
    * * @author grkvlt@apache.org */ -@XmlType(name = "Vm") +@XmlRootElement(name = "Vm") +@XmlType(name = "VmType") public class Vm extends AbstractVAppType { public static Builder builder() {