mirror of https://github.com/apache/jclouds.git
Issue 112: formatting and pulled shareable code into core
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2241 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
68edff3895
commit
7602f1b7b8
|
@ -21,16 +21,16 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.domain;
|
package org.jclouds.rest.domain;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.vcloud.domain.internal.LinkImpl;
|
import org.jclouds.rest.domain.internal.LinkImpl;
|
||||||
|
|
||||||
import com.google.inject.ImplementedBy;
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Location of a vCloud resource
|
* Location of a Rest resource
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*
|
*
|
|
@ -21,14 +21,14 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.domain.internal;
|
package org.jclouds.rest.domain.internal;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.vcloud.domain.Link;
|
import org.jclouds.rest.domain.Link;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Location of a vCloud resource
|
* Location of a Rest resource
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*
|
*
|
|
@ -21,13 +21,13 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.util;
|
package org.jclouds.rest.util;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.vcloud.domain.Link;
|
import org.jclouds.rest.domain.Link;
|
||||||
import org.jclouds.vcloud.domain.internal.LinkImpl;
|
import org.jclouds.rest.domain.internal.LinkImpl;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -4,7 +4,7 @@
|
||||||
$Revision$
|
$Revision$
|
||||||
$Date$
|
$Date$
|
||||||
|
|
||||||
Copyright (C) 2009 Adrian Cole <adrian@jclouds.org>
|
Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
|
||||||
====================================================================
|
====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.jclouds</groupId>
|
<groupId>org.jclouds</groupId>
|
||||||
<artifactId>jclouds-vcloud-core</artifactId>
|
<artifactId>jclouds-vcloud</artifactId>
|
||||||
<name>jclouds vcloud Components Core</name>
|
<name>jclouds vcloud Components Core</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description>jclouds Core components to access vcloud</description>
|
<description>jclouds Core components to access vcloud</description>
|
||||||
|
|
|
@ -51,7 +51,6 @@ public interface VCloudClient {
|
||||||
@XMLResponseParser(CatalogHandler.class)
|
@XMLResponseParser(CatalogHandler.class)
|
||||||
Future<Catalog> getCatalog();
|
Future<Catalog> getCatalog();
|
||||||
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Endpoint(org.jclouds.vcloud.endpoints.VDC.class)
|
@Endpoint(org.jclouds.vcloud.endpoints.VDC.class)
|
||||||
@Consumes(VDC_XML)
|
@Consumes(VDC_XML)
|
||||||
|
|
|
@ -29,18 +29,18 @@ import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
||||||
import org.jclouds.logging.jdk.config.JDKLoggingModule;
|
import org.jclouds.logging.jdk.config.JDKLoggingModule;
|
||||||
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.rest.RestContextBuilder;
|
import org.jclouds.rest.RestContextBuilder;
|
||||||
import org.jclouds.vcloud.config.BaseVCloudContextModule;
|
import org.jclouds.vcloud.config.VCloudContextModule;
|
||||||
import org.jclouds.vcloud.config.BaseVCloudRestClientModule;
|
import org.jclouds.vcloud.config.VCloudRestClientModule;
|
||||||
import org.jclouds.vcloud.config.VCloudDiscoveryRestClientModule;
|
import org.jclouds.vcloud.config.VCloudDiscoveryRestClientModule;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link VCloudContext} or {@link Injector} instances based on the most commonly requested
|
* Creates {@link RestContext} for {@link VCloudClient} instances based on the most commonly
|
||||||
* arguments.
|
* requested arguments.
|
||||||
* <p/>
|
* <p/>
|
||||||
* Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
|
* Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
@ -49,11 +49,12 @@ import com.google.inject.TypeLiteral;
|
||||||
* {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed.
|
* {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see CloudFilesContext
|
* @see RestContext
|
||||||
|
* @see VCloudClient
|
||||||
*/
|
*/
|
||||||
public class BaseVCloudContextBuilder extends RestContextBuilder<VCloudClient> {
|
public class VCloudContextBuilder extends RestContextBuilder<VCloudClient> {
|
||||||
|
|
||||||
public BaseVCloudContextBuilder(Properties props) {
|
public VCloudContextBuilder(Properties props) {
|
||||||
super(new TypeLiteral<VCloudClient>() {
|
super(new TypeLiteral<VCloudClient>() {
|
||||||
}, props);
|
}, props);
|
||||||
}
|
}
|
||||||
|
@ -61,22 +62,22 @@ public class BaseVCloudContextBuilder extends RestContextBuilder<VCloudClient> {
|
||||||
@Override
|
@Override
|
||||||
protected void addClientModule(List<Module> modules) {
|
protected void addClientModule(List<Module> modules) {
|
||||||
modules.add(new VCloudDiscoveryRestClientModule());
|
modules.add(new VCloudDiscoveryRestClientModule());
|
||||||
modules.add(new BaseVCloudRestClientModule());
|
modules.add(new VCloudRestClientModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContextModule(List<Module> modules) {
|
protected void addContextModule(List<Module> modules) {
|
||||||
modules.add(new BaseVCloudContextModule());
|
modules.add(new VCloudContextModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseVCloudContextBuilder withExecutorService(ExecutorService service) {
|
public VCloudContextBuilder withExecutorService(ExecutorService service) {
|
||||||
return (BaseVCloudContextBuilder) super.withExecutorService(service);
|
return (VCloudContextBuilder) super.withExecutorService(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseVCloudContextBuilder withModules(Module... modules) {
|
public VCloudContextBuilder withModules(Module... modules) {
|
||||||
return (BaseVCloudContextBuilder) super.withModules(modules);
|
return (VCloudContextBuilder) super.withModules(modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -34,7 +34,7 @@ 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.domain.Link;
|
import org.jclouds.rest.domain.Link;
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
import org.jclouds.vcloud.endpoints.Org;
|
||||||
import org.jclouds.vcloud.endpoints.VCloud;
|
import org.jclouds.vcloud.endpoints.VCloud;
|
||||||
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
|
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
|
||||||
|
|
|
@ -41,7 +41,7 @@ import com.google.inject.Provides;
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class BaseVCloudContextModule extends AbstractModule {
|
public class VCloudContextModule extends AbstractModule {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
}
|
}
|
|
@ -45,7 +45,7 @@ import com.google.inject.Provides;
|
||||||
*/
|
*/
|
||||||
@RequiresHttp
|
@RequiresHttp
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
public class BaseVCloudRestClientModule extends AbstractModule {
|
public class VCloudRestClientModule extends AbstractModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
|
@ -25,6 +25,7 @@ package org.jclouds.vcloud.domain;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.jclouds.rest.domain.Link;
|
||||||
import org.jclouds.vcloud.domain.internal.CatalogImpl;
|
import org.jclouds.vcloud.domain.internal.CatalogImpl;
|
||||||
|
|
||||||
import com.google.inject.ImplementedBy;
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
|
@ -25,6 +25,7 @@ package org.jclouds.vcloud.domain;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.jclouds.rest.domain.Link;
|
||||||
import org.jclouds.vcloud.domain.internal.OrganizationImpl;
|
import org.jclouds.vcloud.domain.internal.OrganizationImpl;
|
||||||
import org.jclouds.vcloud.endpoints.Catalog;
|
import org.jclouds.vcloud.endpoints.Catalog;
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
import org.jclouds.vcloud.endpoints.Org;
|
||||||
|
|
|
@ -29,8 +29,9 @@ import java.net.URI;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.jclouds.rest.domain.Link;
|
||||||
|
import org.jclouds.rest.domain.internal.LinkImpl;
|
||||||
import org.jclouds.vcloud.domain.Catalog;
|
import org.jclouds.vcloud.domain.Catalog;
|
||||||
import org.jclouds.vcloud.domain.Link;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locations of resources in vCloud
|
* Locations of resources in vCloud
|
||||||
|
|
|
@ -26,7 +26,8 @@ package org.jclouds.vcloud.domain.internal;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.vcloud.domain.Link;
|
import org.jclouds.rest.domain.Link;
|
||||||
|
import org.jclouds.rest.domain.internal.LinkImpl;
|
||||||
import org.jclouds.vcloud.domain.Organization;
|
import org.jclouds.vcloud.domain.Organization;
|
||||||
import org.jclouds.vcloud.endpoints.Catalog;
|
import org.jclouds.vcloud.endpoints.Catalog;
|
||||||
import org.jclouds.vcloud.endpoints.TasksList;
|
import org.jclouds.vcloud.endpoints.TasksList;
|
||||||
|
|
|
@ -38,9 +38,9 @@ import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.HttpResponseException;
|
import org.jclouds.http.HttpResponseException;
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.http.functions.ParseSax.Factory;
|
import org.jclouds.http.functions.ParseSax.Factory;
|
||||||
|
import org.jclouds.rest.domain.Link;
|
||||||
import org.jclouds.vcloud.VCloudToken;
|
import org.jclouds.vcloud.VCloudToken;
|
||||||
import org.jclouds.vcloud.VCloudLogin.VCloudSession;
|
import org.jclouds.vcloud.VCloudLogin.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.Link;
|
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
import org.jclouds.vcloud.endpoints.Org;
|
||||||
import org.jclouds.vcloud.xml.OrgListHandler;
|
import org.jclouds.vcloud.xml.OrgListHandler;
|
||||||
|
|
||||||
|
|
|
@ -23,16 +23,16 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.xml;
|
package org.jclouds.vcloud.xml;
|
||||||
|
|
||||||
import static org.jclouds.vcloud.util.Utils.putLink;
|
import static org.jclouds.rest.util.Utils.putLink;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
|
import org.jclouds.rest.domain.Link;
|
||||||
|
import org.jclouds.rest.domain.internal.LinkImpl;
|
||||||
import org.jclouds.vcloud.domain.Catalog;
|
import org.jclouds.vcloud.domain.Catalog;
|
||||||
import org.jclouds.vcloud.domain.Link;
|
|
||||||
import org.jclouds.vcloud.domain.internal.CatalogImpl;
|
import org.jclouds.vcloud.domain.internal.CatalogImpl;
|
||||||
import org.jclouds.vcloud.domain.internal.LinkImpl;
|
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
|
|
@ -23,20 +23,20 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.xml;
|
package org.jclouds.vcloud.xml;
|
||||||
|
|
||||||
|
import static org.jclouds.rest.util.Utils.newLink;
|
||||||
|
import static org.jclouds.rest.util.Utils.putLink;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
|
||||||
import static org.jclouds.vcloud.util.Utils.newLink;
|
|
||||||
import static org.jclouds.vcloud.util.Utils.putLink;
|
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.vcloud.domain.Link;
|
import org.jclouds.rest.domain.Link;
|
||||||
|
import org.jclouds.rest.domain.internal.LinkImpl;
|
||||||
import org.jclouds.vcloud.domain.Organization;
|
import org.jclouds.vcloud.domain.Organization;
|
||||||
import org.jclouds.vcloud.domain.internal.LinkImpl;
|
|
||||||
import org.jclouds.vcloud.domain.internal.OrganizationImpl;
|
import org.jclouds.vcloud.domain.internal.OrganizationImpl;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
|
@ -23,13 +23,13 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.xml;
|
package org.jclouds.vcloud.xml;
|
||||||
|
|
||||||
|
import static org.jclouds.rest.util.Utils.putLink;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
|
||||||
import static org.jclouds.vcloud.util.Utils.putLink;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.vcloud.domain.Link;
|
import org.jclouds.rest.domain.Link;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class VCloudClientLiveTest {
|
||||||
public void testDefaultVDC() throws Exception {
|
public void testDefaultVDC() throws Exception {
|
||||||
String response = connection.getDefaultVDC();
|
String response = connection.getDefaultVDC();
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
System.err.println(response);
|
System.err.println(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeGroups(groups = { "live" })
|
@BeforeGroups(groups = { "live" })
|
||||||
|
@ -69,7 +69,7 @@ System.err.println(response);
|
||||||
"jclouds.test.endpoint");
|
"jclouds.test.endpoint");
|
||||||
account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
connection = new BaseVCloudContextBuilder(new VCloudPropertiesBuilder(URI.create(endpoint),
|
connection = new VCloudContextBuilder(new VCloudPropertiesBuilder(URI.create(endpoint),
|
||||||
account, key).build()).withModules(new Log4JLoggingModule()).buildContext().getApi();
|
account, key).build()).withModules(new Log4JLoggingModule()).buildContext().getApi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class VCloudClientTest extends RestClientTest<VCloudClient> {
|
||||||
GeneratedHttpRequest<VCloudClient> httpMethod = processor.createRequest(method);
|
GeneratedHttpRequest<VCloudClient> httpMethod = processor.createRequest(method);
|
||||||
|
|
||||||
assertRequestLineEquals(httpMethod, "GET http://catalog HTTP/1.1");
|
assertRequestLineEquals(httpMethod, "GET http://catalog HTTP/1.1");
|
||||||
assertHeadersEqual(httpMethod,"Accept: application/vnd.vmware.vcloud.catalog+xml\n");
|
assertHeadersEqual(httpMethod, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
|
||||||
assertEntityEquals(httpMethod, null);
|
assertEntityEquals(httpMethod, null);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, httpMethod, ParseSax.class);
|
assertResponseParserClassEquals(method, httpMethod, ParseSax.class);
|
||||||
|
|
|
@ -38,8 +38,8 @@ import org.jclouds.rest.ConfiguresRestClient;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.rest.RestContextBuilder;
|
import org.jclouds.rest.RestContextBuilder;
|
||||||
import org.jclouds.rest.internal.RestContextImpl;
|
import org.jclouds.rest.internal.RestContextImpl;
|
||||||
import org.jclouds.vcloud.config.BaseVCloudContextModule;
|
import org.jclouds.vcloud.config.VCloudContextModule;
|
||||||
import org.jclouds.vcloud.config.BaseVCloudRestClientModule;
|
import org.jclouds.vcloud.config.VCloudRestClientModule;
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
import org.jclouds.vcloud.endpoints.Org;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -50,12 +50,12 @@ import com.google.inject.Module;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of modules configured in BaseVCloudContextBuilder
|
* Tests behavior of modules configured in VCloudContextBuilder
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "vcloud.BaseVCloudContextBuilderTest")
|
@Test(groups = "unit", testName = "vcloud.VCloudContextBuilderTest")
|
||||||
public class BaseVCloudContextBuilderTest {
|
public class VCloudContextBuilderTest {
|
||||||
VCloudClient connection = createMock(VCloudClient.class);
|
VCloudClient connection = createMock(VCloudClient.class);
|
||||||
|
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
|
@ -86,10 +86,9 @@ public class BaseVCloudContextBuilderTest {
|
||||||
assertEquals(context.getEndPoint(), URI.create("http://org"));
|
assertEquals(context.getEndPoint(), URI.create("http://org"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseVCloudContextBuilder builder() {
|
public VCloudContextBuilder builder() {
|
||||||
return new BaseVCloudContextBuilder(new VCloudPropertiesBuilder(URI
|
return new VCloudContextBuilder(new VCloudPropertiesBuilder(URI.create("http://localhost"),
|
||||||
.create("http://localhost"), "id", "secret").build())
|
"id", "secret").build()).withModules(new StubClientModule());
|
||||||
.withModules(new StubClientModule());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBuildInjector() {
|
public void testBuildInjector() {
|
||||||
|
@ -102,18 +101,18 @@ public class BaseVCloudContextBuilderTest {
|
||||||
|
|
||||||
protected void testAddContextModule() {
|
protected void testAddContextModule() {
|
||||||
List<Module> modules = new ArrayList<Module>();
|
List<Module> modules = new ArrayList<Module>();
|
||||||
BaseVCloudContextBuilder builder = builder();
|
VCloudContextBuilder builder = builder();
|
||||||
builder.addContextModule(modules);
|
builder.addContextModule(modules);
|
||||||
assertEquals(modules.size(), 1);
|
assertEquals(modules.size(), 1);
|
||||||
assertEquals(modules.get(0).getClass(), BaseVCloudContextModule.class);
|
assertEquals(modules.get(0).getClass(), VCloudContextModule.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addClientModule() {
|
protected void addClientModule() {
|
||||||
List<Module> modules = new ArrayList<Module>();
|
List<Module> modules = new ArrayList<Module>();
|
||||||
BaseVCloudContextBuilder builder = builder();
|
VCloudContextBuilder builder = builder();
|
||||||
builder.addClientModule(modules);
|
builder.addClientModule(modules);
|
||||||
assertEquals(modules.size(), 1);
|
assertEquals(modules.size(), 1);
|
||||||
assertEquals(modules.get(0).getClass(), BaseVCloudRestClientModule.class);
|
assertEquals(modules.get(0).getClass(), VCloudRestClientModule.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -68,6 +68,7 @@ public class VCloudDiscoveryLiveTest {
|
||||||
"jclouds.test.endpoint");
|
"jclouds.test.endpoint");
|
||||||
String account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
String account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
|
|
||||||
private final class VCloudDiscoveryContextModule extends AbstractModule {
|
private final class VCloudDiscoveryContextModule extends AbstractModule {
|
||||||
|
|
||||||
@SuppressWarnings( { "unused" })
|
@SuppressWarnings( { "unused" })
|
||||||
|
|
|
@ -69,8 +69,8 @@ public class VCloudLoginLiveTest {
|
||||||
@SuppressWarnings( { "unused" })
|
@SuppressWarnings( { "unused" })
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
RestContext<VCloudLogin> provideContext(Closer closer, VCloudLogin api,
|
RestContext<VCloudLogin> provideContext(Closer closer, VCloudLogin api, @VCloud URI endPoint,
|
||||||
@VCloud URI endPoint, @Named(VCloudConstants.PROPERTY_VCLOUD_USER) String account) {
|
@Named(VCloudConstants.PROPERTY_VCLOUD_USER) String account) {
|
||||||
return new RestContextImpl<VCloudLogin>(closer, api, endPoint, account);
|
return new RestContextImpl<VCloudLogin>(closer, api, endPoint, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ public class VCloudLoginLiveTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addClientModule(List<Module> modules) {
|
protected void addClientModule(List<Module> modules) {
|
||||||
properties.setProperty(VCloudConstants.PROPERTY_VCLOUD_ENDPOINT, checkNotNull(
|
properties.setProperty(VCloudConstants.PROPERTY_VCLOUD_ENDPOINT, checkNotNull(endpoint,
|
||||||
endpoint, "endpoint").toString());
|
"endpoint").toString());
|
||||||
properties.setProperty(PROPERTY_VCLOUD_USER, checkNotNull(account, "user"));
|
properties.setProperty(PROPERTY_VCLOUD_USER, checkNotNull(account, "user"));
|
||||||
properties.setProperty(PROPERTY_VCLOUD_KEY, checkNotNull(key, "key"));
|
properties.setProperty(PROPERTY_VCLOUD_KEY, checkNotNull(key, "key"));
|
||||||
properties.setProperty(PROPERTY_VCLOUD_SESSIONINTERVAL, "4");
|
properties.setProperty(PROPERTY_VCLOUD_SESSIONINTERVAL, "4");
|
||||||
|
|
|
@ -38,10 +38,10 @@ import org.jclouds.http.handlers.CloseContentAndSetExceptionErrorHandler;
|
||||||
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
||||||
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
||||||
import org.jclouds.http.handlers.RedirectionRetryHandler;
|
import org.jclouds.http.handlers.RedirectionRetryHandler;
|
||||||
|
import org.jclouds.rest.domain.Link;
|
||||||
import org.jclouds.util.Jsr330;
|
import org.jclouds.util.Jsr330;
|
||||||
import org.jclouds.vcloud.VCloudLogin;
|
import org.jclouds.vcloud.VCloudLogin;
|
||||||
import org.jclouds.vcloud.VCloudLogin.VCloudSession;
|
import org.jclouds.vcloud.VCloudLogin.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.Link;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
|
|
@ -31,9 +31,9 @@ import javax.ws.rs.core.HttpHeaders;
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.functions.BaseHandlerTest;
|
import org.jclouds.http.functions.BaseHandlerTest;
|
||||||
|
import org.jclouds.rest.domain.internal.LinkImpl;
|
||||||
import org.jclouds.vcloud.VCloudMediaType;
|
import org.jclouds.vcloud.VCloudMediaType;
|
||||||
import org.jclouds.vcloud.VCloudLogin.VCloudSession;
|
import org.jclouds.vcloud.VCloudLogin.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.internal.LinkImpl;
|
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.functions.BaseHandlerTest;
|
import org.jclouds.http.functions.BaseHandlerTest;
|
||||||
|
import org.jclouds.rest.domain.internal.LinkImpl;
|
||||||
import org.jclouds.vcloud.domain.Catalog;
|
import org.jclouds.vcloud.domain.Catalog;
|
||||||
import org.jclouds.vcloud.domain.internal.LinkImpl;
|
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,9 @@ import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.functions.BaseHandlerTest;
|
import org.jclouds.http.functions.BaseHandlerTest;
|
||||||
|
import org.jclouds.rest.domain.internal.LinkImpl;
|
||||||
import org.jclouds.vcloud.VCloudMediaType;
|
import org.jclouds.vcloud.VCloudMediaType;
|
||||||
import org.jclouds.vcloud.domain.Organization;
|
import org.jclouds.vcloud.domain.Organization;
|
||||||
import org.jclouds.vcloud.domain.internal.LinkImpl;
|
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ public class OrgHandlerTest extends BaseHandlerTest {
|
||||||
assertEquals(result.getLocation(), URI
|
assertEquals(result.getLocation(), URI
|
||||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"));
|
.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"));
|
||||||
assertEquals(result.getType(), ORG_XML);
|
assertEquals(result.getType(), ORG_XML);
|
||||||
assertEquals(result.getCatalog(), new LinkImpl("Miami Environment 1 Catalog", CATALOG_XML, URI
|
assertEquals(result.getCatalog(), new LinkImpl("Miami Environment 1 Catalog", CATALOG_XML,
|
||||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")));
|
||||||
assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new LinkImpl(
|
assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new LinkImpl(
|
||||||
"Miami Environment 1", VCloudMediaType.VDC_XML, URI
|
"Miami Environment 1", VCloudMediaType.VDC_XML, URI
|
||||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"))));
|
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"))));
|
||||||
|
|
|
@ -30,9 +30,9 @@ import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.http.functions.BaseHandlerTest;
|
import org.jclouds.http.functions.BaseHandlerTest;
|
||||||
|
import org.jclouds.rest.domain.Link;
|
||||||
|
import org.jclouds.rest.domain.internal.LinkImpl;
|
||||||
import org.jclouds.vcloud.VCloudMediaType;
|
import org.jclouds.vcloud.VCloudMediaType;
|
||||||
import org.jclouds.vcloud.domain.Link;
|
|
||||||
import org.jclouds.vcloud.domain.internal.LinkImpl;
|
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue