diff --git a/sandbox/savvis/pom.xml b/sandbox/savvis/pom.xml
new file mode 100644
index 0000000000..9b1c36e30a
--- /dev/null
+++ b/sandbox/savvis/pom.xml
@@ -0,0 +1,153 @@
+
+
+
+ 4.0.0
+
+ org.jclouds
+ jclouds-project
+ 1.0-SNAPSHOT
+ ../../project/pom.xml
+
+ org.jclouds
+ jclouds-savvis
+ jclouds savvis core
+ jclouds components to access savvis
+
+
+
+
+ jclouds-googlecode-deploy
+ http://jclouds.googlecode.com/svn/repo
+
+
+ jclouds-rimu-snapshots-nexus
+ https://oss.sonatype.org/content/repositories/snapshots
+
+ true
+
+
+
+
+
+
+ node-924
+ https://api.sandbox.symphonyVPDC.savvis.net/rest/api
+ 0.8
+ FIXME
+ FIXME
+
+
+
+ ${project.groupId}
+ jclouds-vcloud
+ ${project.version}
+
+
+ ${project.groupId}
+ jclouds-core
+ ${project.version}
+ test-jar
+ test
+
+
+ ${project.groupId}
+ jclouds-compute
+ ${project.version}
+ test-jar
+ test
+
+
+ ${project.groupId}
+ jclouds-vcloud
+ ${project.version}
+ test-jar
+ test
+
+
+ ${project.groupId}
+ jclouds-jsch
+ ${project.version}
+ test
+
+
+ log4j
+ log4j
+ 1.2.14
+ test
+
+
+ ${project.groupId}
+ jclouds-log4j
+ ${project.version}
+ test
+
+
+
+
+ live
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration
+ integration-test
+
+ test
+
+
+
+
+ test.savvis-symphony-vpdc.endpoint
+ ${test.savvis-symphony-vpdc.endpoint}
+
+
+ test.savvis-symphony-vpdc.apiversion
+ ${test.savvis-symphony-vpdc.apiversion}
+
+
+ test.savvis-symphony-vpdc.identity
+ ${test.savvis-symphony-vpdc.identity}
+
+
+ test.savvis-symphony-vpdc.credential
+ ${test.savvis-symphony-vpdc.credential}
+
+
+ jclouds.compute.blacklist-nodes
+ ${jclouds.compute.blacklist-nodes}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCAsyncClient.java b/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCAsyncClient.java
new file mode 100644
index 0000000000..36d8c2dc38
--- /dev/null
+++ b/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCAsyncClient.java
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed 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.savvis;
+
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.vcloud.VCloudExpressAsyncClient;
+import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
+
+/**
+ * Provides access to Symphony VPDC resources via their REST API.
+ *
+ *
+ * @see
+ * @author Adrian Cole
+ */
+@RequestFilters(SetVCloudTokenCookie.class)
+public interface SymphonyVPDCAsyncClient extends VCloudExpressAsyncClient {
+
+}
diff --git a/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCClient.java b/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCClient.java
new file mode 100644
index 0000000000..e6f1f1bf4d
--- /dev/null
+++ b/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCClient.java
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed 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.savvis;
+
+import java.util.concurrent.TimeUnit;
+
+import org.jclouds.concurrent.Timeout;
+import org.jclouds.vcloud.VCloudExpressClient;
+
+/**
+ * Provides access to Symphony VPDC resources via their REST API.
+ *
+ *
+ * @see
+ * @author Adrian Cole
+ */
+@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
+public interface SymphonyVPDCClient extends VCloudExpressClient {
+
+}
\ No newline at end of file
diff --git a/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCContextBuilder.java b/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCContextBuilder.java
new file mode 100644
index 0000000000..2b60e557ed
--- /dev/null
+++ b/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCContextBuilder.java
@@ -0,0 +1,51 @@
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed 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.savvis;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.jclouds.compute.ComputeServiceContextBuilder;
+import org.jclouds.savvis.compute.config.SymphonyVPDCComputeServiceContextModule;
+import org.jclouds.savvis.config.SymphonyVPDCRestClientModule;
+
+import com.google.inject.Module;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class SymphonyVPDCContextBuilder extends
+ ComputeServiceContextBuilder {
+
+ public SymphonyVPDCContextBuilder(Properties props) {
+ super(SymphonyVPDCClient.class, SymphonyVPDCAsyncClient.class, props);
+ }
+
+ @Override
+ protected void addContextModule(List modules) {
+ modules.add(new SymphonyVPDCComputeServiceContextModule());
+ }
+
+ protected void addClientModule(List modules) {
+ modules.add(new SymphonyVPDCRestClientModule());
+ }
+
+}
diff --git a/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCPropertiesBuilder.java b/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCPropertiesBuilder.java
new file mode 100644
index 0000000000..c0307f28ab
--- /dev/null
+++ b/sandbox/savvis/src/main/java/org/jclouds/savvis/SymphonyVPDCPropertiesBuilder.java
@@ -0,0 +1,47 @@
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed 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.savvis;
+
+import static org.jclouds.Constants.PROPERTY_API_VERSION;
+import static org.jclouds.Constants.PROPERTY_ENDPOINT;
+
+import java.util.Properties;
+
+import org.jclouds.vcloud.VCloudExpressPropertiesBuilder;
+
+/**
+ * Builds properties used in Symphony VPDC Clients
+ *
+ * @author Adrian Cole
+ */
+public class SymphonyVPDCPropertiesBuilder extends VCloudExpressPropertiesBuilder {
+ @Override
+ protected Properties defaultProperties() {
+ Properties properties = super.defaultProperties();
+ properties.setProperty(PROPERTY_API_VERSION, "0.8");
+ properties.setProperty(PROPERTY_ENDPOINT, "https://api.sandbox.symphonyVPDC.savvis.net/rest/api");
+ return properties;
+ }
+
+ public SymphonyVPDCPropertiesBuilder(Properties properties) {
+ super(properties);
+ }
+
+}
diff --git a/sandbox/savvis/src/main/java/org/jclouds/savvis/compute/config/SymphonyVPDCComputeServiceContextModule.java b/sandbox/savvis/src/main/java/org/jclouds/savvis/compute/config/SymphonyVPDCComputeServiceContextModule.java
new file mode 100644
index 0000000000..932143c28b
--- /dev/null
+++ b/sandbox/savvis/src/main/java/org/jclouds/savvis/compute/config/SymphonyVPDCComputeServiceContextModule.java
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed 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.savvis.compute.config;
+
+import org.jclouds.vcloud.compute.config.VCloudExpressComputeServiceContextModule;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class SymphonyVPDCComputeServiceContextModule extends VCloudExpressComputeServiceContextModule {
+
+}
diff --git a/sandbox/savvis/src/main/java/org/jclouds/savvis/config/SymphonyVPDCRestClientModule.java b/sandbox/savvis/src/main/java/org/jclouds/savvis/config/SymphonyVPDCRestClientModule.java
new file mode 100644
index 0000000000..ecb01e1df2
--- /dev/null
+++ b/sandbox/savvis/src/main/java/org/jclouds/savvis/config/SymphonyVPDCRestClientModule.java
@@ -0,0 +1,63 @@
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed 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.savvis.config;
+
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.savvis.SymphonyVPDCAsyncClient;
+import org.jclouds.savvis.SymphonyVPDCClient;
+import org.jclouds.savvis.handlers.SymphonyVPDCErrorHandler;
+import org.jclouds.vcloud.VCloudExpressAsyncClient;
+import org.jclouds.vcloud.VCloudExpressClient;
+import org.jclouds.vcloud.config.BaseVCloudExpressRestClientModule;
+
+import com.google.inject.Provides;
+
+public class SymphonyVPDCRestClientModule extends
+ BaseVCloudExpressRestClientModule {
+
+ public SymphonyVPDCRestClientModule() {
+ super(SymphonyVPDCClient.class, SymphonyVPDCAsyncClient.class);
+ }
+
+ @Provides
+ @Singleton
+ protected VCloudExpressAsyncClient provideVCloudAsyncClient(SymphonyVPDCAsyncClient in) {
+ return in;
+ }
+
+ @Provides
+ @Singleton
+ protected VCloudExpressClient provideVCloudClient(SymphonyVPDCClient in) {
+ return in;
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(SymphonyVPDCErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(SymphonyVPDCErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(SymphonyVPDCErrorHandler.class);
+ }
+
+}
\ No newline at end of file
diff --git a/sandbox/savvis/src/main/java/org/jclouds/savvis/handlers/SymphonyVPDCErrorHandler.java b/sandbox/savvis/src/main/java/org/jclouds/savvis/handlers/SymphonyVPDCErrorHandler.java
new file mode 100644
index 0000000000..f7c391e223
--- /dev/null
+++ b/sandbox/savvis/src/main/java/org/jclouds/savvis/handlers/SymphonyVPDCErrorHandler.java
@@ -0,0 +1,98 @@
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed 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.savvis.handlers;
+
+import java.io.IOException;
+
+import javax.annotation.Resource;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.logging.Logger;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.jclouds.util.Utils;
+
+import com.google.common.base.Throwables;
+import com.google.common.io.Closeables;
+
+/**
+ *
+ * @author Adrian Cole
+ *
+ */
+@Singleton
+public class SymphonyVPDCErrorHandler implements HttpErrorHandler {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ public void handleError(HttpCommand command, HttpResponse response) {
+ // it is important to always read fully and close streams
+ String message = parseMessage(response);
+ Exception exception = message != null ? new HttpResponseException(command, response, message)
+ : new HttpResponseException(command, response);
+ try {
+ message = message != null ? message : String.format("%s -> %s", command.getRequest().getRequestLine(),
+ response.getStatusLine());
+ switch (response.getStatusCode()) {
+ case 400:
+ exception = new IllegalArgumentException(message, exception);
+ break;
+ case 401:
+ exception = new AuthorizationException(message, exception);
+ break;
+ case 404:
+ if (!command.getRequest().getMethod().equals("DELETE")) {
+ exception = new ResourceNotFoundException(message, exception);
+ }
+ break;
+ case 405:
+ exception = new IllegalArgumentException(message, exception);
+ break;
+ case 409:
+ exception = new IllegalStateException(message, exception);
+ break;
+ }
+ } finally {
+ if (response.getPayload() != null)
+ Closeables.closeQuietly(response.getPayload().getInput());
+ command.setException(exception);
+ }
+ }
+
+ public String parseMessage(HttpResponse response) {
+ if (response.getPayload() == null)
+ return null;
+ try {
+ return Utils.toStringAndClose(response.getPayload().getInput());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ try {
+ response.getPayload().getInput().close();
+ } catch (IOException e) {
+ Throwables.propagate(e);
+ }
+ }
+ }
+}
diff --git a/sandbox/savvis/src/test/java/org/jclouds/savvis/SymphonyVPDCAsyncClientTest.java b/sandbox/savvis/src/test/java/org/jclouds/savvis/SymphonyVPDCAsyncClientTest.java
new file mode 100644
index 0000000000..3ad7a7d071
--- /dev/null
+++ b/sandbox/savvis/src/test/java/org/jclouds/savvis/SymphonyVPDCAsyncClientTest.java
@@ -0,0 +1,906 @@
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed 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.savvis;
+
+import static org.jclouds.Constants.PROPERTY_API_VERSION;
+import static org.jclouds.Constants.PROPERTY_IDENTITY;
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.processorCount;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.RequiresHttp;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.RestClientTest;
+import org.jclouds.rest.RestContextFactory;
+import org.jclouds.rest.RestContextSpec;
+import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
+import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
+import org.jclouds.rest.internal.RestAnnotationProcessor;
+import org.jclouds.savvis.config.SymphonyVPDCRestClientModule;
+import org.jclouds.util.Utils;
+import org.jclouds.vcloud.CommonVCloudClient;
+import org.jclouds.vcloud.VCloudAsyncClient;
+import org.jclouds.vcloud.VCloudExpressMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VCloudSession;
+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.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
+import org.jclouds.vcloud.options.CloneVAppOptions;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+import org.jclouds.vcloud.xml.CatalogHandler;
+import org.jclouds.vcloud.xml.CatalogItemHandler;
+import org.jclouds.vcloud.xml.OrgHandler;
+import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.TasksListHandler;
+import org.jclouds.vcloud.xml.VCloudExpressVAppHandler;
+import org.jclouds.vcloud.xml.VCloudExpressVAppTemplateHandler;
+import org.jclouds.vcloud.xml.VDCHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
+
+import domain.VCloudExpressLoginAsyncClient;
+import domain.VCloudVersionsAsyncClient;
+
+/**
+ * Tests annotation parsing of {@code SymphonyVPDCAsyncClient}
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "savvis.SymphonyVPDCAsyncClientTest")
+public class SymphonyVPDCAsyncClientTest extends RestClientTest {
+ public void testInstantiateVAppTemplateInVDCURI() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
+ String.class, InstantiateVAppTemplateOptions[].class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1"),
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vAppTemplate/3"), "my-vapp");
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
+ assertPayloadEquals(
+ request,
+ Utils.toStringAndClose(getClass().getResourceAsStream("/express/newvapp-hosting.xml")).replace(
+ "vcloud.safesecureweb.com/api", "api.sandbox.symphonyVPDC.savvis.net/rest/api"),
+ "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testInstantiateVAppTemplateInVDCURIOptions() throws SecurityException, NoSuchMethodException,
+ IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
+ String.class, InstantiateVAppTemplateOptions[].class);
+ HttpRequest request = processor.createRequest(
+ method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1"),
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vAppTemplate/3"),
+ "my-vapp",
+ processorCount(1)
+ .memory(512)
+ .disk(1024)
+ .addNetworkConfig(
+ new NetworkConfig(null, URI.create("https://vcloud.safesecureweb.com/network/1990"),
+ FenceMode.BRIDGED)));
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
+ assertPayloadEquals(
+ request,
+ Utils.toStringAndClose(getClass().getResourceAsStream("/express/newvapp-hostingcpumemdisk.xml")).replace(
+ "vcloud.safesecureweb.com/api", "api.sandbox.symphonyVPDC.savvis.net/rest/api"),
+ "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testInstantiateVAppTemplateInOrgOptionsIllegalName() throws SecurityException, NoSuchMethodException,
+ IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
+ String.class, InstantiateVAppTemplateOptions[].class);
+ processor.createRequest(
+ method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1"),
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1"),
+ "CentOS 01",
+ processorCount(1)
+ .memory(512)
+ .disk(1024)
+ .addNetworkConfig(
+ new NetworkConfig("aloha", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/1990"), null)));
+ }
+
+ public void testCloneVAppInVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
+ CloneVAppOptions[].class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1"),
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vapp/4181"), "my-vapp");
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1/action/cloneVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(
+ request,
+ Utils.toStringAndClose(getClass().getResourceAsStream("/express/cloneVApp-default.xml")).replace(
+ "vcloud.safesecureweb.com/api", "api.sandbox.symphonyVPDC.savvis.net/rest/api"),
+ "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testCloneVAppInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
+ CloneVAppOptions[].class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1"),
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vapp/201"), "new-linux-server",
+ new CloneVAppOptions().deploy().powerOn().withDescription("The description of the new vApp"));
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1/action/cloneVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/express/cloneVApp.xml"))
+ .replace("vcloud.safesecureweb.com/api", "api.sandbox.symphonyVPDC.savvis.net/rest/api"),
+ "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("getOrg", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/org/1"));
+
+ assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/org/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("findOrgNamed", String.class);
+ HttpRequest request = processor.createRequest(method, "org");
+
+ assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/org/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("getCatalog", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/catalog/1"));
+
+ assertRequestLineEquals(request,
+ "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/catalog/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCatalogInOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("findCatalogInOrgNamed", String.class, String.class);
+ HttpRequest request = processor.createRequest(method, "org", "catalog");
+
+ assertRequestLineEquals(request,
+ "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/catalog/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("getNetwork", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/network/2"));
+
+ assertRequestLineEquals(request,
+ "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/network/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgNetworkFromVCloudExpressNetworkHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("getCatalogItem", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/catalogItem/2"));
+
+ assertRequestLineEquals(request,
+ "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/catalogItem/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindCatalogItemInOrgCatalogNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("findCatalogItemInOrgCatalogNamed", String.class,
+ String.class, String.class);
+ HttpRequest request = processor.createRequest(method, "org", "catalog", "item");
+
+ assertRequestLineEquals(request,
+ "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/catalogItem/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("findVAppTemplateInOrgCatalogNamed", String.class,
+ String.class, String.class);
+ HttpRequest request = processor.createRequest(method, "org", "catalog", "template");
+
+ assertRequestLineEquals(request,
+ "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/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, VCloudExpressVAppTemplateHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("getVAppTemplate", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vAppTemplate/2"));
+
+ assertRequestLineEquals(request,
+ "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/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, VCloudExpressVAppTemplateHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindVDCInOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class);
+ HttpRequest request = processor.createRequest(method, "org", "vdc");
+
+ assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/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);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testFindVDCInOrgNamedBadVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class);
+ processor.createRequest(method, "org", "vdc1");
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testFindVDCInOrgNamedBadOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class);
+ processor.createRequest(method, "org1", "vdc");
+ }
+
+ public void testFindVDCInOrgNamedNullOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class);
+ HttpRequest request = processor.createRequest(method, null, "vdc");
+
+ assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/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);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindVDCInOrgNamedNullOrgAndVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class);
+ HttpRequest request = processor.createRequest(method, null, null);
+
+ assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/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);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("getVDC", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1"));
+
+ assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/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);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("getTasksList", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/tasksList/1"));
+
+ assertRequestLineEquals(request,
+ "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/tasksList/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TasksListHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindTasksListInOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = VCloudAsyncClient.class.getMethod("findTasksListInOrgNamed", String.class);
+ HttpRequest request = processor.createRequest(method, "org");
+
+ assertRequestLineEquals(request,
+ "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/tasksList/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TasksListHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testDeployVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("deployVApp", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1"));
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1/action/deploy 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);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testGet() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("getVApp", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1"));
+
+ assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testUndeployVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("undeployVApp", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1"));
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1/action/undeploy 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);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDelete() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("deleteVApp", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1"));
+
+ assertRequestLineEquals(request,
+ "DELETE https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("powerOnVApp", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1"));
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/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);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOffVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("powerOffVApp", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1"));
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/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);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testResetVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("resetVApp", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1"));
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/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);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testSuspendVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("suspendVApp", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1"));
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/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);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testShutdownVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("shutdownVApp", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1"));
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1/power/action/shutdown HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("getTask", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/task/1"));
+
+ assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/task/1 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);
+ assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
+ Method method = SymphonyVPDCAsyncClient.class.getMethod("cancelTask", URI.class);
+ HttpRequest request = processor.createRequest(method,
+ URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/task/1"));
+
+ assertRequestLineEquals(request,
+ "POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/task/1/action/cancel HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertExceptionParserClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ assertEquals(request.getFilters().get(0).getClass(), SetVCloudTokenCookie.class);
+ }
+
+ @Override
+ protected TypeLiteral> createTypeLiteral() {
+ return new TypeLiteral>() {
+ };
+ }
+
+ @Override
+ protected Module createModule() {
+ return new SymphonyVPDCRestClientModuleExtension();
+ }
+
+ @Override
+ public RestContextSpec, ?> createContextSpec() {
+ Properties restProperties = new Properties();
+ restProperties
+ .setProperty("savvis-symphony-vpdc.contextbuilder", "org.jclouds.savvis.SymphonyVPDCContextBuilder");
+ restProperties.setProperty("savvis-symphony-vpdc.propertiesbuilder",
+ "org.jclouds.savvis.SymphonyVPDCPropertiesBuilder");
+
+ Properties overrides = new Properties();
+ overrides.setProperty("savvis-symphony-vpdc.endpoint",
+ "https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8");
+ return new RestContextFactory(restProperties).createContextSpec("savvis-symphony-vpdc", "identity", "credential",
+ overrides);
+ }
+
+ @RequiresHttp
+ @ConfiguresRestClient
+ public static class SymphonyVPDCRestClientModuleExtension extends SymphonyVPDCRestClientModule {
+ @Override
+ protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService,
+ @Named(PROPERTY_API_VERSION) String version) {
+ return URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/login");
+ }
+
+ @Override
+ protected URI provideOrg(@org.jclouds.vcloud.endpoints.Org Iterable orgs) {
+ return URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/org");
+
+ }
+
+ @Override
+ protected String provideOrgName(@org.jclouds.vcloud.endpoints.Org Iterable orgs) {
+ return "org";
+ }
+
+ @Override
+ protected URI provideCatalog(Org org, @Named(PROPERTY_IDENTITY) String user) {
+ return URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/catalog");
+
+ }
+
+ @Override
+ protected Org provideOrg(CommonVCloudClient discovery) {
+ return null;
+ }
+
+ @Override
+ protected Iterable provideOrgs(Supplier cache, @Named(PROPERTY_IDENTITY) String user) {
+ return null;
+ }
+
+ @Override
+ protected URI provideDefaultTasksList(Org org) {
+ return URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/taskslist");
+ }
+
+ @Override
+ protected URI provideDefaultVDC(Org org, @org.jclouds.vcloud.endpoints.VDC String defaultVDC) {
+ return URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1");
+ }
+
+ @Override
+ protected String provideDefaultVDCName(
+ @org.jclouds.vcloud.endpoints.VDC Supplier