Issue 440: decoupled vcloudexpress from vcloud

This commit is contained in:
Adrian Cole 2011-01-09 15:32:17 -08:00
parent 68e55a76bb
commit 3d9a4070fb
233 changed files with 397 additions and 114 deletions

View File

@ -35,7 +35,7 @@ our compute api supports: aws-ec2, gogrid, cloudservers (generic), cloudservers-
cloudsigma, elasticstack(generic), bluelock-vclouddirector, cloudsigma, elasticstack(generic), bluelock-vclouddirector,
slicehost, ecc-ec2, elastichosts-lon-p (Peer 1), slicehost, ecc-ec2, elastichosts-lon-p (Peer 1),
elastichosts-sat-p (Peer 1), elastichosts-lon-b (BlueSquare), elastichosts-sat-p (Peer 1), elastichosts-lon-b (BlueSquare),
stub (in-memory) vcloudexpress (generic), stub (in-memory)
* note * the pom dependency org.jclouds/jclouds-allcompute gives you access to * note * the pom dependency org.jclouds/jclouds-allcompute gives you access to
to all of these providers to all of these providers

View File

@ -64,6 +64,11 @@
<artifactId>vcloud</artifactId> <artifactId>vcloud</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>vcloudexpress</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.jclouds.provider</groupId> <groupId>org.jclouds.provider</groupId>
<artifactId>bluelock-vcdirector</artifactId> <artifactId>bluelock-vcdirector</artifactId>

View File

@ -43,5 +43,6 @@
<module>cloudfiles</module> <module>cloudfiles</module>
<module>cloudservers</module> <module>cloudservers</module>
<module>vcloud</module> <module>vcloud</module>
<module>vcloudexpress</module>
</modules> </modules>
</project> </project>

View File

@ -41,13 +41,20 @@
<test.vcloud.identity>FIXME</test.vcloud.identity> <test.vcloud.identity>FIXME</test.vcloud.identity>
<test.vcloud.credential>FIXME</test.vcloud.credential> <test.vcloud.credential>FIXME</test.vcloud.credential>
</properties> </properties>
<scm>
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/vcloud/core</connection>
<developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/vcloud/core</developerConnection>
<url>http://jclouds.googlecode.com/svn/trunk/vcloud/core</url>
</scm>
<dependencies> <dependencies>
<dependency>
<groupId>org.jclouds.common</groupId>
<artifactId>vcloud-common</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.common</groupId>
<artifactId>vcloud-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.jclouds</groupId> <groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId> <artifactId>jclouds-core</artifactId>

View File

@ -38,7 +38,7 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder; import org.jclouds.rest.MapBinder;
import org.jclouds.rest.binders.BindToStringPayload; import org.jclouds.rest.binders.BindToStringPayload;
import org.jclouds.rest.internal.GeneratedHttpRequest; import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.jclouds.vcloud.VCloudExpressMediaType; import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.options.CaptureVAppOptions; import org.jclouds.vcloud.options.CaptureVAppOptions;
import com.google.inject.Inject; import com.google.inject.Inject;
@ -94,7 +94,7 @@ public class BindCaptureVAppParamsToXmlPayload implements MapBinder {
XMLBuilder rootBuilder = buildRoot(templateName); XMLBuilder rootBuilder = buildRoot(templateName);
if (options.getDescription() != null) if (options.getDescription() != null)
rootBuilder.e("Description").text(options.getDescription()); rootBuilder.e("Description").text(options.getDescription());
rootBuilder.e("Source").a("href", vApp).a("type", VCloudExpressMediaType.VAPP_XML); rootBuilder.e("Source").a("href", vApp).a("type", VCloudMediaType.VAPP_XML);
Properties outputProperties = new Properties(); Properties outputProperties = new Properties();
outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes"); outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
return rootBuilder.asString(outputProperties); return rootBuilder.asString(outputProperties);

View File

@ -33,6 +33,7 @@ import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier; import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.VCloudAsyncClient;
import org.jclouds.vcloud.VCloudClient; import org.jclouds.vcloud.VCloudClient;
import org.jclouds.vcloud.VCloudLoginAsyncClient;
import org.jclouds.vcloud.domain.CatalogItem; import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.VAppTemplate; import org.jclouds.vcloud.domain.VAppTemplate;
import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.domain.VCloudSession;
@ -43,7 +44,6 @@ import com.google.common.base.Supplier;
import com.google.inject.Provides; import com.google.inject.Provides;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import domain.VCloudLoginAsyncClient;
/** /**
* Configures the VCloud authentication service connection, including logging * Configures the VCloud authentication service connection, including logging

View File

@ -93,8 +93,6 @@ import com.google.inject.Injector;
import com.google.inject.Module; import com.google.inject.Module;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import domain.VCloudLoginAsyncClient;
import domain.VCloudVersionsAsyncClient;
/** /**
* Tests behavior of {@code VCloudAsyncClient} * Tests behavior of {@code VCloudAsyncClient}

154
apis/vcloudexpress/pom.xml Normal file
View File

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2010 Cloud Conscious, LLC.
<info@cloudconscious.com>
====================================================================
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.
====================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.jclouds.api</groupId>
<artifactId>vcloudexpress</artifactId>
<name>jcloud vcloudexpress api</name>
<description>jclouds components to access an implementation of VMWare vCloud Express</description>
<properties>
<!-- when instances are hung, open a ticket and add here -->
<jclouds.compute.blacklist-nodes>trmkrun-ccc,test.trmk-924</jclouds.compute.blacklist-nodes>
<test.vcloudexpress.endpoint>FIXME</test.vcloudexpress.endpoint>
<test.vcloudexpress.apiversion>1.0</test.vcloudexpress.apiversion>
<test.vcloudexpress.identity>FIXME</test.vcloudexpress.identity>
<test.vcloudexpress.credential>FIXME</test.vcloudexpress.credential>
</properties>
<dependencies>
<dependency>
<groupId>org.jclouds.common</groupId>
<artifactId>vcloud-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.common</groupId>
<artifactId>vcloud-common</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-jsch</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jamesmurty.utils</groupId>
<artifactId>java-xmlbuilder</artifactId>
<version>0.3</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>test.vcloudexpress.endpoint</name>
<value>${test.vcloudexpress.endpoint}</value>
</property>
<property>
<name>test.vcloudexpress.apiversion</name>
<value>${test.vcloudexpress.apiversion}</value>
</property>
<property>
<name>test.vcloudexpress.identity</name>
<value>${test.vcloudexpress.identity}</value>
</property>
<property>
<name>test.vcloudexpress.credential</name>
<value>${test.vcloudexpress.credential}</value>
</property>
<property>
<name>jclouds.compute.blacklist-nodes</name>
<value>${jclouds.compute.blacklist-nodes}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package domain; package org.jclouds.vcloud;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.POST; import javax.ws.rs.POST;
@ -26,7 +26,6 @@ import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.annotations.Endpoint; import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.vcloud.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.domain.VCloudSession;
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders; import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;

View File

@ -0,0 +1,55 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* 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.vcloud.compute.functions;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterables.transform;
import static org.jclouds.vcloud.predicates.VCloudPredicates.resourceType;
import javax.inject.Singleton;
import org.jclouds.compute.domain.Volume;
import org.jclouds.compute.domain.internal.VolumeImpl;
import org.jclouds.vcloud.domain.ovf.ResourceAllocation;
import org.jclouds.vcloud.domain.ovf.ResourceType;
import com.google.common.base.Function;
/**
* @author Adrian Cole
*/
@Singleton
public class ResourceAllocationsToVolumes implements Function<Iterable<? extends ResourceAllocation>, Iterable<Volume>> {
@Override
public Iterable<Volume> apply(Iterable<? extends ResourceAllocation> resourceAllocations) {
Iterable<Volume> volumes = transform(filter(resourceAllocations, resourceType(ResourceType.DISK_DRIVE)),
new Function<ResourceAllocation, Volume>() {
@Override
public Volume apply(ResourceAllocation from) {
return new VolumeImpl(from.getAddressOnParent() + "", Volume.Type.LOCAL,
from.getVirtualQuantity() / 1024 / 1024f, null, from.getAddressOnParent() == 0, true);
}
});
return volumes;
}
}

View File

@ -33,6 +33,7 @@ import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier; import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
import org.jclouds.vcloud.VCloudExpressAsyncClient; import org.jclouds.vcloud.VCloudExpressAsyncClient;
import org.jclouds.vcloud.VCloudExpressClient; import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.VCloudExpressLoginAsyncClient;
import org.jclouds.vcloud.domain.CatalogItem; import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate; import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.domain.VCloudSession;
@ -43,7 +44,6 @@ import com.google.common.base.Supplier;
import com.google.inject.Provides; import com.google.inject.Provides;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import domain.VCloudExpressLoginAsyncClient;
/** /**
* Configures the VCloud authentication service connection, including logging * Configures the VCloud authentication service connection, including logging

View File

@ -82,8 +82,6 @@ import com.google.inject.Injector;
import com.google.inject.Module; import com.google.inject.Module;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import domain.VCloudExpressLoginAsyncClient;
import domain.VCloudVersionsAsyncClient;
/** /**
* Tests behavior of {@code VCloudExpressAsyncClient} * Tests behavior of {@code VCloudExpressAsyncClient}
@ -105,7 +103,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
"POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/instantiateVAppTemplate HTTP/1.1"); "POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
assertPayloadEquals(request, Strings2.toStringAndClose(getClass() assertPayloadEquals(request, Strings2.toStringAndClose(getClass()
.getResourceAsStream("/express/newvapp-hosting.xml")), .getResourceAsStream("/newvapp-hosting.xml")),
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false); "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
@ -130,7 +128,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
"POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/instantiateVAppTemplate HTTP/1.1"); "POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream( assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
"/express/newvapp-hostingcpumemdisk.xml")), "/newvapp-hostingcpumemdisk.xml")),
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false); "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
@ -162,7 +160,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
assertRequestLineEquals(request, "POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/cloneVApp HTTP/1.1"); assertRequestLineEquals(request, "POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/cloneVApp HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream( assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
"/express/cloneVApp-default.xml")), "application/vnd.vmware.vcloud.cloneVAppParams+xml", false); "/cloneVApp-default.xml")), "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, TaskHandler.class); assertSaxResponseParserClassEquals(method, TaskHandler.class);
@ -181,7 +179,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
assertRequestLineEquals(request, "POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/cloneVApp HTTP/1.1"); assertRequestLineEquals(request, "POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/cloneVApp HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/express/cloneVApp.xml")), assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/cloneVApp.xml")),
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false); "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
@ -423,7 +421,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
} }
public void testFindTasksListInOrgNamed() throws SecurityException, NoSuchMethodException, IOException { public void testFindTasksListInOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudAsyncClient.class.getMethod("findTasksListInOrgNamed", String.class); Method method = VCloudExpressAsyncClient.class.getMethod("findTasksListInOrgNamed", String.class);
HttpRequest request = processor.createRequest(method, "org"); HttpRequest request = processor.createRequest(method, "org");
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/tasksList/1 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/tasksList/1 HTTP/1.1");

View File

@ -73,7 +73,7 @@ public class BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayloadTest {
}); });
public void testDefault() throws IOException { public void testDefault() throws IOException {
String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/express/newvapp-hosting.xml")); String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/newvapp-hosting.xml"));
GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class); GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class);
expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes(); expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes();
expect(request.getArgs()).andReturn(ImmutableList.<Object>of()).atLeastOnce(); expect(request.getArgs()).andReturn(ImmutableList.<Object>of()).atLeastOnce();
@ -96,7 +96,7 @@ public class BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayloadTest {
options.processorCount(1).memory(512).disk(1024); options.processorCount(1).memory(512).disk(1024);
String expected = Strings2 String expected = Strings2
.toStringAndClose(getClass().getResourceAsStream("/express/newvapp-hostingcpumemdisk.xml")); .toStringAndClose(getClass().getResourceAsStream("/newvapp-hostingcpumemdisk.xml"));
GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class); GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class);
expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes(); expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes();
expect(request.getArgs()).andReturn(ImmutableList.<Object>of( options)).atLeastOnce(); expect(request.getArgs()).andReturn(ImmutableList.<Object>of( options)).atLeastOnce();
@ -118,7 +118,7 @@ public class BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayloadTest {
public void testWithNetworkNameDhcpFenceMode() throws IOException { public void testWithNetworkNameDhcpFenceMode() throws IOException {
String expected = Strings2.toStringAndClose(getClass().getResourceAsStream( String expected = Strings2.toStringAndClose(getClass().getResourceAsStream(
"/express/newvapp-hostingnetworknamedhcpfencemode.xml")); "/newvapp-hostingnetworknamedhcpfencemode.xml"));
GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class); GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class);
expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes(); expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes();

View File

@ -60,7 +60,7 @@ public class VCloudExpressBindCloneVAppParamsToXmlPayloadTest {
}); });
public void testWithDescriptionDeployOn() throws IOException { public void testWithDescriptionDeployOn() throws IOException {
String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/express/cloneVApp.xml")); String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/cloneVApp.xml"));
CloneVAppOptions options = new CloneVAppOptions().deploy().powerOn().withDescription( CloneVAppOptions options = new CloneVAppOptions().deploy().powerOn().withDescription(
"The description of the new vApp"); "The description of the new vApp");
@ -80,7 +80,7 @@ public class VCloudExpressBindCloneVAppParamsToXmlPayloadTest {
} }
public void testDefault() throws IOException { public void testDefault() throws IOException {
String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/express/cloneVApp-default.xml")); String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/cloneVApp-default.xml"));
GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class); GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class);
expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes(); expect(request.getEndpoint()).andReturn(URI.create("http://localhost/key")).anyTimes();

View File

@ -49,7 +49,7 @@ import com.google.inject.Injector;
public class VCloudExpressOrgNetworkAdapterTest { public class VCloudExpressOrgNetworkAdapterTest {
public void testTerremark() { public void testTerremark() {
InputStream is = getClass().getResourceAsStream("/express/network-terremark.xml"); InputStream is = getClass().getResourceAsStream("/network-terremark.xml");
Injector injector = Guice.createInjector(new SaxParserModule()); Injector injector = Guice.createInjector(new SaxParserModule());
Factory factory = injector.getInstance(ParseSax.Factory.class); Factory factory = injector.getInstance(ParseSax.Factory.class);
VCloudExpressNetwork in = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is); VCloudExpressNetwork in = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is);
@ -79,7 +79,7 @@ public class VCloudExpressOrgNetworkAdapterTest {
} }
public void testBluelock() { public void testBluelock() {
InputStream is = getClass().getResourceAsStream("/express/network-bluelock.xml"); InputStream is = getClass().getResourceAsStream("/network-bluelock.xml");
Injector injector = Guice.createInjector(new SaxParserModule()); Injector injector = Guice.createInjector(new SaxParserModule());
Factory factory = injector.getInstance(ParseSax.Factory.class); Factory factory = injector.getInstance(ParseSax.Factory.class);
VCloudExpressNetwork in = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is); VCloudExpressNetwork in = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is);

View File

@ -51,7 +51,7 @@ public class VCloudExpressNetworkHandlerTest {
private Factory factory; private Factory factory;
public void testTerremark() { public void testTerremark() {
InputStream is = getClass().getResourceAsStream("/express/network-terremark.xml"); InputStream is = getClass().getResourceAsStream("/network-terremark.xml");
injector = Guice.createInjector(new SaxParserModule()); injector = Guice.createInjector(new SaxParserModule());
factory = injector.getInstance(ParseSax.Factory.class); factory = injector.getInstance(ParseSax.Factory.class);
VCloudExpressNetwork result = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is); VCloudExpressNetwork result = factory.create(injector.getInstance(VCloudExpressNetworkHandler.class)).parse(is);
@ -64,7 +64,7 @@ public class VCloudExpressNetworkHandlerTest {
} }
public void testHosting() { public void testHosting() {
InputStream is = getClass().getResourceAsStream("/express/network-hosting.xml"); InputStream is = getClass().getResourceAsStream("/network-hosting.xml");
injector = Guice.createInjector(new SaxParserModule()); injector = Guice.createInjector(new SaxParserModule());
factory = injector.getInstance(ParseSax.Factory.class); factory = injector.getInstance(ParseSax.Factory.class);
VCloudExpressNetwork result = (VCloudExpressNetwork) factory.create( VCloudExpressNetwork result = (VCloudExpressNetwork) factory.create(
@ -76,7 +76,7 @@ public class VCloudExpressNetworkHandlerTest {
} }
public void testBluelock() { public void testBluelock() {
InputStream is = getClass().getResourceAsStream("/express/network-bluelock.xml"); InputStream is = getClass().getResourceAsStream("/network-bluelock.xml");
injector = Guice.createInjector(new SaxParserModule()); injector = Guice.createInjector(new SaxParserModule());
factory = injector.getInstance(ParseSax.Factory.class); factory = injector.getInstance(ParseSax.Factory.class);
VCloudExpressNetwork result = (VCloudExpressNetwork) factory.create( VCloudExpressNetwork result = (VCloudExpressNetwork) factory.create(

View File

@ -48,7 +48,7 @@ public class VCloudExpressVAppTemplateHandlerTest {
private Factory factory; private Factory factory;
public void testTerremark() { public void testTerremark() {
InputStream is = getClass().getResourceAsStream("/express/vAppTemplate-trmk.xml"); InputStream is = getClass().getResourceAsStream("/vAppTemplate-trmk.xml");
injector = Guice.createInjector(new SaxParserModule()); injector = Guice.createInjector(new SaxParserModule());
factory = injector.getInstance(ParseSax.Factory.class); factory = injector.getInstance(ParseSax.Factory.class);
VCloudExpressVAppTemplate result = factory.create(injector.getInstance(VCloudExpressVAppTemplateHandler.class)).parse(is); VCloudExpressVAppTemplate result = factory.create(injector.getInstance(VCloudExpressVAppTemplateHandler.class)).parse(is);
@ -58,7 +58,7 @@ public class VCloudExpressVAppTemplateHandlerTest {
} }
public void testHosting() { public void testHosting() {
InputStream is = getClass().getResourceAsStream("/express/vAppTemplate-hosting.xml"); InputStream is = getClass().getResourceAsStream("/vAppTemplate-hosting.xml");
injector = Guice.createInjector(new SaxParserModule()); injector = Guice.createInjector(new SaxParserModule());
factory = injector.getInstance(ParseSax.Factory.class); factory = injector.getInstance(ParseSax.Factory.class);
VCloudExpressVAppTemplate result = (VCloudExpressVAppTemplate) factory.create(injector.getInstance(VCloudExpressVAppTemplateHandler.class)).parse(is); VCloudExpressVAppTemplate result = (VCloudExpressVAppTemplate) factory.create(injector.getInstance(VCloudExpressVAppTemplateHandler.class)).parse(is);

85
common/vcloud/pom.xml Normal file
View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
====================================================================
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.
====================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.jclouds.common</groupId>
<artifactId>vcloud-common</artifactId>
<name>common vCloud components</name>
<description>common vCloud components</description>
<dependencies>
<dependency>
<groupId>com.jamesmurty.utils</groupId>
<artifactId>java-xmlbuilder</artifactId>
<version>0.3</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-jsch</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package domain; package org.jclouds.vcloud;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.POST; import javax.ws.rs.POST;
@ -26,7 +26,6 @@ import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.annotations.Endpoint; import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.domain.VCloudSession;
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders; import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;

View File

@ -17,7 +17,7 @@
* ==================================================================== * ====================================================================
*/ */
package domain; package org.jclouds.vcloud;
import java.net.URI; import java.net.URI;
import java.util.SortedMap; import java.util.SortedMap;

View File

@ -38,7 +38,7 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.rest.MapBinder; import org.jclouds.rest.MapBinder;
import org.jclouds.rest.binders.BindToStringPayload; import org.jclouds.rest.binders.BindToStringPayload;
import org.jclouds.rest.internal.GeneratedHttpRequest; import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.jclouds.vcloud.VCloudExpressMediaType; import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.options.CloneVAppOptions; import org.jclouds.vcloud.options.CloneVAppOptions;
import com.google.inject.Inject; import com.google.inject.Inject;
@ -94,7 +94,7 @@ public class BindCloneVAppParamsToXmlPayload implements MapBinder {
XMLBuilder rootBuilder = buildRoot(newName, options.isDeploy(), options.isPowerOn()); XMLBuilder rootBuilder = buildRoot(newName, options.isDeploy(), options.isPowerOn());
if (options.getDescription() != null) if (options.getDescription() != null)
rootBuilder.e("Description").text(options.getDescription()); rootBuilder.e("Description").text(options.getDescription());
rootBuilder.e("VApp").a("href", vApp).a("type", VCloudExpressMediaType.VAPP_XML); rootBuilder.e("VApp").a("href", vApp).a("type", VCloudMediaType.VAPP_XML);
Properties outputProperties = new Properties(); Properties outputProperties = new Properties();
outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes"); outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
return rootBuilder.asString(outputProperties); return rootBuilder.asString(outputProperties);

View File

@ -64,6 +64,7 @@ import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSu
import org.jclouds.vcloud.CommonVCloudAsyncClient; import org.jclouds.vcloud.CommonVCloudAsyncClient;
import org.jclouds.vcloud.CommonVCloudClient; import org.jclouds.vcloud.CommonVCloudClient;
import org.jclouds.vcloud.VCloudToken; import org.jclouds.vcloud.VCloudToken;
import org.jclouds.vcloud.VCloudVersionsAsyncClient;
import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem; import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.Org;
@ -92,7 +93,6 @@ import com.google.inject.Provides;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import com.google.inject.name.Names; import com.google.inject.name.Names;
import domain.VCloudVersionsAsyncClient;
/** /**
* Configures the VCloud authentication service connection, including logging and http transport. * Configures the VCloud authentication service connection, including logging and http transport.

Some files were not shown because too many files have changed in this diff Show More