You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ab...@apache.org on 2013/08/29 20:31:52 UTC

[10/14] JCLOUDS-166, JCLOUDS-167 - Removing async from vcloud and Terremark APIs/providers

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppClientLiveTest.java
deleted file mode 100644
index 43fdcd5..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppClientLiveTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.vcloud.VCloudMediaType;
-import org.jclouds.vcloud.domain.Org;
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.domain.VApp;
-import org.jclouds.vcloud.domain.VDC;
-import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
-import org.testng.annotations.Test;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppClientLiveTest")
-public class VAppClientLiveTest extends BaseVCloudClientLiveTest {
-
-   @Test
-   public void testGetVApp() throws Exception {
-      Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
-      for (ReferenceType vdc : org.getVDCs().values()) {
-         VDC response = getVCloudApi().getVDCClient().getVDC(vdc.getHref());
-         for (ReferenceType item : response.getResourceEntities().values()) {
-            if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
-               try {
-                  VApp app = getVCloudApi().getVAppClient().getVApp(item.getHref());
-                  assertNotNull(app);
-               } catch (RuntimeException e) {
-
-               }
-            }
-         }
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java
new file mode 100644
index 0000000..f93f93e
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static com.google.common.collect.Iterables.getOnlyElement;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.jclouds.util.Predicates2.retry;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.jclouds.vcloud.options.CatalogItemOptions;
+import org.jclouds.vcloud.predicates.TaskSuccess;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppTemplateApiLiveTest")
+public class VAppTemplateApiLiveTest extends BaseVCloudApiLiveTest {
+   @Test
+   public void testGetVAppTemplate() throws Exception {
+      Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
+      for (ReferenceType cat : org.getCatalogs().values()) {
+         Catalog response = getVCloudApi().getCatalogClient().getCatalog(cat.getHref());
+         for (ReferenceType resource : response.values()) {
+            if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
+               CatalogItem item = getVCloudApi().getCatalogClient().getCatalogItem(resource.getHref());
+               if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
+                  VAppTemplate template = getVCloudApi().getVAppTemplateClient().getVAppTemplate(item.getEntity().getHref());
+                  if (template != null) {
+                     // the UUID in the href is the only way to actually link templates
+                     assertEquals(template.getHref(), item.getEntity().getHref());
+                  } else {
+                     // null can be no longer available or auth exception
+                  }
+               }
+            }
+         }
+      }
+   }
+
+   @Test
+   public void testGetOvfEnvelopeForVAppTemplate() throws Exception {
+      Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
+      for (ReferenceType cat : org.getCatalogs().values()) {
+         Catalog response = getVCloudApi().getCatalogClient().getCatalog(cat.getHref());
+         for (ReferenceType resource : response.values()) {
+            if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
+               CatalogItem item = getVCloudApi().getCatalogClient().getCatalogItem(resource.getHref());
+               if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
+                  getVCloudApi().getVAppTemplateClient().getOvfEnvelopeForVAppTemplate(item.getEntity().getHref());
+                  // null can be no longer available or auth exception
+               }
+            }
+         }
+      }
+   }
+
+   @Test
+   public void testFindVAppTemplate() throws Exception {
+      Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
+      for (ReferenceType cat : org.getCatalogs().values()) {
+         Catalog response = getVCloudApi().getCatalogClient().getCatalog(cat.getHref());
+         for (ReferenceType resource : response.values()) {
+            if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
+               CatalogItem item = getVCloudApi().getCatalogClient().getCatalogItem(resource.getHref());
+               if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
+                  VAppTemplate template = getVCloudApi().getVAppTemplateClient().findVAppTemplateInOrgCatalogNamed(
+                           org.getName(), response.getName(), item.getEntity().getName());
+                  if (template != null) {
+                     // the UUID in the href is the only way to actually link templates
+                     assertEquals(template.getHref(), item.getEntity().getHref());
+                  } else {
+                     // null can be no longer available or auth exception
+                  }
+               }
+            }
+         }
+      }
+   }
+
+   @Test
+   public void testCaptureVApp() throws Exception {
+      String group = prefix + "cap";
+      NodeMetadata node = null;
+      VAppTemplate vappTemplate = null;
+      CatalogItem item = null;
+      try {
+
+         node = getOnlyElement(client.createNodesInGroup(group, 1));
+
+         Predicate<URI> taskTester = retry(new TaskSuccess(getVCloudApi()), 600, 5, SECONDS);
+
+         // I have to undeploy first
+         Task task = getVCloudApi().getVAppClient().undeployVApp(URI.create(node.getId()));
+
+         // wait up to ten minutes per above
+         assert taskTester.apply(task.getHref()) : node;
+
+         VApp vApp = getVCloudApi().getVAppClient().getVApp(URI.create(node.getId()));
+
+         // wait up to ten minutes per above
+         assertEquals(vApp.getStatus(), Status.OFF);
+
+         // vdc is equiv to the node's location
+         // vapp uri is the same as the node's id
+         vappTemplate = getVCloudApi().getVAppTemplateClient().captureVAppAsTemplateInVDC(URI.create(node.getId()),
+                  group, URI.create(node.getLocation().getId()));
+
+         assertEquals(vappTemplate.getName(), group);
+
+         task = vappTemplate.getTasks().get(0);
+
+         // wait up to ten minutes per above
+         assert taskTester.apply(task.getHref()) : vappTemplate;
+
+         item = getVCloudApi().getCatalogClient().addVAppTemplateOrMediaImageToCatalogAndNameItem(
+                  vappTemplate.getHref(),
+                  getVCloudApi().getCatalogClient().findCatalogInOrgNamed(null, null).getHref(), "fooname",
+                  CatalogItemOptions.Builder.description("description").properties(ImmutableMap.of("foo", "bar")));
+
+         assertEquals(item.getName(), "fooname");
+         assertEquals(item.getDescription(), "description");
+         assertEquals(item.getProperties(), ImmutableMap.of("foo", "bar"));
+         assertEquals(item.getEntity().getName(), "fooname");
+         assertEquals(item.getEntity().getHref(), vappTemplate.getHref());
+         assertEquals(item.getEntity().getType(), vappTemplate.getType());
+
+      } finally {
+         if (item != null)
+            getVCloudApi().getCatalogClient().deleteCatalogItem(item.getHref());
+         if (vappTemplate != null)
+            getVCloudApi().getVAppTemplateClient().deleteVAppTemplate(vappTemplate.getHref());
+         if (node != null)
+            client.destroyNode(node.getId());
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java
new file mode 100644
index 0000000..06f592e
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java
@@ -0,0 +1,238 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.ovf.xml.EnvelopeHandler;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.options.CaptureVAppOptions;
+import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VAppHandler;
+import org.jclouds.vcloud.xml.VAppTemplateHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VAppTemplateApi}
+ * 
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VAppTemplateApiTest")
+public class VAppTemplateApiTest extends BaseVCloudApiTest<VAppTemplateApi> {
+
+   public void testCreateVAppInVDCByInstantiatingTemplate() throws SecurityException, NoSuchMethodException,
+            IOException {
+      Invokable<?, ?> method = method(VAppTemplateApi.class, "createVAppInVDCByInstantiatingTemplate", String.class,
+               URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("my-vapp", URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"),
+               addNetworkConfig(new NetworkConfig("aloha", URI
+                        .create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), FenceMode.NAT_ROUTED))));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
+      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
+               "/instantiationparams-network.xml")), "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml",
+               false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, VAppHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testCreateVAppInVDCByInstantiatingTemplateOptionsIllegalName() throws SecurityException,
+            NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VAppTemplateApi.class, "createVAppInVDCByInstantiatingTemplate", String.class,
+               URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
+      processor.createRequest(method, ImmutableList.<Object> of("CentOS 01", URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), addNetworkConfig(new NetworkConfig(null,
+               URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), null))));
+   }
+
+   public void testcopyVAppTemplateToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VAppTemplateApi.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
+               String.class, CloneVAppTemplateOptions[].class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181"), URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "my-vapptemplate"));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
+               "/copyVAppTemplate-default.xml")), "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testcopyVAppTemplateToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VAppTemplateApi.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
+               String.class, CloneVAppTemplateOptions[].class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server",
+               new CloneVAppTemplateOptions().description("The description of the new vAppTemplate")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVAppTemplate.xml")),
+               "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testmoveVAppTemplateToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VAppTemplateApi.class, "moveVAppTemplateToVDCAndRename", URI.class, URI.class,
+               String.class, CloneVAppTemplateOptions[].class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server",
+               new CloneVAppTemplateOptions().description("The description of the new vAppTemplate")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/moveVAppTemplate.xml")),
+               "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testcaptureVAppAsTemplateInVDC() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VAppTemplateApi.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
+               URI.class, CaptureVAppOptions[].class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), "my-template", URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/captureVApp HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+      assertPayloadEquals(request, Strings2
+               .toStringAndClose(getClass().getResourceAsStream("/captureVApp-default.xml")),
+               "application/vnd.vmware.vcloud.captureVAppParams+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testcaptureVAppAsTemplateInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VAppTemplateApi.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
+               URI.class, CaptureVAppOptions[].class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "my-template", URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), new CaptureVAppOptions()
+               .withDescription("The description of the new vApp Template")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/captureVApp HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/captureVApp.xml")),
+               "application/vnd.vmware.vcloud.captureVAppParams+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VAppTemplateApi.class, "findVAppTemplateInOrgCatalogNamed", String.class,
+               String.class, String.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "template"));
+
+      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(request);
+   }
+
+   public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VAppTemplateApi.class, "getVAppTemplate", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
+
+      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(request);
+   }
+
+   public void testGetOvfEnvelopeForVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VAppTemplateApi.class, "getOvfEnvelopeForVAppTemplate", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
+
+      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2/ovf HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: text/xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, EnvelopeHandler.class);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(request);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateAsyncClientTest.java
deleted file mode 100644
index 92181cf..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateAsyncClientTest.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import static org.jclouds.reflect.Reflection2.method;
-import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.ovf.xml.EnvelopeHandler;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.util.Strings2;
-import org.jclouds.vcloud.domain.network.FenceMode;
-import org.jclouds.vcloud.domain.network.NetworkConfig;
-import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
-import org.jclouds.vcloud.options.CaptureVAppOptions;
-import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
-import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
-import org.jclouds.vcloud.xml.TaskHandler;
-import org.jclouds.vcloud.xml.VAppHandler;
-import org.jclouds.vcloud.xml.VAppTemplateHandler;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.Invokable;
-/**
- * Tests behavior of {@code VAppTemplateAsyncClient}
- * 
- * @author Adrian Cole
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during
-// surefire
-@Test(groups = "unit", testName = "VAppTemplateAsyncClientTest")
-public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppTemplateAsyncClient> {
-
-   public void testCreateVAppInVDCByInstantiatingTemplate() throws SecurityException, NoSuchMethodException,
-            IOException {
-      Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "createVAppInVDCByInstantiatingTemplate", String.class,
-               URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
-      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("my-vapp", URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"),
-               addNetworkConfig(new NetworkConfig("aloha", URI
-                        .create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), FenceMode.NAT_ROUTED))));
-
-      assertRequestLineEquals(request,
-               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
-      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
-               "/instantiationparams-network.xml")), "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml",
-               false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, VAppHandler.class);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   @Test(expectedExceptions = IllegalArgumentException.class)
-   public void testCreateVAppInVDCByInstantiatingTemplateOptionsIllegalName() throws SecurityException,
-            NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "createVAppInVDCByInstantiatingTemplate", String.class,
-               URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
-      processor.createRequest(method, ImmutableList.<Object> of("CentOS 01", URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), addNetworkConfig(new NetworkConfig(null,
-               URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), null))));
-   }
-
-   public void testcopyVAppTemplateToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
-               String.class, CloneVAppTemplateOptions[].class);
-      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181"), URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "my-vapptemplate"));
-
-      assertRequestLineEquals(request,
-               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
-      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
-               "/copyVAppTemplate-default.xml")), "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, TaskHandler.class);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   public void testcopyVAppTemplateToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
-               String.class, CloneVAppTemplateOptions[].class);
-      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server",
-               new CloneVAppTemplateOptions().description("The description of the new vAppTemplate")));
-
-      assertRequestLineEquals(request,
-               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
-      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVAppTemplate.xml")),
-               "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, TaskHandler.class);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   public void testmoveVAppTemplateToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "moveVAppTemplateToVDCAndRename", URI.class, URI.class,
-               String.class, CloneVAppTemplateOptions[].class);
-      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server",
-               new CloneVAppTemplateOptions().description("The description of the new vAppTemplate")));
-
-      assertRequestLineEquals(request,
-               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
-      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/moveVAppTemplate.xml")),
-               "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, TaskHandler.class);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   public void testcaptureVAppAsTemplateInVDC() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
-               URI.class, CaptureVAppOptions[].class);
-      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), "my-template", URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
-
-      assertRequestLineEquals(request,
-               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/captureVApp HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
-      assertPayloadEquals(request, Strings2
-               .toStringAndClose(getClass().getResourceAsStream("/captureVApp-default.xml")),
-               "application/vnd.vmware.vcloud.captureVAppParams+xml", false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   public void testcaptureVAppAsTemplateInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
-               URI.class, CaptureVAppOptions[].class);
-      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "my-template", URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), new CaptureVAppOptions()
-               .withDescription("The description of the new vApp Template")));
-
-      assertRequestLineEquals(request,
-               "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/captureVApp HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
-      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/captureVApp.xml")),
-               "application/vnd.vmware.vcloud.captureVAppParams+xml", false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
-      assertFallbackClassEquals(method, null);
-
-      checkFilters(request);
-   }
-
-   public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "findVAppTemplateInOrgCatalogNamed", String.class,
-               String.class, String.class);
-      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "template"));
-
-      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
-      assertPayloadEquals(request, null, null, false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(request);
-   }
-
-   public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "getVAppTemplate", URI.class);
-      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
-
-      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
-      assertPayloadEquals(request, null, null, false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(request);
-   }
-
-   public void testGetOvfEnvelopeForVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "getOvfEnvelopeForVAppTemplate", URI.class);
-      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
-
-      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2/ovf HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: text/xml\n");
-      assertPayloadEquals(request, null, null, false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, EnvelopeHandler.class);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(request);
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateClientLiveTest.java
deleted file mode 100644
index 26d9fc1..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppTemplateClientLiveTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import static com.google.common.collect.Iterables.getOnlyElement;
-import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.jclouds.util.Predicates2.retry;
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.vcloud.VCloudMediaType;
-import org.jclouds.vcloud.domain.Catalog;
-import org.jclouds.vcloud.domain.CatalogItem;
-import org.jclouds.vcloud.domain.Org;
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.domain.Status;
-import org.jclouds.vcloud.domain.Task;
-import org.jclouds.vcloud.domain.VApp;
-import org.jclouds.vcloud.domain.VAppTemplate;
-import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
-import org.jclouds.vcloud.options.CatalogItemOptions;
-import org.jclouds.vcloud.predicates.TaskSuccess;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableMap;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppTemplateClientLiveTest")
-public class VAppTemplateClientLiveTest extends BaseVCloudClientLiveTest {
-   @Test
-   public void testGetVAppTemplate() throws Exception {
-      Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
-      for (ReferenceType cat : org.getCatalogs().values()) {
-         Catalog response = getVCloudApi().getCatalogClient().getCatalog(cat.getHref());
-         for (ReferenceType resource : response.values()) {
-            if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
-               CatalogItem item = getVCloudApi().getCatalogClient().getCatalogItem(resource.getHref());
-               if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
-                  VAppTemplate template = getVCloudApi().getVAppTemplateClient().getVAppTemplate(item.getEntity().getHref());
-                  if (template != null) {
-                     // the UUID in the href is the only way to actually link templates
-                     assertEquals(template.getHref(), item.getEntity().getHref());
-                  } else {
-                     // null can be no longer available or auth exception
-                  }
-               }
-            }
-         }
-      }
-   }
-
-   @Test
-   public void testGetOvfEnvelopeForVAppTemplate() throws Exception {
-      Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
-      for (ReferenceType cat : org.getCatalogs().values()) {
-         Catalog response = getVCloudApi().getCatalogClient().getCatalog(cat.getHref());
-         for (ReferenceType resource : response.values()) {
-            if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
-               CatalogItem item = getVCloudApi().getCatalogClient().getCatalogItem(resource.getHref());
-               if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
-                  getVCloudApi().getVAppTemplateClient().getOvfEnvelopeForVAppTemplate(item.getEntity().getHref());
-                  // null can be no longer available or auth exception
-               }
-            }
-         }
-      }
-   }
-
-   @Test
-   public void testFindVAppTemplate() throws Exception {
-      Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
-      for (ReferenceType cat : org.getCatalogs().values()) {
-         Catalog response = getVCloudApi().getCatalogClient().getCatalog(cat.getHref());
-         for (ReferenceType resource : response.values()) {
-            if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
-               CatalogItem item = getVCloudApi().getCatalogClient().getCatalogItem(resource.getHref());
-               if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
-                  VAppTemplate template = getVCloudApi().getVAppTemplateClient().findVAppTemplateInOrgCatalogNamed(
-                           org.getName(), response.getName(), item.getEntity().getName());
-                  if (template != null) {
-                     // the UUID in the href is the only way to actually link templates
-                     assertEquals(template.getHref(), item.getEntity().getHref());
-                  } else {
-                     // null can be no longer available or auth exception
-                  }
-               }
-            }
-         }
-      }
-   }
-
-   @Test
-   public void testCaptureVApp() throws Exception {
-      String group = prefix + "cap";
-      NodeMetadata node = null;
-      VAppTemplate vappTemplate = null;
-      CatalogItem item = null;
-      try {
-
-         node = getOnlyElement(client.createNodesInGroup(group, 1));
-
-         Predicate<URI> taskTester = retry(new TaskSuccess(getVCloudApi()), 600, 5, SECONDS);
-
-         // I have to undeploy first
-         Task task = getVCloudApi().getVAppClient().undeployVApp(URI.create(node.getId()));
-
-         // wait up to ten minutes per above
-         assert taskTester.apply(task.getHref()) : node;
-
-         VApp vApp = getVCloudApi().getVAppClient().getVApp(URI.create(node.getId()));
-
-         // wait up to ten minutes per above
-         assertEquals(vApp.getStatus(), Status.OFF);
-
-         // vdc is equiv to the node's location
-         // vapp uri is the same as the node's id
-         vappTemplate = getVCloudApi().getVAppTemplateClient().captureVAppAsTemplateInVDC(URI.create(node.getId()),
-                  group, URI.create(node.getLocation().getId()));
-
-         assertEquals(vappTemplate.getName(), group);
-
-         task = vappTemplate.getTasks().get(0);
-
-         // wait up to ten minutes per above
-         assert taskTester.apply(task.getHref()) : vappTemplate;
-
-         item = getVCloudApi().getCatalogClient().addVAppTemplateOrMediaImageToCatalogAndNameItem(
-                  vappTemplate.getHref(),
-                  getVCloudApi().getCatalogClient().findCatalogInOrgNamed(null, null).getHref(), "fooname",
-                  CatalogItemOptions.Builder.description("description").properties(ImmutableMap.of("foo", "bar")));
-
-         assertEquals(item.getName(), "fooname");
-         assertEquals(item.getDescription(), "description");
-         assertEquals(item.getProperties(), ImmutableMap.of("foo", "bar"));
-         assertEquals(item.getEntity().getName(), "fooname");
-         assertEquals(item.getEntity().getHref(), vappTemplate.getHref());
-         assertEquals(item.getEntity().getType(), vappTemplate.getType());
-
-      } finally {
-         if (item != null)
-            getVCloudApi().getCatalogClient().deleteCatalogItem(item.getHref());
-         if (vappTemplate != null)
-            getVCloudApi().getVAppTemplateClient().deleteVAppTemplate(vappTemplate.getHref());
-         if (node != null)
-            client.destroyNode(node.getId());
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java
new file mode 100644
index 0000000..5c3632a
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VDCApiLiveTest")
+public class VDCApiLiveTest extends BaseVCloudApiLiveTest {
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java
new file mode 100644
index 0000000..549b47c
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.NoSuchElementException;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.VDCHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VDCApi}
+ * 
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VDCApiTest")
+public class VDCApiTest extends BaseVCloudApiTest<VDCApi> {
+
+   @Test(expectedExceptions = NoSuchElementException.class)
+   public void testFindVDCInOrgNamedBadVDC() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+      processor.createRequest(method, ImmutableList.<Object> of("org", "vdc1"));
+   }
+
+   @Test(expectedExceptions = NoSuchElementException.class)
+   public void testFindVDCInOrgNamedBadOrg() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+      processor.createRequest(method, ImmutableList.<Object> of("org1", "vdc"));
+   }
+
+   public void testFindVDCInOrgNamedNullOrg() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+      GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "vdc"));
+
+      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, VDCHandler.class);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(request);
+   }
+
+   public void testFindVDCInOrgNamedNullOrgAndVDC() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+      GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null));
+
+      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, VDCHandler.class);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(request);
+   }
+
+   public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VDCApi.class, "getVDC", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
+
+      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, VDCHandler.class);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(request);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCAsyncClientTest.java
deleted file mode 100644
index 9e0f2e5..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCAsyncClientTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import static org.jclouds.reflect.Reflection2.method;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.NoSuchElementException;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
-import org.jclouds.vcloud.xml.VDCHandler;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.google.common.reflect.Invokable;
-/**
- * Tests behavior of {@code VDCAsyncClient}
- * 
- * @author Adrian Cole
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during
-// surefire
-@Test(groups = "unit", testName = "VDCAsyncClientTest")
-public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest<VDCAsyncClient> {
-
-   @Test(expectedExceptions = NoSuchElementException.class)
-   public void testFindVDCInOrgNamedBadVDC() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
-      processor.createRequest(method, ImmutableList.<Object> of("org", "vdc1"));
-   }
-
-   @Test(expectedExceptions = NoSuchElementException.class)
-   public void testFindVDCInOrgNamedBadOrg() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
-      processor.createRequest(method, ImmutableList.<Object> of("org1", "vdc"));
-   }
-
-   public void testFindVDCInOrgNamedNullOrg() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
-      GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "vdc"));
-
-      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
-      assertPayloadEquals(request, null, null, false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, VDCHandler.class);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(request);
-   }
-
-   public void testFindVDCInOrgNamedNullOrgAndVDC() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
-      GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null));
-
-      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
-      assertPayloadEquals(request, null, null, false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, VDCHandler.class);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(request);
-   }
-
-   public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
-      Invokable<?, ?> method = method(VDCAsyncClient.class, "getVDC", URI.class);
-      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
-               .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
-
-      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
-      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
-      assertPayloadEquals(request, null, null, false);
-
-      assertResponseParserClassEquals(method, request, ParseSax.class);
-      assertSaxResponseParserClassEquals(method, VDCHandler.class);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(request);
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCClientLiveTest.java
deleted file mode 100644
index 4b6ed69..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VDCClientLiveTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
-import org.testng.annotations.Test;
-
-/**
- * @author Adrian Cole
- */
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VDCClientLiveTest")
-public class VDCClientLiveTest extends BaseVCloudClientLiveTest {
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java
new file mode 100644
index 0000000..48c0dc7
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static com.google.common.base.Charsets.UTF_8;
+import static com.google.common.collect.Iterables.get;
+import static com.google.common.collect.Iterables.getOnlyElement;
+import static com.google.common.io.BaseEncoding.base64;
+import static org.jclouds.compute.options.RunScriptOptions.Builder.wrapInInitScript;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.compute.domain.ExecResponse;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+import com.google.common.net.HostAndPort;
+
+/**
+ * This tests that we can use guest customization as an alternative to bootstrapping with ssh. There
+ * are a few advantages to this, including the fact that it can work inside google appengine where
+ * network sockets (ssh:22) are prohibited.
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VmApiLiveTest")
+public class VmApiLiveTest extends BaseVCloudApiLiveTest {
+
+   @Test
+   public void testGetThumbnailOfVm() throws Exception {
+      Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
+      for (ReferenceType vdc : org.getVDCs().values()) {
+         VDC response = getVCloudApi().getVDCClient().getVDC(vdc.getHref());
+         for (ReferenceType item : response.getResourceEntities().values()) {
+            if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
+               try {
+                  VApp app = getVCloudApi().getVAppClient().getVApp(item.getHref());
+                  assertNotNull(app);
+                  for (Vm vm : app.getChildren()) {
+                     assert getVCloudApi().getVmClient().getScreenThumbnailForVm(vm.getHref()) != null;
+                  }
+               } catch (RuntimeException e) {
+
+               }
+            }
+         }
+      }
+   }
+
+   @Test
+   public void testGetVm() throws Exception {
+      Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
+      for (ReferenceType vdc : org.getVDCs().values()) {
+         VDC response = getVCloudApi().getVDCClient().getVDC(vdc.getHref());
+         for (ReferenceType item : response.getResourceEntities().values()) {
+            if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
+               try {
+                  VApp app = getVCloudApi().getVAppClient().getVApp(item.getHref());
+                  assertNotNull(app);
+                  for (Vm vm : app.getChildren()) {
+                     assertEquals(getVCloudApi().getVmClient().getVm(vm.getHref()).getHref(), vm.getHref());
+                  }
+               } catch (RuntimeException e) {
+
+               }
+            }
+         }
+      }
+   }
+
+   @Test
+   public void testExtendedOptionsWithCustomizationScript() throws Exception {
+      String PARSE_VMTOOLSD = "vmtoolsd --cmd=\"info-get guestinfo.ovfenv\" |grep vCloud_CustomizationInfo|sed 's/.*value=\"\\(.*\\)\".*/\\1/g'";
+
+      String group = prefix + "cus";
+
+      NodeMetadata node = null;
+      try {
+
+         TemplateOptions options = client.templateOptions();
+         options.blockOnPort(22, 180);
+         options.as(VCloudTemplateOptions.class).customizationScript(script);
+         options.as(VCloudTemplateOptions.class).description(group);
+         node = getOnlyElement(client.createNodesInGroup(group, 1, options));
+
+         VApp vapp = client.getContext().unwrapApi(VCloudApi.class).getVAppClient().getVApp(
+                 node.getUri());
+         assertEquals(vapp.getDescription(), group);
+
+         Vm vm = Iterables.get(vapp.getChildren(), 0);
+         String apiOutput = vm.getGuestCustomizationSection().getCustomizationScript();
+         checkApiOutput(apiOutput);
+
+         ExecResponse vmTools = client.runScriptOnNode(node.getId(), PARSE_VMTOOLSD,
+               wrapInInitScript(false).runAsRoot(false));
+         checkApiOutput(new String(base64().decode(vmTools.getOutput().trim()), UTF_8));
+
+         ExecResponse foo = client.runScriptOnNode(node.getId(), "cat /root/foo.txt", wrapInInitScript(false)
+               .runAsRoot(false));
+         checkCustomizationOccurred(foo);
+
+      } finally {
+         if (node != null)
+            client.destroyNode(node.getId());
+      }
+   }
+
+   protected void checkCustomizationOccurred(ExecResponse exec) {
+      // note that vmwaretools throws in \r characters when executing scripts
+      assert exec.getOutput().equals(iLoveAscii + "\r\n") : exec;
+   }
+
+   protected void checkApiOutput(String apiOutput) {
+      checkApiOutput1_0_1(apiOutput);
+   }
+
+   // make sure the script has a lot of screwy characters, knowing our parser
+   // throws-out \r
+   protected String iLoveAscii = "I '\"love\"' {asc|!}*&";
+
+   String script = "cat > /root/foo.txt<<EOF\n" + iLoveAscii + "\nEOF\n";
+
+   protected void checkApiOutput1_0_1(String apiOutput) {
+      // in 1.0.1, vcloud director seems to pass through characters via api
+      // flawlessly
+      assertEquals(apiOutput, script);
+   }
+
+   protected void checkApiOutput1_0_0(String apiOutput) {
+      // in 1.0.0, vcloud director seems to remove all newlines
+      assertEquals(apiOutput, script.replace("\n", ""));
+   }
+
+   protected HostAndPort getSocket(NodeMetadata node) {
+      return HostAndPort.fromParts(get(node.getPublicAddresses(), 0), 22);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiTest.java
new file mode 100644
index 0000000..6502d27
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VmApiTest.java
@@ -0,0 +1,320 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.http.functions.ReturnInputStream;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.utils.TestUtils;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VmHandler;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VmApi}
+ * 
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VmApiTest")
+public class VmApiTest extends BaseVCloudApiTest<VmApi> {
+
+   public void testGetThumbnailOfVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "getScreenThumbnailForVm", URI.class);
+      GeneratedHttpRequest request = processor
+               .createRequest(method, ImmutableList.<Object> of(URI.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+      assertRequestLineEquals(request, "GET http://vcloud.example.com/api/v1.0/vApp/vm-12/screen HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: image/png\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ReturnInputStream.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(request);
+   }
+
+   @Test(dataProvider = "ignoreOnWindows", description = "see http://code.google.com/p/jclouds/issues/detail?id=402")
+   public void testUpdateGuestConfiguration() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "updateGuestCustomizationOfVm", GuestCustomizationSection.class,
+               URI.class);
+      GuestCustomizationSection guest = new GuestCustomizationSection(URI
+               .create("http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection"));
+      guest.setCustomizationScript("cat > /tmp/foo.txt<<EOF\nI love candy\nEOF");
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(guest, URI
+               .create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+      assertRequestLineEquals(request,
+               "PUT http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
+               "/guestCustomizationSection.xml")), "application/vnd.vmware.vcloud.guestCustomizationSection+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testUpdateCPUCountOfVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "updateCPUCountOfVm", int.class, URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, URI
+               .create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+      assertRequestLineEquals(request,
+               "PUT http://vcloud.example.com/api/v1.0/vApp/vm-12/virtualHardwareSection/cpu HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/cpuItem.xml")),
+               "application/vnd.vmware.vcloud.rasdItem+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testUpdateMemoryMBOfVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "updateMemoryMBOfVm", int.class, URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(512, URI
+               .create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+      assertRequestLineEquals(request,
+               "PUT http://vcloud.example.com/api/v1.0/vApp/vm-12/virtualHardwareSection/memory HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/memoryItem.xml")),
+               "application/vnd.vmware.vcloud.rasdItem+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testDeployVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "deployVm", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+      assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+               "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testDeployAndPowerOnVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "deployAndPowerOnVm", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+      assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>",
+               "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testGetVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "getVm", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vm/1")));
+
+      assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vm/1 HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vm+xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, VmHandler.class);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(request);
+   }
+
+   public void testRebootVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "rebootVm", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reboot HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testUndeployVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "undeployVm", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+               "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testUndeployAndSaveStateOfVmSaveState() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "undeployAndSaveStateOfVm", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request,
+               "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>",
+               "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testPowerOnVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "powerOnVm", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOn HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testPowerOffVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "powerOffVm", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOff HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testResetVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "resetVm", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reset HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testSuspendVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "suspendVm", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/suspend HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseSax.class);
+      assertSaxResponseParserClassEquals(method, TaskHandler.class);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   public void testShutdownVm() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VmApi.class, "shutdownVm", URI.class);
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+      assertRequestLineEquals(request,
+               "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, "");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   @DataProvider
+   public Object[][] ignoreOnWindows() {
+      return (TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS 
+                                      : TestUtils.SINGLE_NO_ARG_INVOCATION);
+   }
+   
+}