You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2014/03/31 09:13:33 UTC

[20/52] [partial] Moving jclouds dependencies to accurate parent directories

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java
new file mode 100755
index 0000000..06f592e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/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-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java
new file mode 100755
index 0000000..5c3632a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/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-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java
new file mode 100755
index 0000000..549b47c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/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-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java
new file mode 100755
index 0000000..095a12b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/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().getOrgApi().findOrgNamed(null);
+      for (ReferenceType vdc : org.getVDCs().values()) {
+         VDC response = getVCloudApi().getVDCApi().getVDC(vdc.getHref());
+         for (ReferenceType item : response.getResourceEntities().values()) {
+            if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
+               try {
+                  VApp app = getVCloudApi().getVAppApi().getVApp(item.getHref());
+                  assertNotNull(app);
+                  for (Vm vm : app.getChildren()) {
+                     assert getVCloudApi().getVmApi().getScreenThumbnailForVm(vm.getHref()) != null;
+                  }
+               } catch (RuntimeException e) {
+
+               }
+            }
+         }
+      }
+   }
+
+   @Test
+   public void testGetVm() throws Exception {
+      Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+      for (ReferenceType vdc : org.getVDCs().values()) {
+         VDC response = getVCloudApi().getVDCApi().getVDC(vdc.getHref());
+         for (ReferenceType item : response.getResourceEntities().values()) {
+            if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
+               try {
+                  VApp app = getVCloudApi().getVAppApi().getVApp(item.getHref());
+                  assertNotNull(app);
+                  for (Vm vm : app.getChildren()) {
+                     assertEquals(getVCloudApi().getVmApi().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).getVAppApi().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-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiTest.java
new file mode 100755
index 0000000..d7f0b0f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/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;
+   }
+   
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java
new file mode 100755
index 0000000..d4a0c06
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.filters;
+
+import static org.testng.Assert.assertEquals;
+
+import javax.ws.rs.core.HttpHeaders;
+
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(testName = "AddVCloudAuthorizationAndCookieToRequestTest")
+public class AddVCloudAuthorizationAndCookieToRequestTest {
+
+   private AddVCloudAuthorizationAndCookieToRequest filter;
+
+   @BeforeTest
+   void setUp() {
+      filter = new AddVCloudAuthorizationAndCookieToRequest(new Supplier<String>() {
+         public String get() {
+            return "token";
+         }
+           }, "1.0");
+   }
+
+   @Test
+   public void testApply() {
+      HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://localhost").build();
+      request = filter.filter(request);
+      assertEquals(request.getHeaders().size(), 3);
+      assertEquals(request.getFirstHeaderOrNull(HttpHeaders.COOKIE), "vcloud-token=token");
+      assertEquals(request.getFirstHeaderOrNull("x-vcloud-authorization"), "token");
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java
new file mode 100755
index 0000000..77d1069
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java
@@ -0,0 +1,147 @@
+/*
+ * 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.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests behavior of {@code ParseLoginResponseFromHeaders}
+ * 
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "ParseLoginResponseFromHeadersTest")
+public class ParseLoginResponseFromHeadersTest extends BaseHandlerTest {
+
+   private ParseLoginResponseFromHeaders parser;
+
+   @BeforeTest
+   void setUp() {
+      parser = injector.getInstance(ParseLoginResponseFromHeaders.class);
+   }
+
+   @Test
+   public void testApply() {
+      HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+                                          .payload(getClass().getResourceAsStream("/orglist.xml"))
+                                          .addHeader("x-vcloud-authorization", "vcloud-token=9er4d061-4bff-48fa-84b1-5da7166764d2; path=/").build();
+      response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+      response.getPayload().getContentMetadata().setContentLength(307l);
+
+      VCloudSession reply = parser.apply(response);
+      assertEquals(reply.getVCloudToken(), "9er4d061-4bff-48fa-84b1-5da7166764d2");
+      assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+               VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+   }
+
+   @Test
+   public void testApplyBlueLock() {
+      HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+                                          .payload(getClass().getResourceAsStream("/orglist.xml"))
+                                          .addHeader("x-vcloud-authorization", "MUKOJ2HoAfoMmLnHRp4esNb2MtWscCLLhVysnsIsCG0=").build();
+      response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+      response.getPayload().getContentMetadata().setContentLength(307l);
+
+      VCloudSession reply = parser.apply(response);
+      assertEquals(reply.getVCloudToken(), "MUKOJ2HoAfoMmLnHRp4esNb2MtWscCLLhVysnsIsCG0=");
+      assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+               VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+   }
+
+   @Test
+   public void testApplyTerremark() {
+      HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+                                          .payload(getClass().getResourceAsStream("/orglist.xml"))
+                                          .addHeader("Set-Cookie", "vcloud-token=37ce2715-9aba-4f48-8e45-2db8a8da702d; path=/").build();
+      response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+      response.getPayload().getContentMetadata().setContentLength(307l);
+
+      VCloudSession reply = parser.apply(response);
+      assertEquals(reply.getVCloudToken(), "37ce2715-9aba-4f48-8e45-2db8a8da702d");
+      assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+               VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+   }
+
+   @Test
+   public void testApplyTerremarkMultipleCookies() {
+      HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+                                          .payload(getClass().getResourceAsStream("/orglist.xml"))
+                                          .addHeader("Set-Cookie", "NSC_ESUO_21654_72.46.239.132_443=fooo;expires=Thu, 02-Jun-2011 17:19:26 GMT;path=/;secure;httponly")
+                                          .addHeader("Set-Cookie", "vcloud-token=37ce2715-9aba-4f48-8e45-2db8a8da702d; path=/").build();
+      response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+      response.getPayload().getContentMetadata().setContentLength(307l);
+
+      VCloudSession reply = parser.apply(response);
+      assertEquals(reply.getVCloudToken(), "37ce2715-9aba-4f48-8e45-2db8a8da702d");
+      assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+               VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+   }
+
+   @Test(expectedExceptions = HttpResponseException.class)
+   public void testUnmatchedCookieThrowsHttpResponseException() {
+      HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+                                          .payload(getClass().getResourceAsStream("/orglist.xml"))
+                                          .addHeader("Set-Cookie", "NSC_ESUO_21654_72.46.239.132_443=fooo;expires=Thu, 02-Jun-2011 17:19:26 GMT;path=/;secure;httponly").build();
+      response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+      response.getPayload().getContentMetadata().setContentLength(307l);
+
+      parser.apply(response);
+   }
+
+   @Test(expectedExceptions = HttpResponseException.class)
+   public void testNoThrowsHttpResponseException() {
+      HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+                                          .payload(getClass().getResourceAsStream("/orglist.xml")).build();
+      response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+      response.getPayload().getContentMetadata().setContentLength(307l);
+
+      parser.apply(response);
+   }
+
+   @Test
+   public void testApplyVirtacore() {
+      HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+                                          .payload(getClass().getResourceAsStream("/orglist.xml"))
+                                          .addHeader("x-vcloud-authorization", "vcloud-token=IPy0w7UGD4lwtdWAK/ZVzfuLK+dztxGRqsOhWqV0i48=").build();
+      response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+      response.getPayload().getContentMetadata().setContentLength(307l);
+
+      VCloudSession reply = parser.apply(response);
+      assertEquals(reply.getVCloudToken(), "IPy0w7UGD4lwtdWAK/ZVzfuLK+dztxGRqsOhWqV0i48=");
+      assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+               VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java
new file mode 100755
index 0000000..e824715
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.handlers;
+
+import java.net.URI;
+
+import org.jclouds.http.BaseHttpErrorHandlerTest;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = { "unit" })
+public class ParseVCloudErrorFromHttpResponseTest extends BaseHttpErrorHandlerTest {
+
+   @Test
+   public void testGet404SetsResourceNotFoundException() {
+      assertCodeMakes("GET", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"), 404,
+               "", "", ResourceNotFoundException.class);
+   }
+
+   @Test
+   public void testGet403NoAcessToEntitySetsResourceNotFoundException() {
+      assertCodeMakes(
+               "GET",
+               URI.create("https://zone01.bluelock.com/api/v1.0/vApp/vapp-1535788985"),
+               403,
+               "HTTP/1.1 403",
+               VCloudMediaType.ERROR_XML,
+               "<Error xmlns=\"http://www.vmware.com/vcloud/v1\" minorErrorCode=\"ACCESS_TO_RESOURCE_IS_FORBIDDEN\" message=\"No access to entity &quot;(com.vmware.vcloud.entity.vapp:1535788985)&quot;.\" majorErrorCode=\"403\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd\"></Error>\n",
+               ResourceNotFoundException.class);
+   }
+
+   @Test
+   public void testGet403NoAcessToEntitySetsResourceNotFoundExceptionOnAPI1_0AgainstVCD1_5() {
+      assertCodeMakes(
+               "GET",
+               URI.create("https://mycloud.greenhousedata.com/api/v1.0/vApp/vapp-d3a1f2cd-d07b-4ddc-bf7b-fb7468b4d95a"),
+               403,
+               "HTTP/1.1 403",
+               // NOTE VCD 1.5 appends the api version to the media type
+               VCloudMediaType.ERROR_XML + ";1.0",
+               "<Error xmlns=\"http://www.vmware.com/vcloud/v1\" minorErrorCode=\"ACCESS_TO_RESOURCE_IS_FORBIDDEN\" message=\"No access to entity &quot;(com.vmware.vcloud.entity.vapp:d3a1f2cd-d07b-4ddc-bf7b-fb7468b4d95a)&quot;.\" majorErrorCode=\"403\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://mycloud.greenhousedata.com/api/v1.0/schema/master.xsd\"></Error>",
+               ResourceNotFoundException.class);
+   }
+
+   @Test
+   public void testDelete404SetsHttpResponseException() {
+      assertCodeMakes("DELETE", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"),
+               404, "", "", HttpResponseException.class);
+   }
+
+   @Test
+   public void testPOSTNotRunningSetsIllegalStateException() {
+      assertCodeMakes(
+               "POST",
+               URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-138351019/action/undeploy"),
+               400,
+               "HTTP/1.1 400 Bad Request",
+               VCloudMediaType.ERROR_XML,
+               "<Error xmlns=\"http://www.vmware.com/vcloud/v1\" minorErrorCode=\"BAD_REQUEST\" message=\"The requested operation could not be executed since vApp &quot;adriancolecap-78c&quot; is not running&quot;\" majorErrorCode=\"400\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd\"></Error>\n",
+               IllegalStateException.class);
+   }
+
+   @Test
+   public void test401SetsAuthorizationException() {
+      assertCodeMakes("GET", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"), 401,
+               "", "", AuthorizationException.class);
+   }
+
+   @Override
+   protected Class<? extends HttpErrorHandler> getHandlerClass() {
+      return ParseVCloudErrorFromHttpResponse.class;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java
new file mode 100755
index 0000000..4ffe512
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.internal;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.net.URI;
+import java.util.List;
+
+import org.jclouds.reflect.Invocation;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.nnsoft.guice.rocoto.Rocoto;
+import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class BasePayloadTest {
+
+   protected Injector injector = Guice.createInjector(Rocoto.expandVariables(new ConfigurationModule() {
+      protected void bindConfigurations() {
+         bindProperties(new VCloudApiMetadata().getDefaultProperties());
+      }
+   }));
+
+   protected GeneratedHttpRequest requestForArgs(List<Object> args) {
+      try {
+         Invocation invocation = Invocation.create(method(String.class, "toString"), args);
+         return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create("http://localhost/key"))
+               .invocation(invocation).build();
+      } catch (SecurityException e) {
+         throw Throwables.propagate(e);
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java
new file mode 100755
index 0000000..73880ee
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.internal;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
+import org.jclouds.sshj.config.SshjSshClientModule;
+import org.jclouds.vcloud.VCloudApi;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.inject.Module;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true)
+public abstract class BaseVCloudApiLiveTest extends BaseComputeServiceContextLiveTest {
+
+   // username is too long for name constraints
+   protected String prefix = "vcd";
+
+   protected ComputeService client;
+
+   public BaseVCloudApiLiveTest() {
+      provider = "vcloud";
+   }
+
+   protected VCloudApi getVCloudApi() {
+      return view.unwrapApi(VCloudApi.class);
+   }
+
+   @Override
+   @BeforeClass(groups = { "integration", "live" })
+   public void setupContext() {
+      super.setupContext();
+      client = view.getComputeService();
+   }
+
+   @Override
+   protected Module getSshModule() {
+      return new SshjSshClientModule();
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
new file mode 100755
index 0000000..2ac9667
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
@@ -0,0 +1,272 @@
+/*
+ * 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.internal;
+
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.ovf.xml.EnvelopeHandlerTest;
+import org.jclouds.providers.AnonymousProviderMetadata;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.VCloudVersionsApi;
+import org.jclouds.vcloud.config.VCloudHttpApiModule;
+import org.jclouds.vcloud.domain.AllocationModel;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.VDCStatus;
+import org.jclouds.vcloud.domain.internal.CatalogImpl;
+import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
+import org.jclouds.vcloud.domain.internal.OrgImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.internal.VDCImpl;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.xml.VAppTemplateHandlerTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Functions;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheLoader;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.AbstractModule;
+import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Tests behavior of {@code VCloudApi}
+ * 
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "BaseVCloudApiTest")
+public abstract class BaseVCloudApiTest<T> extends BaseAsyncClientTest<T> {
+
+   @Override
+   protected void checkFilters(HttpRequest request) {
+      assertEquals(request.getFilters().size(), 1);
+      assertEquals(request.getFilters().get(0).getClass(), AddVCloudAuthorizationAndCookieToRequest.class);
+   }
+
+   @Override
+   protected Module createModule() {
+      return new VCloudHttpApiModuleExtension();
+   }
+   
+   @Override
+   protected ProviderMetadata createProviderMetadata() {
+      return  AnonymousProviderMetadata.forApiWithEndpoint(new VCloudApiMetadata(), "https://vcenterprise.bluelock.com/api/v1.0");
+   }
+   
+   protected static final ReferenceTypeImpl ORG_REF = new ReferenceTypeImpl("org", VCloudMediaType.ORG_XML,
+         URI.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"));
+
+   protected static final ReferenceTypeImpl CATALOG_REF = new ReferenceTypeImpl("catalog", VCloudMediaType.CATALOG_XML,
+         URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"));
+
+   protected static final ReferenceTypeImpl TASKSLIST_REF = new ReferenceTypeImpl("tasksList",
+         VCloudMediaType.TASKSLIST_XML, URI.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1"));
+
+   protected static final ReferenceTypeImpl VDC_REF = new ReferenceTypeImpl("vdc", VCloudMediaType.VDC_XML,
+         URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"));
+
+   protected static final ReferenceTypeImpl NETWORK_REF = new ReferenceTypeImpl("network", VCloudMediaType.NETWORK_XML,
+         URI.create("https://vcloud.safesecureweb.com/network/1990"));
+
+   protected static final Org ORG = new OrgImpl(ORG_REF.getName(), ORG_REF.getType(), ORG_REF.getHref(), "org", null,
+         ImmutableMap.<String, ReferenceType> of(CATALOG_REF.getName(), CATALOG_REF),
+         ImmutableMap.<String, ReferenceType> of(VDC_REF.getName(), VDC_REF), ImmutableMap.<String, ReferenceType> of(
+               NETWORK_REF.getName(), NETWORK_REF), TASKSLIST_REF, ImmutableList.<Task> of());
+
+   protected static final VDC VDC = new VDCImpl(VDC_REF.getName(), VDC_REF.getType(), VDC_REF.getHref(),
+         VDCStatus.READY, null, "description", ImmutableSet.<Task> of(), AllocationModel.ALLOCATION_POOL, null, null,
+         null, ImmutableMap.<String, ReferenceType> of(
+               "vapp",
+               new ReferenceTypeImpl("vapp", "application/vnd.vmware.vcloud.vApp+xml", URI
+                     .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")),
+               "network",
+               new ReferenceTypeImpl("network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
+                     .create("https://vcenterprise.bluelock.com/api/v1.0/vdcItem/2"))),
+         ImmutableMap.<String, ReferenceType> of(NETWORK_REF.getName(), NETWORK_REF), 0, 0, 0, false);
+
+   @ConfiguresHttpApi
+   public static class VCloudHttpApiModuleExtension extends VCloudHttpApiModule {
+
+      @Override
+      protected Supplier<URI> provideAuthenticationURI(VCloudVersionsApi versionService, String version) {
+         return Suppliers.ofInstance(URI.create("https://vcenterprise.bluelock.com/api/v1.0/login"));
+      }
+
+      @Override
+      protected Supplier<Org> provideOrg(Supplier<Map<String, Org>> orgSupplier,
+            @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
+         return Suppliers.ofInstance(ORG);
+      }
+
+      @Override
+      protected void installDefaultVCloudEndpointsModule() {
+         install(new AbstractModule() {
+
+            @Override
+            protected void configure() {
+               TypeLiteral<Supplier<ReferenceType>> refTypeSupplier = new TypeLiteral<Supplier<ReferenceType>>() {
+               };
+               bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Org.class).toInstance(
+                     Suppliers.<ReferenceType> ofInstance(ORG_REF));
+               bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Catalog.class).toInstance(
+                     Suppliers.<ReferenceType> ofInstance(CATALOG_REF));
+               bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.TasksList.class).toInstance(
+                     Suppliers.<ReferenceType> ofInstance(TASKSLIST_REF));
+               bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.VDC.class).toInstance(
+                     Suppliers.<ReferenceType> ofInstance(VDC_REF));
+               bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Network.class).toInstance(
+                     Suppliers.<ReferenceType> ofInstance(NETWORK_REF));
+            }
+
+         });
+      }
+
+      @Override
+      protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
+            AtomicReference<AuthorizationException> authException, final VCloudLoginApi login) {
+         return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
+
+            @Override
+            public Map<String, ReferenceType> getOrgs() {
+               return ImmutableMap.<String, ReferenceType> of(ORG_REF.getName(), ORG_REF);
+            }
+
+            @Override
+            public String getVCloudToken() {
+               return "token";
+            }
+
+         });
+
+      }
+
+      @Override
+      protected void configure() {
+         super.configure();
+         bind(OrgMapSupplier.class).to(TestOrgMapSupplier.class);
+         bind(OrgCatalogSupplier.class).to(TestOrgCatalogSupplier.class);
+         bind(OrgCatalogItemSupplier.class).to(TestOrgCatalogItemSupplier.class);
+      }
+      
+      @SuppressWarnings("unchecked")
+      @Override
+      protected void bindCacheLoaders() {
+         bind(new TypeLiteral<CacheLoader<URI, VAppTemplate>>() {
+         }).toInstance(CacheLoader.class.cast(CacheLoader.from(Functions.constant(VAppTemplateHandlerTest.parseTemplate()))));
+
+         bind(new TypeLiteral<CacheLoader<URI, Envelope>>() {
+         }).toInstance(CacheLoader.class.cast(CacheLoader.from(Functions.constant(EnvelopeHandlerTest.parseEnvelope()))));
+      }
+
+      @Override
+      protected Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
+            @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException,
+            OrgVDCSupplier supplier) {
+         return Suppliers.<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> ofInstance(ImmutableMap
+               .<String, Map<String, org.jclouds.vcloud.domain.VDC>> of(ORG_REF.getName(),
+                     ImmutableMap.<String, org.jclouds.vcloud.domain.VDC> of(VDC.getName(), VDC)));
+      }
+
+      @Singleton
+      public static class TestOrgMapSupplier extends OrgMapSupplier {
+
+         @Inject
+         protected TestOrgMapSupplier() {
+            super(null, null);
+         }
+
+         @Override
+         public Map<String, Org> get() {
+            return ImmutableMap.<String, Org> of(ORG.getName(), ORG);
+         }
+      }
+
+      @Singleton
+      public static class TestOrgCatalogSupplier extends OrgCatalogSupplier {
+         @Inject
+         protected TestOrgCatalogSupplier() {
+            super(null, null);
+         }
+
+         @Override
+         public Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>> get() {
+            return ImmutableMap.<String, Map<String, org.jclouds.vcloud.domain.Catalog>> of(
+                  ORG_REF.getName(), ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of(
+                        CATALOG_REF.getName(),
+                        new CatalogImpl(CATALOG_REF.getName(), CATALOG_REF.getType(), CATALOG_REF.getHref(), null,
+                              "description", ImmutableMap.<String, ReferenceType> of(
+                                    "item",
+                                    new ReferenceTypeImpl("item", "application/vnd.vmware.vcloud.catalogItem+xml", URI
+                                          .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1")),
+                                    "template",
+                                    new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+                                          URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))),
+                              ImmutableList.<Task> of(), true, false)));
+         }
+      }
+
+      @Singleton
+      public static class TestOrgCatalogItemSupplier extends OrgCatalogItemSupplier {
+         protected TestOrgCatalogItemSupplier() {
+            super(null, null);
+         }
+
+         @Override
+         public Map<String, Map<String, Map<String, CatalogItem>>> get() {
+            return ImmutableMap.<String, Map<String, Map<String, CatalogItem>>> of(
+                  ORG_REF.getName(), ImmutableMap
+                        .<String, Map<String, CatalogItem>> of(CATALOG_REF
+                              .getName(), ImmutableMap.<String, CatalogItem> of(
+                              "template",
+                              new CatalogItemImpl("template", URI
+                                    .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"), "description",
+                                    new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+                                          URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")),
+                                    ImmutableMap.<String, String> of()))));
+
+         }
+      }
+
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/19c8cdaf/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
new file mode 100755
index 0000000..4652e5e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.internal;
+
+import static org.jclouds.reflect.Reflection2.method;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+
+import javax.ws.rs.core.HttpHeaders;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.location.Provider;
+import org.jclouds.providers.AnonymousProviderMetadata;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.endpoints.VCloudLogin;
+import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
+import org.jclouds.vcloud.http.filters.VCloudBasicAuthentication;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+import com.google.inject.Binder;
+import com.google.inject.Module;
+import com.google.inject.Provides;
+/**
+ * Tests behavior of {@code VCloudLoginApi}
+ * 
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "VCloudLoginApiTest")
+public class VCloudLoginApiTest extends BaseAsyncClientTest<VCloudLoginApi> {
+
+   public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
+      Invokable<?, ?> method = method(VCloudLoginApi.class, "login");
+      GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+      assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1");
+      assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": application/vnd.vmware.vcloud.orgList+xml\n" + HttpHeaders.ACCEPT + ": application/vnd.vmware.vcloud.session+xml\n");
+      assertPayloadEquals(request, null, null, false);
+
+      assertResponseParserClassEquals(method, request, ParseLoginResponseFromHeaders.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, null);
+
+      checkFilters(request);
+   }
+
+   @Override
+   protected void checkFilters(HttpRequest request) {
+      assertEquals(request.getFilters().size(), 1);
+      assertEquals(request.getFilters().get(0).getClass(), VCloudBasicAuthentication.class);
+   }
+
+   @Override
+   protected Module createModule() {
+      return new Module() {
+
+         @Override
+         public void configure(Binder binder) {
+         }
+
+         @Provides
+         @VCloudLogin
+         Supplier<URI> provideURI(@Provider Supplier<URI> uri) {
+            return uri;
+         }
+
+      };
+   }
+
+   @Override
+   protected ProviderMetadata createProviderMetadata() {
+      return AnonymousProviderMetadata.forApiOnEndpoint(VCloudLoginApi.class,
+            "http://localhost:8080/login");
+   }
+
+}