Issue 475: removed builtin providers for ec2, s3, cloudservers, cloudfiles, and vcloudexpress

This commit is contained in:
Adrian Cole 2011-02-15 17:51:40 +01:00
parent 1fec99e379
commit f38c8d5e56
18 changed files with 293 additions and 410 deletions

View File

@ -29,29 +29,27 @@ data.
our current version is 1.0-beta-9a our current version is 1.0-beta-9a
our dev version is 1.0-SNAPSHOT our dev version is 1.0-SNAPSHOT
our compute api supports: aws-ec2, gogrid, cloudservers (generic), cloudservers-us, our compute api supports: aws-ec2, gogrid, cloudservers-us, stub (in-memory),
cloudservers-uk, vcloud (generic), ec2 (generic), byon, cloudservers-uk, vcloud (generic), ec2 (generic), byon,
trmk-ecloud, trmk-vcloudexpress, eucalyptus (generic), trmk-ecloud, trmk-vcloudexpress, eucalyptus (generic),
cloudsigma-zrh, elasticstack(generic), bluelock-vclouddirector, cloudsigma-zrh, elasticstack(generic), bluelock-vclouddirector,
slicehost, eucalyptus-partnercloud-ec2, elastichosts-lon-p (Peer 1), slicehost, eucalyptus-partnercloud-ec2, elastichosts-lon-p (Peer 1),
elastichosts-sat-p (Peer 1), elastichosts-lon-b (BlueSquare), elastichosts-sat-p (Peer 1), elastichosts-lon-b (BlueSquare),
openhosting-east1, serverlove-z1-man, skalicloud-sdg-my, openhosting-east1, serverlove-z1-man, skalicloud-sdg-my
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
our blobstore api supports: aws-s3, cloudfiles (generic), cloudfiles-us, cloudfiles-uk, our blobstore api supports: aws-s3, cloudfiles-us, cloudfiles-uk, filesystem,
azureblob, atmos (generic), synaptic-storage, scaleup-storage, azureblob, atmos (generic), synaptic-storage, scaleup-storage,
cloudonestorage, s3 (generic), walrus(generic), googlestorage, cloudonestorage, walrus(generic), googlestorage,
eucalyptus-partnercloud-s3, swift (generic), transient (in-mem), eucalyptus-partnercloud-s3, swift (generic), transient (in-mem)
filesystem (on-disk)
* note * the pom dependency org.jclouds/jclouds-allblobstore gives you access to * note * the pom dependency org.jclouds/jclouds-allblobstore gives you access to
to all of these providers to all of these providers
we also have support for: ibmdev, mezeo, nirvanix, boxdotnet, rimuhosting, openstack nova, we also have support for: ibmdev, mezeo, nirvanix, boxdotnet, rimuhosting, openstack nova,
azurequeue, simpledb, scaleup-storage as well as a async-http-client azurequeue, simpledb, cloudstack as well as a async-http-client
driver in the sandbox driver in the sandbox

View File

@ -20,7 +20,6 @@
package org.jclouds.cloudservers; package org.jclouds.cloudservers;
import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withFile; import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withFile;
import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withMetadata; import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withMetadata;
import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withSharedIpGroup; import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withSharedIpGroup;
@ -55,8 +54,8 @@ import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.ReturnFalseOn404; import org.jclouds.http.functions.ReturnFalseOn404;
import org.jclouds.http.functions.ReturnTrueIf2xx; import org.jclouds.http.functions.ReturnTrueIf2xx;
import org.jclouds.http.functions.UnwrapOnlyJsonValue; import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.openstack.TestOpenStackAuthenticationModule;
import org.jclouds.openstack.OpenStackAuthAsyncClient.AuthenticationResponse; import org.jclouds.openstack.OpenStackAuthAsyncClient.AuthenticationResponse;
import org.jclouds.openstack.TestOpenStackAuthenticationModule;
import org.jclouds.openstack.filters.AddTimestampQuery; import org.jclouds.openstack.filters.AddTimestampQuery;
import org.jclouds.openstack.filters.AuthenticateRequest; import org.jclouds.openstack.filters.AuthenticateRequest;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresRestClient;
@ -890,16 +889,17 @@ public class CloudServersAsyncClientTest extends RestClientTest<CloudServersAsyn
protected String provider = "cloudservers"; protected String provider = "cloudservers";
@Override @Override
public RestContextSpec<CloudServersClient, CloudServersAsyncClient> createContextSpec() { public RestContextSpec<?, ?> createContextSpec() {
return new RestContextFactory().createContextSpec(provider, "user", "password", new Properties()); return new RestContextFactory(getProperties()).createContextSpec(provider, "user", "password", new Properties());
} }
@Override @Override
protected Properties getProperties() { protected Properties getProperties() {
Properties properties = new Properties(); Properties overrides = new Properties();
properties.setProperty(PROPERTY_REGIONS, "US"); overrides.setProperty(PROPERTY_REGIONS, "US");
properties.setProperty(PROPERTY_ENDPOINT, "https://auth"); overrides.setProperty(PROPERTY_API_VERSION, "1");
properties.setProperty(PROPERTY_API_VERSION, "1"); overrides.setProperty(provider + ".endpoint", "https://auth");
return properties; overrides.setProperty(provider + ".contextbuilder", CloudServersContextBuilder.class.getName());
return overrides;
} }
} }

View File

@ -20,7 +20,6 @@
package org.jclouds.ec2; package org.jclouds.ec2;
import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG; import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG;
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG; import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS; import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
@ -40,7 +39,6 @@ public class EC2PropertiesBuilder extends PropertiesBuilder {
Properties properties = super.defaultProperties(); Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_AUTH_TAG, "AWS"); properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
properties.setProperty(PROPERTY_HEADER_TAG, "amz"); properties.setProperty(PROPERTY_HEADER_TAG, "amz");
properties.setProperty(PROPERTY_ENDPOINT, "https://ec2.us-east-1.amazonaws.com");
properties.setProperty(PROPERTY_API_VERSION, EC2AsyncClient.VERSION); properties.setProperty(PROPERTY_API_VERSION, EC2AsyncClient.VERSION);
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "*"); properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "*");
return properties; return properties;

View File

@ -31,6 +31,8 @@ import org.jclouds.aws.filters.FormSigner;
import org.jclouds.date.DateService; import org.jclouds.date.DateService;
import org.jclouds.ec2.EC2AsyncClient; import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
import org.jclouds.ec2.EC2ContextBuilder;
import org.jclouds.ec2.EC2PropertiesBuilder;
import org.jclouds.ec2.config.EC2RestClientModule; import org.jclouds.ec2.config.EC2RestClientModule;
import org.jclouds.ec2.domain.AvailabilityZone; import org.jclouds.ec2.domain.AvailabilityZone;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
@ -114,9 +116,19 @@ public abstract class BaseEC2AsyncClientTest<T> extends RestClientTest<T> {
protected String provider = "ec2"; protected String provider = "ec2";
@Override
protected Properties getProperties() {
Properties overrides = new Properties();
overrides.setProperty(provider + ".endpoint", "https://ec2.us-east-1.amazonaws.com");
overrides.setProperty(provider + ".propertiesbuilder", EC2PropertiesBuilder.class.getName());
overrides.setProperty(provider + ".contextbuilder", EC2ContextBuilder.class.getName());
return overrides;
}
@Override @Override
public RestContextSpec<?, ?> createContextSpec() { public RestContextSpec<?, ?> createContextSpec() {
return new RestContextFactory().createContextSpec(provider, "identity", "credential", new Properties()); return new RestContextFactory(getProperties()).createContextSpec(provider, "identity", "credential",
new Properties());
} }
} }

View File

@ -20,7 +20,6 @@
package org.jclouds.s3; package org.jclouds.s3;
import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.Constants.PROPERTY_RELAX_HOSTNAME; import static org.jclouds.Constants.PROPERTY_RELAX_HOSTNAME;
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG; import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG;
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG; import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
@ -49,7 +48,6 @@ public class S3PropertiesBuilder extends PropertiesBuilder {
properties.setProperty(PROPERTY_S3_SERVICE_PATH, "/"); properties.setProperty(PROPERTY_S3_SERVICE_PATH, "/");
properties.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "true"); properties.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "true");
properties.setProperty(PROPERTY_RELAX_HOSTNAME, "true"); properties.setProperty(PROPERTY_RELAX_HOSTNAME, "true");
properties.setProperty(PROPERTY_ENDPOINT, "https://s3.amazonaws.com");
properties.setProperty(PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX, DIRECTORY_SUFFIX_FOLDER); properties.setProperty(PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX, DIRECTORY_SUFFIX_FOLDER);
return properties; return properties;
} }

View File

@ -72,9 +72,19 @@ public abstract class BaseS3AsyncClientTest extends RestClientTest<S3AsyncClient
protected String provider = "s3"; protected String provider = "s3";
@Override
protected Properties getProperties() {
Properties overrides = new Properties();
overrides.setProperty(provider + ".endpoint", "https://s3.amazonaws.com");
overrides.setProperty(provider + ".propertiesbuilder", S3PropertiesBuilder.class.getName());
overrides.setProperty(provider + ".contextbuilder", S3ContextBuilder.class.getName());
return overrides;
}
@Override @Override
public RestContextSpec<?, ?> createContextSpec() { public RestContextSpec<?, ?> createContextSpec() {
return new RestContextFactory().createContextSpec(provider, "identity", "credential", new Properties()); return new RestContextFactory(getProperties()).createContextSpec(provider, "identity", "credential",
new Properties());
} }
} }

View File

@ -1,48 +0,0 @@
/**
*
* 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.s3;
import org.jclouds.blobstore.util.BlobStoreUtils;
import org.jclouds.rest.Providers;
import org.testng.annotations.Test;
import com.google.common.collect.Iterables;
/**
*
* @author Adrian Cole
*
*/
@Test(groups = "unit")
public class ProvidersInPropertiesTest {
@Test
public void testSupportedProviders() {
Iterable<String> providers = Providers.getSupportedProviders();
assert Iterables.contains(providers, "s3") : providers;;
}
@Test
public void testSupportedBlobStoreProviders() {
Iterable<String> providers = BlobStoreUtils.getSupportedProviders();
assert Iterables.contains(providers, "s3") : providers;
}
}

View File

@ -70,7 +70,7 @@ public class BindAsHostPrefixIfConfiguredTest extends BaseS3AsyncClientTest {
@Override @Override
protected Properties getProperties() { protected Properties getProperties() {
Properties properties = new Properties(); Properties properties = super.getProperties();
properties.setProperty(PROPERTY_S3_SERVICE_PATH, "/services/Walrus"); properties.setProperty(PROPERTY_S3_SERVICE_PATH, "/services/Walrus");
properties.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "false"); properties.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "false");
return properties; return properties;

View File

@ -22,7 +22,6 @@ package org.jclouds.s3.blobstore;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.IOException; import java.io.IOException;
import java.util.Properties;
import org.jclouds.blobstore.BlobRequestSigner; import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.Blob;
@ -32,10 +31,7 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.http.RequiresHttp; import org.jclouds.http.RequiresHttp;
import org.jclouds.io.payloads.PhantomPayload; import org.jclouds.io.payloads.PhantomPayload;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.RestClientTest; import org.jclouds.s3.BaseS3AsyncClientTest;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.rest.RestContextSpec;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.S3AsyncClient;
import org.jclouds.s3.S3Client; import org.jclouds.s3.S3Client;
import org.jclouds.s3.config.S3RestClientModule; import org.jclouds.s3.config.S3RestClientModule;
@ -44,7 +40,6 @@ import org.testng.annotations.Test;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.inject.Module; import com.google.inject.Module;
import com.google.inject.TypeLiteral;
/** /**
* Tests behavior of {@code S3BlobRequestSigner} * Tests behavior of {@code S3BlobRequestSigner}
@ -53,7 +48,7 @@ import com.google.inject.TypeLiteral;
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "S3BlobRequestSignerTest") @Test(groups = "unit", testName = "S3BlobRequestSignerTest")
public class S3BlobRequestSignerTest extends RestClientTest<S3AsyncClient> { public class S3BlobRequestSignerTest extends BaseS3AsyncClientTest {
private BlobRequestSigner signer; private BlobRequestSigner signer;
private Factory blobFactory; private Factory blobFactory;
@ -112,16 +107,6 @@ public class S3BlobRequestSignerTest extends RestClientTest<S3AsyncClient> {
this.signer = injector.getInstance(BlobRequestSigner.class); this.signer = injector.getInstance(BlobRequestSigner.class);
} }
@Override
protected void checkFilters(HttpRequest request) {
}
@Override
protected TypeLiteral<RestAnnotationProcessor<S3AsyncClient>> createTypeLiteral() {
return new TypeLiteral<RestAnnotationProcessor<S3AsyncClient>>() {
};
}
@Override @Override
protected Module createModule() { protected Module createModule() {
return new TestS3RestClientModule(); return new TestS3RestClientModule();
@ -141,9 +126,4 @@ public class S3BlobRequestSignerTest extends RestClientTest<S3AsyncClient> {
} }
} }
@Override
public RestContextSpec<?, ?> createContextSpec() {
return new RestContextFactory().createContextSpec("s3", "identity", "credential", new Properties());
}
} }

View File

@ -1,97 +0,0 @@
/**
*
* 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.s3.config;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import java.io.IOException;
import java.util.Properties;
import org.jclouds.aws.handlers.AWSClientErrorRetryHandler;
import org.jclouds.aws.handlers.AWSRedirectionRetryHandler;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.http.handlers.DelegatingErrorHandler;
import org.jclouds.http.handlers.DelegatingRetryHandler;
import org.jclouds.logging.config.NullLoggingModule;
import org.jclouds.rest.BaseRestClientTest.MockModule;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.s3.S3AsyncClient;
import org.jclouds.s3.S3Client;
import org.jclouds.s3.handlers.ParseS3ErrorFromXmlContent;
import org.testng.annotations.Test;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Injector;
/**
* @author Adrian Cole
*/
@Test(groups = "unit")
public class S3RestClientModuleTest {
Injector createInjector() throws IOException {
return new RestContextFactory().createContextBuilder("s3", "foo", "bar",
ImmutableSet.of(new MockModule(), new NullLoggingModule()), new Properties())
.buildInjector();
}
@Test
void testUpdatesOnlyOncePerSecond() throws NoSuchMethodException, InterruptedException {
S3RestClientModule<S3Client, S3AsyncClient> module = S3RestClientModule.create();
Supplier<String> map = module.provideTimeStampCache(1, new SimpleDateFormatDateService());
String timeStamp = map.get();
for (int i = 0; i < 10; i++)
map.get();
assertEquals(timeStamp, map.get());
Thread.sleep(1001);
assertFalse(timeStamp.equals(map.get()));
}
@Test
void testServerErrorHandler() throws IOException {
DelegatingErrorHandler handler = createInjector().getInstance(DelegatingErrorHandler.class);
assertEquals(handler.getServerErrorHandler().getClass(), ParseS3ErrorFromXmlContent.class);
}
@Test
void testClientErrorHandler() throws IOException {
DelegatingErrorHandler handler = createInjector().getInstance(DelegatingErrorHandler.class);
assertEquals(handler.getClientErrorHandler().getClass(), ParseS3ErrorFromXmlContent.class);
}
@Test
void testClientRetryHandler() throws IOException {
DelegatingRetryHandler handler = createInjector().getInstance(DelegatingRetryHandler.class);
assertEquals(handler.getClientErrorRetryHandler().getClass(),
AWSClientErrorRetryHandler.class);
}
@Test
void testRedirectionRetryHandler() throws IOException {
DelegatingRetryHandler handler = createInjector().getInstance(DelegatingRetryHandler.class);
assertEquals(handler.getRedirectionRetryHandler().getClass(),
AWSRedirectionRetryHandler.class);
}
}

View File

@ -69,21 +69,21 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest {
date = request.getFirstHeaderOrNull(HttpHeaders.DATE); date = request.getFirstHeaderOrNull(HttpHeaders.DATE);
filter.filter(request); filter.filter(request);
if (request.getFirstHeaderOrNull(HttpHeaders.DATE).equals(date)) if (request.getFirstHeaderOrNull(HttpHeaders.DATE).equals(date))
assert signature.equals(request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION)) : String assert signature.equals(request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION)) : String.format(
.format("sig: %s != %s on attempt %s", signature, request "sig: %s != %s on attempt %s", signature, request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION),
.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION), iterations); iterations);
else else
iterations++; iterations++;
} }
System.out.printf("%s: %d iterations before the timestamp updated %n", Thread.currentThread() System.out.printf("%s: %d iterations before the timestamp updated %n", Thread.currentThread().getName(),
.getName(), iterations); iterations);
} }
@Test @Test
void testAppendBucketNameHostHeader() throws SecurityException, NoSuchMethodException { void testAppendBucketNameHostHeader() throws SecurityException, NoSuchMethodException {
HttpRequest request = processor.createRequest(S3AsyncClient.class.getMethod( HttpRequest request = processor.createRequest(S3AsyncClient.class.getMethod("getBucketLocation", String.class),
"getBucketLocation", String.class), "bucket"); "bucket");
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
filter.appendBucketName(request, builder); filter.appendBucketName(request, builder);
assertEquals(builder.toString(), "/bucket"); assertEquals(builder.toString(), "/bucket");
@ -98,9 +98,9 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest {
} }
private GeneratedHttpRequest<S3AsyncClient> putBucketAcl() throws NoSuchMethodException { private GeneratedHttpRequest<S3AsyncClient> putBucketAcl() throws NoSuchMethodException {
return processor.createRequest(S3AsyncClient.class.getMethod("putBucketACL", String.class, return processor.createRequest(
AccessControlList.class), "bucket", AccessControlList.fromCannedAccessPolicy( S3AsyncClient.class.getMethod("putBucketACL", String.class, AccessControlList.class), "bucket",
CannedAccessPolicy.PRIVATE, "1234")); AccessControlList.fromCannedAccessPolicy(CannedAccessPolicy.PRIVATE, "1234"));
} }
// "?acl", "?location", "?logging", or "?torrent" // "?acl", "?location", "?logging", or "?torrent"
@ -129,20 +129,21 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest {
S3Object object = blobToS3Object.apply(BindBlobToMultipartFormTest.TEST_BLOB); S3Object object = blobToS3Object.apply(BindBlobToMultipartFormTest.TEST_BLOB);
object.getMetadata().getUserMetadata().put("x-amz-Adrian", "foo"); object.getMetadata().getUserMetadata().put("x-amz-Adrian", "foo");
HttpRequest request = processor.createRequest(S3AsyncClient.class.getMethod("putObject", HttpRequest request = processor.createRequest(
String.class, S3Object.class, PutObjectOptions[].class), "bucket", object); S3AsyncClient.class.getMethod("putObject", String.class, S3Object.class, PutObjectOptions[].class),
"bucket", object);
return request; return request;
} }
@Test @Test
void testAppendBucketNameURIHost() throws SecurityException, NoSuchMethodException { void testAppendBucketNameURIHost() throws SecurityException, NoSuchMethodException {
HttpRequest request = processor.createRequest(S3AsyncClient.class.getMethod( HttpRequest request = processor.createRequest(S3AsyncClient.class.getMethod("getBucketLocation", String.class),
"getBucketLocation", String.class), "bucket"); "bucket");
assertEquals(request.getEndpoint().getHost(), "bucket.s3.amazonaws.com"); assertEquals(request.getEndpoint().getHost(), "bucket.s3.amazonaws.com");
} }
protected Properties getProperties() { protected Properties getProperties() {
Properties overrides= new Properties(); Properties overrides = super.getProperties();
overrides.setProperty(PROPERTY_SESSION_INTERVAL, 1 + ""); overrides.setProperty(PROPERTY_SESSION_INTERVAL, 1 + "");
return overrides; return overrides;
} }

View File

@ -82,7 +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;
/** /**
* Tests behavior of {@code VCloudExpressAsyncClient} * Tests behavior of {@code VCloudExpressAsyncClient}
* *
@ -95,15 +94,14 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testInstantiateVAppTemplateInVDCURI() throws SecurityException, NoSuchMethodException, IOException { public void testInstantiateVAppTemplateInVDCURI() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class, Method method = VCloudExpressAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
String.class, InstantiateVAppTemplateOptions[].class); String.class, InstantiateVAppTemplateOptions[].class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"), "my-vapp"); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"), "my-vapp");
assertRequestLineEquals(request, assertRequestLineEquals(request,
"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("/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);
@ -117,18 +115,23 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
IOException { IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class, Method method = VCloudExpressAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
String.class, InstantiateVAppTemplateOptions[].class); String.class, InstantiateVAppTemplateOptions[].class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"), "my-vapp", processorCount(1) URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
.memory(512).disk(1024).addNetworkConfig( URI.create("https://vcloud.safesecureweb.com/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"), new NetworkConfig(null, URI.create("https://vcloud.safesecureweb.com/network/1990"),
FenceMode.BRIDGED))); FenceMode.BRIDGED)));
assertRequestLineEquals(request, assertRequestLineEquals(request,
"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,
"/newvapp-hostingcpumemdisk.xml")), Strings2.toStringAndClose(getClass().getResourceAsStream("/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);
@ -143,9 +146,15 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
IOException { IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class, Method method = VCloudExpressAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
String.class, InstantiateVAppTemplateOptions[].class); String.class, InstantiateVAppTemplateOptions[].class);
processor.createRequest(method, URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI processor.createRequest(
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), "CentOS 01", processorCount(1).memory(512) method,
.disk(1024).addNetworkConfig( URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
"CentOS 01",
processorCount(1)
.memory(512)
.disk(1024)
.addNetworkConfig(
new NetworkConfig("aloha", URI new NetworkConfig("aloha", URI
.create("https://vcenterprise.bluelock.com/api/v1.0/network/1990"), null))); .create("https://vcenterprise.bluelock.com/api/v1.0/network/1990"), null)));
} }
@ -153,14 +162,14 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testCloneVAppInVDC() throws SecurityException, NoSuchMethodException, IOException { public void testCloneVAppInVDC() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class, Method method = VCloudExpressAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
CloneVAppOptions[].class); CloneVAppOptions[].class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
.create("https://vcloud.safesecureweb.com/api/v0.8/vapp/4181"), "my-vapp"); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vapp/4181"), "my-vapp");
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("/cloneVApp-default.xml")),
"/cloneVApp-default.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);
assertSaxResponseParserClassEquals(method, TaskHandler.class); assertSaxResponseParserClassEquals(method, TaskHandler.class);
@ -172,9 +181,9 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testCloneVAppInVDCOptions() throws SecurityException, NoSuchMethodException, IOException { public void testCloneVAppInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class, Method method = VCloudExpressAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
CloneVAppOptions[].class); CloneVAppOptions[].class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
.create("https://vcloud.safesecureweb.com/api/v0.8/vapp/201"), "new-linux-server", URI.create("https://vcloud.safesecureweb.com/api/v0.8/vapp/201"), "new-linux-server",
new CloneVAppOptions().deploy().powerOn().withDescription("The description of the new vApp")); new CloneVAppOptions().deploy().powerOn().withDescription("The description of the new vApp"));
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");
@ -191,8 +200,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testOrg() throws SecurityException, NoSuchMethodException, IOException { public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("getOrg", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("getOrg", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/org/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"));
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/org/1 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/org/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
@ -222,8 +231,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException { public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("getCatalog", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("getCatalog", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"));
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/catalog/1 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/catalog/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
@ -253,8 +262,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testNetwork() throws SecurityException, NoSuchMethodException, IOException { public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("getNetwork", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("getNetwork", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/network/2")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/network/2"));
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/network/2 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/network/2 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
@ -269,8 +278,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException { public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("getCatalogItem", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("getCatalogItem", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"));
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
@ -317,8 +326,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException { public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("getVAppTemplate", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("getVAppTemplate", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"));
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
@ -390,8 +399,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException { public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("getVDC", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("getVDC", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"));
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/vdc/1 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/vdc/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
@ -406,8 +415,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException { public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("getTasksList", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("getTasksList", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1"));
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");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
@ -437,8 +446,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testDeployVApp() throws SecurityException, NoSuchMethodException, IOException { public void testDeployVApp() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("deployVApp", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("deployVApp", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
assertRequestLineEquals(request, "POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/action/deploy HTTP/1.1"); assertRequestLineEquals(request, "POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/action/deploy HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
@ -453,8 +462,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testGet() throws SecurityException, NoSuchMethodException, IOException { public void testGet() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("getVApp", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("getVApp", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/vApp/1 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/vApp/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
@ -469,8 +478,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testUndeployVApp() throws SecurityException, NoSuchMethodException, IOException { public void testUndeployVApp() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("undeployVApp", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("undeployVApp", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
assertRequestLineEquals(request, "POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/action/undeploy HTTP/1.1"); assertRequestLineEquals(request, "POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/action/undeploy HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
@ -485,8 +494,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testDelete() throws SecurityException, NoSuchMethodException, IOException { public void testDelete() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("deleteVApp", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("deleteVApp", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
assertRequestLineEquals(request, "DELETE https://vcloud.safesecureweb.com/api/v0.8/vApp/1 HTTP/1.1"); assertRequestLineEquals(request, "DELETE https://vcloud.safesecureweb.com/api/v0.8/vApp/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, ""); assertNonPayloadHeadersEqual(request, "");
@ -501,8 +510,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException { public void testPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("powerOnVApp", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("powerOnVApp", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
assertRequestLineEquals(request, assertRequestLineEquals(request,
"POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/power/action/powerOn HTTP/1.1"); "POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/power/action/powerOn HTTP/1.1");
@ -518,8 +527,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testPowerOffVApp() throws SecurityException, NoSuchMethodException, IOException { public void testPowerOffVApp() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("powerOffVApp", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("powerOffVApp", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
assertRequestLineEquals(request, assertRequestLineEquals(request,
"POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/power/action/powerOff HTTP/1.1"); "POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/power/action/powerOff HTTP/1.1");
@ -535,8 +544,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testResetVApp() throws SecurityException, NoSuchMethodException, IOException { public void testResetVApp() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("resetVApp", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("resetVApp", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
assertRequestLineEquals(request, assertRequestLineEquals(request,
"POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/power/action/reset HTTP/1.1"); "POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/power/action/reset HTTP/1.1");
@ -552,8 +561,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testSuspendVApp() throws SecurityException, NoSuchMethodException, IOException { public void testSuspendVApp() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("suspendVApp", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("suspendVApp", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
assertRequestLineEquals(request, assertRequestLineEquals(request,
"POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/power/action/suspend HTTP/1.1"); "POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/power/action/suspend HTTP/1.1");
@ -569,8 +578,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testShutdownVApp() throws SecurityException, NoSuchMethodException, IOException { public void testShutdownVApp() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("shutdownVApp", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("shutdownVApp", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
assertRequestLineEquals(request, assertRequestLineEquals(request,
"POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/power/action/shutdown HTTP/1.1"); "POST https://vcloud.safesecureweb.com/api/v0.8/vApp/1/power/action/shutdown HTTP/1.1");
@ -586,8 +595,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testGetTask() throws SecurityException, NoSuchMethodException, IOException { public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("getTask", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("getTask", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/task/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/task/1"));
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/task/1 HTTP/1.1"); assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/api/v0.8/task/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
@ -602,8 +611,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException { public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudExpressAsyncClient.class.getMethod("cancelTask", URI.class); Method method = VCloudExpressAsyncClient.class.getMethod("cancelTask", URI.class);
HttpRequest request = processor.createRequest(method, URI HttpRequest request = processor.createRequest(method,
.create("https://vcloud.safesecureweb.com/api/v0.8/task/1")); URI.create("https://vcloud.safesecureweb.com/api/v0.8/task/1"));
assertRequestLineEquals(request, "POST https://vcloud.safesecureweb.com/api/v0.8/task/1/action/cancel HTTP/1.1"); assertRequestLineEquals(request, "POST https://vcloud.safesecureweb.com/api/v0.8/task/1/action/cancel HTTP/1.1");
assertNonPayloadHeadersEqual(request, ""); assertNonPayloadHeadersEqual(request, "");
@ -633,11 +642,21 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
return new VCloudRestClientModuleExtension(); return new VCloudRestClientModuleExtension();
} }
protected String provider = "vcloudexpress";
@Override
protected Properties getProperties() {
Properties overrides = new Properties();
overrides.setProperty(provider + ".endpoint", "https://vcloud.safesecureweb.com/api/v0.8");
overrides.setProperty(provider + ".propertiesbuilder", VCloudExpressPropertiesBuilder.class.getName());
overrides.setProperty(provider + ".contextbuilder", VCloudExpressContextBuilder.class.getName());
return overrides;
}
@Override @Override
public RestContextSpec<?, ?> createContextSpec() { public RestContextSpec<?, ?> createContextSpec() {
Properties overrides = new Properties(); return new RestContextFactory(getProperties()).createContextSpec(provider, "identity", "credential",
overrides.setProperty("vcloudexpress.endpoint", "https://vcloud.safesecureweb.com/api/v0.8"); new Properties());
return new RestContextFactory().createContextSpec("vcloudexpress", "identity", "credential", overrides);
} }
@RequiresHttp @RequiresHttp
@ -731,15 +750,17 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
return Suppliers.<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> ofInstance(ImmutableMap return Suppliers.<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> ofInstance(ImmutableMap
.<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> of("org", .<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> of("org",
ImmutableMap.<String, org.jclouds.vcloud.domain.VDC> of("vdc", new VDCImpl("vdc", null, URI ImmutableMap.<String, org.jclouds.vcloud.domain.VDC> of(
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), null, null, "description", null, "vdc",
null, null, null, null, ImmutableMap.<String, ReferenceType> of("vapp", new VDCImpl("vdc", null, URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), null,
null, "description", null, null, null, null, null, ImmutableMap.<String, ReferenceType> of(
"vapp",
new ReferenceTypeImpl("vapp", "application/vnd.vmware.vcloud.vApp+xml", URI new ReferenceTypeImpl("vapp", "application/vnd.vmware.vcloud.vApp+xml", URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1")), .create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1")),
"network", new ReferenceTypeImpl("network", "network",
"application/vnd.vmware.vcloud.vAppTemplate+xml", URI new ReferenceTypeImpl("network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vdcItem/2"))), .create("https://vcloud.safesecureweb.com/api/v0.8/vdcItem/2"))), null, 0, 0, 0,
null, 0, 0, 0, false)))); false))));
} }
@ -752,13 +773,17 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
@Override @Override
public Map<String, Org> get() { public Map<String, Org> get() {
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI return ImmutableMap.<String, Org> of(
.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), "org", null, ImmutableMap "org",
.<String, ReferenceType> of("catalog", new ReferenceTypeImpl("catalog", new OrgImpl("org", null, URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), "org", null,
VCloudExpressMediaType.CATALOG_XML, URI ImmutableMap.<String, ReferenceType> of(
"catalog",
new ReferenceTypeImpl("catalog", VCloudExpressMediaType.CATALOG_XML, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"))), ImmutableMap .create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"))), ImmutableMap
.<String, ReferenceType> of("vdc", new ReferenceTypeImpl("vdc", VCloudExpressMediaType.VDC_XML, .<String, ReferenceType> of(
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))), ImmutableMap "vdc",
new ReferenceTypeImpl("vdc", VCloudExpressMediaType.VDC_XML, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))), ImmutableMap
.<String, ReferenceType> of(), new ReferenceTypeImpl("tasksList", .<String, ReferenceType> of(), new ReferenceTypeImpl("tasksList",
VCloudExpressMediaType.TASKSLIST_XML, URI VCloudExpressMediaType.TASKSLIST_XML, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1")), ImmutableList .create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1")), ImmutableList
@ -777,14 +802,17 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() { public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() {
return ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> of("org", return ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> of("org",
ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of("catalog", new CatalogImpl("catalog", "type", ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of(
URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"), null, "description", "catalog",
ImmutableMap.<String, ReferenceType> of("item", new ReferenceTypeImpl("item", new CatalogImpl("catalog", "type", URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"),
"application/vnd.vmware.vcloud.catalogItem+xml", URI null, "description", ImmutableMap.<String, ReferenceType> of(
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/1")), "template", "item",
new ReferenceTypeImpl("item", "application/vnd.vmware.vcloud.catalogItem+xml", URI
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/1")),
"template",
new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"))), .create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"))), ImmutableList
ImmutableList.<Task> of(), true))); .<Task> of(), true)));
} }
} }
@ -796,25 +824,14 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
@Override @Override
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() { public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
return ImmutableMap return ImmutableMap.<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> of(
.<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> of( "org", ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>> of(
"org", "catalog", ImmutableMap.<String, org.jclouds.vcloud.domain.CatalogItem> of(
ImmutableMap
.<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>> of(
"catalog",
ImmutableMap
.<String, org.jclouds.vcloud.domain.CatalogItem> of(
"template", "template",
new CatalogItemImpl( new CatalogItemImpl("template", URI
"template", .create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"), "description",
URI new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"), URI.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2")),
"description",
new ReferenceTypeImpl(
"template",
"application/vnd.vmware.vcloud.vAppTemplate+xml",
URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2")),
ImmutableMap.<String, String> of())))); ImmutableMap.<String, String> of()))));
} }

View File

@ -21,7 +21,7 @@
"A clojure binding for the jclouds BlobStore. "A clojure binding for the jclouds BlobStore.
Current supported services are: Current supported services are:
[transient, filesystem, s3, azureblob, atmos, cloudfiles, walrus, scaleup-storage, [transient, filesystem, azureblob, atmos, walrus, scaleup-storage,
googlestorage, synaptic, peer1-storage, aws-s3, eucalyptus-partnercloud-s3, googlestorage, synaptic, peer1-storage, aws-s3, eucalyptus-partnercloud-s3,
cloudfiles-us, cloudfiles-uk, swift] cloudfiles-us, cloudfiles-uk, swift]

View File

@ -21,12 +21,11 @@
"A clojure binding to the jclouds ComputeService. "A clojure binding to the jclouds ComputeService.
Current supported providers are: Current supported providers are:
[ec2, aws-ec2, eucualyptus-partnercloud-ec2, cloudservers, [aws-ec2, eucualyptus-partnercloud-ec2, elastichosts-lon-b,
cloudservers-uk, cloudservers-us, byon, cloudservers-uk, cloudservers-us, byon, cloudsigma-zrh, stub,
trmk-ecloud, trmk-vcloudexpress, vcloud, bluelock, eucalyptus, trmk-ecloud, trmk-vcloudexpress, vcloud, bluelock, eucalyptus,
slicehost, elastichosts-lon-p, elastichosts-sat-p, elastichosts, slicehost, elastichosts-lon-p, elastichosts-sat-p, elastichosts,
openhosting-east1, serverlove-z1-man, skalicloud-sdg-my, openhosting-east1, serverlove-z1-man, skalicloud-sdg-my]
elastichosts-lon-b, cloudsigma-zrh, vcloudexpress, stub]
Here's an example of getting some compute configuration from rackspace: Here's an example of getting some compute configuration from rackspace:

View File

@ -180,9 +180,9 @@ public class RestContextFactory {
/** /**
* *
* Identity will be found by searching {@code jclouds.identity} failing that {@code * Identity will be found by searching {@code jclouds.identity} failing that
* provider.identity} where provider corresponds to the parameter. Same pattern is used for * {@code provider.identity} where provider corresponds to the parameter. Same pattern is used
* credential ({@code jclouds.credential} failing that {@code provider.credential}). * for credential ({@code jclouds.credential} failing that {@code provider.credential}).
* *
* @param <S> * @param <S>
* Type of the provider specific client * Type of the provider specific client
@ -251,15 +251,15 @@ public class RestContextFactory {
props.setProperty(contextSpec.provider + ".async", checkNotNull(contextSpec.async, "contextSpec.async") props.setProperty(contextSpec.provider + ".async", checkNotNull(contextSpec.async, "contextSpec.async")
.getName()); .getName());
} else { } else {
props.setProperty(contextSpec.provider + ".contextbuilder", checkNotNull(contextSpec.contextBuilderClass, props.setProperty(contextSpec.provider + ".contextbuilder",
"contextSpec.contextBuilderClass").getName()); checkNotNull(contextSpec.contextBuilderClass, "contextSpec.contextBuilderClass").getName());
props.setProperty(contextSpec.provider + ".propertiesbuilder", checkNotNull( props.setProperty(contextSpec.provider + ".propertiesbuilder",
contextSpec.propertiesBuilderClass, "contextSpec.propertiesBuilderClass").getName()); checkNotNull(contextSpec.propertiesBuilderClass, "contextSpec.propertiesBuilderClass").getName());
} }
if (size(contextSpec.modules) > 0) { if (size(contextSpec.modules) > 0) {
props.setProperty(contextSpec.provider + ".modules", Joiner.on(',').join( props.setProperty(contextSpec.provider + ".modules",
transform(contextSpec.modules, new Function<Module, String>() { Joiner.on(',').join(transform(contextSpec.modules, new Function<Module, String>() {
@Override @Override
public String apply(Module from) { public String apply(Module from) {
@ -291,8 +291,8 @@ public class RestContextFactory {
String iso3166Codes = props.getProperty(providerName + "." + LocationConstants.ISO3166_CODES, null); String iso3166Codes = props.getProperty(providerName + "." + LocationConstants.ISO3166_CODES, null);
String apiVersion = props.getProperty(providerName + ".apiversion", null); String apiVersion = props.getProperty(providerName + ".apiversion", null);
identity = props.getProperty(providerName + ".identity", props.getProperty("jclouds.identity", identity)); identity = props.getProperty(providerName + ".identity", props.getProperty("jclouds.identity", identity));
credential = loadCredentialOrDefault(props, providerName + ".credential", loadCredentialOrDefault(props, credential = loadCredentialOrDefault(props, providerName + ".credential",
"jclouds.credential", credential)); loadCredentialOrDefault(props, "jclouds.credential", credential));
String syncClassName = props.getProperty(providerName + ".sync", null); String syncClassName = props.getProperty(providerName + ".sync", null);
String asyncClassName = props.getProperty(providerName + ".async", null); String asyncClassName = props.getProperty(providerName + ".async", null);
Iterable<Module> modules = concat(Modules2.modulesForProviderInProperties(providerName, props), wiring); Iterable<Module> modules = concat(Modules2.modulesForProviderInProperties(providerName, props), wiring);
@ -306,6 +306,11 @@ public class RestContextFactory {
propertiesBuilderClass = Providers.resolvePropertiesBuilderClass(providerName, props); propertiesBuilderClass = Providers.resolvePropertiesBuilderClass(providerName, props);
sync = (Class<S>) (syncClassName != null ? Class.forName(syncClassName) : null); sync = (Class<S>) (syncClassName != null ? Class.forName(syncClassName) : null);
async = (Class<A>) (syncClassName != null ? Class.forName(asyncClassName) : null); async = (Class<A>) (syncClassName != null ? Class.forName(asyncClassName) : null);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException(
String.format(
"provider %s not configured or supported. consider one of the following, as the provider name may have changed:%n%s%nIf you are sure that provider name is correct, check that the maven dependency org.jclouds.provider/%s is loaded.",
providerName, Providers.getSupportedProviders(), providerName), e);
} catch (Exception e) { } catch (Exception e) {
propagate(e); propagate(e);
assert false : "exception should have propogated " + e; assert false : "exception should have propogated " + e;

View File

@ -19,6 +19,7 @@
package org.jclouds.aws.ec2; package org.jclouds.aws.ec2;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
import static org.jclouds.aws.domain.Region.AP_SOUTHEAST_1; import static org.jclouds.aws.domain.Region.AP_SOUTHEAST_1;
import static org.jclouds.aws.domain.Region.EU_WEST_1; import static org.jclouds.aws.domain.Region.EU_WEST_1;
@ -63,6 +64,7 @@ public class AWSEC2PropertiesBuilder extends org.jclouds.ec2.EC2PropertiesBuilde
properties.setProperty("jclouds.ssh.max_retries", "7"); properties.setProperty("jclouds.ssh.max_retries", "7");
properties.setProperty("jclouds.ssh.retryable_messages", properties.setProperty("jclouds.ssh.retryable_messages",
"Auth fail,invalid data,End of IO Stream Read,Connection reset,socket is not established"); "Auth fail,invalid data,End of IO Stream Read,Connection reset,socket is not established");
properties.setProperty(PROPERTY_ENDPOINT, "https://ec2.us-east-1.amazonaws.com");
properties.setProperty(PROPERTY_REGIONS, Joiner.on(',').join(DEFAULT_REGIONS)); properties.setProperty(PROPERTY_REGIONS, Joiner.on(',').join(DEFAULT_REGIONS));
// amazon, alestic, canonical, and rightscale // amazon, alestic, canonical, and rightscale
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "137112412989,063491364108,099720109477,411009282317"); properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "137112412989,063491364108,099720109477,411009282317");

View File

@ -29,6 +29,7 @@ import com.google.inject.Module;
*/ */
@Test(groups = "unit") @Test(groups = "unit")
public abstract class BaseAWSEC2AsyncClientTest<T> extends RestClientTest<T> { public abstract class BaseAWSEC2AsyncClientTest<T> extends RestClientTest<T> {
@RequiresHttp @RequiresHttp
@ConfiguresRestClient @ConfiguresRestClient
protected static class StubAWSEC2RestClientModule extends AWSEC2RestClientModule { protected static class StubAWSEC2RestClientModule extends AWSEC2RestClientModule {
@ -46,8 +47,8 @@ public abstract class BaseAWSEC2AsyncClientTest<T> extends RestClientTest<T> {
@Override @Override
public Map<String, URI> get() { public Map<String, URI> get() {
return ImmutableMap.<String, URI> of(Region.EU_WEST_1, URI.create("https://ec2.eu-west-1.amazonaws.com"), return ImmutableMap.<String, URI> of(Region.EU_WEST_1, URI.create("https://ec2.eu-west-1.amazonaws.com"),
Region.US_EAST_1, URI.create("https://ec2.us-east-1.amazonaws.com"), Region.US_WEST_1, URI Region.US_EAST_1, URI.create("https://ec2.us-east-1.amazonaws.com"), Region.US_WEST_1,
.create("https://ec2.us-west-1.amazonaws.com")); URI.create("https://ec2.us-west-1.amazonaws.com"));
} }
} }

View File

@ -22,9 +22,11 @@ package org.jclouds.aws.s3;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Properties;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ReturnTrueIf2xx; import org.jclouds.http.functions.ReturnTrueIf2xx;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.S3AsyncClient;
import org.jclouds.s3.functions.ReturnFalseIfBucketAlreadyOwnedByYouOrIllegalState; import org.jclouds.s3.functions.ReturnFalseIfBucketAlreadyOwnedByYouOrIllegalState;
import org.jclouds.s3.options.PutBucketOptions; import org.jclouds.s3.options.PutBucketOptions;
@ -41,10 +43,15 @@ public class AWSS3AsyncClientTest extends org.jclouds.s3.S3AsyncClientTest {
this.provider = "aws-s3"; this.provider = "aws-s3";
} }
@Override
protected Properties getProperties() {
return RestContextFactory.getPropertiesFromResource("/rest.properties");
}
public void testPutBucketEu() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException, public void testPutBucketEu() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
NoSuchMethodException, IOException { NoSuchMethodException, IOException {
Method method = S3AsyncClient.class.getMethod("putBucketInRegion", String.class, String.class, Array.newInstance( Method method = S3AsyncClient.class.getMethod("putBucketInRegion", String.class, String.class,
PutBucketOptions.class, 0).getClass()); Array.newInstance(PutBucketOptions.class, 0).getClass());
HttpRequest request = processor.createRequest(method, "EU", "bucket"); HttpRequest request = processor.createRequest(method, "EU", "bucket");
assertRequestLineEquals(request, "PUT https://bucket." + url + "/ HTTP/1.1"); assertRequestLineEquals(request, "PUT https://bucket." + url + "/ HTTP/1.1");