mirror of https://github.com/apache/jclouds.git
Issue 475: removed builtin providers for ec2, s3, cloudservers, cloudfiles, and vcloudexpress
This commit is contained in:
parent
1fec99e379
commit
f38c8d5e56
14
README.txt
14
README.txt
|
@ -29,29 +29,27 @@ data.
|
|||
our current version is 1.0-beta-9a
|
||||
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,
|
||||
trmk-ecloud, trmk-vcloudexpress, eucalyptus (generic),
|
||||
cloudsigma-zrh, elasticstack(generic), bluelock-vclouddirector,
|
||||
slicehost, eucalyptus-partnercloud-ec2, elastichosts-lon-p (Peer 1),
|
||||
elastichosts-sat-p (Peer 1), elastichosts-lon-b (BlueSquare),
|
||||
openhosting-east1, serverlove-z1-man, skalicloud-sdg-my,
|
||||
vcloudexpress (generic), stub (in-memory)
|
||||
openhosting-east1, serverlove-z1-man, skalicloud-sdg-my
|
||||
|
||||
* note * the pom dependency org.jclouds/jclouds-allcompute gives you access to
|
||||
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,
|
||||
cloudonestorage, s3 (generic), walrus(generic), googlestorage,
|
||||
eucalyptus-partnercloud-s3, swift (generic), transient (in-mem),
|
||||
filesystem (on-disk)
|
||||
cloudonestorage, walrus(generic), googlestorage,
|
||||
eucalyptus-partnercloud-s3, swift (generic), transient (in-mem)
|
||||
|
||||
* note * the pom dependency org.jclouds/jclouds-allblobstore gives you access to
|
||||
to all of these providers
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.jclouds.cloudservers;
|
||||
|
||||
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.withMetadata;
|
||||
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.ReturnTrueIf2xx;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.openstack.TestOpenStackAuthenticationModule;
|
||||
import org.jclouds.openstack.OpenStackAuthAsyncClient.AuthenticationResponse;
|
||||
import org.jclouds.openstack.TestOpenStackAuthenticationModule;
|
||||
import org.jclouds.openstack.filters.AddTimestampQuery;
|
||||
import org.jclouds.openstack.filters.AuthenticateRequest;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
|
@ -890,16 +889,17 @@ public class CloudServersAsyncClientTest extends RestClientTest<CloudServersAsyn
|
|||
protected String provider = "cloudservers";
|
||||
|
||||
@Override
|
||||
public RestContextSpec<CloudServersClient, CloudServersAsyncClient> createContextSpec() {
|
||||
return new RestContextFactory().createContextSpec(provider, "user", "password", new Properties());
|
||||
public RestContextSpec<?, ?> createContextSpec() {
|
||||
return new RestContextFactory(getProperties()).createContextSpec(provider, "user", "password", new Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Properties getProperties() {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(PROPERTY_REGIONS, "US");
|
||||
properties.setProperty(PROPERTY_ENDPOINT, "https://auth");
|
||||
properties.setProperty(PROPERTY_API_VERSION, "1");
|
||||
return properties;
|
||||
Properties overrides = new Properties();
|
||||
overrides.setProperty(PROPERTY_REGIONS, "US");
|
||||
overrides.setProperty(PROPERTY_API_VERSION, "1");
|
||||
overrides.setProperty(provider + ".endpoint", "https://auth");
|
||||
overrides.setProperty(provider + ".contextbuilder", CloudServersContextBuilder.class.getName());
|
||||
return overrides;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.jclouds.ec2;
|
||||
|
||||
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_HEADER_TAG;
|
||||
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.setProperty(PROPERTY_AUTH_TAG, "AWS");
|
||||
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_EC2_AMI_OWNERS, "*");
|
||||
return properties;
|
||||
|
|
|
@ -31,6 +31,8 @@ import org.jclouds.aws.filters.FormSigner;
|
|||
import org.jclouds.date.DateService;
|
||||
import org.jclouds.ec2.EC2AsyncClient;
|
||||
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.domain.AvailabilityZone;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
|
@ -114,9 +116,19 @@ public abstract class BaseEC2AsyncClientTest<T> extends RestClientTest<T> {
|
|||
|
||||
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
|
||||
public RestContextSpec<?, ?> createContextSpec() {
|
||||
return new RestContextFactory().createContextSpec(provider, "identity", "credential", new Properties());
|
||||
return new RestContextFactory(getProperties()).createContextSpec(provider, "identity", "credential",
|
||||
new Properties());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.jclouds.s3;
|
||||
|
||||
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.aws.reference.AWSConstants.PROPERTY_AUTH_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_VIRTUAL_HOST_BUCKETS, "true");
|
||||
properties.setProperty(PROPERTY_RELAX_HOSTNAME, "true");
|
||||
properties.setProperty(PROPERTY_ENDPOINT, "https://s3.amazonaws.com");
|
||||
properties.setProperty(PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX, DIRECTORY_SUFFIX_FOLDER);
|
||||
return properties;
|
||||
}
|
||||
|
|
|
@ -72,9 +72,19 @@ public abstract class BaseS3AsyncClientTest extends RestClientTest<S3AsyncClient
|
|||
|
||||
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
|
||||
public RestContextSpec<?, ?> createContextSpec() {
|
||||
return new RestContextFactory().createContextSpec(provider, "identity", "credential", new Properties());
|
||||
return new RestContextFactory(getProperties()).createContextSpec(provider, "identity", "credential",
|
||||
new Properties());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -70,7 +70,7 @@ public class BindAsHostPrefixIfConfiguredTest extends BaseS3AsyncClientTest {
|
|||
|
||||
@Override
|
||||
protected Properties getProperties() {
|
||||
Properties properties = new Properties();
|
||||
Properties properties = super.getProperties();
|
||||
properties.setProperty(PROPERTY_S3_SERVICE_PATH, "/services/Walrus");
|
||||
properties.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "false");
|
||||
return properties;
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.jclouds.s3.blobstore;
|
|||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.blobstore.BlobRequestSigner;
|
||||
import org.jclouds.blobstore.domain.Blob;
|
||||
|
@ -32,10 +31,7 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.RequiresHttp;
|
||||
import org.jclouds.io.payloads.PhantomPayload;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.RestClientTest;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.rest.RestContextSpec;
|
||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||
import org.jclouds.s3.BaseS3AsyncClientTest;
|
||||
import org.jclouds.s3.S3AsyncClient;
|
||||
import org.jclouds.s3.S3Client;
|
||||
import org.jclouds.s3.config.S3RestClientModule;
|
||||
|
@ -44,7 +40,6 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
/**
|
||||
* 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
|
||||
@Test(groups = "unit", testName = "S3BlobRequestSignerTest")
|
||||
public class S3BlobRequestSignerTest extends RestClientTest<S3AsyncClient> {
|
||||
public class S3BlobRequestSignerTest extends BaseS3AsyncClientTest {
|
||||
|
||||
private BlobRequestSigner signer;
|
||||
private Factory blobFactory;
|
||||
|
@ -112,16 +107,6 @@ public class S3BlobRequestSignerTest extends RestClientTest<S3AsyncClient> {
|
|||
this.signer = injector.getInstance(BlobRequestSigner.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkFilters(HttpRequest request) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TypeLiteral<RestAnnotationProcessor<S3AsyncClient>> createTypeLiteral() {
|
||||
return new TypeLiteral<RestAnnotationProcessor<S3AsyncClient>>() {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Module createModule() {
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -69,21 +69,21 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest {
|
|||
date = request.getFirstHeaderOrNull(HttpHeaders.DATE);
|
||||
filter.filter(request);
|
||||
if (request.getFirstHeaderOrNull(HttpHeaders.DATE).equals(date))
|
||||
assert signature.equals(request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION)) : String
|
||||
.format("sig: %s != %s on attempt %s", signature, request
|
||||
.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION), iterations);
|
||||
assert signature.equals(request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION)) : String.format(
|
||||
"sig: %s != %s on attempt %s", signature, request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION),
|
||||
iterations);
|
||||
else
|
||||
iterations++;
|
||||
|
||||
}
|
||||
System.out.printf("%s: %d iterations before the timestamp updated %n", Thread.currentThread()
|
||||
.getName(), iterations);
|
||||
System.out.printf("%s: %d iterations before the timestamp updated %n", Thread.currentThread().getName(),
|
||||
iterations);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAppendBucketNameHostHeader() throws SecurityException, NoSuchMethodException {
|
||||
HttpRequest request = processor.createRequest(S3AsyncClient.class.getMethod(
|
||||
"getBucketLocation", String.class), "bucket");
|
||||
HttpRequest request = processor.createRequest(S3AsyncClient.class.getMethod("getBucketLocation", String.class),
|
||||
"bucket");
|
||||
StringBuilder builder = new StringBuilder();
|
||||
filter.appendBucketName(request, builder);
|
||||
assertEquals(builder.toString(), "/bucket");
|
||||
|
@ -98,9 +98,9 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest {
|
|||
}
|
||||
|
||||
private GeneratedHttpRequest<S3AsyncClient> putBucketAcl() throws NoSuchMethodException {
|
||||
return processor.createRequest(S3AsyncClient.class.getMethod("putBucketACL", String.class,
|
||||
AccessControlList.class), "bucket", AccessControlList.fromCannedAccessPolicy(
|
||||
CannedAccessPolicy.PRIVATE, "1234"));
|
||||
return processor.createRequest(
|
||||
S3AsyncClient.class.getMethod("putBucketACL", String.class, AccessControlList.class), "bucket",
|
||||
AccessControlList.fromCannedAccessPolicy(CannedAccessPolicy.PRIVATE, "1234"));
|
||||
}
|
||||
|
||||
// "?acl", "?location", "?logging", or "?torrent"
|
||||
|
@ -129,20 +129,21 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest {
|
|||
S3Object object = blobToS3Object.apply(BindBlobToMultipartFormTest.TEST_BLOB);
|
||||
|
||||
object.getMetadata().getUserMetadata().put("x-amz-Adrian", "foo");
|
||||
HttpRequest request = processor.createRequest(S3AsyncClient.class.getMethod("putObject",
|
||||
String.class, S3Object.class, PutObjectOptions[].class), "bucket", object);
|
||||
HttpRequest request = processor.createRequest(
|
||||
S3AsyncClient.class.getMethod("putObject", String.class, S3Object.class, PutObjectOptions[].class),
|
||||
"bucket", object);
|
||||
return request;
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAppendBucketNameURIHost() throws SecurityException, NoSuchMethodException {
|
||||
HttpRequest request = processor.createRequest(S3AsyncClient.class.getMethod(
|
||||
"getBucketLocation", String.class), "bucket");
|
||||
HttpRequest request = processor.createRequest(S3AsyncClient.class.getMethod("getBucketLocation", String.class),
|
||||
"bucket");
|
||||
assertEquals(request.getEndpoint().getHost(), "bucket.s3.amazonaws.com");
|
||||
}
|
||||
|
||||
protected Properties getProperties() {
|
||||
Properties overrides= new Properties();
|
||||
Properties overrides = super.getProperties();
|
||||
overrides.setProperty(PROPERTY_SESSION_INTERVAL, 1 + "");
|
||||
return overrides;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,6 @@ import com.google.inject.Injector;
|
|||
import com.google.inject.Module;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VCloudExpressAsyncClient}
|
||||
*
|
||||
|
@ -95,15 +94,14 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
|
|||
public void testInstantiateVAppTemplateInVDCURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
||||
String.class, InstantiateVAppTemplateOptions[].class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"), "my-vapp");
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"), "my-vapp");
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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");
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(getClass()
|
||||
.getResourceAsStream("/newvapp-hosting.xml")),
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/newvapp-hosting.xml")),
|
||||
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
|
@ -117,18 +115,23 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
|
|||
IOException {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
||||
String.class, InstantiateVAppTemplateOptions[].class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"), "my-vapp", processorCount(1)
|
||||
.memory(512).disk(1024).addNetworkConfig(
|
||||
HttpRequest request = processor.createRequest(
|
||||
method,
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
|
||||
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"),
|
||||
FenceMode.BRIDGED)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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");
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
|
||||
"/newvapp-hostingcpumemdisk.xml")),
|
||||
assertPayloadEquals(request,
|
||||
Strings2.toStringAndClose(getClass().getResourceAsStream("/newvapp-hostingcpumemdisk.xml")),
|
||||
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
|
@ -143,9 +146,15 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
|
|||
IOException {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
||||
String.class, InstantiateVAppTemplateOptions[].class);
|
||||
processor.createRequest(method, 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(
|
||||
processor.createRequest(
|
||||
method,
|
||||
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
|
||||
.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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vapp/4181"), "my-vapp");
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
|
||||
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");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
|
||||
"/cloneVApp-default.xml")), "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/cloneVApp-default.xml")),
|
||||
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||
|
@ -172,9 +181,9 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
|
|||
public void testCloneVAppInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vapp/201"), "new-linux-server",
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
|
||||
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"));
|
||||
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("getOrg", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("getCatalog", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("getNetwork", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/network/2"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("getCatalogItem", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("getVAppTemplate", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("getVDC", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("getTasksList", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("deployVApp", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("getVApp", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("undeployVApp", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("deleteVApp", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -501,8 +510,8 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
|
|||
|
||||
public void testPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("powerOnVApp", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("powerOffVApp", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("resetVApp", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("suspendVApp", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("shutdownVApp", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/1"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("getTask", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/task/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
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 {
|
||||
Method method = VCloudExpressAsyncClient.class.getMethod("cancelTask", URI.class);
|
||||
HttpRequest request = processor.createRequest(method, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/task/1"));
|
||||
HttpRequest request = processor.createRequest(method,
|
||||
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");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -633,11 +642,21 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
|
|||
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
|
||||
public RestContextSpec<?, ?> createContextSpec() {
|
||||
Properties overrides = new Properties();
|
||||
overrides.setProperty("vcloudexpress.endpoint", "https://vcloud.safesecureweb.com/api/v0.8");
|
||||
return new RestContextFactory().createContextSpec("vcloudexpress", "identity", "credential", overrides);
|
||||
return new RestContextFactory(getProperties()).createContextSpec(provider, "identity", "credential",
|
||||
new Properties());
|
||||
}
|
||||
|
||||
@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
|
||||
.<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
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"), null, null, "description", null,
|
||||
null, null, null, null, ImmutableMap.<String, ReferenceType> of("vapp",
|
||||
ImmutableMap.<String, org.jclouds.vcloud.domain.VDC> of(
|
||||
"vdc",
|
||||
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
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1")),
|
||||
"network", new ReferenceTypeImpl("network",
|
||||
"application/vnd.vmware.vcloud.vAppTemplate+xml", URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdcItem/2"))),
|
||||
null, 0, 0, 0, false))));
|
||||
"network",
|
||||
new ReferenceTypeImpl("network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdcItem/2"))), null, 0, 0, 0,
|
||||
false))));
|
||||
|
||||
}
|
||||
|
||||
|
@ -752,13 +773,17 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
|
|||
|
||||
@Override
|
||||
public Map<String, Org> get() {
|
||||
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), "org", null, ImmutableMap
|
||||
.<String, ReferenceType> of("catalog", new ReferenceTypeImpl("catalog",
|
||||
VCloudExpressMediaType.CATALOG_XML, URI
|
||||
return ImmutableMap.<String, Org> of(
|
||||
"org",
|
||||
new OrgImpl("org", null, URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/1"), "org", null,
|
||||
ImmutableMap.<String, ReferenceType> of(
|
||||
"catalog",
|
||||
new ReferenceTypeImpl("catalog", VCloudExpressMediaType.CATALOG_XML, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"))), ImmutableMap
|
||||
.<String, ReferenceType> of("vdc", new ReferenceTypeImpl("vdc", VCloudExpressMediaType.VDC_XML,
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"))), ImmutableMap
|
||||
.<String, ReferenceType> of(
|
||||
"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",
|
||||
VCloudExpressMediaType.TASKSLIST_XML, URI
|
||||
.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() {
|
||||
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",
|
||||
URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"), null, "description",
|
||||
ImmutableMap.<String, ReferenceType> of("item", new ReferenceTypeImpl("item",
|
||||
"application/vnd.vmware.vcloud.catalogItem+xml", URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/1")), "template",
|
||||
ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of(
|
||||
"catalog",
|
||||
new CatalogImpl("catalog", "type", URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"),
|
||||
null, "description", ImmutableMap.<String, ReferenceType> of(
|
||||
"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
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"))),
|
||||
ImmutableList.<Task> of(), true)));
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"))), ImmutableList
|
||||
.<Task> of(), true)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -796,25 +824,14 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
|
|||
|
||||
@Override
|
||||
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
|
||||
return ImmutableMap
|
||||
.<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> of(
|
||||
"org",
|
||||
ImmutableMap
|
||||
.<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>> of(
|
||||
"catalog",
|
||||
ImmutableMap
|
||||
.<String, org.jclouds.vcloud.domain.CatalogItem> of(
|
||||
return ImmutableMap.<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> of(
|
||||
"org", ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>> of(
|
||||
"catalog", ImmutableMap.<String, org.jclouds.vcloud.domain.CatalogItem> of(
|
||||
"template",
|
||||
new CatalogItemImpl(
|
||||
"template",
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"),
|
||||
"description",
|
||||
new ReferenceTypeImpl(
|
||||
"template",
|
||||
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2")),
|
||||
new CatalogItemImpl("template", URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/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()))));
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"A clojure binding for the jclouds BlobStore.
|
||||
|
||||
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,
|
||||
cloudfiles-us, cloudfiles-uk, swift]
|
||||
|
||||
|
|
|
@ -21,12 +21,11 @@
|
|||
"A clojure binding to the jclouds ComputeService.
|
||||
|
||||
Current supported providers are:
|
||||
[ec2, aws-ec2, eucualyptus-partnercloud-ec2, cloudservers,
|
||||
cloudservers-uk, cloudservers-us, byon,
|
||||
[aws-ec2, eucualyptus-partnercloud-ec2, elastichosts-lon-b,
|
||||
cloudservers-uk, cloudservers-us, byon, cloudsigma-zrh, stub,
|
||||
trmk-ecloud, trmk-vcloudexpress, vcloud, bluelock, eucalyptus,
|
||||
slicehost, elastichosts-lon-p, elastichosts-sat-p, elastichosts,
|
||||
openhosting-east1, serverlove-z1-man, skalicloud-sdg-my,
|
||||
elastichosts-lon-b, cloudsigma-zrh, vcloudexpress, stub]
|
||||
openhosting-east1, serverlove-z1-man, skalicloud-sdg-my]
|
||||
|
||||
Here's an example of getting some compute configuration from rackspace:
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ public class RestContextFactory {
|
|||
return new RestContextSpec<S, A>(provider, endpoint, apiVersion, iso3166Codes, identity, credential, sync, async);
|
||||
}
|
||||
|
||||
@SuppressWarnings( { "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public static <S, A> RestContextSpec<S, A> contextSpec(String provider, String endpoint, String apiVersion,
|
||||
String iso3166Codes, String identity, String credential, Class<S> sync, Class<A> async,
|
||||
Iterable<Module> modules) {
|
||||
|
@ -180,9 +180,9 @@ public class RestContextFactory {
|
|||
|
||||
/**
|
||||
*
|
||||
* Identity will be found by searching {@code jclouds.identity} failing that {@code
|
||||
* provider.identity} where provider corresponds to the parameter. Same pattern is used for
|
||||
* credential ({@code jclouds.credential} failing that {@code provider.credential}).
|
||||
* Identity will be found by searching {@code jclouds.identity} failing that
|
||||
* {@code provider.identity} where provider corresponds to the parameter. Same pattern is used
|
||||
* for credential ({@code jclouds.credential} failing that {@code provider.credential}).
|
||||
*
|
||||
* @param <S>
|
||||
* Type of the provider specific client
|
||||
|
@ -251,15 +251,15 @@ public class RestContextFactory {
|
|||
props.setProperty(contextSpec.provider + ".async", checkNotNull(contextSpec.async, "contextSpec.async")
|
||||
.getName());
|
||||
} else {
|
||||
props.setProperty(contextSpec.provider + ".contextbuilder", checkNotNull(contextSpec.contextBuilderClass,
|
||||
"contextSpec.contextBuilderClass").getName());
|
||||
props.setProperty(contextSpec.provider + ".contextbuilder",
|
||||
checkNotNull(contextSpec.contextBuilderClass, "contextSpec.contextBuilderClass").getName());
|
||||
|
||||
props.setProperty(contextSpec.provider + ".propertiesbuilder", checkNotNull(
|
||||
contextSpec.propertiesBuilderClass, "contextSpec.propertiesBuilderClass").getName());
|
||||
props.setProperty(contextSpec.provider + ".propertiesbuilder",
|
||||
checkNotNull(contextSpec.propertiesBuilderClass, "contextSpec.propertiesBuilderClass").getName());
|
||||
}
|
||||
if (size(contextSpec.modules) > 0) {
|
||||
props.setProperty(contextSpec.provider + ".modules", Joiner.on(',').join(
|
||||
transform(contextSpec.modules, new Function<Module, String>() {
|
||||
props.setProperty(contextSpec.provider + ".modules",
|
||||
Joiner.on(',').join(transform(contextSpec.modules, new Function<Module, String>() {
|
||||
|
||||
@Override
|
||||
public String apply(Module from) {
|
||||
|
@ -291,8 +291,8 @@ public class RestContextFactory {
|
|||
String iso3166Codes = props.getProperty(providerName + "." + LocationConstants.ISO3166_CODES, null);
|
||||
String apiVersion = props.getProperty(providerName + ".apiversion", null);
|
||||
identity = props.getProperty(providerName + ".identity", props.getProperty("jclouds.identity", identity));
|
||||
credential = loadCredentialOrDefault(props, providerName + ".credential", loadCredentialOrDefault(props,
|
||||
"jclouds.credential", credential));
|
||||
credential = loadCredentialOrDefault(props, providerName + ".credential",
|
||||
loadCredentialOrDefault(props, "jclouds.credential", credential));
|
||||
String syncClassName = props.getProperty(providerName + ".sync", null);
|
||||
String asyncClassName = props.getProperty(providerName + ".async", null);
|
||||
Iterable<Module> modules = concat(Modules2.modulesForProviderInProperties(providerName, props), wiring);
|
||||
|
@ -306,6 +306,11 @@ public class RestContextFactory {
|
|||
propertiesBuilderClass = Providers.resolvePropertiesBuilderClass(providerName, props);
|
||||
sync = (Class<S>) (syncClassName != null ? Class.forName(syncClassName) : 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) {
|
||||
propagate(e);
|
||||
assert false : "exception should have propogated " + e;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.jclouds.aws.ec2;
|
||||
|
||||
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
||||
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.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.retryable_messages",
|
||||
"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));
|
||||
// amazon, alestic, canonical, and rightscale
|
||||
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "137112412989,063491364108,099720109477,411009282317");
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.google.inject.Module;
|
|||
*/
|
||||
@Test(groups = "unit")
|
||||
public abstract class BaseAWSEC2AsyncClientTest<T> extends RestClientTest<T> {
|
||||
|
||||
@RequiresHttp
|
||||
@ConfiguresRestClient
|
||||
protected static class StubAWSEC2RestClientModule extends AWSEC2RestClientModule {
|
||||
|
@ -46,8 +47,8 @@ public abstract class BaseAWSEC2AsyncClientTest<T> extends RestClientTest<T> {
|
|||
@Override
|
||||
public Map<String, URI> get() {
|
||||
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
|
||||
.create("https://ec2.us-west-1.amazonaws.com"));
|
||||
Region.US_EAST_1, URI.create("https://ec2.us-east-1.amazonaws.com"), Region.US_WEST_1,
|
||||
URI.create("https://ec2.us-west-1.amazonaws.com"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,11 @@ package org.jclouds.aws.s3;
|
|||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ReturnTrueIf2xx;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.s3.S3AsyncClient;
|
||||
import org.jclouds.s3.functions.ReturnFalseIfBucketAlreadyOwnedByYouOrIllegalState;
|
||||
import org.jclouds.s3.options.PutBucketOptions;
|
||||
|
@ -41,10 +43,15 @@ public class AWSS3AsyncClientTest extends org.jclouds.s3.S3AsyncClientTest {
|
|||
this.provider = "aws-s3";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Properties getProperties() {
|
||||
return RestContextFactory.getPropertiesFromResource("/rest.properties");
|
||||
}
|
||||
|
||||
public void testPutBucketEu() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
||||
NoSuchMethodException, IOException {
|
||||
Method method = S3AsyncClient.class.getMethod("putBucketInRegion", String.class, String.class, Array.newInstance(
|
||||
PutBucketOptions.class, 0).getClass());
|
||||
Method method = S3AsyncClient.class.getMethod("putBucketInRegion", String.class, String.class,
|
||||
Array.newInstance(PutBucketOptions.class, 0).getClass());
|
||||
HttpRequest request = processor.createRequest(method, "EU", "bucket");
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/ HTTP/1.1");
|
||||
|
|
Loading…
Reference in New Issue