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

[08/18] Forking jclouds's vcloud API

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
new file mode 100755
index 0000000..e309e67
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.binders;
+
+import static org.jclouds.util.Strings2.toStringAndClose;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+
+/**
+ * Tests behavior of {@code BindCloneVAppTemplateParamsToXmlPayload}
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class BindCloneVAppTemplateParamsToXmlPayloadTest extends BasePayloadTest {
+   public void testWithDescription() throws IOException {
+      String expected = toStringAndClose(getClass().getResourceAsStream("/copyVAppTemplate.xml"));
+      
+      CloneVAppTemplateOptions options = new CloneVAppTemplateOptions()
+            .description("The description of the new vAppTemplate");
+      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+      BindCloneVAppTemplateParamsToXmlPayload binder = injector
+            .getInstance(BindCloneVAppTemplateParamsToXmlPayload.class);
+
+      Builder<String, Object> map = ImmutableMap.builder();
+      map.put("name", "new-linux-server");
+      map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201");
+
+      assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+   }
+
+   public void testWithDescriptionSourceDelete() throws IOException {
+      String expected = toStringAndClose(getClass().getResourceAsStream("/moveVAppTemplate.xml"));
+
+      CloneVAppTemplateOptions options = new CloneVAppTemplateOptions()
+            .description("The description of the new vAppTemplate");
+      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+      BindCloneVAppTemplateParamsToXmlPayload binder = injector
+            .getInstance(BindCloneVAppTemplateParamsToXmlPayload.class);
+
+      Builder<String, Object> map = ImmutableMap.builder();
+      map.put("name", "new-linux-server");
+      map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201");
+      map.put("IsSourceDelete", "true");
+
+      assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+   }
+
+   public void testDefault() throws IOException {
+      String expected = toStringAndClose(getClass().getResourceAsStream("/copyVAppTemplate-default.xml"));
+
+      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+      BindCloneVAppTemplateParamsToXmlPayload binder = injector
+            .getInstance(BindCloneVAppTemplateParamsToXmlPayload.class);
+
+      Builder<String, Object> map = ImmutableMap.builder();
+      map.put("name", "my-vapptemplate");
+      map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181");
+
+      assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
new file mode 100755
index 0000000..d943b37
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Maps;
+
+/**
+ * Tests behavior of {@code BindDeployVAppParamsToXmlPayload}
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class BindDeployVAppParamsToXmlPayloadTest extends BasePayloadTest {
+
+   public void testPowerOnTrue() throws IOException {
+      String expected = "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>";
+
+      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+      BindDeployVAppParamsToXmlPayload binder = injector.getInstance(BindDeployVAppParamsToXmlPayload.class);
+
+      Map<String, Object> map = Maps.newHashMap();
+      map.put("powerOn", "true");
+      assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+   }
+
+   public void testDefault() throws IOException {
+      String expected = "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>";
+
+      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+      BindDeployVAppParamsToXmlPayload binder = injector.getInstance(BindDeployVAppParamsToXmlPayload.class);
+
+      Map<String, Object> map = Maps.newHashMap();
+      assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
new file mode 100755
index 0000000..b937c85
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.binders;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.replay;
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.endpoints.Network;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+import org.nnsoft.guice.rocoto.Rocoto;
+import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.base.Functions;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Provides;
+
+/**
+ * Tests behavior of {@code BindInstantiateVAppTemplateParamsToXmlPayload}
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class BindInstantiateVAppTemplateParamsToXmlPayloadTest extends BasePayloadTest {
+   Injector createInjector(final URI vAppTemplate, final VAppTemplate value) {
+
+      return Guice.createInjector(Rocoto.expandVariables(new ConfigurationModule() {
+
+         @Provides
+         @Singleton
+         @Network
+         protected Function<VAppTemplate, String> templateToDefaultNetworkName() {
+            return Functions.forMap(ImmutableMap.of(value, "vAppNet-vApp Internal"));
+         }
+
+         @Provides
+         @Singleton
+         protected LoadingCache<URI, VAppTemplate> templateIdToVAppTemplate() {
+            return CacheBuilder.newBuilder().build(
+                     CacheLoader.from(Functions.forMap(ImmutableMap.of(vAppTemplate, value))));
+         }
+
+         @Override
+         protected void bindConfigurations() {
+            bindProperties(new VCloudApiMetadata().getDefaultProperties());
+         }
+
+         @Provides
+         @Singleton
+         public FenceMode defaultFenceMode(@Named(PROPERTY_VCLOUD_DEFAULT_FENCEMODE) String fenceMode) {
+            return FenceMode.fromValue(fenceMode);
+         }
+
+         @Network
+         @Provides
+         @Singleton
+         Supplier<ReferenceType> provideNetwork() {
+            return Suppliers.<ReferenceType>ofInstance(new ReferenceTypeImpl(null, null, URI
+                     .create("https://vcenterprise.bluelock.com/api/v1.0/network/1990")));
+         }
+      }));
+   }
+
+   public void testDefault() throws IOException {
+      URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+      VAppTemplate template = createMock(VAppTemplate.class);
+      replay(template);
+
+      String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/instantiationparams.xml"));
+      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(new InstantiateVAppTemplateOptions()));
+
+      BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+               BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+      Map<String, Object> map = Maps.newHashMap();
+      map.put("name", "my-vapp");
+      map.put("template", templateUri.toASCIIString());
+      assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+   }
+
+   public void testDescription() throws IOException {
+      URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+      VAppTemplate template = createMock(VAppTemplate.class);
+      replay(template);
+
+      String expected = Strings2.toStringAndClose(getClass()
+               .getResourceAsStream("/instantiationparams-description.xml"));
+      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(new InstantiateVAppTemplateOptions().description("my foo")));
+
+      BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+               BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+      Map<String, Object> map = Maps.newHashMap();
+      map.put("name", "my-vapp");
+      map.put("template", templateUri.toASCIIString());
+      assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+   }
+
+   public void testWhenTemplateDoesntExist() throws IOException {
+      URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+      VAppTemplate template = createMock(VAppTemplate.class);
+      replay(template);
+
+      String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/instantiationparams.xml"));
+      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+      BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+               BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+      Map<String, Object> map = Maps.newHashMap();
+      map.put("name", "my-vapp");
+      map.put("template", templateUri.toASCIIString());
+      assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+   }
+
+   public void testWithNetworkNameFenceMode() throws IOException {
+      URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+      VAppTemplate template = createMock(VAppTemplate.class);
+      replay(template);
+
+      InstantiateVAppTemplateOptions options = addNetworkConfig(new NetworkConfig("aloha", URI
+               .create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), FenceMode.NAT_ROUTED));
+
+      String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/instantiationparams-network.xml"));
+      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+      BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+               BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+      Map<String, Object> map = Maps.newHashMap();
+      map.put("name", "my-vapp");
+      map.put("template", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+
+      assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
new file mode 100755
index 0000000..d207fb0
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code BindNetworkConnectionSectionToXmlPayload}
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "BindNetworkConnectionSectionToXmlPayloadTest")
+public class BindNetworkConnectionSectionToXmlPayloadTest extends BasePayloadTest {
+
+   public void testWithIpAllocationModeNONE() throws IOException {
+
+      HttpRequest request = HttpRequest.builder().endpoint("http://localhost/key").method("GET")
+            .build();
+
+      BindNetworkConnectionSectionToXmlPayload binder = injector
+            .getInstance(BindNetworkConnectionSectionToXmlPayload.class);
+
+      binder.bindToRequest(
+            request,
+            NetworkConnectionSection
+                  .builder()
+                  .type("application/vnd.vmware.vcloud.networkConnectionSection+xml")
+                  .info("Specifies the available VM network connections")
+                  .href(URI.create("https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/"))
+                  .connections(
+                        ImmutableSet.<NetworkConnection> of(NetworkConnection.builder().network("none")
+                              .ipAddressAllocationMode(IpAddressAllocationMode.NONE).build())).build());
+      assertEquals(request.getPayload().getContentMetadata().getContentType(),
+            "application/vnd.vmware.vcloud.networkConnectionSection+xml");
+
+      assertEquals(
+            request.getPayload().getRawContent(),
+            "<NetworkConnectionSection xmlns=\"http://www.vmware.com/vcloud/v1\" xmlns:ovf=\"http://schemas.dmtf.org/ovf/envelope/1\" href=\"https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/\" ovf:required=\"false\" type=\"application/vnd.vmware.vcloud.networkConnectionSection+xml\"><ovf:Info>Specifies the available VM network connections</ovf:Info><NetworkConnection network=\"none\"><NetworkConnectionIndex>0</NetworkConnectionIndex><IsConnected>false</IsConnected><IpAddressAllocationMode>NONE</IpAddressAllocationMode></NetworkConnection></NetworkConnectionSection>");
+
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
new file mode 100755
index 0000000..4f4a115
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Maps;
+
+/**
+ * Tests behavior of {@code BindUndeployVAppParamsToXmlPayload}
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class BindUndeployVAppParamsToXmlPayloadTest extends BasePayloadTest {
+   
+   public void testSaveStateTrue() throws IOException {
+      String expected = "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>";
+
+      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+      BindUndeployVAppParamsToXmlPayload binder = injector.getInstance(BindUndeployVAppParamsToXmlPayload.class);
+
+      Map<String, Object> map = Maps.newHashMap();
+      map.put("saveState", "true");
+      assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+   }
+
+   public void testDefault() throws IOException {
+      String expected = "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>";
+
+      GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+      BindUndeployVAppParamsToXmlPayload binder = injector.getInstance(BindUndeployVAppParamsToXmlPayload.class);
+
+      Map<String, Object> map = Maps.newHashMap();
+      assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
new file mode 100755
index 0000000..8dc8f40
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
@@ -0,0 +1,160 @@
+/*
+ * 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.compute;
+
+import java.net.URI;
+import java.util.Properties;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.VCloudMediaType;
+
+import com.google.common.base.Function;
+import com.google.common.net.HttpHeaders;
+import com.google.inject.Module;
+
+/**
+ * Base class for writing VCloud Expect tests for ComputeService operations
+ * 
+ * @author Adrian Cole
+ */
+public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestClientExpectTest<ComputeService> {
+   protected static final String ENDPOINT = "https://zone.myvcloud.com/api";
+
+   protected HttpRequest versionsRequest = HttpRequest.builder().method("GET").endpoint(
+            URI.create(ENDPOINT + "/versions")).build();
+
+   protected HttpResponse versionsResponseFromVCD1_5 = HttpResponse.builder().statusCode(200)
+            .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/versions-vcd15.xml", "text/xml"))
+            .build();
+
+   // initial auth is using basic
+   protected HttpRequest version1_0LoginRequest = HttpRequest.builder().method("POST").endpoint(ENDPOINT + "/v1.0/login")
+            .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.ORGLIST_XML)
+            .addHeader(HttpHeaders.AUTHORIZATION, "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build();
+
+   protected String sessionToken = "AtatAgvJMrwOc9pDQq4RRCRLazThpnTKJDxSVH9oB2I=";
+   
+   // login response includes a cookie and also a vcloud extended header with the session token in it
+   // NOTE: vCloud Director 1.5 returns ;version=1.0 on responses to requests made in 1.0 format.
+   protected HttpResponse successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg = HttpResponse.builder().statusCode(200)
+            .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/orgList1.0-vcd15.xml",  VCloudMediaType.ORGLIST_XML +";version=1.0"))
+            .addHeader("x-vcloud-authorization", sessionToken)
+            .addHeader(HttpHeaders.SET_COOKIE, String.format("vcloud-token=%s; Secure; Path=/", sessionToken)).build();
+
+   // objects are looked up by id and the format of the id is hex-hyphen
+   protected String orgId = "c076f90a-397a-49fa-89b8-b294c1599cd0";
+   
+   protected HttpRequest version1_0GetOrgRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/org/" + orgId)
+            .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.ORG_XML)
+            .addHeader("x-vcloud-authorization", sessionToken)
+            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+   
+   protected HttpResponse successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork = HttpResponse.builder().statusCode(200)
+            .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/org1.0-vcd15.xml",  VCloudMediaType.ORG_XML +";version=1.0"))
+            .build();
+   
+   protected String catalogId = "3155f393-1e1d-4572-8c9c-d76f72ddb658";
+   protected String vdcId = "e9cd3387-ac57-4d27-a481-9bee75e0690f";
+
+   protected HttpRequest version1_0GetCatalogRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/catalog/" + catalogId)
+            .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.CATALOG_XML)
+            .addHeader("x-vcloud-authorization", sessionToken)
+            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+   
+   protected HttpResponse successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate = HttpResponse.builder().statusCode(200)
+            .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/catalog1.0-vcd15.xml",  VCloudMediaType.CATALOG_XML +";version=1.0"))
+            .build();   
+   
+   protected String catalogItemId = "ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c";
+   
+   protected HttpRequest version1_0GetCatalogItemRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/catalogItem/" + catalogItemId)
+            .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.CATALOGITEM_XML)
+            .addHeader("x-vcloud-authorization", sessionToken)
+            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+   
+   protected HttpResponse successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate = HttpResponse.builder().statusCode(200)
+            .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/catalogItem1.0-vcd15.xml",  VCloudMediaType.CATALOGITEM_XML +";version=1.0"))
+            .build();   
+   
+   // note vAppTemplate has a prefix in its id
+   protected String templateId = "vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728";
+
+   protected HttpRequest version1_0GetVDCRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/vdc/" + vdcId)
+            .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.VDC_XML)
+            .addHeader("x-vcloud-authorization", sessionToken)
+            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+            
+   protected HttpResponse successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork = HttpResponse.builder().statusCode(200)
+            .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/vdc1.0-vcd15.xml",  VCloudMediaType.VDC_XML +";version=1.0"))
+            .build();   
+   
+   protected String networkId = "b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1";
+   
+   protected HttpRequest version1_0GetVAppTemplateRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/vAppTemplate/" + templateId)
+            .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.VAPPTEMPLATE_XML)
+            .addHeader("x-vcloud-authorization", sessionToken)
+            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+   
+   protected HttpResponse successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent = HttpResponse.builder().statusCode(200)
+            .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/template1.0-vcd15.xml",  VCloudMediaType.VAPPTEMPLATE_XML +";version=1.0"))
+            .build();   
+
+   protected HttpResponse successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithMultipleVMsAndVDCParent = HttpResponse.builder().statusCode(200)
+            .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/template1.0-vcd15-multi-vm.xml",  VCloudMediaType.VAPPTEMPLATE_XML +";version=1.0"))
+            .build();   
+
+   protected HttpRequest version1_0GetOVFForVAppTemplateRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/vAppTemplate/" + templateId + "/ovf")
+            .addHeader(HttpHeaders.ACCEPT, MediaType.TEXT_XML)
+            .addHeader("x-vcloud-authorization", sessionToken)
+            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+   
+   protected HttpResponse successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM = HttpResponse.builder().statusCode(200)
+            .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/ovf-ubuntu64.xml",  MediaType.TEXT_XML +";version=1.0"))
+            .build();   
+
+   protected HttpResponse successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithMultipleVMs = HttpResponse.builder().statusCode(200)
+            .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/ovf-multi-vm.xml",  MediaType.TEXT_XML +";version=1.0"))
+            .build();   
+
+   public BaseVCloudComputeServiceExpectTest() {
+      provider = "vcloud";
+   }
+
+   @Override
+   public ComputeService createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
+      return createInjector(fn, module, props).getInstance(ComputeService.class);
+   }
+   
+   @Override
+   protected ApiMetadata createApiMetadata() {
+      return new VCloudApiMetadata();
+   }
+
+   @Override
+   protected Properties setupProperties() {
+      Properties props = super.setupProperties();
+      props.setProperty(provider + ".endpoint", ENDPOINT);
+      return props;
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
new file mode 100755
index 0000000..2abd06d
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.compute;
+
+import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
+import org.jclouds.sshj.config.SshjSshClientModule;
+import org.testng.annotations.Test;
+
+import com.google.inject.Module;
+
+/**
+ * 
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true)
+public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
+
+   public VCloudComputeServiceLiveTest() {
+      provider = "vcloud";
+   }
+
+   @Override
+   public void setServiceDefaults() {
+      // extremely short names needed so that we don't get errors relating to
+      // guestCustomization.computerName being too long
+      group = "vcd";
+   }
+
+   @Override
+   public void testOptionToNotBlock() {
+      // start call has to block until deploy
+   }
+
+   @Override
+   protected Module getSshModule() {
+      return new SshjSshClientModule();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java
new file mode 100755
index 0000000..39ae435
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code FindLocationForResource}
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class FindLocationForResourceTest {
+   public void testMatchWhenIdIsHref() {
+      Location location = new LocationBuilder().id("http://foo").description("description")
+            .scope(LocationScope.PROVIDER).build();
+      FindLocationForResource converter = new FindLocationForResource(
+            Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(location)));
+      assertEquals(converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo"))), location);
+   }
+
+   @Test(expectedExceptions = NoSuchElementException.class)
+   public void testGracefulWhenHrefIsntLocationId() {
+      FindLocationForResource converter = new FindLocationForResource(
+            Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(new LocationBuilder()
+                  .id("http://bar").description("description").scope(LocationScope.PROVIDER).build())));
+      converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo")));
+   }
+
+   @Test(expectedExceptions = NoSuchElementException.class)
+   public void testGracefulWhenLocationIdIsntURI() {
+      FindLocationForResource converter = new FindLocationForResource(
+            Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(new LocationBuilder().id("1")
+                  .description("description").scope(LocationScope.PROVIDER).build())));
+      converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo")));
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java
new file mode 100755
index 0000000..f95b192
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Set;
+
+import org.jclouds.cim.OSType;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.CIMOperatingSystem;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.location.suppliers.all.JustProvider;
+import org.jclouds.vcloud.compute.BaseVCloudComputeServiceExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Test(singleThreaded = true, testName = "ListImagesInVCloudExpectTest")
+public class ListImagesInVCloudExpectTest extends BaseVCloudComputeServiceExpectTest {
+
+   public void testListImagesUsingVCloud1_0ApiOnServerRunningVCloudDirector1_5ReturnsImageWithLocationForVAppTemplateInVDC() throws Exception {
+      ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse>builder()
+               .put(versionsRequest, versionsResponseFromVCD1_5)
+               .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+               .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+               .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+               .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+               .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+               .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+               .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+               .build());
+
+      Location provider = Iterables.getOnlyElement(compute.getContext().utils().injector().getInstance(JustProvider.class).get());
+
+      Location orgLocation = new LocationBuilder().id(ENDPOINT + "/v1.0/org/" + orgId).scope(LocationScope.REGION)
+               .description("jclouds").parent(provider).build();
+
+      Location vdcLocation = new LocationBuilder().id(ENDPOINT + "/v1.0/vdc/" + vdcId).scope(LocationScope.ZONE)
+               .description("orgVDC-jclouds-Tier1-PAYG").parent(orgLocation).build();
+
+      Set<? extends Image> currentImages = compute.listImages();
+      assertEquals(compute.listImages().size(), 1);
+      Image onlyImage = Iterables.get(currentImages, 0);
+      
+      
+      Image expectedImage = new ImageBuilder()
+               .ids(ENDPOINT + "/v1.0/vAppTemplate/" + templateId)
+               .uri(URI.create(ENDPOINT + "/v1.0/vAppTemplate/" + templateId))
+               .name("UbuntuServer-x64-2GB")
+               .operatingSystem(new CIMOperatingSystem(OSType.UBUNTU_64, "", null, "Ubuntu Linux (64-bit)"))
+               // TODO: this looks like a bug, as it says network interfaces
+               .description("This is a special place-holder used for disconnected network interfaces.")
+               .defaultCredentials(LoginCredentials.builder().identity("root").build())
+               .status(Image.Status.AVAILABLE)
+               .location(vdcLocation).build();
+      
+      assertEquals(onlyImage, expectedImage);
+      assertEquals(onlyImage.getStatus(), Image.Status.AVAILABLE);
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java
new file mode 100755
index 0000000..32bb50d
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java
@@ -0,0 +1,228 @@
+/*
+ * 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.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.io.InputStream;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import javax.inject.Singleton;
+
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.collect.Memoized;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.domain.Credentials;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.compute.config.VCloudComputeServiceDependenciesModule;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.internal.VAppImpl;
+import org.jclouds.vcloud.xml.VAppHandler;
+import org.jclouds.vcloud.xml.ovf.VCloudResourceAllocationSettingDataHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.base.Joiner;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+import com.google.inject.name.Names;
+
+/**
+ * Tests behavior of {@code VAppToNodeMetadata}
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "unit")
+public class VAppToNodeMetadataTest {
+
+   public Injector createInjectorWithLocation(final Location location) {
+      return Guice.createInjector(new SaxParserModule(), new AbstractModule() {
+
+         @Override
+         protected void configure() {
+            Names.bindProperties(binder(), new VCloudApiMetadata().getDefaultProperties());
+            bind(new TypeLiteral<Function<ReferenceType, Location>>() {
+            }).to(new TypeLiteral<FindLocationForResource>() {
+            });
+            bind(new TypeLiteral<Function<VApp, Hardware>>() {
+            }).to(new TypeLiteral<HardwareForVApp>() {
+            });
+            bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
+         }
+
+         @Memoized
+         @Singleton
+         @Provides
+         Supplier<Set<? extends Location>> supplyLocations() {
+            return Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(location));
+         }
+
+         @Singleton
+         @Provides
+         Map<String, Credentials> supplyCreds() {
+            return Maps.newConcurrentMap();
+         }
+
+         @Singleton
+         @Provides
+         protected Map<Status, NodeMetadata.Status> provideVAppStatusToNodeStatus() {
+            return VCloudComputeServiceDependenciesModule.toPortableNodeStatus;
+         }
+
+      });
+   }
+
+   public void testWhenVDCIsLocation() {
+      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+            .scope(LocationScope.PROVIDER).build();
+      Injector injector = createInjectorWithLocation(location);
+      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+      Factory factory = injector.getInstance(ParseSax.Factory.class);
+      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+      VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+      NodeMetadata node = converter.apply(result);
+      assertNotNull(node);
+      assertEquals(node.getUserMetadata(), ImmutableMap.<String, String>of());
+      assertEquals(node.getTags(), ImmutableSet.<String>of());
+      assertEquals(node.getLocation(), location);
+      assertEquals(node.getPrivateAddresses(), ImmutableSet.of("172.16.7.230"));
+      assertEquals(node.getPublicAddresses(), ImmutableSet.of());
+   }
+
+   public void testWithMetadataParseException() {
+      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+         .scope(LocationScope.PROVIDER).build();
+      Injector injector = createInjectorWithLocation(location);
+      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+      Factory factory = injector.getInstance(ParseSax.Factory.class);
+      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+      VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+      ImmutableMap<String, String> metadata = ImmutableMap.<String, String>of();
+      ImmutableSet<String> tags = ImmutableSet.<String>of();
+
+      String description = " user=user_ssoid_1\nuid=3b7bb605-bb30-4e62-a3de-9076b052dee7 label='foo-DEVELOPMENT' date=2013-01-22 17:39:28.252";
+
+      result = new VAppImpl(result.getName(), result.getType(), result.getHref(), result.getStatus(), result.getVDC(),
+         description, result.getTasks(), result.isOvfDescriptorUploaded(), result.getChildren(),
+         result.getNetworkSection());
+
+      NodeMetadata node = converter.apply(result);
+      assertNotNull(node);
+      assertEquals(node.getUserMetadata(), metadata);
+      assertEquals(node.getTags(), tags);
+   }
+
+   public void testWithMetadataNoNewLines() {
+      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+         .scope(LocationScope.PROVIDER).build();
+      Injector injector = createInjectorWithLocation(location);
+      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+      Factory factory = injector.getInstance(ParseSax.Factory.class);
+      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+      VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+      ImmutableMap<String, String> metadata = ImmutableMap.<String, String>of();
+      ImmutableSet<String> tags = ImmutableSet.<String>of();
+
+      String description = " user=user_ssoid_1 uid=3b7bb605-bb30-4e62-a3de-9076b052dee7 label='foo-DEVELOPMENT' date=2013-01-22 17:39:28.252";
+
+      result = new VAppImpl(result.getName(), result.getType(), result.getHref(), result.getStatus(), result.getVDC(),
+         description, result.getTasks(), result.isOvfDescriptorUploaded(), result.getChildren(),
+         result.getNetworkSection());
+
+      NodeMetadata node = converter.apply(result);
+      assertNotNull(node);
+      assertEquals(node.getUserMetadata(), metadata);
+      assertEquals(node.getTags(), tags);
+   }
+
+   public void testWithEncodedMetadata() {
+      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+            .scope(LocationScope.PROVIDER).build();
+      Injector injector = createInjectorWithLocation(location);
+      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+      Factory factory = injector.getInstance(ParseSax.Factory.class);
+      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+      VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+      ImmutableMap<String, String> metadata = ImmutableMap.<String, String>of("foo", "bar");
+      ImmutableSet<String> tags = ImmutableSet.<String>of("tag1", "tag2");
+      
+      String description = Joiner
+               .on('\n')
+               .withKeyValueSeparator("=")
+               .join(ImmutableMap.<String, String> builder().putAll(metadata)
+                        .put("jclouds_tags", Joiner.on(',').join(tags)).build());
+      
+      result = new VAppImpl(result.getName(), result.getType(), result.getHref(), result.getStatus(), result.getVDC(),
+               description, result.getTasks(), result.isOvfDescriptorUploaded(), result.getChildren(),
+               result.getNetworkSection());
+      
+      NodeMetadata node = converter.apply(result);
+      assertNotNull(node);
+      assertEquals(node.getUserMetadata(), metadata);
+      assertEquals(node.getTags(), tags);
+
+   }
+
+   public void testGracefulWhenNoIPs() {
+      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+            .scope(LocationScope.PROVIDER).build();
+      Injector injector = createInjectorWithLocation(location);
+      InputStream is = getClass().getResourceAsStream("/vapp-none.xml");
+      Factory factory = injector.getInstance(ParseSax.Factory.class);
+      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+      VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+      NodeMetadata node = converter.apply(result);
+      assertNotNull(node);
+      assertEquals(node.getLocation(), location);
+      assertEquals(node.getPrivateAddresses(), ImmutableSet.of());
+      assertEquals(node.getPublicAddresses(), ImmutableSet.of());
+   }
+
+   @Test(expectedExceptions = NoSuchElementException.class)
+   public void testGracefulWhenVDCIsNotLocation() {
+      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/11111").description("description")
+            .scope(LocationScope.PROVIDER).build();
+      Injector injector = createInjectorWithLocation(location);
+      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+      Factory factory = injector.getInstance(ParseSax.Factory.class);
+      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+      VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+      NodeMetadata node = converter.apply(result);
+      assertNotNull(node);
+      assertEquals(node.getLocation(), location);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java
new file mode 100755
index 0000000..19a3ef7
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java
@@ -0,0 +1,197 @@
+/*
+ * 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.compute.options;
+
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.blockOnPort;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.customizationScript;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.description;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.inboundPorts;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.ipAddressAllocationMode;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.parentNetwork;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.testng.annotations.Test;
+
+/**
+ * Tests possible uses of VCloudTemplateOptions and
+ * VCloudTemplateOptions.Builder.*
+ * 
+ * @author Adrian Cole
+ */
+public class VCloudTemplateOptionsTest {
+   @Test
+   public void testipAddressAllocationMode() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      options.ipAddressAllocationMode(IpAddressAllocationMode.NONE);
+      assertEquals(options.getIpAddressAllocationMode(), IpAddressAllocationMode.NONE);
+   }
+
+   @Test
+   public void testipAddressAllocationModeStatic() {
+      VCloudTemplateOptions options = ipAddressAllocationMode(IpAddressAllocationMode.NONE);
+      assertEquals(options.getIpAddressAllocationMode(), IpAddressAllocationMode.NONE);
+   }
+
+   public void testAs() {
+      TemplateOptions options = new VCloudTemplateOptions();
+      assertEquals(options.as(VCloudTemplateOptions.class), options);
+   }
+
+   @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "customizationScript must be defined")
+   public void testcustomizationScriptBadFormat() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      options.customizationScript("");
+   }
+
+   @Test
+   public void testcustomizationScript() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      options.customizationScript("mykeypair");
+      assertEquals(options.getCustomizationScript(), "mykeypair");
+   }
+
+   @Test
+   public void testcustomizationScriptStatic() {
+      VCloudTemplateOptions options = customizationScript("mykeypair");
+      assertEquals(options.getCustomizationScript(), "mykeypair");
+   }
+
+   @Test
+   public void testNullparentNetwork() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      assertEquals(options.getParentNetwork(), null);
+   }
+
+   @Test
+   public void testparentNetwork() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      options.parentNetwork(URI.create("https://network"));
+      assertEquals(options.getParentNetwork(), URI.create("https://network"));
+   }
+
+   @Test
+   public void testparentNetworkStatic() {
+      VCloudTemplateOptions options = parentNetwork(URI.create("https://network"));
+      assertEquals(options.getParentNetwork(), URI.create("https://network"));
+   }
+
+   @Test
+   public void testdescription() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      options.description("mykeypair");
+      assertEquals(options.getDescription(), "mykeypair");
+   }
+
+   @Test
+   public void testdescriptionStatic() {
+      VCloudTemplateOptions options = description("mykeypair");
+      assertEquals(options.getDescription(), "mykeypair");
+   }
+
+   @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "customizationScript must be defined")
+   public void testcustomizationScriptNPE() {
+      customizationScript(null);
+   }
+
+   @Test
+   public void testinstallPrivateKey() throws IOException {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      options.installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
+      assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
+   }
+
+   @Test
+   public void testNullinstallPrivateKey() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      assertEquals(options.getPrivateKey(), null);
+   }
+
+   @Test
+   public void testauthorizePublicKey() throws IOException {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      options.authorizePublicKey("ssh-rsa");
+      assertEquals(options.getPublicKey(), "ssh-rsa");
+   }
+
+   @Test
+   public void testNullauthorizePublicKey() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      assertEquals(options.getPublicKey(), null);
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testblockOnPortBadFormat() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      options.blockOnPort(-1, -1);
+   }
+
+   @Test
+   public void testblockOnPort() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      options.blockOnPort(22, 30);
+      assertEquals(options.getPort(), 22);
+      assertEquals(options.getSeconds(), 30);
+
+   }
+
+   @Test
+   public void testNullblockOnPort() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      assertEquals(options.getPort(), -1);
+      assertEquals(options.getSeconds(), -1);
+   }
+
+   @Test
+   public void testblockOnPortStatic() {
+      VCloudTemplateOptions options = blockOnPort(22, 30);
+      assertEquals(options.getPort(), 22);
+      assertEquals(options.getSeconds(), 30);
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testinboundPortsBadFormat() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      options.inboundPorts(-1, -1);
+   }
+
+   @Test
+   public void testinboundPorts() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      options.inboundPorts(22, 30);
+      assertEquals(options.getInboundPorts()[0], 22);
+      assertEquals(options.getInboundPorts()[1], 30);
+
+   }
+
+   @Test
+   public void testDefaultOpen22() {
+      VCloudTemplateOptions options = new VCloudTemplateOptions();
+      assertEquals(options.getInboundPorts()[0], 22);
+   }
+
+   @Test
+   public void testinboundPortsStatic() {
+      VCloudTemplateOptions options = inboundPorts(22, 30);
+      assertEquals(options.getInboundPorts()[0], 22);
+      assertEquals(options.getInboundPorts()[1], 30);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java
new file mode 100755
index 0000000..8ee0a29
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java
@@ -0,0 +1,171 @@
+/*
+ * 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.compute.strategy;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.vcloud.compute.BaseVCloudComputeServiceExpectTest;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.net.HttpHeaders;
+import com.jamesmurty.utils.XMLBuilder;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Test(singleThreaded = true, testName = "InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest")
+public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest extends
+         BaseVCloudComputeServiceExpectTest {
+
+   String ns = "http://www.vmware.com/vcloud/v1";
+   Properties outputProperties;
+   public InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest() {
+      outputProperties = new Properties();
+      outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+   }
+
+   HttpResponse successfulVersion1_0InstantiatedVApp = HttpResponse.builder()
+         .statusCode(200)
+         .message("HTTP/1.1 200 OK")
+         .payload(payloadFromResourceWithContentType("/instantiatedvapp.xml",  "application/vnd.vmware.vcloud.vApp+xml")).build();
+
+   // TODO: finish me!
+   @Test(enabled = false)
+   public void testCreateNodeUsingVCloud1_0ApiAgainstVCloudDirector1_5WhenVAppTemplateHasNetworkNamedNone()
+            throws Exception {
+
+      String group = "group";
+      String name = "group-abcd";
+
+      String instantiateXML = XMLBuilder.create("InstantiateVAppTemplateParams")
+                                           .a("xmlns", ns).a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1")
+                                           .a("deploy", "false").a("name", name).a("powerOn", "false")
+                                        .e("Description").up()
+                                        .e("InstantiationParams")
+                                           .e("NetworkConfigSection")
+                                              .e("ovf:Info").t("Configuration parameters for logical networks").up()
+                                              .e("NetworkConfig").a("networkName", "orgNet-jclouds-External") // NOTE not "None"
+                                                 .e("Configuration")
+                                                    .e("ParentNetwork").a("href", ENDPOINT + "/v1.0/network/" + networkId).up()
+                                                    .e("FenceMode").t("bridged").up()
+                                                 .up()
+                                              .up()
+                                           .up()
+                                        .up()
+                                        .e("Source").a("href", ENDPOINT + "/v1.0/vAppTemplate/" + templateId).up()
+                                        .e("AllEULAsAccepted").t("true").up()
+                                        .asString(outputProperties);
+     
+      HttpRequest version1_0InstantiateWithNetworkNamedSameAsOrgNetwork = HttpRequest.builder().method("POST")
+                                                                           .endpoint(ENDPOINT + "/v1.0/vdc/" + vdcId + "/action/instantiateVAppTemplate")
+                                                                           .addHeader(HttpHeaders.ACCEPT, "application/vnd.vmware.vcloud.vApp+xml")
+                                                                           .addHeader("x-vcloud-authorization", sessionToken)
+                                                                           .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken)
+                                                                           .payload(payloadFromStringWithContentType(instantiateXML, "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")).build();
+                                                                        
+      ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+              .put(versionsRequest, versionsResponseFromVCD1_5)
+              .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+              .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+              .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+              .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+              .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+              .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+              .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+              .put(version1_0InstantiateWithNetworkNamedSameAsOrgNetwork, successfulVersion1_0InstantiatedVApp).build());
+
+      InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn starter = compute.getContext()
+               .utils().injector().getInstance(
+                        InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.class);
+
+
+      NodeAndInitialCredentials<VApp> appAndCreds = starter.createNodeWithGroupEncodedIntoName(group, name, compute
+               .templateBuilder().build());
+
+      assertEquals(appAndCreds.getNode().getName(), name);
+      assertEquals(appAndCreds.getCredentials(), LoginCredentials.builder().user("root").password("fromVApp").build());
+
+   }
+   
+   public void testInstantiateVAppFromTemplateWhenUsingOverriddenNetworkAndFenceMode()
+         throws Exception {
+   
+      String name = "group-abcd";
+      FenceMode fenceMode = FenceMode.NAT_ROUTED;
+      URI parentNetwork = URI.create(ENDPOINT + "/v1.0/network/" + "foooooooo");
+   
+      String instantiateXML = XMLBuilder.create("InstantiateVAppTemplateParams")
+                                           .a("xmlns", ns).a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1")
+                                           .a("deploy", "false").a("name", name).a("powerOn", "false")
+                                        .e("Description").up()
+                                        .e("InstantiationParams")
+                                           .e("NetworkConfigSection")
+                                              .e("ovf:Info").t("Configuration parameters for logical networks").up()
+                                              .e("NetworkConfig").a("networkName", "jclouds") // NOTE not "None"
+                                                 .e("Configuration")
+                                                    .e("ParentNetwork").a("href", parentNetwork.toASCIIString()).up()
+                                                    .e("FenceMode").t(fenceMode.toString()).up()
+                                                 .up()
+                                              .up()
+                                           .up()
+                                        .up()
+                                        .e("Source").a("href", ENDPOINT + "/v1.0/vAppTemplate/" + templateId).up()
+                                        .e("AllEULAsAccepted").t("true").up()
+                                        .asString(outputProperties);
+     
+      HttpRequest version1_0InstantiateWithCustomizedNetwork = HttpRequest.builder().method("POST")
+                                                                          .endpoint(ENDPOINT + "/v1.0/vdc/" + vdcId + "/action/instantiateVAppTemplate")
+                                                                          .addHeader(HttpHeaders.ACCEPT, "application/vnd.vmware.vcloud.vApp+xml")
+                                                                          .addHeader("x-vcloud-authorization", sessionToken)
+                                                                          .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken)
+                                                                          .payload(payloadFromStringWithContentType(instantiateXML, "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")).build();
+                                                                        
+      ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+              .put(versionsRequest, versionsResponseFromVCD1_5)
+              .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+              .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+              .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+              .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+              .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+              .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+              .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+              .put(version1_0InstantiateWithCustomizedNetwork, successfulVersion1_0InstantiatedVApp).build());
+   
+      InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn starter = compute.getContext()
+               .utils().injector().getInstance(
+                        InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.class);
+
+      Template template = compute.templateBuilder().build();
+      template.getOptions().as(VCloudTemplateOptions.class).parentNetwork(parentNetwork).fenceMode(fenceMode);
+      starter.instantiateVAppFromTemplate(name, template);
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java
new file mode 100755
index 0000000..09843d2
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.compute.strategy;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.vcloud.compute.BaseVCloudComputeServiceExpectTest;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
+public class VCloudComputeServiceAdapterTest extends BaseVCloudComputeServiceExpectTest {
+
+   @Test
+   public void testListHardwareProfiles() throws Exception {
+      ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+               .put(versionsRequest, versionsResponseFromVCD1_5)
+               .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+               .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+               .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+               .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+               .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+               .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+               .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+               .build());
+
+      VCloudComputeServiceAdapter adapter = compute.getContext()
+               .utils().injector().getInstance(VCloudComputeServiceAdapter.class);
+
+      Iterable<VAppTemplate> hardwareProfiles = adapter.listHardwareProfiles();
+      
+      Iterable<URI> hardwareProfileRefs = Iterables.transform(ImmutableList.copyOf(hardwareProfiles), new Function<VAppTemplate,URI>() {
+         @Override public URI apply(VAppTemplate input) {
+            return input.getHref();
+         }
+      });
+      assertEquals(ImmutableSet.copyOf(hardwareProfileRefs), ImmutableSet.of(URI.create("https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728")));
+   }
+   
+   /**
+    * For issue 994. In BaseEnvelopeHandler when it encounters VirtualSystemCollection, it throws IllegalArgumentException
+    * (cannot currently create envelopes with multiple virtual systems).
+    * Thus we do not include the VM in the supported set, but we do return without propagating the exception.
+    */
+   @Test
+   public void testListHardwareProfilesWithUnsupportedTemplate() throws Exception {
+      ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+               .put(versionsRequest, versionsResponseFromVCD1_5)
+               .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+               .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+               .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+               .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+               .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+               .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithMultipleVMsAndVDCParent)
+               .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithMultipleVMs)
+               .build());
+
+      VCloudComputeServiceAdapter adapter = compute.getContext()
+               .utils().injector().getInstance(VCloudComputeServiceAdapter.class);
+
+      Iterable<VAppTemplate> hardwareProfiles = adapter.listHardwareProfiles();
+      
+      assertEquals(ImmutableSet.copyOf(hardwareProfiles), ImmutableSet.of());
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4cbbd29e/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java
new file mode 100755
index 0000000..fa81fa3
--- /dev/null
+++ b/dependencies/jclouds/vcloud/1.7.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.rest.annotations.ApiVersion;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.inject.Key;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "CatalogApiLiveTest")
+public class CatalogApiLiveTest extends BaseVCloudApiLiveTest {
+   @Test
+   public void testGetCatalog() throws Exception {
+      Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+      for (ReferenceType catalog : org.getCatalogs().values()) {
+         assertEquals(catalog.getType(), VCloudMediaType.CATALOG_XML);
+         assertNotNull(getVCloudApi().getCatalogApi().getCatalog(catalog.getHref()));
+      }
+   }
+
+   @Test
+   public void testFindCatalogIsWriteableIfNotVersion1_5() throws Exception {
+      // when we are in vCloud 1.0.0 public catalogs don't work, so our default
+      // catalog is private
+      if (!view.utils().injector().getInstance(Key.get(String.class, ApiVersion.class)).startsWith("1.5"))
+         assertTrue(getVCloudApi().getCatalogApi().findCatalogInOrgNamed(null, null).isReadOnly());
+   }
+}