From 78b5a16e29e21b53ac1792af49d4e8c33d384c9f Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Fri, 16 Mar 2012 00:32:38 +0000 Subject: [PATCH] Issue 830: Updates to VAppClientLiveTest and Checks, and changes to associated domain objects --- .../v1_5/domain/LeaseSettingsSection.java | 32 +- .../director/v1_5/domain/ScreenTicket.java | 7 +- .../v1_5/domain/UndeployVAppParams.java | 26 +- .../v1_5/domain/UploadVAppTemplateParams.java | 28 +- .../director/v1_5/domain/VMWareTools.java | 3 +- .../director/v1_5/domain/ovf/Network.java | 3 +- .../director/v1_5/domain/ovf/SectionType.java | 2 +- .../v1_5/domain/ovf/StartupSection.java | 68 +- .../v1_5/features/VAppAsyncClient.java | 12 +- .../director/v1_5/features/VAppClient.java | 22 +- .../predicates/ReferenceTypePredicates.java | 21 +- .../v1_5/VCloudDirectorLiveTestConstants.java | 16 +- .../vcloud/director/v1_5/domain/Checks.java | 361 ++++-- .../v1_5/features/VAppClientLiveTest.java | 1108 ++++++++++------- .../BaseVCloudDirectorClientLiveTest.java | 13 + ...aseVCloudDirectorRestClientExpectTest.java | 2 +- 16 files changed, 1017 insertions(+), 707 deletions(-) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java index 6db3583953..8d9cee0fba 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/LeaseSettingsSection.java @@ -63,7 +63,7 @@ import com.google.common.collect.Sets; * */ @XmlRootElement(name = "LeaseSettingsSection") -@XmlType(name = "LeaseSettingsSection") +@XmlType(name = "LeaseSettingsSectionType") public class LeaseSettingsSection extends SectionType { public static Builder builder() { @@ -142,7 +142,6 @@ public class LeaseSettingsSection extends SectionType { return self(); } - @Override public LeaseSettingsSection build() { return new LeaseSettingsSection(this); @@ -194,17 +193,14 @@ public class LeaseSettingsSection extends SectionType { } /** - * Gets the value of the link property. + * Gets the value of the links property. */ public Set getLinks() { - return Collections.unmodifiableSet(this.links); + return Collections.unmodifiableSet(links); } /** * Gets the value of the deploymentLeaseInSeconds property. - * - * @return possible object is - * {@link Integer } */ public Integer getDeploymentLeaseInSeconds() { return deploymentLeaseInSeconds; @@ -212,9 +208,6 @@ public class LeaseSettingsSection extends SectionType { /** * Gets the value of the storageLeaseInSeconds property. - * - * @return possible object is - * {@link Integer } */ public Integer getStorageLeaseInSeconds() { return storageLeaseInSeconds; @@ -235,7 +228,7 @@ public class LeaseSettingsSection extends SectionType { } /** - * @return the value of the href property. + * Gets the value of the href property. */ public URI getHref() { return href; @@ -243,9 +236,6 @@ public class LeaseSettingsSection extends SectionType { /** * Gets the value of the type property. - * - * @return possible object is - * {@link String } */ public String getType() { return type; @@ -259,13 +249,13 @@ public class LeaseSettingsSection extends SectionType { return false; LeaseSettingsSection that = LeaseSettingsSection.class.cast(o); return super.equals(that) && - equal(links, that.links) && - equal(deploymentLeaseInSeconds, that.deploymentLeaseInSeconds) && - equal(storageLeaseInSeconds, that.storageLeaseInSeconds) && - equal(deploymentLeaseExpiration, that.deploymentLeaseExpiration) && - equal(storageLeaseExpiration, that.storageLeaseExpiration) && - equal(href, that.href) && - equal(type, that.type); + equal(this.links, that.links) && + equal(this.deploymentLeaseInSeconds, that.deploymentLeaseInSeconds) && + equal(this.storageLeaseInSeconds, that.storageLeaseInSeconds) && + equal(this.deploymentLeaseExpiration, that.deploymentLeaseExpiration) && + equal(this.storageLeaseExpiration, that.storageLeaseExpiration) && + equal(this.href, that.href) && + equal(this.type, that.type); } @Override diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ScreenTicket.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ScreenTicket.java index a866d5be1e..986ac34b07 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ScreenTicket.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ScreenTicket.java @@ -21,8 +21,7 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; @@ -35,8 +34,8 @@ import com.google.common.base.Objects; * <complexType name="ScreenTicket" /> * */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ScreenTicket") +@XmlRootElement(name = "ScreenTicket") +@XmlType(name = "ScreenTicketType") public class ScreenTicket { public static Builder builder() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UndeployVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UndeployVAppParams.java index c6ab12038e..781b5cfed6 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UndeployVAppParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UndeployVAppParams.java @@ -1,4 +1,4 @@ -/** +/* * Licensed to jclouds, Inc. (jclouds) under one or more * contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -16,14 +16,12 @@ * specific language governing permissions and limitations * under the License. */ - package org.jclouds.vcloud.director.v1_5.domain; -import static com.google.common.base.Objects.*; +import static com.google.common.base.Objects.equal; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import com.google.common.base.Objects; @@ -32,20 +30,14 @@ import com.google.common.base.Objects; * Represents vApp/VM undeployment parameters. * *
- * <complexType name="UndeployVAppParams">
- *   <complexContent>
- *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
- *       <sequence>
- *         <element name="UndeployPowerAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *       <anyAttribute processContents='lax' namespace='##other'/>
- *     </extension>
- *   </complexContent>
- * </complexType>
+ * <complexType name="UndeployVAppParamsType" />
  * 
+ * + * @author grkvlt@apache.org + * @since 0.9 */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UndeployVAppParams") +@XmlRootElement(name = "UndeployVAppParams") +@XmlType(name = "UndeployVAppParamsType") public class UndeployVAppParams { public static Builder builder() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java index cf5e5b1de0..15d18a455d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java @@ -1,4 +1,4 @@ -/** +/* * Licensed to jclouds, Inc. (jclouds) under one or more * contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -16,38 +16,28 @@ * specific language governing permissions and limitations * under the License. */ - package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import com.google.common.base.Objects; - /** * Represents vApp Template upload parameters. - *

- *

- *

Java class for UploadVAppTemplateParams complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

+ * *

- * <complexType name="UploadVAppTemplateParams">
- *   <complexContent>
- *     <extension base="{http://www.vmware.com/vcloud/v1.5}ParamsType">
- *       <attribute name="transferFormat" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="manifestRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" />
- *       <anyAttribute processContents='lax' namespace='##other'/>
- *     </extension>
- *   </complexContent>
- * </complexType>
+ * <complexType name="UploadVAppTemplateParamsType" />
  * 
+ * + * @author grkvlt@apache.org + * @since 0.9 */ -@XmlType(name = "UploadVAppTemplateParams") +@XmlRootElement(name = "UploadVAppTemplateParams") +@XmlType(name = "UploadVAppTemplateParamsType") public class UploadVAppTemplateParams extends ParamsType { public static Builder builder() { return new ConcreteBuilder(); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VMWareTools.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VMWareTools.java index f32573a54f..7eed6795de 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VMWareTools.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VMWareTools.java @@ -23,6 +23,7 @@ import static com.google.common.base.Objects.*; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import com.google.common.base.Objects; @@ -30,7 +31,7 @@ import com.google.common.base.Objects; /** * @author grkvlt@apache.org */ -@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "VMWareTools") @XmlType(name = "VMWareTools") public class VMWareTools { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Network.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Network.java index 4df71fec5b..d58df57f62 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Network.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/Network.java @@ -1,4 +1,4 @@ -/** +/* * Licensed to jclouds, Inc. (jclouds) under one or more * contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -18,7 +18,6 @@ */ package org.jclouds.vcloud.director.v1_5.domain.ovf; - import javax.xml.bind.annotation.XmlRootElement; /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java index 969e8bd79d..58332bccc6 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/SectionType.java @@ -135,7 +135,7 @@ public abstract class SectionType { if (getClass() != obj.getClass()) return false; SectionType other = (SectionType) obj; - return Objects.equal(info, other.info) && Objects.equal(required, other.required); + return Objects.equal(this.info, other.info) && Objects.equal(this.required, other.required); } @Override diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/StartupSection.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/StartupSection.java index ad179bb97e..c02622cfa5 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/StartupSection.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ovf/StartupSection.java @@ -1,15 +1,25 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2012.02.08 at 02:47:44 PM GMT -// - +/* + * 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.domain.ovf; import static com.google.common.base.Objects.equal; -import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -74,7 +84,7 @@ public class StartupSection extends SectionType { } @XmlElement(name = "Item") - private List item; + private List items; @XmlAnyElement(lax = true) private List any; @@ -84,50 +94,22 @@ public class StartupSection extends SectionType { public StartupSection(Builder builder) { super(builder); - this.item = (item != null) ? ImmutableList.copyOf(builder.item) : Collections.emptyList(); + this.items = (items != null) ? ImmutableList.copyOf(builder.item) : Collections.emptyList(); this.any = (any != null) ? ImmutableList.copyOf(builder.any) : Collections.emptyList(); } /** * Gets the value of the item property. - *

- * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned - * list will be present inside the JAXB object. This is why there is not a set method for the item property. - *

- * For example, to add a new item, do as follows: - * - *

-    * getItem().add(newItem);
-    * 
- *

- * Objects of the following type(s) are allowed in the list {@link StartupSectionItem } */ public List getItem() { - if (item == null) { - item = new ArrayList(); - } - return this.item; + return items; } /** * Gets the value of the any property. - *

- * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned - * list will be present inside the JAXB object. This is why there is not a set method for the any property. - *

- * For example, to add a new item, do as follows: - * - *

-    * getAny().add(newItem);
-    * 
- *

- * Objects of the following type(s) are allowed in the list {@link Object } {@link Element } */ public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; + return any; } @Override @@ -138,16 +120,16 @@ public class StartupSection extends SectionType { return false; StartupSection that = StartupSection.class.cast(o); return super.equals(that) && - equal(this.item, that.item) && equal(this.any, that.any); + equal(this.items, that.items) && equal(this.any, that.any); } @Override public int hashCode() { - return Objects.hashCode(super.hashCode(), item, any); + return Objects.hashCode(super.hashCode(), items, any); } @Override public ToStringHelper string() { - return super.string().add("item", item).add("any", any); + return super.string().add("item", items).add("any", any); } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncClient.java index e6df71aa84..516fdc220d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncClient.java @@ -345,7 +345,7 @@ public interface VAppAsyncClient { @Consumes(TASK) @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture ejectMedia(@EndpointParam URI vAppURI, + ListenableFuture ejectMedia(@EndpointParam URI vmURI, @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); /** @@ -357,7 +357,7 @@ public interface VAppAsyncClient { @Consumes(TASK) @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture insertMedia(@EndpointParam URI vAppURI, + ListenableFuture insertMedia(@EndpointParam URI vmURI, @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); /** @@ -396,7 +396,7 @@ public interface VAppAsyncClient { @Consumes @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture getNetworkConnectionSection(@EndpointParam URI vAppURI); + ListenableFuture getNetworkConnectionSection(@EndpointParam URI vmURI); /** * @see VAppClient#modifyNetworkConnectionSection(URI, NetworkConnectionSection) @@ -407,7 +407,7 @@ public interface VAppAsyncClient { @Consumes(TASK) @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture modifyNetworkConnectionSection(@EndpointParam URI vAppURI, + ListenableFuture modifyNetworkConnectionSection(@EndpointParam URI vmURI, @BinderParam(BindToXMLPayload.class) NetworkConnectionSection section); /** @@ -428,7 +428,7 @@ public interface VAppAsyncClient { @Consumes @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture getOperatingSystemSection(@EndpointParam URI vAppURI); + ListenableFuture getOperatingSystemSection(@EndpointParam URI vmURI); /** * @see VAppClient#modifyOperatingSystemSection(URI, OperatingSystemSection) @@ -439,7 +439,7 @@ public interface VAppAsyncClient { @Consumes(TASK) @JAXBResponseParser @ExceptionParser(ThrowVCloudErrorOn4xx.class) - ListenableFuture modifyOperatingSystemSection(@EndpointParam URI vAppURI, + ListenableFuture modifyOperatingSystemSection(@EndpointParam URI vmURI, @BinderParam(BindToXMLPayload.class) OperatingSystemSection section); /** 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 c1e5be9ca6..ca3362a641 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 @@ -420,7 +420,7 @@ public interface VAppClient { * * @since 0.9 */ - Task ejectMedia(URI vAppURI, MediaInsertOrEjectParams mediaParams); + Task ejectMedia(URI vmURI, MediaInsertOrEjectParams mediaParams); /** * Inserts a media into a VM. @@ -431,7 +431,7 @@ public interface VAppClient { * * @since 0.9 */ - Task insertMedia(URI vAppURI, MediaInsertOrEjectParams mediaParams); + Task insertMedia(URI vmURI, MediaInsertOrEjectParams mediaParams); /** * @return synchronous access to {@link Metadata} features @@ -440,7 +440,7 @@ public interface VAppClient { MetadataClient.Writeable getMetadataClient(); /** - * Retrieves the network configuration section of a VM. + * Retrieves the network config section of a vApp or vApp template. * *
     * GET /vApp/{id}/networkConfigSection
@@ -448,10 +448,10 @@ public interface VAppClient {
     *
     * @since 0.9
     */
-   NetworkConfigSection getNetworkConfigSection(URI vAppURI);
+   NetworkConfigSection getNetworkConfigSection(URI vmURI);
 
    /**
-    * Modifies the network configuration section of a VM.
+    * Modifies the network config section of a vApp.
     *
     * 
     * PUT /vApp/{id}/networkConfigSection
@@ -459,7 +459,7 @@ public interface VAppClient {
     *
     * @since 0.9
     */
-   Task modifyNetworkConfigSection(URI vAppURI, NetworkConfigSection section);
+   Task modifyNetworkConfigSection(URI vmURI, NetworkConfigSection section);
 
    /**
     * Retrieves the network connection section of a VM.
@@ -470,7 +470,7 @@ public interface VAppClient {
     *
     * @since 0.9
     */
-   NetworkConnectionSection getNetworkConnectionSection(URI vAppURI);
+   NetworkConnectionSection getNetworkConnectionSection(URI vmURI);
 
    /**
     * Modifies the network connection section of a VM.
@@ -481,10 +481,10 @@ public interface VAppClient {
     *
     * @since 0.9
     */
-   Task modifyNetworkConnectionSection(URI vAppURI, NetworkConnectionSection section);
+   Task modifyNetworkConnectionSection(URI vmURI, NetworkConnectionSection section);
 
    /**
-    * Retrieves the network section of a VM.
+    * Retrieves the network section of a vApp or vApp template.
     *
     * 
     * GET /vApp/{id}/networkSection
@@ -503,7 +503,7 @@ public interface VAppClient {
     *
     * @since 0.9
     */
-   OperatingSystemSection getOperatingSystemSection(URI vAppURI);
+   OperatingSystemSection getOperatingSystemSection(URI vmURI);
 
    /**
     * Modifies the operating system section of a VM.
@@ -514,7 +514,7 @@ public interface VAppClient {
     *
     * @since 0.9
     */
-   Task modifyOperatingSystemSection(URI vAppURI, OperatingSystemSection section);
+   Task modifyOperatingSystemSection(URI vmURI, OperatingSystemSection section);
 
    /**
     * Retrieves the owner of a vApp.
diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/predicates/ReferenceTypePredicates.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/predicates/ReferenceTypePredicates.java
index dc6b40bffe..be839e837f 100644
--- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/predicates/ReferenceTypePredicates.java
+++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/predicates/ReferenceTypePredicates.java
@@ -20,27 +20,22 @@ package org.jclouds.vcloud.director.v1_5.predicates;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
-import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
-import org.jclouds.vcloud.director.v1_5.domain.Link;
 import org.jclouds.vcloud.director.v1_5.domain.Reference;
 
 import com.google.common.base.Predicate;
 
 /**
- * Predicates handy when working with Reference Types
+ * Predicates for working with {@link Reference} collections.
  * 
  * @author Adrian Cole
  */
-
 public class ReferenceTypePredicates {
 
    /**
-    * matches references of the given name
+    * Matches {@link Reference}s of the given name.
     * 
-    * @param 
-    *           type of the ReferenceType, ex. {@link Link}
-    * @param name
-    *           ex. {@code context.getApi().getCurrentSession().getOrg()}
+    * @param T type of the reference, for example {@link Link}
+    * @param name value of the name attribute of the referenced object
     * @return predicate that will match references of the given name
     */
    public static  Predicate nameEquals(final String name) {
@@ -60,12 +55,10 @@ public class ReferenceTypePredicates {
    }
 
    /**
-    * matches references of the given type
+    * Matches {@link Reference}s of the given type.
     * 
-    * @param 
-    *           type of the ReferenceType, ex. {@link Link}
-    * @param type
-    *           ex. {@link VCloudDirectorMediaType#CATALOG}
+    * @param T type of the reference, for example {@link Link}
+    * @param type the media type string of the referenced object, for example {@link VCloudDirectorMediaType#CATALOG}
     * @return predicate that will match references of the given type
     * @see VCloudDirectorMediaType
     */
diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorLiveTestConstants.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorLiveTestConstants.java
index 48824c9592..ea8fc73ff4 100644
--- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorLiveTestConstants.java
+++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorLiveTestConstants.java
@@ -23,9 +23,15 @@ package org.jclouds.vcloud.director.v1_5;
  */
 public class VCloudDirectorLiveTestConstants {
 
+   /* regular expressions for pattern matching */
+   
+   public static final String MAC_ADDRESS_PATTERN = "^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$";
+
+   /* Error code 200 indicates success. */
+
    public static final String OK = "ERR-200: ok";
 
-   /* Error codes from 100 to 199 reflect parsing and other errors in domain objects. */
+   /* Error codes from 100 to 199 reflect parsing and other errors in domain object fields and attributes. */
 
    public static final String REF_REQ_LIVE = "ERR-101: %s reference required to perform live tests";
 
@@ -53,7 +59,7 @@ public class VCloudDirectorLiveTestConstants {
 
    public static final String TASK_COMPLETE_TIMELY = "ERR-113: Task %s should complete in a timely fashion";
 
-   public static final String NOT_NULL_OBJECT_FMT = "ERR-114: The %s field of the %s must not be null";
+   public static final String NOT_NULL_OBJ_FIELD_FMT = "ERR-114: The %s field of the %s must not be null";
    
    public static final String NOT_EMPTY_OBJECT_FMT = "ERR-115: One or more %s fields of the %s must be present";
    
@@ -74,6 +80,12 @@ public class VCloudDirectorLiveTestConstants {
    public static final String OBJ_FIELD_CLONE = "ERR-123: %s %s must be a clone of \"%s\" (%s)";
    
    public static final String OBJ_FIELD_EMPTY_TO_DELETE = "ERR-124: %s must have no %s to be deleted (%s)";
+   
+   public static final String NOT_NULL_OBJ_FMT = "ERR-125: The %s object must not be null";
+
+   public static final String NOT_EMPTY_STRING_FMT = "ERR-126: The %s field must not be an empty string";
+
+   public static final String MATCHES_STRING_FMT = "ERR-127: The %s field must match the pattern \"%s\"";
 
    /* Error codes from 300 to 399 reflect entities and their links and relationship errors. */ 
    
diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java
index 0abad4ee0f..fc7b31688a 100644
--- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java
+++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java
@@ -19,9 +19,13 @@
 package org.jclouds.vcloud.director.v1_5.domain;
 
 import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CONDITION_FMT;
+import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MAC_ADDRESS_PATTERN;
+import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MATCHES_STRING_FMT;
 import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_BE_WELL_FORMED_FMT;
 import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_CONTAIN_FMT;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_NULL_OBJECT_FMT;
+import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_EMPTY_STRING_FMT;
+import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_NULL_OBJ_FIELD_FMT;
+import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_NULL_OBJ_FMT;
 import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_DEL;
 import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_ATTRB_REQ;
 import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
@@ -56,7 +60,9 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
 import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
 import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
 import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
+import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
 import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
+import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
 import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
 import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualSystem;
 import org.jclouds.vcloud.director.v1_5.domain.ovf.environment.EnvironmentType;
@@ -85,7 +91,7 @@ public class Checks {
    
    public static void checkEntityType(EntityType entity) {
       // Check required fields
-      assertNotNull(entity.getName(), String.format(NOT_NULL_OBJECT_FMT, "Name", "EntityType"));
+      assertNotNull(entity.getName(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Name", "EntityType"));
 
       // Check optional fields
       // NOTE description cannot be checked
@@ -109,7 +115,7 @@ public class Checks {
    
    public static void checkReferenceType(Reference reference, Collection validTypes) {
       // Check required fields
-      assertNotNull(reference.getHref(), String.format(NOT_NULL_OBJECT_FMT, "Href", "ReferenceType"));
+      assertNotNull(reference.getHref(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Href", "ReferenceType"));
 
       // Check optional fields
       String id = reference.getId();
@@ -164,7 +170,7 @@ public class Checks {
 
    public static void checkLink(Link link) {
       // Check required fields
-      assertNotNull(link.getRel(), String.format(NOT_NULL_OBJECT_FMT, "Rel", "Link"));
+      assertNotNull(link.getRel(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Rel", "Link"));
       assertTrue(Link.Rel.ALL.contains(link.getRel()), String.format(REQUIRED_VALUE_OBJECT_FMT, "Rel", "Link", link.getRel(), Iterables.toString(Link.Rel.ALL)));
 
       // Check parent type
@@ -173,7 +179,7 @@ public class Checks {
 
    public static void checkTask(Task task) {
       // Check required fields
-      assertNotNull(task.getStatus(), String.format(NOT_NULL_OBJECT_FMT, "Status", "Task"));
+      assertNotNull(task.getStatus(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Status", "Task"));
       assertTrue(Task.Status.ALL.contains(task.getStatus()), String.format(REQUIRED_VALUE_OBJECT_FMT, "Status", "Task", task.getStatus(), Iterables.toString(Task.Status.ALL)));
 
       // Check optional fields
@@ -228,8 +234,8 @@ public class Checks {
 
    public static void checkMetadataEntry(MetadataEntry metadataEntry) {
       // Check required fields
-      assertNotNull(metadataEntry.getKey(), String.format(NOT_NULL_OBJECT_FMT, "Key", "MetadataEntry"));
-      assertNotNull(metadataEntry.getValue(), String.format(NOT_NULL_OBJECT_FMT, "Value", "MetadataEntry"));
+      assertNotNull(metadataEntry.getKey(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Key", "MetadataEntry"));
+      assertNotNull(metadataEntry.getValue(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Value", "MetadataEntry"));
 
       // Check parent type
       checkResourceType(metadataEntry);
@@ -237,7 +243,7 @@ public class Checks {
 
    public static void checkMetadataValue(MetadataValue metadataValue) {
       // Check required elements and attributes
-      assertNotNull(metadataValue.getValue(), String.format(NOT_NULL_OBJECT_FMT, "Value", "MetadataValue"));
+      assertNotNull(metadataValue.getValue(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Value", "MetadataValue"));
       
       // Check parent type
       checkResourceType(metadataValue);
@@ -249,9 +255,9 @@ public class Checks {
 
    public static void checkError(Error error) {
       // Check required fields
-      assertNotNull(error.getMessage(), String.format(NOT_NULL_OBJECT_FMT, "Message", "Error"));
-      assertNotNull(error.getMajorErrorCode(), String.format(NOT_NULL_OBJECT_FMT, "MajorErrorCode", "Error"));
-      assertNotNull(error.getMinorErrorCode(), String.format(NOT_NULL_OBJECT_FMT, "MinorErrorCode", "Error"));
+      assertNotNull(error.getMessage(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Message", "Error"));
+      assertNotNull(error.getMajorErrorCode(), String.format(NOT_NULL_OBJ_FIELD_FMT, "MajorErrorCode", "Error"));
+      assertNotNull(error.getMinorErrorCode(), String.format(NOT_NULL_OBJ_FIELD_FMT, "MinorErrorCode", "Error"));
       
       // NOTE vendorSpecificErrorCode cannot be checked
       // NOTE stackTrace cannot be checked
@@ -259,7 +265,7 @@ public class Checks {
 
    public static void checkOrg(Org org) {
       // Check required elements and attributes
-      assertNotNull(org.getFullName(), String.format(NOT_NULL_OBJECT_FMT, "FullName", "Org"));
+      assertNotNull(org.getFullName(), String.format(NOT_NULL_OBJ_FIELD_FMT, "FullName", "Org"));
 
       // Check parent type
       checkEntityType(org);
@@ -267,7 +273,7 @@ public class Checks {
    
    public static void checkAdminOrg(AdminOrg org) {
       // required
-      assertNotNull(org.getSettings(), String.format(NOT_NULL_OBJECT_FMT, "settings", "AdminOrg"));
+      assertNotNull(org.getSettings(), String.format(NOT_NULL_OBJ_FIELD_FMT, "settings", "AdminOrg"));
       
       // optional
       if (org.getGroups() != null) {
@@ -405,7 +411,7 @@ public class Checks {
    public static void checkNetworkFeatures(NetworkFeatures features) {
       // Check optional fields
       if (features.getNetworkServices() != null) {
-         for (NetworkServiceType service : features.getNetworkServices()) {
+         for (NetworkServiceType service : features.getNetworkServices()) {
             checkNetworkService(service);
          }
       }
@@ -456,12 +462,14 @@ public class Checks {
    }
    
    public static void checkIpAddress(String ip) {
-      InetAddresses.isInetAddress(ip);
+      // Check the string is a valid IP address
+      assertTrue(InetAddresses.isInetAddress(ip), String.format(CONDITION_FMT, "IpAddress", "a valid IP address", ip));
    }
    
    private static void checkMacAddress(String macAddress) {
-      assertNotNull(macAddress, String.format(NOT_NULL_OBJECT_FMT, "macAddress", ""));
-      assertTrue(macAddress.matches("^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$"));
+      // Check the string is a valid MAC address
+      assertNotNull(macAddress, String.format(NOT_EMPTY_STRING_FMT, "macAddress"));
+      assertTrue(macAddress.matches(MAC_ADDRESS_PATTERN), String.format(MATCHES_STRING_FMT, "macAddress", MAC_ADDRESS_PATTERN));
    }
 
    public static void checkComputeCapacity(ComputeCapacity computeCapacity) {
@@ -493,7 +501,6 @@ public class Checks {
       assertNotNull(capacity.getLimit(), "The limit attribute of a CapacityWithUsage must be set");
       assertTrue(capacity.getLimit() >= 0, "Limit must be greater than or equal to 0");
       
-      
       // Check optional fields
       if (capacity.getAllocated() != null) {
          assertTrue(capacity.getAllocated() >= 0, "allocated must be greater than or equal to 0");
@@ -615,7 +622,7 @@ public class Checks {
 
    public static void checkVAppTemplate(VAppTemplate template) {
       // Check required fields
-      assertNotNull(template.getName(), String.format(NOT_NULL_OBJECT_FMT, "Name", "VAppTemplate"));
+      assertNotNull(template.getName(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Name", "VAppTemplate"));
       
       // Check optional fields
       Owner owner = template.getOwner();
@@ -810,16 +817,16 @@ public class Checks {
       // NOTE canPublishCatalogs cannot be checked
       // NOTE useServerBootSequence cannot be checked
       if (settings.getDeployedVMQuota() != null) {
-         assertTrue(settings.getDeployedVMQuota() >= 0, String.format(
-               OBJ_FIELD_GTE_0, "deployedVMQuota", "port", settings.getDeployedVMQuota()));
+         assertTrue(settings.getDeployedVMQuota() >= 0,
+               String.format(OBJ_FIELD_GTE_0, "deployedVMQuota", "port", settings.getDeployedVMQuota()));
       }
       if (settings.getStoredVmQuota() != null) {
-         assertTrue(settings.getStoredVmQuota() >= 0, String.format(
-               OBJ_FIELD_GTE_0, "storedVmQuota", "port", settings.getStoredVmQuota()));
+         assertTrue(settings.getStoredVmQuota() >= 0,
+               String.format(OBJ_FIELD_GTE_0, "storedVmQuota", "port", settings.getStoredVmQuota()));
       }
       if (settings.getDelayAfterPowerOnSeconds() != null) {
-         assertTrue(settings.getDelayAfterPowerOnSeconds() >= 0, String.format(
-               OBJ_FIELD_GTE_0, "delayAfterPowerOnSeconds", "port", settings.getDelayAfterPowerOnSeconds()));
+         assertTrue(settings.getDelayAfterPowerOnSeconds() >= 0,
+               String.format(OBJ_FIELD_GTE_0, "delayAfterPowerOnSeconds", "port", settings.getDelayAfterPowerOnSeconds()));
       }
       
       // parent type
@@ -830,8 +837,9 @@ public class Checks {
       // Check optional fields
       // NOTE customUsersOu cannot be checked
       if (settings.getLdapMode() != null) {
-         assertTrue(LdapMode.ALL.contains(settings.getLdapMode()), String.format(REQUIRED_VALUE_OBJECT_FMT, 
-               "LdapMode", "OrdLdapSettings", settings.getLdapMode(), Iterables.toString(OrgLdapSettings.LdapMode.ALL)));
+         assertTrue(LdapMode.ALL.contains(settings.getLdapMode()),
+               String.format(REQUIRED_VALUE_OBJECT_FMT, "LdapMode", "OrdLdapSettings", settings.getLdapMode(),
+                     Iterables.toString(OrgLdapSettings.LdapMode.ALL)));
       }
       if (settings.getCustomOrgLdapSettings() != null) {
          checkCustomOrgLdapSettings(settings.getCustomOrgLdapSettings());
@@ -845,17 +853,17 @@ public class Checks {
       // required
       assertNotNull(settings.getHostName(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "hostName"));
       assertNotNull(settings.getPort(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "port"));
-      assertTrue(settings.getPort() >= 0, String.format(
-            OBJ_FIELD_GTE_0, "CustomOrgLdapSettings", "port", settings.getPort()));
+      assertTrue(settings.getPort() >= 0,
+            String.format(OBJ_FIELD_GTE_0, "CustomOrgLdapSettings", "port", settings.getPort()));
       assertNotNull(settings.getAuthenticationMechanism(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "authenticationMechanism"));
-      assertTrue(AuthenticationMechanism.ALL.contains(settings.getAuthenticationMechanism()), String.format(REQUIRED_VALUE_OBJECT_FMT, 
-            "AuthenticationMechanism", "CustomOrdLdapSettings", settings.getAuthenticationMechanism(), 
-            Iterables.toString(CustomOrgLdapSettings.AuthenticationMechanism.ALL)));
+      assertTrue(AuthenticationMechanism.ALL.contains(settings.getAuthenticationMechanism()),
+            String.format(REQUIRED_VALUE_OBJECT_FMT, "AuthenticationMechanism", "CustomOrdLdapSettings", settings.getAuthenticationMechanism(),
+                  Iterables.toString(CustomOrgLdapSettings.AuthenticationMechanism.ALL)));
       assertNotNull(settings.isGroupSearchBaseEnabled(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "isGroupSearchBaseEnabled"));
       assertNotNull(settings.getConnectorType(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "connectorType"));
-      assertTrue(ConnectorType.ALL.contains(settings.getConnectorType()), String.format(REQUIRED_VALUE_OBJECT_FMT, 
-            "ConnectorType", "CustomOrdLdapSettings", settings.getConnectorType(), 
-            Iterables.toString(CustomOrgLdapSettings.ConnectorType.ALL)));
+      assertTrue(ConnectorType.ALL.contains(settings.getConnectorType()),
+            String.format(REQUIRED_VALUE_OBJECT_FMT, "ConnectorType", "CustomOrdLdapSettings", settings.getConnectorType(),
+                  Iterables.toString(CustomOrgLdapSettings.ConnectorType.ALL)));
       assertNotNull(settings.getUserAttributes(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "userAttributes"));
       checkUserAttributes("CustomOrdLdapSettings", settings.getUserAttributes());
       assertNotNull(settings.getGroupAttributes(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "groupAttributes"));
@@ -901,13 +909,16 @@ public class Checks {
 
    public static void checkPasswordPolicySettings(OrgPasswordPolicySettings settings) {
       // required
-      assertNotNull(settings.isAccountLockoutEnabled(), String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "isAccountLockoutEnabled"));
-      assertNotNull(settings.getInvalidLoginsBeforeLockout(), String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "invalidLoginsBeforeLockout"));
-      assertTrue(settings.getInvalidLoginsBeforeLockout() >= 0, String.format(
-            OBJ_FIELD_GTE_0, "OrgPasswordPolicySettings", "storageLeaseSeconds", settings.getInvalidLoginsBeforeLockout()));
-      assertNotNull(settings.getAccountLockoutIntervalMinutes(), String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "accountLockoutIntervalMinutes"));
-      assertTrue(settings.getAccountLockoutIntervalMinutes() >= 0, String.format(
-            OBJ_FIELD_GTE_0, "OrgPasswordPolicySettings", "accountLockoutIntervalMinutes", settings.getAccountLockoutIntervalMinutes()));
+      assertNotNull(settings.isAccountLockoutEnabled(),
+            String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "isAccountLockoutEnabled"));
+      assertNotNull(settings.getInvalidLoginsBeforeLockout(),
+            String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "invalidLoginsBeforeLockout"));
+      assertTrue(settings.getInvalidLoginsBeforeLockout() >= 0,
+            String.format(OBJ_FIELD_GTE_0, "OrgPasswordPolicySettings", "storageLeaseSeconds", settings.getInvalidLoginsBeforeLockout()));
+      assertNotNull(settings.getAccountLockoutIntervalMinutes(),
+            String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "accountLockoutIntervalMinutes"));
+      assertTrue(settings.getAccountLockoutIntervalMinutes() >= 0,
+            String.format(OBJ_FIELD_GTE_0, "OrgPasswordPolicySettings", "accountLockoutIntervalMinutes", settings.getAccountLockoutIntervalMinutes()));
       
       // parent type
       checkResourceType(settings);
@@ -917,12 +928,12 @@ public class Checks {
       // Check optional fields
       // NOTE deleteOnStorageLeaseExpiration cannot be checked
       if (settings.getStorageLeaseSeconds() != null) {
-         assertTrue(settings.getStorageLeaseSeconds() >= 0, String.format(
-               OBJ_FIELD_GTE_0, "OrgLeaseSettings", "storageLeaseSeconds", settings.getStorageLeaseSeconds()));
+         assertTrue(settings.getStorageLeaseSeconds() >= 0,
+               String.format(OBJ_FIELD_GTE_0, "OrgLeaseSettings", "storageLeaseSeconds", settings.getStorageLeaseSeconds()));
       }
       if (settings.getDeploymentLeaseSeconds() != null) {
-         assertTrue(settings.getDeploymentLeaseSeconds() >= 0, String.format(
-               OBJ_FIELD_GTE_0, "OrgLeaseSettings", "deploymentLeaseSeconds", settings.getDeploymentLeaseSeconds()));
+         assertTrue(settings.getDeploymentLeaseSeconds() >= 0,
+               String.format(OBJ_FIELD_GTE_0, "OrgLeaseSettings", "deploymentLeaseSeconds", settings.getDeploymentLeaseSeconds()));
       }
       
       // parent type
@@ -933,8 +944,8 @@ public class Checks {
       // Check optional fields
       // NOTE deleteOnStorageLeaseExpiration cannot be checked
       if (settings.getStorageLeaseSeconds() != null) {
-         assertTrue(settings.getStorageLeaseSeconds() >= 0, String.format(
-               OBJ_FIELD_GTE_0, "OrgVAppTemplateLeaseSettings", "storageLeaseSeconds", settings.getStorageLeaseSeconds()));
+         assertTrue(settings.getStorageLeaseSeconds() >= 0,
+               String.format(OBJ_FIELD_GTE_0, "OrgVAppTemplateLeaseSettings", "storageLeaseSeconds", settings.getStorageLeaseSeconds()));
       }
       
       // parent type
@@ -965,12 +976,12 @@ public class Checks {
          checkEmailAddress(user.getAlertEmail());
       }
       if (user.getStoredVmQuota() != null) {
-         assertTrue(user.getStoredVmQuota() >= 0, String.format(OBJ_FIELD_GTE_0, 
-               "User", "storedVmQuota", user.getStoredVmQuota()));
+         assertTrue(user.getStoredVmQuota() >= 0,
+               String.format(OBJ_FIELD_GTE_0, "User", "storedVmQuota", user.getStoredVmQuota()));
       }
       if (user.getDeployedVmQuota() != null) {
-         assertTrue(user.getDeployedVmQuota() >= 0, String.format(OBJ_FIELD_GTE_0, 
-               "User", "deployedVmQuota", user.getDeployedVmQuota()));
+         assertTrue(user.getDeployedVmQuota() >= 0,
+               String.format(OBJ_FIELD_GTE_0, "User", "deployedVmQuota", user.getDeployedVmQuota()));
       }
       if (user.getRole() != null) {
          checkReferenceType(user.getRole());
@@ -986,99 +997,174 @@ public class Checks {
    }
    
    public static void checkTelephone(String number) {
-      // TODO: regex validate telephone 
+      // TODO regex validate telephone 
    }
 
-   public static void checkCustomizationSection(CustomizationSection val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "CustomizationSection", ""));
+   public static void checkScreenTicket(ScreenTicket ticket) {
+      // NOTE the value field cannot be checked
+   }
+
+   public static void checkCustomizationSection(CustomizationSection section) {
+      assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "CustomizationSection"));
       
       // Check optional fields
-      if (val.getLinks() != null) {
-         for (Link link : val.getLinks()) {
+      if (section.getLinks() != null) {
+         for (Link link : section.getLinks()) {
             checkLink(link);
          }
       }
-      if (val.getType() != null) {
-         checkType(val.getType());
-      }
-      if (val.getHref() != null) {
-         checkHref(val.getHref());
-      }
+      if (section.getType() != null) checkType(section.getType());
+      if (section.getHref() != null) checkHref(section.getHref());
       
-      checkOvfSectionType(val);
+      // Check parent type
+      checkOvfSectionType(section);
    }
 
-   public static void checkProductSectionList(ProductSectionList val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "ProductSectionList", ""));
+   public static void checkProductSectionList(ProductSectionList sections) {
+      assertNotNull(sections, String.format(NOT_NULL_OBJ_FMT, "ProductSectionList"));
       
-      for (ProductSection productSection : val) {
+      for (ProductSection productSection : sections) {
          checkOvfProductSection(productSection);
       }
       
-      checkResourceType(val);
+      // Check parent type
+      checkResourceType(sections);
    }
 
-   public static void checkGuestCustomizationSection(GuestCustomizationSection val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "GuestCustomizationSection", ""));
+   public static void checkGuestCustomizationSection(GuestCustomizationSection section) {
+      assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "NetworkConfigSection"));
       
-      if (!val.isJoinDomainEnabled()) {
-         assertFalse(val.isUseOrgSettings());
-         assertNull(val.getDomainName());
-         assertNull(val.getDomainUserName());
-         assertNull(val.getDomainUserPassword());
+      
+      if (!section.isJoinDomainEnabled()) {
+         assertFalse(section.isUseOrgSettings());
+         assertNull(section.getDomainName());
+         assertNull(section.getDomainUserName());
+         assertNull(section.getDomainUserPassword());
       }
       
-      if (!val.isAdminPasswordEnabled()) {
-         assertFalse(val.isAdminPasswordAuto());
-         assertFalse(val.isResetPasswordRequired());
-         if (val.isAdminPasswordAuto()) {
-            assertNull(val.getAdminPassword());
+      if (!section.isAdminPasswordEnabled()) {
+         assertFalse(section.isAdminPasswordAuto());
+         assertFalse(section.isResetPasswordRequired());
+         if (section.isAdminPasswordAuto()) {
+            assertNull(section.getAdminPassword());
          }
       }
       
-      checkOvfSectionType(val);
+      // Check parent type
+      checkOvfSectionType(section);
    }
 
-   public static void checkLeaseSettingsSection(LeaseSettingsSection val) {
-      if (val.getLinks() != null) {
-         for (Link link : val.getLinks()) {
+   public static void checkLeaseSettingsSection(LeaseSettingsSection section) {
+      assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "LeaseSettingsSection"));
+      
+      if (section.getLinks() != null) {
+         for (Link link : section.getLinks()) {
             checkLink(link);
          }
       }
       
-      checkOvfSectionType(val);
+      // Check parent type
+      checkOvfSectionType(section);
    }
 
-   public static void checkNetworkConfigSection(NetworkConfigSection val) {
-      if (val.getNetworkConfigs() != null) {
-         for (VAppNetworkConfiguration networkConfig : val.getNetworkConfigs()) {
+   public static void checkNetworkConfigSection(NetworkConfigSection section) {
+      assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "NetworkConfigSection"));
+      
+      if (section.getNetworkConfigs() != null) {
+         for (VAppNetworkConfiguration networkConfig : section.getNetworkConfigs()) {
             checkVAppNetworkConfig(networkConfig);
          }
       }
-      if (val.getLinks() != null) {
-         for (Link link : val.getLinks()) {
+      if (section.getLinks() != null) {
+         for (Link link : section.getLinks()) {
             checkLink(link);
          }
       }
-      if (val.getHref() != null) {
-         checkHref(val.getHref());
+      if (section.getHref() != null) {
+         checkHref(section.getHref());
       }
       
-      checkOvfSectionType(val);
+      // Check parent type
+      checkOvfSectionType(section);
+   }
+
+   public static void checkNetworkSection(NetworkSection section) {
+      assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "NetworkSection"));
+      
+      // Check optional fields
+      if (section.getNetworks() != null) {
+	      for (Network network : section.getNetworks()) {
+	         checkNetwork(network);
+	      }
+      }
+
+      // Check parent type
+      checkOvfSectionType(section);
+   }
+
+   public static void checkNetwork(Network network) {
+      assertNotNull(network, String.format(NOT_NULL_OBJ_FMT, "Network"));
+      
+      // Check optional fields
+      // NOTE name field cannot be checked
+      // NOTE description field cannot be checked
+   }
+
+   public static void checkOperatingSystemSection(OperatingSystemSection section) {
+      assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "OperatingSystemSection"));
+      
+      // Check optional fields
+      // NOTE id field cannot be checked
+      // NOTE version field cannot be checked
+      // NOTE description field cannot be checked
+
+      // Check parent type
+      checkOvfSectionType(section);
+   }
+
+   public static void checkRuntimeInfoSection(RuntimeInfoSection section) {
+      assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "RuntimeInfoSection"));
+      
+      // Check optional fields
+      VMWareTools tools = section.getVMWareTools();
+      if (tools != null) checkVMWareTools(tools);
+
+      // NOTE does this mean anything?
+      for (Object any : section.getAny()) {
+         assertNotNull(any);
+      }
+
+      // Check parent type
+      checkOvfSectionType(section);
+   }
+
+   public static void checkVMWareTools(VMWareTools tools) {
+      assertNotNull(tools, String.format(NOT_NULL_OBJ_FMT, "VMWareTools"));
+      
+      // Check required fields
+      assertNotNull(tools.getVersion(), String.format(NOT_NULL_OBJ_FIELD_FMT, "version", "VMWareTools"));
+      assertFalse(tools.getVersion().isEmpty(), String.format(NOT_EMPTY_STRING_FMT, "VMWareTools.version"));
+   }
+
+   public static void checkStartupSection(StartupSection section) {
+      // TODO
+
+      // Check parent type
+      checkOvfSectionType(section);
    }
 
    private static void checkVAppNetworkConfig(VAppNetworkConfiguration val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "VAppNetworkConfiguration", ""));
+      assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "VAppNetworkConfiguration"));
       
       // required fields
-      assertNotNull(val.getNetworkName(), String.format(NOT_NULL_OBJECT_FMT, "NetworkName", "VAppNetworkConfiguration"));
+      assertNotNull(val.getNetworkName(), String.format(NOT_NULL_OBJ_FIELD_FMT, "NetworkName", "VAppNetworkConfiguration"));
       checkNetworkConfiguration(val.getConfiguration());
       
       checkResourceType(val);
    }
 
    public static void checkNetworkConnectionSection(NetworkConnectionSection val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "VAppConnectionSection", ""));
+      assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "VAppConnectionSection"));
       
       // Check optional fields
       if (val.getLinks() != null) {
@@ -1102,11 +1188,11 @@ public class Checks {
    }
 
    private static void checkNetworkConnection(NetworkConnection val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "NetworkConnection", ""));
+      assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "NetworkConnection"));
       
       // Check required fields
-      assertNotNull(val.getNetwork(), String.format(NOT_NULL_OBJECT_FMT, "Network", "NetworkConnection"));
-      assertNotNull(val.getIpAddressAllocationMode(), String.format(NOT_NULL_OBJECT_FMT, "IpAddressAllocationMode", "NetworkConnection"));
+      assertNotNull(val.getNetwork(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Network", "NetworkConnection"));
+      assertNotNull(val.getIpAddressAllocationMode(), String.format(NOT_NULL_OBJ_FIELD_FMT, "IpAddressAllocationMode", "NetworkConnection"));
       IpAddressAllocationMode mode = NetworkConnection.IpAddressAllocationMode.valueOf(val.getIpAddressAllocationMode());
       assertTrue(NetworkConnection.IpAddressAllocationMode.ALL.contains(mode), 
                String.format(REQUIRED_VALUE_OBJECT_FMT, "IpAddressAllocationMode", "NetworkConnection", val.getIpAddressAllocationMode(), Iterables.toString(NetworkConnection.IpAddressAllocationMode.ALL)));
@@ -1122,17 +1208,28 @@ public class Checks {
       if (val.getMACAddress() != null) {
          checkMacAddress(val.getMACAddress());
       }
-      
-      // FIXME Missing?
-      //val.getVCloudExtension();
+   }
+
+   public static void checkRASD(RASD rasd) {
+      // Check fields
+      // TODO
+   }
+
+   public static void checkRasdItemsList(RasdItemsList items) {
+      // Check fields
+      // TODO
+
+      for (RASD item : items.getItems()) {
+         checkRASD(item);
+      }
    }
 
    public static void checkOvfSectionType(SectionType section) {
-      assertNotNull(section, String.format(NOT_NULL_OBJECT_FMT, "SectionType", ""));
+      assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "SectionType"));
    }
    
    public static void checkOvfProductSection(ProductSection val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "ProductSection", ""));
+      assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "ProductSection"));
 
       if (val.getProperties() != null) {
          for (org.jclouds.vcloud.director.v1_5.domain.ovf.Property property : val.getProperties()) {
@@ -1140,15 +1237,16 @@ public class Checks {
          }
       }
       
+      // Check parent type
       checkOvfSectionType(val);
    }
 
    private static void checkOvfProperty(org.jclouds.vcloud.director.v1_5.domain.ovf.Property val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "Property", ""));
+      assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "Property"));
    }
 
    public static void checkOvfNetworkSection(NetworkSection val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "NetworkSection", ""));
+      assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "NetworkSection"));
 
       if (val.getNetworks() != null) {
          for (Network network : val.getNetworks()) {
@@ -1160,11 +1258,11 @@ public class Checks {
    }
 
    private static void checkOvfNetwork(Network val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "Network", ""));
+      assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "Network"));
    }
 
    public static void checkOvfEnvelope(Envelope val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "Envelope", ""));
+      assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "Envelope"));
       
       if (val.getDiskSections() != null) {
          for (DiskSection diskSection : val.getDiskSections()) {
@@ -1182,7 +1280,7 @@ public class Checks {
    }
 
    private static void checkOvfVirtualSystem(VirtualSystem val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "VirtualSystem", ""));
+      assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "VirtualSystem"));
       
       if (val.getProductSections() != null) {
          for (ProductSection productSection : val.getProductSections()) {
@@ -1199,47 +1297,54 @@ public class Checks {
       }
    }
 
-   private static void checkOvfDiskSection(DiskSection val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "DiskSection", ""));
+   private static void checkOvfDiskSection(DiskSection section) {
+      assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "DiskSection"));
       
-      if (val.getDisks() != null) {
-         for (Disk disk : val.getDisks()) {
+      if (section.getDisks() != null) {
+         for (Disk disk : section.getDisks()) {
             checkOvfDisk(disk);
          }
       }
+      
+      // Check parent type
+      checkOvfSectionType(section);
    }
    
-   private static void checkOvfDisk(Disk val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "Disk", ""));
+   private static void checkOvfDisk(Disk disk) {
+      assertNotNull(disk, String.format(NOT_NULL_OBJ_FMT, "Disk"));
    }
 
-   private static void checkOvfOperationSystemSection(OperatingSystemSection val) {
-      checkOvfSectionType(val);
-   }
-
-   private static void checkOvfVirtualHardwareSection(VirtualHardwareSection val) {
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "VirtualHardwareSection", ""));
+   private static void checkOvfOperationSystemSection(OperatingSystemSection section) {
+      assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "OperatingSystemSection"));
       
-      if (val.getItems() != null) {
-         for (ResourceAllocationSettingData item : val.getItems()) {
+      // Check parent type
+      checkOvfSectionType(section);
+   }
+
+   private static void checkOvfVirtualHardwareSection(VirtualHardwareSection section) {
+      assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "VirtualHardwareSection"));
+      
+      if (section.getItems() != null) {
+         for (ResourceAllocationSettingData item : section.getItems()) {
             checkCimResourceAllocationSettingData(item);
          }
       }
-      if (val.getSystem() != null) {
-         checkCimVirtualSystemSettingData(val.getSystem());
+      if (section.getSystem() != null) {
+         checkCimVirtualSystemSettingData(section.getSystem());
       }
       
-      checkOvfSectionType(val);
+      // Check parent type
+      checkOvfSectionType(section);
    }
 
    private static void checkCimVirtualSystemSettingData(VirtualSystemSettingData val) {
       // TODO Could do more assertions...
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "VirtualSystemSettingData", ""));
+      assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "VirtualSystemSettingData"));
    }
 
    private static void checkCimResourceAllocationSettingData(ResourceAllocationSettingData val) {
       // TODO Could do more assertions...
-      assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "ResouorceAllocatoinSettingData", ""));
+      assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "ResouorceAllocatoinSettingData"));
    }
 
    public static void checkAdminVdc(AdminVdc vdc) {
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 8f8b93fed8..6d6ca59a26 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
@@ -19,7 +19,6 @@
 package org.jclouds.vcloud.director.v1_5.features;
 
 import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CONDITION_FMT;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_CONDITION;
 import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_EQUAL;
 import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_NON_NULL;
 import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
@@ -29,10 +28,18 @@ 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.checkMetadataFor;
 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.checkRASD;
+import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkRasdItemsList;
+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.testng.Assert.assertEquals;
@@ -43,6 +50,8 @@ import static org.testng.Assert.fail;
 
 import java.io.IOException;
 import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
 import java.util.Map;
 import java.util.Random;
 import java.util.Set;
@@ -74,6 +83,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Reference;
 import org.jclouds.vcloud.director.v1_5.domain.RelocateParams;
 import org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status;
 import org.jclouds.vcloud.director.v1_5.domain.RuntimeInfoSection;
+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.UndeployVAppParams;
 import org.jclouds.vcloud.director.v1_5.domain.VApp;
@@ -86,6 +96,8 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
 import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
 import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
 import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
+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.internal.BaseVCloudDirectorClientLiveTest;
 import org.jclouds.vcloud.director.v1_5.predicates.ReferenceTypePredicates;
 import org.jclouds.xml.internal.JAXBParser;
@@ -101,7 +113,6 @@ import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
 
 /**
  * Tests behavior of {@code VAppClient}
@@ -116,8 +127,8 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
    public static final String VDC = "vdc";
 
    /*
-    * Convenience reference to API clients.
-    */
+   * Convenience reference to API clients.
+   */
 
    protected CatalogClient catalogClient;
    protected OrgClient orgClient;
@@ -127,307 +138,288 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
    protected MetadataClient.Writeable metadataClient;
 
    /*
-    * Objects shared between tests.
-    */
+   * Objects shared between tests.
+   */
 
-   private JAXBParser parser;
-   
    private Vdc vdc;
    private VApp vApp;
    private VAppTemplate vAppTemplate;
 
    private final Random random = new Random();
-   
+
    @BeforeClass(inheritGroups = true)
    @Override
    public void setupRequiredClients() {
-      catalogClient = context.getApi().getCatalogClient();
-      orgClient = context.getApi().getOrgClient();
-      vAppClient = context.getApi().getVAppClient();
-      vAppTemplateClient = context.getApi().getVAppTemplateClient();
-      vdcClient = context.getApi().getVdcClient();
-      metadataClient = vAppClient.getMetadataClient();
-
-      parser = new JAXBParser();
+     catalogClient = context.getApi().getCatalogClient();
+     orgClient = context.getApi().getOrgClient();
+     vAppClient = context.getApi().getVAppClient();
+     vAppTemplateClient = context.getApi().getVAppTemplateClient();
+     vdcClient = context.getApi().getVdcClient();
+     metadataClient = vAppClient.getMetadataClient();
    }
 
    @BeforeClass(inheritGroups = true)
    public void setupEnvironment() {
-      vdc = vdcClient.getVdc(vdcURI);
-      assertNotNull(vdc, String.format(ENTITY_NON_NULL, VDC));
+     vdc = vdcClient.getVdc(vdcURI);
+     assertNotNull(vdc, String.format(ENTITY_NON_NULL, VDC));
 
-      vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
-      assertNotNull(vAppTemplate, String.format(ENTITY_NON_NULL, VAPP_TEMPLATE));
-      
-      // Delete the test-vapp VApp if present
-      Iterable vApps = Iterables.filter(
-            vdc.getResourceEntities().getResourceEntities(),
-            Predicates.and(
-			      ReferenceTypePredicates.typeEquals(VCloudDirectorMediaType.VAPP),
-	            Predicates.or(
-				      ReferenceTypePredicates.nameEquals("test-vapp"),
-				      ReferenceTypePredicates.nameEquals("new-name")
-			      )
-		      )
-		   );
-      if (vApps != null && !Iterables.isEmpty(vApps)) {
-         for (Reference each : vApps) {
-            VApp found  = vAppClient.getVApp(each.getHref());
-            // debug(found);
-            if (found.getStatus().equals(Status.POWERED_ON.getValue())) {
-               Task shutdownTask = vAppClient.shutdown(found.getHref());
-   		      retryTaskSuccess.apply(shutdownTask);
-            }
-            if (found.isDeployed()) {
-               UndeployVAppParams params = UndeployVAppParams.builder().build();
-               Task undeployTask = vAppClient.undeploy(vApp.getHref(), params);
-               retryTaskSuccess.apply(undeployTask);
-            }
-            Task deleteTask = vAppClient.deleteVApp(found.getHref());
-   	      retryTaskSuccess.apply(deleteTask);
-         }
-      }
+     vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
+     assertNotNull(vAppTemplate, String.format(ENTITY_NON_NULL, VAPP_TEMPLATE));
+
+     cleanUp();
    }
 
    /**
-    * @see VAppClient#getVApp(URI)
-    */
+   * @see VAppClient#getVApp(URI)
+   */
    @Test(testName = "GET /vApp/{id}")
    public void testGetVApp() {
-      VApp vAppInstantiated = instantiateVApp();
-      
-      // Wait for the task to complete
-      Task instantiateTask = Iterables.getOnlyElement(vAppInstantiated.getTasks());
-      assertTrue(retryTaskSuccessLong.apply(instantiateTask), String.format(TASK_COMPLETE_TIMELY, "instantiateTask"));
+     VApp vAppInstantiated = instantiateVApp();
 
-      // The method under test
-      vApp = vAppClient.getVApp(vAppInstantiated.getHref());
+     // Wait for the task to complete
+     Task instantiateTask = Iterables.getOnlyElement(vAppInstantiated.getTasks());
+     assertTrue(retryTaskSuccessLong.apply(instantiateTask), String.format(TASK_COMPLETE_TIMELY, "instantiateTask"));
 
-      // Check the retrieved object is well formed
-      checkVApp(vApp);
+     // The method under test
+     vApp = vAppClient.getVApp(vAppInstantiated.getHref());
 
-      // Check the required fields are set
-      assertEquals(vApp.isDeployed(), Boolean.FALSE, String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString()));
-      // TODO others
-      
-      // Check status
-      Status poweredOffStatus = Status.POWERED_OFF;
-      assertEquals(vApp.getStatus(), poweredOffStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
+     // Check the retrieved object is well formed
+     checkVApp(vApp);
+     debug(vApp);
+
+     // Check the required fields are set
+     assertEquals(vApp.isDeployed(), Boolean.FALSE, String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString()));
+     assertEquals(vApp.getName(), "test-vapp", String.format(OBJ_FIELD_EQ, VAPP, "name", "test-vapp", vApp.getName()));
+     assertEquals(vApp.getDescription(), "Test VApp", String.format(OBJ_FIELD_EQ, VAPP, "Description", "Test VApp", vApp.getDescription()));
+
+     // TODO instantiationParams instantiationParams()
+     // TODO source.href vAppTemplateURI
+
+     // Check status
+     Status poweredOffStatus = Status.POWERED_OFF;
+     assertEquals(vApp.getStatus(), poweredOffStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
    }
 
    /**
-    * @see VAppClient#modifyVApp(URI, VApp)
-    */
+   * @see VAppClient#modifyVApp(URI, VApp)
+   */
    @Test(testName = "PUT /vApp/{id}", dependsOnMethods = { "testGetVApp" })
    public void testModifyVApp() {
-      VApp newVApp = VApp.builder()
+     VApp newVApp = VApp.builder()
 		      .name("new-name")
 		      .description("New Description")
 		      .build();
 
-      // The method under test
-      Task modifyVApp = vAppClient.modifyVApp(vApp.getHref(), newVApp);
-      assertTrue(retryTaskSuccess.apply(modifyVApp), String.format(TASK_COMPLETE_TIMELY, "modifyVApp"));
+     // The method under test
+     Task modifyVApp = vAppClient.modifyVApp(vApp.getHref(), newVApp);
+     assertTrue(retryTaskSuccess.apply(modifyVApp), String.format(TASK_COMPLETE_TIMELY, "modifyVApp"));
 
-      // Get the updated VApp
-      vApp = vAppClient.getVApp(vApp.getHref());
-      
-      // Check the required fields are set
-      assertEquals(vApp.getName(), newVApp.getName(), String.format(OBJ_FIELD_EQ, VAPP, "Name", newVApp.getName(), vApp.getName()));
-      assertEquals(vApp.getDescription(), newVApp.getDescription(), String.format(OBJ_FIELD_EQ, VAPP, "Description", newVApp.getDescription(), vApp.getDescription()));
+     // Get the updated VApp
+     vApp = vAppClient.getVApp(vApp.getHref());
+
+     // Check the required fields are set
+     assertEquals(vApp.getName(), newVApp.getName(), String.format(OBJ_FIELD_EQ, VAPP, "Name", newVApp.getName(), vApp.getName()));
+     assertEquals(vApp.getDescription(), newVApp.getDescription(), String.format(OBJ_FIELD_EQ, VAPP, "Description", newVApp.getDescription(), vApp.getDescription()));
    }
 
    @Test(testName = "POST /vApp/{id}/action/deploy", dependsOnMethods = { "testGetVApp" })
    public void testDeployVApp() {
-      DeployVAppParams params = DeployVAppParams.builder()
-            .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS))
-            .notForceCustomization()
-            .notPowerOn()
-            .build();
+     DeployVAppParams params = DeployVAppParams.builder()
+           .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS))
+           .notForceCustomization()
+           .notPowerOn()
+           .build();
 
-      // The method under test
-      Task deployVApp = vAppClient.deploy(vApp.getHref(), params);
-      assertTrue(retryTaskSuccessLong.apply(deployVApp), String.format(TASK_COMPLETE_TIMELY, "deployVApp"));
+     // The method under test
+     Task deployVApp = vAppClient.deploy(vApp.getHref(), params);
+     assertTrue(retryTaskSuccessLong.apply(deployVApp), String.format(TASK_COMPLETE_TIMELY, "deployVApp"));
 
-      // Get the updated VApp
-      vApp = vAppClient.getVApp(vApp.getHref());
+     // Get the updated VApp
+     vApp = vAppClient.getVApp(vApp.getHref());
 
-      // Check the required fields are set
-      assertEquals(vApp.isDeployed(), Boolean.TRUE, String.format(OBJ_FIELD_EQ, VAPP, "deployed", "TRUE", vApp.isDeployed().toString()));
+     // Check the required fields are set
+     assertEquals(vApp.isDeployed(), Boolean.TRUE, String.format(OBJ_FIELD_EQ, VAPP, "deployed", "TRUE", vApp.isDeployed().toString()));
 
-      // Check status
-      Status deployedStatus = Status.POWERED_OFF;
-      assertEquals(vApp.getStatus(), deployedStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", deployedStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
+     // Check status
+     Status deployedStatus = Status.POWERED_OFF;
+     assertEquals(vApp.getStatus(), deployedStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", deployedStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
    }
 
    @Test(testName = "POST /vApp/{id}/power/action/powerOn", dependsOnMethods = { "testDeployVApp" })
    public void testPowerOnVApp() {
-      // The method under test
-      Task powerOnVApp = vAppClient.powerOn(vApp.getHref());
-      assertTrue(retryTaskSuccess.apply(powerOnVApp), String.format(TASK_COMPLETE_TIMELY, "powerOnVApp"));
+     // The method under test
+     Task powerOnVApp = vAppClient.powerOn(vApp.getHref());
+     assertTrue(retryTaskSuccess.apply(powerOnVApp), String.format(TASK_COMPLETE_TIMELY, "powerOnVApp"));
 
-      // Get the updated VApp
-      vApp = vAppClient.getVApp(vApp.getHref());
+     // Get the updated VApp
+     vApp = vAppClient.getVApp(vApp.getHref());
 
-      // Check status
-      Status poweredOnStatus = Status.POWERED_ON;
-      assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
+     // Check status
+     Status poweredOnStatus = Status.POWERED_ON;
+     assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
    }
 
    @Test(testName = "POST /vApp/{id}/power/action/reboot", dependsOnMethods = { "testPowerOnVApp" })
    public void testReboot() {
-      // The method under test
-      Task reboot = vAppClient.reboot(vApp.getHref());
-      assertTrue(retryTaskSuccess.apply(reboot), String.format(TASK_COMPLETE_TIMELY, "reboot"));
+     // The method under test
+     Task reboot = vAppClient.reboot(vApp.getHref());
+     assertTrue(retryTaskSuccess.apply(reboot), String.format(TASK_COMPLETE_TIMELY, "reboot"));
 
-      // Get the updated VApp
-      vApp = vAppClient.getVApp(vApp.getHref());
+     // Get the updated VApp
+     vApp = vAppClient.getVApp(vApp.getHref());
 
-      // Check status
-      Status poweredOnStatus = Status.POWERED_ON;
-      assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
+     // Check status
+     Status poweredOffStatus = Status.POWERED_OFF;
+     assertEquals(vApp.getStatus(), poweredOffStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
    }
 
    @Test(testName = "POST /vApp/{id}/power/action/shutdown", dependsOnMethods = { "testReboot" })
    public void testShutdown() {
-      // The method under test
-      Task shutdown = vAppClient.shutdown(vApp.getHref());
-      assertTrue(retryTaskSuccess.apply(shutdown), String.format(TASK_COMPLETE_TIMELY, "shutdown"));
+     // The method under test
+     Task shutdown = vAppClient.shutdown(vApp.getHref());
+     assertTrue(retryTaskSuccess.apply(shutdown), String.format(TASK_COMPLETE_TIMELY, "shutdown"));
 
-      // Get the updated VApp
-      vApp = vAppClient.getVApp(vApp.getHref());
+     // Get the updated VApp
+     vApp = vAppClient.getVApp(vApp.getHref());
 
-      // Check status
-      Status poweredOnStatus = Status.POWERED_ON;
-      assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
+     // Check status
+     Status poweredOnStatus = Status.POWERED_ON;
+     assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
    }
 
    @Test(testName = "POST /vApp/{id}/power/action/suspend", dependsOnMethods = { "testShutdown" })
    public void testSuspend() {
-      // The method under test
-      Task suspend = vAppClient.suspend(vApp.getHref());
-      assertTrue(retryTaskSuccess.apply(suspend), String.format(TASK_COMPLETE_TIMELY, "suspend"));
+     // The method under test
+     Task suspend = vAppClient.suspend(vApp.getHref());
+     assertTrue(retryTaskSuccess.apply(suspend), String.format(TASK_COMPLETE_TIMELY, "suspend"));
 
-      // Get the updated VApp
-      vApp = vAppClient.getVApp(vApp.getHref());
+     // Get the updated VApp
+     vApp = vAppClient.getVApp(vApp.getHref());
 
-      // Check status
-      Status poweredOnStatus = Status.POWERED_ON;
-      assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
+     // Check status
+     Status poweredOnStatus = Status.POWERED_ON;
+     assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
    }
 
    @Test(testName = "POST /vApp/{id}/power/action/reset", dependsOnMethods = { "testSuspend" })
    public void testReset() {
-      // The method under test
-      Task reset = vAppClient.reset(vApp.getHref());
-      assertTrue(retryTaskSuccess.apply(reset), String.format(TASK_COMPLETE_TIMELY, "reset"));
+     // The method under test
+     Task reset = vAppClient.reset(vApp.getHref());
+     assertTrue(retryTaskSuccess.apply(reset), String.format(TASK_COMPLETE_TIMELY, "reset"));
 
-      // Get the updated VApp
-      vApp = vAppClient.getVApp(vApp.getHref());
+     // Get the updated VApp
+     vApp = vAppClient.getVApp(vApp.getHref());
 
-      // Check status
-      Status poweredOnStatus = Status.POWERED_ON;
-      assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
+     // Check status
+     Status poweredOnStatus = Status.POWERED_ON;
+     assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
    }
 
    @Test(testName = "POST /vApp/{id}/action/undeploy", dependsOnMethods = { "testReset" })
    public void testUndeployVApp() {
-      UndeployVAppParams params = UndeployVAppParams.builder().build();
+     UndeployVAppParams params = UndeployVAppParams.builder().build();
 
-      // The method under test
-      Task undeploy = vAppClient.undeploy(vApp.getHref(), params);
-      assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
+     // The method under test
+     Task undeploy = vAppClient.undeploy(vApp.getHref(), params);
+     assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
 
-      // Get the updated VApp
-      vApp = vAppClient.getVApp(vApp.getHref());
+     // Get the updated VApp
+     vApp = vAppClient.getVApp(vApp.getHref());
 
-      // Check status
-      Status poweredOnStatus = Status.POWERED_ON;
-      assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
+     // Check status
+     Status poweredOnStatus = Status.POWERED_ON;
+     assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
    }
 
    @Test(testName = "POST /vApp/{id}/power/action/powerOff", dependsOnMethods = { "testUndeployVApp" })
    public void testPowerOffVApp() {
-      // The method under test
-      Task powerOffVApp = vAppClient.powerOff(vApp.getHref());
-      assertTrue(retryTaskSuccess.apply(powerOffVApp), String.format(TASK_COMPLETE_TIMELY, "powerOffVApp"));
+     // The method under test
+     Task powerOffVApp = vAppClient.powerOff(vApp.getHref());
+     assertTrue(retryTaskSuccess.apply(powerOffVApp), String.format(TASK_COMPLETE_TIMELY, "powerOffVApp"));
 
-      // Get the updated VApp
-      vApp = vAppClient.getVApp(vApp.getHref());
+     // Get the updated VApp
+     vApp = vAppClient.getVApp(vApp.getHref());
 
-      // Check status
-      Status poweredOffStatus = Status.POWERED_OFF;
-      assertEquals(vApp.getStatus(), poweredOffStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
+     // Check status
+     Status poweredOffStatus = Status.POWERED_OFF;
+     assertEquals(vApp.getStatus(), poweredOffStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
    }
 
    @Test(testName = "POST /vApp/{id}/action/consolidate", dependsOnMethods = { "testPowerOnVApp" })
    public void testConsolidateVApp() {
-      // The method under test
-      Task consolidateVApp = vAppClient.consolidateVApp(vApp.getHref());
-      assertTrue(retryTaskSuccess.apply(consolidateVApp), String.format(TASK_COMPLETE_TIMELY, "consolidateVApp"));
+     // The method under test
+     Task consolidateVApp = vAppClient.consolidateVApp(vApp.getHref());
+     assertTrue(retryTaskSuccess.apply(consolidateVApp), String.format(TASK_COMPLETE_TIMELY, "consolidateVApp"));
    }
 
    @Test(testName = "POST /vApp/{id}/action/controlAccess", dependsOnMethods = { "testGetVApp" })
    public void testControlAccessUser() {
-      ControlAccessParams params = ControlAccessParams.builder()
-            .notSharedToEveryone()
-            .accessSettings(AccessSettings.builder()
-                  .accessSetting(AccessSetting.builder()
-                        .subject(Reference.builder().href(userURI).type(ADMIN_USER).build())
-                        .accessLevel("ReadOnly")
-                        .build())
-                  .build())
-            .build();
+     ControlAccessParams params = ControlAccessParams.builder()
+           .notSharedToEveryone()
+           .accessSettings(AccessSettings.builder()
+                 .accessSetting(AccessSetting.builder()
+                       .subject(Reference.builder().href(userURI).type(ADMIN_USER).build())
+                       .accessLevel("ReadOnly")
+                       .build())
+                 .build())
+           .build();
 
-      // The method under test
-      ControlAccessParams modified = vAppClient.controlAccess(vApp.getHref(), params);
-      checkControlAccessParams(modified);
-      assertEquals(modified, params, String.format(ENTITY_EQUAL, "ControlAccessParams"));
+     // The method under test
+     ControlAccessParams modified = vAppClient.controlAccess(vApp.getHref(), params);
+
+     // Check the retrieved object is well formed
+     checkControlAccessParams(modified);
+     // Check the required fields are set
+     assertEquals(modified, params, String.format(ENTITY_EQUAL, "ControlAccessParams"));
    }
 
    @Test(testName = "POST /vApp/{id}/action/controlAccess", dependsOnMethods = { "testControlAccessUser" })
    public void testControlAccessEveryone() {
-      ControlAccessParams params = ControlAccessParams.builder()
-            .sharedToEveryone()
-            .everyoneAccessLevel("FullControl")
-            .build();
+     ControlAccessParams params = ControlAccessParams.builder()
+           .sharedToEveryone()
+           .everyoneAccessLevel("FullControl")
+           .build();
 
-      // The method under test
-      ControlAccessParams modified = vAppClient.controlAccess(vApp.getHref(), params);
-      checkControlAccessParams(modified);
-      assertEquals(modified, params, String.format(ENTITY_EQUAL, "ControlAccessParams"));
+     // The method under test
+     ControlAccessParams modified = vAppClient.controlAccess(vApp.getHref(), params);
+
+     // Check the retrieved object is well formed
+     checkControlAccessParams(modified);
+
+     // Check entities are equal
+     assertEquals(modified, params, String.format(ENTITY_EQUAL, "ControlAccessParams"));
    }
 
    @Test(testName = "POST /vApp/{id}/action/discardSuspendedState", dependsOnMethods = { "testSuspend" })
    public void testDiscardSuspendedState() {
-      // The method under test
-      Task discardSuspendedState = vAppClient.discardSuspendedState(vApp.getHref());
-      assertTrue(retryTaskSuccess.apply(discardSuspendedState), String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState"));
+     // The method under test
+     Task discardSuspendedState = vAppClient.discardSuspendedState(vApp.getHref());
+     assertTrue(retryTaskSuccess.apply(discardSuspendedState), String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState"));
    }
 
    @Test(testName = "POST /vApp/{id}/action/enterMaintenanceMode", dependsOnMethods = { "testGetVApp" })
    public void testEnterMaintenanceMode() {
-      // The method under test
-      vAppClient.enterMaintenanceMode(vApp.getHref());
+     // The method under test
+     vAppClient.enterMaintenanceMode(vApp.getHref());
 
-      vApp = vAppClient.getVApp(vApp.getHref());
-      assertTrue(vApp.isInMaintenanceMode(), String.format(CONDITION_FMT, "InMaintenanceMode", "TRUE", vApp.isInMaintenanceMode()));
+     vApp = vAppClient.getVApp(vApp.getHref());
+     assertTrue(vApp.isInMaintenanceMode(), String.format(CONDITION_FMT, "InMaintenanceMode", "TRUE", vApp.isInMaintenanceMode()));
    }
 
    @Test(testName = "POST /vApp/{id}/action/exitMaintenanceMode", dependsOnMethods = { "testEnterMaintenanceMode" })
    public void testExitMaintenanceMode() {
-      // The method under test
-      vAppClient.exitMaintenanceMode(vApp.getHref());
+     // The method under test
+     vAppClient.exitMaintenanceMode(vApp.getHref());
 
-      vApp = vAppClient.getVApp(vApp.getHref());
-      assertFalse(vApp.isInMaintenanceMode(), String.format(CONDITION_FMT, "InMaintenanceMode", "FALSE", vApp.isInMaintenanceMode()));
+     vApp = vAppClient.getVApp(vApp.getHref());
+     assertFalse(vApp.isInMaintenanceMode(), String.format(CONDITION_FMT, "InMaintenanceMode", "FALSE", vApp.isInMaintenanceMode()));
    }
 
    @Test(testName = "POST /vApp/{id}/action/installVMwareTools", dependsOnMethods = { "testGetVApp" })
    public void testInstallVMwareTools() {
-      // The method under test
-      Task installVMwareTools = vAppClient.installVMwareTools(vApp.getHref());
-      assertTrue(retryTaskSuccess.apply(installVMwareTools), String.format(TASK_COMPLETE_TIMELY, "installVMwareTools"));
+     // The method under test
+     Task installVMwareTools = vAppClient.installVMwareTools(vApp.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,
@@ -435,18 +427,20 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
    //    contentLength=0, contentMD5=null, contentType=application/vnd.vmware.vcloud.recomposeVAppParams+xml], written=false]]: Could not marshall object"
    @Test(testName = "POST /vApp/{id}/action/recomposeVApp", dependsOnMethods = { "testGetVApp" })
    public void testRecomposeVApp() {
-      RecomposeVAppParams params = RecomposeVAppParams.builder()
-            .build();
+     RecomposeVAppParams params = RecomposeVAppParams.builder()
+           .build();
 
-      // The method under test
-      Task recomposeVApp = vAppClient.recomposeVApp(vApp.getHref(), params);
-      assertTrue(retryTaskSuccess.apply(recomposeVApp), String.format(TASK_COMPLETE_TIMELY, "recomposeVApp"));
+     // The method under test
+     Task recomposeVApp = vAppClient.recomposeVApp(vApp.getHref(), params);
+     assertTrue(retryTaskSuccess.apply(recomposeVApp), String.format(TASK_COMPLETE_TIMELY, "recomposeVApp"));
    }
 
    @Test(testName = "POST /vApp/{id}/action/relocate", dependsOnMethods = { "testGetVApp" })
    public void testRelocate() {
-      RelocateParams params = RelocateParams.builder()
-            .build();
+      // Relocate to the first available datastore
+      QueryResultRecords records = context.getApi().getQueryClient().query("datastore", "fields==name");
+      QueryResultRecordType datastore = Iterables.get(records.getRecords(), 0);
+      RelocateParams params = RelocateParams.builder().datastore(Reference.builder().href(datastore.getHref()).build()).build();
 
       // The method under test
       Task relocate = vAppClient.relocate(vApp.getHref(), params);
@@ -455,79 +449,133 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
 
    @Test(testName = "POST /vApp/{id}/action/upgradeHardwareVersion", dependsOnMethods = { "testGetVApp" })
    public void testUpgradeHardwareVersion() {
-      // The method under test
-      Task upgradeHardwareVersion = vAppClient.upgradeHardwareVersion(vApp.getHref());
-      assertTrue(retryTaskSuccess.apply(upgradeHardwareVersion), String.format(TASK_COMPLETE_TIMELY, "upgradeHardwareVersion"));
+     // The method under test
+     Task upgradeHardwareVersion = vAppClient.upgradeHardwareVersion(vApp.getHref());
+     assertTrue(retryTaskSuccess.apply(upgradeHardwareVersion), String.format(TASK_COMPLETE_TIMELY, "upgradeHardwareVersion"));
    }
 
    @Test(testName = "GET /vApp/{id}/controlAccess", dependsOnMethods = { "testGetVApp" })
    public void testGetControlAccess() {
-      // The method under test
-      ControlAccessParams controlAccess = vAppClient.getControlAccess(vApp.getHref());
-      checkControlAccessParams(controlAccess);
+     // The method under test
+     ControlAccessParams controlAccess = vAppClient.getControlAccess(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkControlAccessParams(controlAccess);
    }
 
    @Test(testName = "GET /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetVApp" })
    public void testGetGuestCustomizationSection() {
-      // The method under test
-      GuestCustomizationSection section = vAppClient.getGuestCustomizationSection(vApp.getHref());
-      checkGuestCustomizationSection(section);
+     // The method under test
+     GuestCustomizationSection section = vAppClient.getGuestCustomizationSection(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkGuestCustomizationSection(section);
    }
 
    @Test(testName = "PUT /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetGuestCustomizationSection" })
    public void testModifyGuestCustomizationSection() {
-      GuestCustomizationSection section = vAppClient.getGuestCustomizationSection(vApp.getHref());
-      // section.setX()
+     // Copy existing section and update fields
+     GuestCustomizationSection oldSection = vAppClient.getGuestCustomizationSection(vApp.getHref());
+     GuestCustomizationSection newSection = oldSection.toBuilder()
+	         .adminPassword("password")
+	         .build();
 
-      // The method under test
-      Task modifyGuestCustomizationSection = vAppClient.modifyGuestCustomizationSection(vApp.getHref(), section);
-      assertTrue(retryTaskSuccess.apply(modifyGuestCustomizationSection), String.format(TASK_COMPLETE_TIMELY, "modifyGuestCustomizationSection"));
+     // The method under test
+     Task modifyGuestCustomizationSection = vAppClient.modifyGuestCustomizationSection(vApp.getHref(), newSection);
+     assertTrue(retryTaskSuccess.apply(modifyGuestCustomizationSection), String.format(TASK_COMPLETE_TIMELY, "modifyGuestCustomizationSection"));
 
-      GuestCustomizationSection modified = vAppClient.getGuestCustomizationSection(vApp.getHref());
-      // assertEquals(modified.getX, "");
+     // Retrieve the modified section
+     GuestCustomizationSection modified = vAppClient.getGuestCustomizationSection(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkGuestCustomizationSection(modified);
+
+     // Check the modified section fields are set correctly
+     assertEquals(modified.getAdminPassword(), "password");
+     assertEquals(modified, newSection);
    }
 
    @Test(testName = "GET /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetVApp" })
    public void testGetLeaseSettingsSection() {
-      // The method under test
-      LeaseSettingsSection section = vAppClient.getLeaseSettingsSection(vApp.getHref());
-      checkLeaseSettingsSection(section);
+     // The method under test
+     LeaseSettingsSection section = vAppClient.getLeaseSettingsSection(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkLeaseSettingsSection(section);
    }
 
    @Test(testName = "PUT /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetLeaseSettingsSection" })
    public void testModifyLeaseSettingsSection() {
-      LeaseSettingsSection section = vAppClient.getLeaseSettingsSection(vApp.getHref());
-
-      // section.setX()
+      // Copy existing section
+      LeaseSettingsSection oldSection = vAppClient.getLeaseSettingsSection(vApp.getHref());
+      LeaseSettingsSection newSection = oldSection.toBuilder().build();
 
       // The method under test
-      Task modifyLeaseSettingsSection = vAppClient.modifyLeaseSettingsSection(vApp.getHref(), section);
+      Task modifyLeaseSettingsSection = vAppClient.modifyLeaseSettingsSection(vApp.getHref(), newSection);
       assertTrue(retryTaskSuccess.apply(modifyLeaseSettingsSection), String.format(TASK_COMPLETE_TIMELY, "modifyLeaseSettingsSection"));
 
+      // Retrieve the modified section
       LeaseSettingsSection modified = vAppClient.getLeaseSettingsSection(vApp.getHref());
-      // assertEquals(modified.getX, "");
+
+      // Check the retrieved object is well formed
+      checkLeaseSettingsSection(modified);
+
+      // Check the date fields
+      if (modified.getDeploymentLeaseExpiration() != null) {
+	      assertTrue(modified.getDeploymentLeaseExpiration().after(newSection.getDeploymentLeaseExpiration()),
+	            String.format("The new deploymentLeaseExpiration timestamp must be later than the original: %s > %s",
+	                  dateService.iso8601DateFormat(modified.getDeploymentLeaseExpiration()),
+	                  dateService.iso8601DateFormat(newSection.getDeploymentLeaseExpiration())));
+      }
+      if (modified.getStorageLeaseExpiration() != null) {
+	      assertTrue(modified.getStorageLeaseExpiration().after(newSection.getStorageLeaseExpiration()),
+	            String.format("The new storageLeaseExpiration timestamp must be later than the original: %s > %s",
+	                  dateService.iso8601DateFormat(modified.getStorageLeaseExpiration()),
+	                  dateService.iso8601DateFormat(newSection.getStorageLeaseExpiration())));
+      }
+
+      // Reset the date fields
+      modified = modified.toBuilder()
+            .deploymentLeaseExpiration(null)
+            .storageLeaseExpiration(null)
+            .build();
+      newSection = newSection.toBuilder()
+            .deploymentLeaseExpiration(null)
+            .storageLeaseExpiration(null)
+            .build();
+
+      // Check the section was modified correctly
+      assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "LeaseSettingsSection"));
    }
 
-   // FIXME "Error: validation error : EntityRef has incorrect type, expected type is com.vmware.vcloud.entity.vm."
-   @Test(testName = "PUT /vApp/{id}/media/action/insertMedia", dependsOnMethods = { "testGetVApp" })
+   // 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(testName = "PUT /vApp/{id}/media/action/insertMedia", dependsOnMethods = { "testPowerOnVApp" })
    public void testInsertMedia() {
+      // Setup media params from configured media id
       MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
             .media(Reference.builder().href(mediaURI).type(MEDIA).build())
             .build();
 
+      // Get URI for child VM
+      URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
+
       // The method under test
-      Task insertMedia = vAppClient.insertMedia(vApp.getHref(), params);
+      Task insertMedia = vAppClient.insertMedia(vmURI, params);
       assertTrue(retryTaskSuccess.apply(insertMedia), String.format(TASK_COMPLETE_TIMELY, "insertMedia"));
    }
 
    @Test(testName = "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();
 
+      // Get URI for child VM
+      URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
+
       // The method under test
-      Task ejectMedia = vAppClient.ejectMedia(vApp.getHref(), params);
+      Task ejectMedia = vAppClient.ejectMedia(vmURI, params);
       assertTrue(retryTaskSuccess.apply(ejectMedia), String.format(TASK_COMPLETE_TIMELY, "ejectMedia"));
    }
 
@@ -535,399 +583,578 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
    public void testGetNetworkConfigSection() {
       // The method under test
       NetworkConfigSection section = vAppClient.getNetworkConfigSection(vApp.getHref());
+
+      // Check the retrieved object is well formed
       checkNetworkConfigSection(section);
    }
 
    @Test(testName = "PUT /vApp/{id}/networkConfigSection", dependsOnMethods = { "testGetNetworkConfigSection" })
    public void testModifyNetworkConfigSection() {
-      NetworkConfigSection section = vAppClient.getNetworkConfigSection(vApp.getHref());
-
-      // section.setX()
+      // Copy existing section and update fields
+      NetworkConfigSection oldSection = vAppClient.getNetworkConfigSection(vApp.getHref());
+      NetworkConfigSection newSection = oldSection.toBuilder()
+           .build();
 
       // The method under test
-      Task modifyNetworkConfigSection = vAppClient.modifyNetworkConfigSection(vApp.getHref(), section);
+      Task modifyNetworkConfigSection = vAppClient.modifyNetworkConfigSection(vApp.getHref(), newSection);
       assertTrue(retryTaskSuccess.apply(modifyNetworkConfigSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConfigSection"));
 
+      // Retrieve the modified section
       NetworkConfigSection modified = vAppClient.getNetworkConfigSection(vApp.getHref());
-      // assertEquals(modified.getX, "");
+
+      // Check the retrieved object is well formed
+      checkNetworkConfigSection(modified);
+
+      // Check the modified section fields are set correctly
+//      assertEquals(modified.getX(), "");
+
+      // Check the section was modified correctly
+      assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "NetworkConfigSection"));
    }
 
    @Test(testName = "GET /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetVApp" })
    public void testGetNetworkConnectionSection() {
+      // Get URI for child VM
+      URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
+
       // The method under test
-      NetworkConnectionSection section = vAppClient.getNetworkConnectionSection(vApp.getHref());
+      NetworkConnectionSection section = vAppClient.getNetworkConnectionSection(vmURI);
+
+      // Check the retrieved object is well formed
       checkNetworkConnectionSection(section);
    }
 
    @Test(testName = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetNetworkConnectionSection" })
    public void testModifyNetworkConnectionSection() {
-      NetworkConnectionSection section = vAppClient.getNetworkConnectionSection(vApp.getHref());
+      // Get URI for child VM
+      URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
 
-      // section.setX()
+      // Copy existing section and update fields
+      NetworkConnectionSection oldSection = vAppClient.getNetworkConnectionSection(vmURI);
+      NetworkConnectionSection newSection = oldSection.toBuilder()
+//           .x("")
+          .build();
 
       // The method under test
-      Task modifyNetworkConnectionSection = vAppClient.modifyNetworkConnectionSection(vApp.getHref(), section);
+      Task modifyNetworkConnectionSection = vAppClient.modifyNetworkConnectionSection(vmURI, newSection);
       assertTrue(retryTaskSuccess.apply(modifyNetworkConnectionSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConnectionSection"));
 
-      NetworkConnectionSection modified = vAppClient.getNetworkConnectionSection(vApp.getHref());
-      // assertEquals(modified.getX, "");
+      // Retrieve the modified section
+      NetworkConnectionSection modified = vAppClient.getNetworkConnectionSection(vmURI);
+
+      // Check the retrieved object is well formed
+      checkNetworkConnectionSection(modified);
+
+      // Check the modified section fields are set correctly
+//      assertEquals(modified.getX(), "");
+
+      // Check the section was modified correctly
+      assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "NetworkConnectionSection"));
    }
 
    @Test(testName = "GET /vApp/{id}/networkSection", dependsOnMethods = { "testGetVApp" })
    public void testGetNetworkSection() {
-      // The method under test
-      NetworkSection section = vAppClient.getNetworkSection(vApp.getHref());
-//      checkNetworkSection(section);
+     // The method under test
+     NetworkSection section = vAppClient.getNetworkSection(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkNetworkSection(section);
    }
 
    @Test(testName = "GET /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetVApp" })
    public void testGetOperatingSystemSection() {
-      // The method under test
-      OperatingSystemSection section = vAppClient.getOperatingSystemSection(vApp.getHref());
-//      checkOperatingSystemSection(section);
+      // Get URI for child VM
+      URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
+
+     // The method under test
+     OperatingSystemSection section = vAppClient.getOperatingSystemSection(vmURI);
+
+     // Check the retrieved object is well formed
+     checkOperatingSystemSection(section);
    }
 
    @Test(testName = "PUT /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetOperatingSystemSection" })
    public void testModifyOperatingSystemSection() {
-      OperatingSystemSection section = vAppClient.getOperatingSystemSection(vApp.getHref());
+      // Get URI for child VM
+      URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
 
-      // section.setX()
+      // Copy existing section and update fields
+      OperatingSystemSection oldSection = vAppClient.getOperatingSystemSection(vmURI);
+      OperatingSystemSection newSection = oldSection.toBuilder()
+           .description("Changed OperatingSystemSection Description")
+           .build();
 
       // The method under test
-      Task modifySection = vAppClient.modifyOperatingSystemSection(vApp.getHref(), section);
-      assertTrue(retryTaskSuccess.apply(modifySection), String.format(TASK_COMPLETE_TIMELY, "modifySection"));
+      Task modifyOperatingSystemSection = vAppClient.modifyOperatingSystemSection(vmURI, newSection);
+      assertTrue(retryTaskSuccess.apply(modifyOperatingSystemSection), String.format(TASK_COMPLETE_TIMELY, "modifyOperatingSystemSection"));
 
-      OperatingSystemSection modified = vAppClient.getOperatingSystemSection(vApp.getHref());
-      // assertEquals(modified.getX, "");
+      // Retrieve the modified section
+      OperatingSystemSection modified = vAppClient.getOperatingSystemSection(vmURI);
+
+      // Check the retrieved object is well formed
+      checkOperatingSystemSection(modified);
+
+      // Check the modified section fields are set correctly
+      assertEquals(modified.getDescription(), newSection.getDescription());
+
+      // Check the section was modified correctly
+      assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "OperatingSystemSection"));
    }
 
    @Test(testName = "GET /vApp/{id}/owner", dependsOnMethods = { "testGetVApp" })
    public void testGetOwner() {
-      // The method under test
-      Owner owner = vAppClient.getOwner(vApp.getHref());
-      checkOwner(owner);
+     // The method under test
+     Owner owner = vAppClient.getOwner(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkOwner(owner);
    }
 
    @Test(testName = "PUT /vApp/{id}/owner", dependsOnMethods = { "testGetOwner" })
    public void testModifyOwner() {
-      Owner newOwner = Owner.builder()
-            .user(Reference.builder().href(userURI).type(ADMIN_USER).build())
-            .build();
+     Owner newOwner = Owner.builder()
+           .user(Reference.builder().href(userURI).type(ADMIN_USER).build())
+           .build();
 
-      // The method under test
-      vAppClient.modifyOwner(vApp.getHref(), newOwner);
+     // The method under test
+     vAppClient.modifyOwner(vApp.getHref(), newOwner);
 
-      Owner modified = vAppClient.getOwner(vApp.getHref());
-      checkOwner(modified);
+     // Get the new VApp owner
+     Owner modified = vAppClient.getOwner(vApp.getHref());
 
-      // Check the href fields match
-      assertEquals(modified.getUser().getHref(), newOwner.getUser().getHref());
+     // Check the retrieved object is well formed
+     checkOwner(modified);
+
+     // Check the href fields match
+     assertEquals(modified.getUser().getHref(), newOwner.getUser().getHref());
    }
 
    @Test(testName = "GET /vApp/{id}/productSections", dependsOnMethods = { "testGetVApp" })
    public void testGetProductSections() {
-      // The method under test
-      ProductSectionList sectionList = vAppClient.getProductSections(vApp.getHref());
-      checkProductSectionList(sectionList);
+     // The method under test
+     ProductSectionList sectionList = vAppClient.getProductSections(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkProductSectionList(sectionList);
    }
 
    @Test(testName = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" })
    public void testModifyProductSections() {
-      ProductSectionList sectionList = vAppClient.getProductSections(vApp.getHref());
+     ProductSectionList sectionList = vAppClient.getProductSections(vApp.getHref());
 
-      // sectionList.setX()
+     // sectionList.setX()
 
-      // The method under test
-      Task modifyProductSections = vAppClient.modifyProductSections(vApp.getHref(), sectionList);
-      assertTrue(retryTaskSuccess.apply(modifyProductSections), String.format(TASK_COMPLETE_TIMELY, "modifyProductSections"));
+     // The method under test
+     Task modifyProductSections = vAppClient.modifyProductSections(vApp.getHref(), sectionList);
+     assertTrue(retryTaskSuccess.apply(modifyProductSections), String.format(TASK_COMPLETE_TIMELY, "modifyProductSections"));
 
-      ProductSectionList modifiedList = vAppClient.getProductSections(vApp.getHref());
-      // assertEquals(modified.getX, "");
+     ProductSectionList modifiedList = vAppClient.getProductSections(vApp.getHref());
+     // assertEquals(modified.getX, "");
    }
 
    @Test(testName = "GET /vApp/{id}/question", dependsOnMethods = { "testGetVApp" })
    public void testGetPendingQuestion() {
-      // TODO how to test?
-      // The method under test
-      VmPendingQuestion question = vAppClient.getPendingQuestion(vApp.getHref());
+     // TODO how to test?
+     // The method under test
+     VmPendingQuestion question = vAppClient.getPendingQuestion(vApp.getHref());
+
+     // Check the retrieved object is well formed
 //      checkQuestion(question);
    }
 
    @Test(testName = "PUT /vApp/{id}/question/action/answer", dependsOnMethods = { "testGetPendingQuestion" })
    public void testAnswerQuestion() {
-      // TODO add builder
+     // TODO add builder
 //      VmQuestionAnswer answer = VmQuestionAnswer.builer()
 //            .build();
 
-      // The method under test
+     // The method under test
 //      vAppClient.answerQuestion(vApp.getHref(), answer);
-      // TODO how to test?
+     // TODO how to test?
    }
 
    @Test(testName = "GET /vApp/{id}/runtimeInfoSection", dependsOnMethods = { "testGetVApp" })
    public void testGetRuntimeInfoSection() {
-      // The method under test
-      RuntimeInfoSection section = vAppClient.getRuntimeInfoSection(vApp.getHref());
-//      checkRuntimeInfoSection(section);
+     // The method under test
+     RuntimeInfoSection section = vAppClient.getRuntimeInfoSection(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkRuntimeInfoSection(section);
    }
 
    @Test(testName = "GET /vApp/{id}/screen", dependsOnMethods = { "testGetVApp" })
    public void testGetScreenImage() {
-      // The method under test
-      byte[] image = vAppClient.getScreenImage(vApp.getHref());
-      // TODO how to check?
+     // The method under test
+     byte[] image = vAppClient.getScreenImage(vApp.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(testName = "GET /vApp/{id}/screen/action/acquireTicket", dependsOnMethods = { "testGetVApp" })
    public void testGetScreenTicket() {
-      // The method under test
-      byte[] image = vAppClient.getScreenImage(vApp.getHref());
-      // TODO how to check?
+     // The method under test
+     ScreenTicket ticket = vAppClient.getScreenTicket(vApp.getHref());
 
+     // Check the retrieved object is well formed
+     checkScreenTicket(ticket);
    }
 
    @Test(testName = "GET /vApp/{id}/startupSection", dependsOnMethods = { "testGetVApp" })
    public void testGetStartupSection() {
-      // The method under test
-      StartupSection section = vAppClient.getStartupSection(vApp.getHref());
-//      checkStartupSection(section);
+     // The method under test
+     StartupSection section = vAppClient.getStartupSection(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkStartupSection(section);
    }
 
    @Test(testName = "PUT /vApp/{id}/startupSection", dependsOnMethods = { "testGetStartupSection" })
    public void testModifyStartupSection() {
-      StartupSection section = vAppClient.getStartupSection(vApp.getHref());
+     // Copy existing section and update fields
+     StartupSection oldSection = vAppClient.getStartupSection(vApp.getHref());
+     StartupSection newSection = oldSection.toBuilder()
+//          .x("")
+         .build();
 
-      // section.setX()
+    // The method under test
+    Task modifyStartupSection = vAppClient.modifyStartupSection(vApp.getHref(), newSection);
+    assertTrue(retryTaskSuccess.apply(modifyStartupSection), String.format(TASK_COMPLETE_TIMELY, "modifyStartupSection"));
 
-      // The method under test
-      Task modifyStartupSection = vAppClient.modifyStartupSection(vApp.getHref(), section);
-      assertTrue(retryTaskSuccess.apply(modifyStartupSection), String.format(TASK_COMPLETE_TIMELY, "modifyStartupSection"));
+    // Retrieve the modified section
+    StartupSection modified = vAppClient.getStartupSection(vApp.getHref());
 
-      StartupSection modified = vAppClient.getStartupSection(vApp.getHref());
-      // assertEquals(modified.getX, "");
+    // Check the retrieved object is well formed
+    checkStartupSection(modified);
+
+    // Check the modified section fields are set correctly
+//     assertEquals(modified.getX(), "");
+    assertEquals(modified, newSection);
    }
 
    @Test(testName = "GET /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVApp" })
    public void testGetVirtualHardwareSection() {
-      // Method under test
-      VirtualHardwareSection hardware = vAppClient.getVirtualHardwareSection(vApp.getHref());
-      checkVirtualHardwareSection(hardware);
+     // Method under test
+     VirtualHardwareSection hardware = vAppClient.getVirtualHardwareSection(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkVirtualHardwareSection(hardware);
    }
 
    @Test(testName = "PUT /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVirtualHardwareSection" })
    public void testModifyVirtualHardwareSection() {
-      VirtualHardwareSection hardware = vAppClient.getVirtualHardwareSection(vApp.getHref());
-      hardware.setInfo("New Info");
+     // Copy existing section and update fields
+     VirtualHardwareSection oldSection = vAppClient.getVirtualHardwareSection(vApp.getHref());
+     VirtualHardwareSection newSection = oldSection.toBuilder()
+//          .x("")
+         .build();
 
-      // Method under test
-      Task modifyVirtualHardwareSection = vAppClient.modifyVirtualHardwareSection(vApp.getHref(), hardware);
-      assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSection), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSection"));
+    // The method under test
+    Task modifyVirtualHardwareSection = vAppClient.modifyVirtualHardwareSection(vApp.getHref(), newSection);
+    assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSection), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSection"));
 
-      VirtualHardwareSection modified = vAppClient.getVirtualHardwareSection(vApp.getHref());
-      assertEquals(modified.getInfo(), "New Info");
+    // Retrieve the modified section
+    VirtualHardwareSection modified = vAppClient.getVirtualHardwareSection(vApp.getHref());
+
+    // Check the retrieved object is well formed
+    checkVirtualHardwareSection(modified);
+
+    // Check the modified section fields are set correctly
+//     assertEquals(modified.getX(), "");
+    assertEquals(modified, newSection);
    }
 
    @Test(testName = "GET /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSection" })
    public void testGetVirtualHardwareSectionCpu() {
-      RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
-//       checkRASD(rasd);
+     RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
+     checkRASD(rasd);
    }
 
    @Test(testName = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" })
    public void testModifyVirtualHardwareSectionCpu() {
-      RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
-      // rasd.setX("New Info");
+     RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
+     // rasd.setX("New Info");
 
-      // Method under test
-      Task modifyVirtualHardwareSectionCpu = vAppClient.modifyVirtualHardwareSectionCpu(vApp.getHref(), rasd);
-      assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionCpu), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionCpu"));
+     // Method under test
+     Task modifyVirtualHardwareSectionCpu = vAppClient.modifyVirtualHardwareSectionCpu(vApp.getHref(), rasd);
+     assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionCpu), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionCpu"));
 
-      RASD modified = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
-      // assertEquals(modified.getInfo(), "New Info");
+     // Retrieve the modified section
+     RASD modified = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
 
+     // Check the retrieved object is well formed
+     checkRASD(modified);
+
+     // assertEquals(modified.getInfo(), "New Info");
    }
 
    @Test(testName = "GET /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSection" })
    public void testGetVirtualHardwareSectionDisks() {
-      RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionDisks(vApp.getHref());
-      // checkRasdItemsList(rasdItems);
+     RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionDisks(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkRasdItemsList(rasdItems);
    }
 
    @Test(testName = "PUT /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSectionDisks" })
    public void testModifyVirtualHardwareSectionDisks() {
-      RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionDisks(vApp.getHref());
-      // rasd.setX("New Info");
+      // Copy the existing items list and add a new item
+      RasdItemsList oldRasdItems = vAppClient.getVirtualHardwareSectionDisks(vApp.getHref());
+      RASD item = RASD.builder().build();
+      RasdItemsList newRasdItems = oldRasdItems.toBuilder().item(item).build();
 
       // Method under test
-      Task modifyVirtualHardwareSectionDisks = vAppClient.modifyVirtualHardwareSectionDisks(vApp.getHref(), rasdItems);
+      Task modifyVirtualHardwareSectionDisks = vAppClient.modifyVirtualHardwareSectionDisks(vApp.getHref(), newRasdItems);
       assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionDisks), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionDisks"));
 
+      // Retrieve the modified section
       RasdItemsList modified = vAppClient.getVirtualHardwareSectionDisks(vApp.getHref());
-      // assertEquals(modified.getInfo(), "New Info");
+
+      // Check the retrieved object is well formed
+      checkRasdItemsList(modified);
+
+      // Check the modified items list
+//       assertEquals(modified.getX(), "");
+      assertTrue(modified.getItems().contains(item));
+      assertEquals(modified, newRasdItems);
    }
 
    @Test(testName = "GET /vApp/{id}/virtualHardwareSection/media", dependsOnMethods = { "testGetVirtualHardwareSection" })
    public void testGetVirtualHardwareSectionMedia() {
-      RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionMedia(vApp.getHref());
-      // checkRasdItemsList(rasdItems);
+     RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionMedia(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkRasdItemsList(rasdItems);
    }
 
    @Test(testName = "GET /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSection" })
    public void testGetVirtualHardwareSectionMemory() {
-      RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
-      // checkRASD(rasd);
+     RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkRASD(rasd);
    }
 
    @Test(testName = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" })
    public void testModifyVirtualHardwareSectionMemory() {
-      RASD rasd = vAppClient.getVirtualHardwareSectionMemory(vApp.getHref());
-      // rasd.setX("New Info");
+     RASD rasd = vAppClient.getVirtualHardwareSectionMemory(vApp.getHref());
+     // rasd.setX("New Info");
 
-      // Method under test
-      Task modifyVirtualHardwareSectionMemory = vAppClient.modifyVirtualHardwareSectionMemory(vApp.getHref(), rasd);
-      assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionMemory), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionMemory"));
+     // Method under test
+     Task modifyVirtualHardwareSectionMemory = vAppClient.modifyVirtualHardwareSectionMemory(vApp.getHref(), rasd);
+     assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionMemory), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionMemory"));
 
-      RASD modified = vAppClient.getVirtualHardwareSectionMemory(vApp.getHref());
-      // assertEquals(modified.getInfo(), "New Info");
+     RASD modified = vAppClient.getVirtualHardwareSectionMemory(vApp.getHref());
+     // assertEquals(modified.getInfo(), "New Info");
    }
 
    @Test(testName = "GET /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSection" })
    public void testGetVirtualHardwareSectionNetworkCards() {
-      RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionNetworkCards(vApp.getHref());
-      // checkRasdItemsList(rasdItems);
+     RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionNetworkCards(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkRasdItemsList(rasdItems);
    }
 
    @Test(testName = "PUT /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSectionNetworkCards" })
    public void testModifyVirtualHardwareSectionNetworkCards() {
-      RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionNetworkCards(vApp.getHref());
-      // rasd.setX("New Info");
+      // Copy the existing items list and add a new item
+      RasdItemsList oldRasdItems = vAppClient.getVirtualHardwareSectionNetworkCards(vApp.getHref());
+      RASD item = RASD.builder().build();
+      RasdItemsList newRasdItems = oldRasdItems.toBuilder().item(item).build();
 
       // Method under test
-      Task modifyVirtualHardwareSectionNetworkCards = vAppClient.modifyVirtualHardwareSectionNetworkCards(vApp.getHref(), rasdItems);
+      Task modifyVirtualHardwareSectionNetworkCards = vAppClient.modifyVirtualHardwareSectionNetworkCards(vApp.getHref(), newRasdItems);
       assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionNetworkCards), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionNetworkCards"));
 
+      // Retrieve the modified section
       RasdItemsList modified = vAppClient.getVirtualHardwareSectionNetworkCards(vApp.getHref());
-      // assertEquals(modified.getInfo(), "New Info");
+
+      // Check the retrieved object is well formed
+      checkRasdItemsList(modified);
+
+      // Check the modified items list
+//       assertEquals(modified.getX(), "");
+      assertTrue(modified.getItems().contains(item));
+      assertEquals(modified, newRasdItems);
    }
 
    @Test(testName = "GET /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSection" })
    public void testGetVirtualHardwareSectionSerialPorts() {
-      RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
-      // checkRasdItemsList(rasdItems);
+     RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkRasdItemsList(rasdItems);
    }
 
    @Test(testName = "PUT /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSectionSerialPorts" })
    public void testModifyVirtualHardwareSectionSerialPorts() {
-      RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
-      // rasd.setX("New Info");
+     // Copy the existing items list and add a new item
+     RasdItemsList oldRasdItems = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
+     RASD item = RASD.builder().build();
+     RasdItemsList newRasdItems = oldRasdItems.toBuilder().item(item).build();
 
-      // Method under test
-      Task modifyVirtualHardwareSectionSerialPorts = vAppClient.modifyVirtualHardwareSectionSerialPorts(vApp.getHref(), rasdItems);
-      assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionSerialPorts), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionSerialPorts"));
+     // Method under test
+     Task modifyVirtualHardwareSectionSerialPorts = vAppClient.modifyVirtualHardwareSectionSerialPorts(vApp.getHref(), newRasdItems);
+     assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionSerialPorts), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionSerialPorts"));
 
-      RasdItemsList modified = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
-      // assertEquals(modified.getInfo(), "New Info");
+     // Retrieve the modified section
+     RasdItemsList modified = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkRasdItemsList(modified);
+
+     // Check the modified items list
+//      assertEquals(modified.getX(), "");
+     assertTrue(modified.getItems().contains(item));
+     assertEquals(modified, newRasdItems);
    }
 
    @Test(testName = "GET /vApp/{id}/metadata", dependsOnMethods = { "testGetVApp" })
    public void testGetMetadata() {
-      Metadata metadata = metadataClient.getMetadata(vApp.getHref());
-      
-      Checks.checkMetadataFor(VAPP, metadata);
+     Metadata metadata = metadataClient.getMetadata(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     checkMetadataFor(VAPP, metadata);
    }
 
    @Test(testName = "PUT & GET /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
    public void testSetAndGetMetadataValue() {
-      // Store a value
-      String key = ""+random.nextInt();
-      String value = ""+random.nextInt();
-      MetadataValue metadataValue = MetadataValue.builder().value(value).build();
-      metadataClient.setMetadata(vApp.getHref(), key, metadataValue);
+     // Store a value
+     String key = Integer.toString(random.nextInt());
+     String value = Integer.toString(random.nextInt());
+     MetadataValue metadataValue = MetadataValue.builder().value(value).build();
+     metadataClient.setMetadata(vApp.getHref(), key, metadataValue);
 
-      // Retrieve the value, and assert it was set correctly
-      MetadataValue newMetadataValue = metadataClient.getMetadataValue(vApp.getHref(), key);
-      Checks.checkMetadataValueFor(VAPP, newMetadataValue, value);
+     // Retrieve the value, and assert it was set correctly
+     MetadataValue newMetadataValue = metadataClient.getMetadataValue(vApp.getHref(), key);
+
+     // Check the retrieved object is well formed
+     Checks.checkMetadataValueFor(VAPP, newMetadataValue, value);
    }
 
    @Test(testName = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetAndGetMetadataValue" })
    public void testDeleteMetadataEntry() {
-      // Store a value, to be deleted
-      String key = ""+random.nextInt();
-      MetadataValue metadataValue = MetadataValue.builder().value("myval").build();
-      metadataClient.setMetadata(vApp.getHref(), key, metadataValue);
-      
-      // Delete the entry
-      Task task = metadataClient.deleteMetadataEntry(vApp.getHref(), key);
-      retryTaskSuccess.apply(task);
+     // Store a value, to be deleted
+     String key = Integer.toString(random.nextInt());
+     MetadataValue metadataValue = MetadataValue.builder().value("myval").build();
+     metadataClient.setMetadata(vApp.getHref(), key, metadataValue);
 
-      // Confirm the entry has been deleted
-      Metadata newMetadata = metadataClient.getMetadata(vApp.getHref());
-      Checks.checkMetadataKeyAbsentFor(VAPP, newMetadata, key);
+     // Delete the entry
+     Task task = metadataClient.deleteMetadataEntry(vApp.getHref(), key);
+     retryTaskSuccess.apply(task);
+
+     // Confirm the entry has been deleted
+     Metadata newMetadata = metadataClient.getMetadata(vApp.getHref());
+
+     // Check the retrieved object is well formed
+     Checks.checkMetadataKeyAbsentFor(VAPP, newMetadata, key);
    }
 
    @Test(testName = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
    public void testMergeMetadata() {
       Metadata oldMetadata = metadataClient.getMetadata(vApp.getHref());
-      Map oldMetadataMap = Checks.metadataToMap(oldMetadata);
-      
+      Map oldMetadataMap = Checks.metadataToMap(oldMetadata);
+
       // Store a value, to be deleted
-      String key = ""+random.nextInt();
-      String value = ""+random.nextInt();
+      String key = Integer.toString(random.nextInt());
+      String value = Integer.toString(random.nextInt());
       Metadata addedMetadata = Metadata.builder()
-               .entry(MetadataEntry.builder()
-                        .key(key)
-                        .value(value)
-                        .build())
-               .build();
+            .entry(MetadataEntry.builder().key(key).value(value).build())
+            .build();
       Task task = metadataClient.mergeMetadata(vApp.getHref(), addedMetadata);
       retryTaskSuccess.apply(task);
-      
+
       // Confirm the entry contains everything that was there, and everything that was being added
       Metadata newMetadata = metadataClient.getMetadata(vApp.getHref());
-      Map expectedMetadataMap = ImmutableMap.builder()
-               .putAll(oldMetadataMap)
-               .put(key, value)
-               .build();
+      Map expectedMetadataMap = ImmutableMap. builder()
+            .putAll(oldMetadataMap)
+            .put(key, value)
+            .build();
+
+      // Check the retrieved object is well formed
       Checks.checkMetadataFor(VAPP, newMetadata, expectedMetadataMap);
    }
 
    /**
-    * @see VAppClient#deleteVApp(URI)
-    */
+   * @see VAppClient#deleteVApp(URI)
+   */
    @Test(testName = "DELETE /vApp/{id}", dependsOnMethods = { "testPowerOffVApp" })
    public void testDeleteVApp() {
-      // The method under test
-      Task deleteVApp = vAppClient.deleteVApp(vApp.getHref());
-      assertTrue(retryTaskSuccess.apply(deleteVApp), String.format(TASK_COMPLETE_TIMELY, "deleteVApp"));
+     // The method under test
+     Task deleteVApp = vAppClient.deleteVApp(vApp.getHref());
+     assertTrue(retryTaskSuccess.apply(deleteVApp), String.format(TASK_COMPLETE_TIMELY, "deleteVApp"));
 
-      try {
-         vApp = vAppClient.getVApp(vApp.getHref());
-         fail("The VApp should have been deleted");
-      } catch (VCloudDirectorException vcde) {
-         assertEquals(vcde.getError().getMajorErrorCode(), Integer.valueOf(403), "The error code should have been 'Forbidden' (403)");
-         vApp = null;
-      }
+     try {
+        vApp = vAppClient.getVApp(vApp.getHref());
+        fail("The VApp should have been deleted");
+     } catch (VCloudDirectorException vcde) {
+        assertEquals(vcde.getError().getMajorErrorCode(), Integer.valueOf(403), "The error code should have been 'Forbidden' (403)");
+        vApp = null;
+     }
    }
 
-   @AfterClass(groups = { "live" })
+   // NOTE This method is also called by the BeforeClass method setupRequiredClients
+   @AfterClass(alwaysRun = true, description = "Clean up the environment by deleting created VApps named 'test-vapp' or 'new-name'")
    public void cleanUp() {
-      if (vApp != null) {
-	      Task deleteVApp = vAppClient.deleteVApp(vApp.getHref());
-	      retryTaskSuccess.apply(deleteVApp);
-      }
+     // Find references in the Vdc with the VApp type and named 'test-vapp' or 'new-name'
+     Iterable vApps = Iterables.filter(
+           vdc.getResourceEntities().getResourceEntities(),
+           Predicates.and(
+              ReferenceTypePredicates.typeEquals(VCloudDirectorMediaType.VAPP),
+              Predicates.or(
+                 ReferenceTypePredicates.nameEquals("test-vapp"),
+                 ReferenceTypePredicates.nameEquals("new-name")
+              )
+           )
+        );
+
+     // If we found any references, delete the VApp they point to
+     if (vApps != null && !Iterables.isEmpty(vApps)) {
+        for (Reference each : vApps) {
+           VApp found  = vAppClient.getVApp(each.getHref());
+           // debug(found);
+
+           // Shutdown and power off the VApp if necessary
+           if (found.getStatus().equals(Status.POWERED_ON.getValue())) {
+              Task shutdownTask = vAppClient.shutdown(found.getHref());
+              retryTaskSuccess.apply(shutdownTask);
+           }
+
+           // Undeploy the VApp if necessary
+           if (found.isDeployed()) {
+              UndeployVAppParams params = UndeployVAppParams.builder().build();
+              Task undeployTask = vAppClient.undeploy(found.getHref(), params);
+              retryTaskSuccess.apply(undeployTask);
+           }
+
+           // Delete the VApp
+           Task deleteTask = vAppClient.deleteVApp(found.getHref());
+           retryTaskSuccess.apply(deleteTask);
+        }
+     }
    }
 
+   /**
+   * Instantiate a {@link VApp} in a {@link Vdc} using the {@link VAppTemplate} we have configured for the tests.
+   *
+   * @return the VApp that is being instantiated
+   */
    private VApp instantiateVApp() {
-      InstantiateVAppTemplateParams instantiate = InstantiateVAppTemplateParams.builder()
-            .name("test-vapp")
-            .notDeploy()
-            .notPowerOn()
-            .description("Test VApp")
-            .instantiationParams(instantiationParams())
-            .source(Reference.builder().href(vAppTemplateURI).build())
-            .build();
-      
-      // debug(instantiate);
+     InstantiateVAppTemplateParams instantiate = InstantiateVAppTemplateParams.builder()
+           .name("test-vapp")
+           .notDeploy()
+           .notPowerOn()
+           .description("Test VApp")
+           .instantiationParams(instantiationParams())
+           .source(Reference.builder().href(vAppTemplateURI).build())
+           .build();
+     // debug(instantiate);
 
 		VApp vAppInstantiated = vdcClient.instantiateVApp(vdcURI, instantiate);
 		assertNotNull(vAppInstantiated, String.format(ENTITY_NON_NULL, VAPP));
@@ -935,16 +1162,18 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
 		return vAppInstantiated;
 	}
 
+   /** Build an {@link InstantiationParams} object. */
    private InstantiationParams instantiationParams() {
-      InstantiationParams instantiationParams = InstantiationParams.builder()
+     InstantiationParams instantiationParams = InstantiationParams.builder()
 		      .sections(ImmutableSet.of(networkConfigSection()))
 		      .build();
 
-      return instantiationParams;
+     return instantiationParams;
    }
 
+   /** Build a {@link NetworkConfigSection} object. */
    private NetworkConfigSection networkConfigSection() {
-      NetworkConfigSection networkConfigSection = NetworkConfigSection.builder()
+     NetworkConfigSection networkConfigSection = NetworkConfigSection.builder()
 		      .info("Configuration parameters for logical networks")
 		      .networkConfigs(
 		            ImmutableSet.of(VAppNetworkConfiguration.builder()
@@ -953,46 +1182,51 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
 		                  .build()))
 		      .build();
 
-      return networkConfigSection;
+     return networkConfigSection;
    }
 
+   /** Build a {@link NetworkConfiguration} object. */
    private NetworkConfiguration networkConfiguration() {
-      Set networks = vdc.getAvailableNetworks().getNetworks();
-      Optional parentNetwork = Iterables.tryFind(
-            networks, new Predicate() {
-                  @Override
-                  public boolean apply(Reference reference) {
-                     return reference.getHref().equals(networkURI);
-                  }
-            });
+     Set networks = vdc.getAvailableNetworks().getNetworks();
 
-      if (!parentNetwork.isPresent()) {
-         fail(String.format("Could not find network %s in vdc", networkURI.toASCIIString()));
-      }
+     // Look up the network in the Vdc with the id configured for the tests
+     Optional parentNetwork = Iterables.tryFind(
+           networks, new Predicate() {
+                 @Override
+                 public boolean apply(Reference reference) {
+                    return reference.getHref().equals(networkURI);
+                 }
+           });
 
-      NetworkConfiguration networkConfiguration = NetworkConfiguration.builder()
+     // Check we actually found a network reference
+     if (!parentNetwork.isPresent()) {
+        fail(String.format("Could not find network %s in vdc", networkURI.toASCIIString()));
+     }
+
+     // Build the configuration object
+     NetworkConfiguration networkConfiguration = NetworkConfiguration.builder()
 		      .parentNetwork(parentNetwork.get())
 		      .fenceMode("bridged")
 		      .build();
 
-      return networkConfiguration;
+     return networkConfiguration;
    }
 
    /**
-    * Marshals a JAXB annotated object into XML.
-    *
-    * The XML is output on {@link System#err}.
-    */
+   * Marshals a JAXB annotated object into XML.
+   *
+   * The XML is output on {@link System#err}.
+   */
    private void debug(Object object) {
-		String xml;
-      try {
-         xml = parser.toXML(object);
-      
+     JAXBParser parser = new JAXBParser();
+     try {
+        String xml = parser.toXML(object);
+
 	      System.err.println(Strings.repeat("-", 80));
 	      System.err.println(xml);
 	      System.err.println(Strings.repeat("-", 80));
-      } catch (IOException ioe) {
-         Throwables.propagate(ioe);
-      }
+     } catch (IOException ioe) {
+        Throwables.propagate(ioe);
+     }
    }
 }
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 5040365a99..d90ddc0f07 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
@@ -18,12 +18,15 @@
  */
 package org.jclouds.vcloud.director.v1_5.internal;
 
+import static org.testng.Assert.assertNotNull;
+
 import java.net.URI;
 import java.util.Properties;
 
 import javax.inject.Inject;
 
 import org.jclouds.compute.BaseVersionedServiceLiveTest;
+import org.jclouds.date.DateService;
 import org.jclouds.logging.log4j.config.Log4JLoggingModule;
 import org.jclouds.predicates.RetryablePredicate;
 import org.jclouds.rest.RestContext;
@@ -41,6 +44,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
 import org.jclouds.vcloud.director.v1_5.predicates.ReferenceTypePredicates;
 import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess;
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeGroups;
 import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
@@ -50,6 +54,7 @@ import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
+import com.google.inject.Guice;
 import com.google.inject.Module;
 
 /**
@@ -69,6 +74,14 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
       provider = "vcloud-director";
    }
 
+   protected static DateService dateService;
+
+   @BeforeGroups("live")
+   protected static void setupDateService() {
+      dateService = Guice.createInjector().getInstance(DateService.class);
+      assertNotNull(dateService);
+   }
+
    // NOTE Implement as required to populate xxxClient fields, or NOP
    public abstract void setupRequiredClients() throws Exception;
 
diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java
index 46d761f1b9..eb0b78e0fd 100644
--- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java
+++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java
@@ -54,7 +54,7 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect
    protected static DateService dateService;
 
    @BeforeGroups("unit")
-   protected static void setUpInjector() {
+   protected static void setupDateService() {
       dateService = Guice.createInjector().getInstance(DateService.class);
       assertNotNull(dateService);
    }