mirror of https://github.com/apache/jclouds.git
corrected ssl errors in blobstore and normalized context factories
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2663 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
d8e6c0e248
commit
2776d12093
|
@ -18,16 +18,19 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.atmosonline.saas.blobstore.integration;
|
package org.jclouds.atmosonline.saas.blobstore.integration;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.atmosonline.saas.AtmosStorageAsyncClient;
|
import org.jclouds.atmosonline.saas.AtmosStorageAsyncClient;
|
||||||
import org.jclouds.atmosonline.saas.AtmosStorageClient;
|
import org.jclouds.atmosonline.saas.AtmosStorageClient;
|
||||||
import org.jclouds.atmosonline.saas.AtmosStoragePropertiesBuilder;
|
|
||||||
import org.jclouds.atmosonline.saas.blobstore.AtmosBlobStoreContextBuilder;
|
|
||||||
import org.jclouds.atmosonline.saas.blobstore.AtmosBlobStoreContextFactory;
|
import org.jclouds.atmosonline.saas.blobstore.AtmosBlobStoreContextFactory;
|
||||||
import org.jclouds.atmosonline.saas.config.AtmosStorageStubClientModule;
|
import org.jclouds.atmosonline.saas.config.AtmosStorageStubClientModule;
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
|
import org.jclouds.blobstore.BlobStoreContextFactory;
|
||||||
import org.jclouds.blobstore.integration.internal.BaseTestInitializer;
|
import org.jclouds.blobstore.integration.internal.BaseTestInitializer;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,12 +40,14 @@ import com.google.inject.Module;
|
||||||
public class AtmosStorageTestInitializer extends
|
public class AtmosStorageTestInitializer extends
|
||||||
BaseTestInitializer<AtmosStorageAsyncClient, AtmosStorageClient> {
|
BaseTestInitializer<AtmosStorageAsyncClient, AtmosStorageClient> {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected BlobStoreContext<AtmosStorageAsyncClient, AtmosStorageClient> createLiveContext(
|
protected BlobStoreContext<AtmosStorageAsyncClient, AtmosStorageClient> createLiveContext(
|
||||||
Module configurationModule, String url, String app, String account, String key) {
|
Module configurationModule, String url, String app, String account, String key)
|
||||||
return new AtmosBlobStoreContextBuilder(new AtmosStoragePropertiesBuilder(account, key)
|
throws IOException {
|
||||||
.relaxSSLHostname().build()).withModules(configurationModule,
|
return (BlobStoreContext<AtmosStorageAsyncClient, AtmosStorageClient>) new BlobStoreContextFactory()
|
||||||
new Log4JLoggingModule()).buildContext();
|
.createContext("atmos", account, key, ImmutableSet.of(configurationModule,
|
||||||
|
new Log4JLoggingModule()), new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -48,7 +48,6 @@ import org.jclouds.aws.s3.functions.BindRegionToXmlPayload;
|
||||||
import org.jclouds.aws.s3.functions.ObjectKey;
|
import org.jclouds.aws.s3.functions.ObjectKey;
|
||||||
import org.jclouds.aws.s3.functions.ParseObjectFromHeadersAndHttpContent;
|
import org.jclouds.aws.s3.functions.ParseObjectFromHeadersAndHttpContent;
|
||||||
import org.jclouds.aws.s3.functions.ParseObjectMetadataFromHeaders;
|
import org.jclouds.aws.s3.functions.ParseObjectMetadataFromHeaders;
|
||||||
import org.jclouds.aws.s3.functions.ReturnFalseOn404OrSSLHandshakeException;
|
|
||||||
import org.jclouds.aws.s3.functions.ReturnTrueIfBucketAlreadyOwnedByYou;
|
import org.jclouds.aws.s3.functions.ReturnTrueIfBucketAlreadyOwnedByYou;
|
||||||
import org.jclouds.aws.s3.functions.ReturnTrueOn404FalseIfNotEmpty;
|
import org.jclouds.aws.s3.functions.ReturnTrueOn404FalseIfNotEmpty;
|
||||||
import org.jclouds.aws.s3.options.CopyObjectOptions;
|
import org.jclouds.aws.s3.options.CopyObjectOptions;
|
||||||
|
@ -69,6 +68,7 @@ import org.jclouds.blobstore.functions.ReturnVoidOnNotFoundOr404;
|
||||||
import org.jclouds.blobstore.functions.ThrowContainerNotFoundOn404;
|
import org.jclouds.blobstore.functions.ThrowContainerNotFoundOn404;
|
||||||
import org.jclouds.blobstore.functions.ThrowKeyNotFoundOn404;
|
import org.jclouds.blobstore.functions.ThrowKeyNotFoundOn404;
|
||||||
import org.jclouds.http.functions.ParseETagHeader;
|
import org.jclouds.http.functions.ParseETagHeader;
|
||||||
|
import org.jclouds.http.functions.ReturnFalseOn404;
|
||||||
import org.jclouds.http.options.GetOptions;
|
import org.jclouds.http.options.GetOptions;
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
import org.jclouds.rest.annotations.Endpoint;
|
import org.jclouds.rest.annotations.Endpoint;
|
||||||
|
@ -156,7 +156,8 @@ public interface S3AsyncClient {
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/")
|
@Path("/")
|
||||||
@ExceptionParser(ReturnTrueIfBucketAlreadyOwnedByYou.class)
|
@ExceptionParser(ReturnTrueIfBucketAlreadyOwnedByYou.class)
|
||||||
ListenableFuture<Boolean> putBucketInRegion(//TODO endpoint based on region
|
ListenableFuture<Boolean> putBucketInRegion(
|
||||||
|
// TODO endpoint based on region
|
||||||
@BinderParam(BindRegionToXmlPayload.class) Region region,
|
@BinderParam(BindRegionToXmlPayload.class) Region region,
|
||||||
@HostPrefixParam String bucketName, PutBucketOptions... options);
|
@HostPrefixParam String bucketName, PutBucketOptions... options);
|
||||||
|
|
||||||
|
@ -174,7 +175,7 @@ public interface S3AsyncClient {
|
||||||
@HEAD
|
@HEAD
|
||||||
@Path("/")
|
@Path("/")
|
||||||
@QueryParams(keys = "max-keys", values = "0")
|
@QueryParams(keys = "max-keys", values = "0")
|
||||||
@ExceptionParser(ReturnFalseOn404OrSSLHandshakeException.class)
|
@ExceptionParser(ReturnFalseOn404.class)
|
||||||
ListenableFuture<Boolean> bucketExists(@HostPrefixParam String bucketName);
|
ListenableFuture<Boolean> bucketExists(@HostPrefixParam String bucketName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,6 +28,7 @@ import static org.jclouds.aws.s3.reference.S3Constants.PROPERTY_S3_SESSIONINTERV
|
||||||
import static org.jclouds.aws.s3.reference.S3Constants.PROPERTY_S3_TIMEOUT;
|
import static org.jclouds.aws.s3.reference.S3Constants.PROPERTY_S3_TIMEOUT;
|
||||||
import static org.jclouds.blobstore.reference.BlobStoreConstants.DIRECTORY_SUFFIX_FOLDER;
|
import static org.jclouds.blobstore.reference.BlobStoreConstants.DIRECTORY_SUFFIX_FOLDER;
|
||||||
import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX;
|
import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX;
|
||||||
|
import static org.jclouds.http.HttpConstants.PROPERTY_HTTP_RELAX_HOSTNAME;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -44,6 +45,7 @@ public class S3PropertiesBuilder extends HttpPropertiesBuilder {
|
||||||
@Override
|
@Override
|
||||||
protected Properties defaultProperties() {
|
protected Properties defaultProperties() {
|
||||||
Properties properties = super.defaultProperties();
|
Properties properties = super.defaultProperties();
|
||||||
|
properties.setProperty(PROPERTY_HTTP_RELAX_HOSTNAME, "true");
|
||||||
properties.setProperty(PROPERTY_S3_ENDPOINT, "https://s3.amazonaws.com");
|
properties.setProperty(PROPERTY_S3_ENDPOINT, "https://s3.amazonaws.com");
|
||||||
properties.setProperty(PROPERTY_S3_METADATA_PREFIX, "x-amz-meta-");
|
properties.setProperty(PROPERTY_S3_METADATA_PREFIX, "x-amz-meta-");
|
||||||
properties.setProperty(PROPERTY_S3_SESSIONINTERVAL, "60");
|
properties.setProperty(PROPERTY_S3_SESSIONINTERVAL, "60");
|
||||||
|
@ -60,6 +62,7 @@ public class S3PropertiesBuilder extends HttpPropertiesBuilder {
|
||||||
withCredentials(id, secret);
|
withCredentials(id, secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public S3PropertiesBuilder withCredentials(String id, String secret) {
|
public S3PropertiesBuilder withCredentials(String id, String secret) {
|
||||||
properties.setProperty(PROPERTY_AWS_ACCESSKEYID, checkNotNull(id, "awsAccessKeyId"));
|
properties.setProperty(PROPERTY_AWS_ACCESSKEYID, checkNotNull(id, "awsAccessKeyId"));
|
||||||
properties.setProperty(PROPERTY_AWS_SECRETACCESSKEY, checkNotNull(secret,
|
properties.setProperty(PROPERTY_AWS_SECRETACCESSKEY, checkNotNull(secret,
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
package org.jclouds.aws.s3.functions;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
import javax.net.ssl.SSLHandshakeException;
|
|
||||||
|
|
||||||
import org.jclouds.http.functions.ReturnFalseOn404;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* S3 buckets are dns names. When we attempt to resolve them, it could throw a misleading
|
|
||||||
* SSLHandshakeException when the bucket isn't found.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ReturnFalseOn404OrSSLHandshakeException extends ReturnFalseOn404 {
|
|
||||||
|
|
||||||
public Boolean apply(Exception from) {
|
|
||||||
Boolean returnVal = super.apply(from);
|
|
||||||
if (returnVal == null && from instanceof SSLHandshakeException) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return returnVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -24,6 +24,7 @@ import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
@ -74,7 +75,7 @@ public class EC2ComputeServiceLiveTest {
|
||||||
String user = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
String user = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String password = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String password = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
context = new ComputeServiceContextFactory().createContext("ec2", user, password,
|
context = new ComputeServiceContextFactory().createContext("ec2", user, password,
|
||||||
ImmutableSet.of(new Log4JLoggingModule()));
|
ImmutableSet.of(new Log4JLoggingModule()), new Properties());
|
||||||
Injector injector = Guice.createInjector(new JschSshClientModule());
|
Injector injector = Guice.createInjector(new JschSshClientModule());
|
||||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||||
|
|
|
@ -39,7 +39,6 @@ import org.jclouds.aws.s3.domain.AccessControlList.Permission;
|
||||||
import org.jclouds.aws.s3.filters.RequestAuthorizeSignature;
|
import org.jclouds.aws.s3.filters.RequestAuthorizeSignature;
|
||||||
import org.jclouds.aws.s3.functions.ParseObjectFromHeadersAndHttpContent;
|
import org.jclouds.aws.s3.functions.ParseObjectFromHeadersAndHttpContent;
|
||||||
import org.jclouds.aws.s3.functions.ParseObjectMetadataFromHeaders;
|
import org.jclouds.aws.s3.functions.ParseObjectMetadataFromHeaders;
|
||||||
import org.jclouds.aws.s3.functions.ReturnFalseOn404OrSSLHandshakeException;
|
|
||||||
import org.jclouds.aws.s3.functions.ReturnTrueIfBucketAlreadyOwnedByYou;
|
import org.jclouds.aws.s3.functions.ReturnTrueIfBucketAlreadyOwnedByYou;
|
||||||
import org.jclouds.aws.s3.functions.ReturnTrueOn404FalseIfNotEmpty;
|
import org.jclouds.aws.s3.functions.ReturnTrueOn404FalseIfNotEmpty;
|
||||||
import org.jclouds.aws.s3.options.CopyObjectOptions;
|
import org.jclouds.aws.s3.options.CopyObjectOptions;
|
||||||
|
@ -63,6 +62,7 @@ import org.jclouds.blobstore.reference.BlobStoreConstants;
|
||||||
import org.jclouds.date.TimeStamp;
|
import org.jclouds.date.TimeStamp;
|
||||||
import org.jclouds.http.functions.ParseETagHeader;
|
import org.jclouds.http.functions.ParseETagHeader;
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
|
import org.jclouds.http.functions.ReturnFalseOn404;
|
||||||
import org.jclouds.http.functions.ReturnTrueIf2xx;
|
import org.jclouds.http.functions.ReturnTrueIf2xx;
|
||||||
import org.jclouds.http.functions.ReturnVoidIf2xx;
|
import org.jclouds.http.functions.ReturnVoidIf2xx;
|
||||||
import org.jclouds.http.options.GetOptions;
|
import org.jclouds.http.options.GetOptions;
|
||||||
|
@ -186,7 +186,7 @@ public class S3AsyncClientTest extends RestClientTest<S3AsyncClient> {
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, httpMethod, ReturnTrueIf2xx.class);
|
assertResponseParserClassEquals(method, httpMethod, ReturnTrueIf2xx.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertExceptionParserClassEquals(method, ReturnFalseOn404OrSSLHandshakeException.class);
|
assertExceptionParserClassEquals(method, ReturnFalseOn404.class);
|
||||||
|
|
||||||
checkFilters(httpMethod);
|
checkFilters(httpMethod);
|
||||||
}
|
}
|
||||||
|
@ -379,8 +379,11 @@ public class S3AsyncClientTest extends RestClientTest<S3AsyncClient> {
|
||||||
Region.EU_WEST_1, "bucket");
|
Region.EU_WEST_1, "bucket");
|
||||||
|
|
||||||
assertRequestLineEquals(httpMethod, "PUT http://bucket.stub:8080/ HTTP/1.1");
|
assertRequestLineEquals(httpMethod, "PUT http://bucket.stub:8080/ HTTP/1.1");
|
||||||
assertHeadersEqual(httpMethod, "Content-Length: 98\nContent-Type: application/unknown\nHost: bucket.stub\n");
|
assertHeadersEqual(httpMethod,
|
||||||
assertPayloadEquals(httpMethod, "<CreateBucketConfiguration><LocationConstraint>EU</LocationConstraint></CreateBucketConfiguration>");
|
"Content-Length: 98\nContent-Type: application/unknown\nHost: bucket.stub\n");
|
||||||
|
assertPayloadEquals(
|
||||||
|
httpMethod,
|
||||||
|
"<CreateBucketConfiguration><LocationConstraint>EU</LocationConstraint></CreateBucketConfiguration>");
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, httpMethod, ReturnTrueIf2xx.class);
|
assertResponseParserClassEquals(method, httpMethod, ReturnTrueIf2xx.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
|
|
@ -18,17 +18,20 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.aws.s3.blobstore.integration;
|
package org.jclouds.aws.s3.blobstore.integration;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.aws.s3.S3AsyncClient;
|
import org.jclouds.aws.s3.S3AsyncClient;
|
||||||
import org.jclouds.aws.s3.S3Client;
|
import org.jclouds.aws.s3.S3Client;
|
||||||
import org.jclouds.aws.s3.S3PropertiesBuilder;
|
|
||||||
import org.jclouds.aws.s3.blobstore.S3BlobStoreContextBuilder;
|
|
||||||
import org.jclouds.aws.s3.blobstore.S3BlobStoreContextFactory;
|
import org.jclouds.aws.s3.blobstore.S3BlobStoreContextFactory;
|
||||||
import org.jclouds.aws.s3.config.S3StubClientModule;
|
import org.jclouds.aws.s3.config.S3StubClientModule;
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
|
import org.jclouds.blobstore.BlobStoreContextFactory;
|
||||||
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
|
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
|
||||||
import org.jclouds.blobstore.integration.internal.BaseTestInitializer;
|
import org.jclouds.blobstore.integration.internal.BaseTestInitializer;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,12 +40,14 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class S3TestInitializer extends BaseTestInitializer<S3AsyncClient, S3Client> {
|
public class S3TestInitializer extends BaseTestInitializer<S3AsyncClient, S3Client> {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected BlobStoreContext<S3AsyncClient, S3Client> createLiveContext(
|
protected BlobStoreContext<S3AsyncClient, S3Client> createLiveContext(
|
||||||
Module configurationModule, String url, String app, String account, String key) {
|
Module configurationModule, String url, String app, String account, String key) throws IOException {
|
||||||
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
|
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
|
||||||
return new S3BlobStoreContextBuilder(new S3PropertiesBuilder(account, key)
|
return (BlobStoreContext<S3AsyncClient, S3Client>) new BlobStoreContextFactory()
|
||||||
.build()).withModules(configurationModule, new Log4JLoggingModule()).buildContext();
|
.createContext("s3", account, key, ImmutableSet.of(configurationModule,
|
||||||
|
new Log4JLoggingModule()), new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,16 +18,19 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.azure.storage.blob.blobstore.integration;
|
package org.jclouds.azure.storage.blob.blobstore.integration;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.azure.storage.blob.AzureBlobAsyncClient;
|
import org.jclouds.azure.storage.blob.AzureBlobAsyncClient;
|
||||||
import org.jclouds.azure.storage.blob.AzureBlobClient;
|
import org.jclouds.azure.storage.blob.AzureBlobClient;
|
||||||
import org.jclouds.azure.storage.blob.AzureBlobPropertiesBuilder;
|
|
||||||
import org.jclouds.azure.storage.blob.blobstore.AzureBlobStoreContextBuilder;
|
|
||||||
import org.jclouds.azure.storage.blob.blobstore.AzureBlobStoreContextFactory;
|
import org.jclouds.azure.storage.blob.blobstore.AzureBlobStoreContextFactory;
|
||||||
import org.jclouds.azure.storage.blob.config.AzureBlobStubClientModule;
|
import org.jclouds.azure.storage.blob.config.AzureBlobStubClientModule;
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
|
import org.jclouds.blobstore.BlobStoreContextFactory;
|
||||||
import org.jclouds.blobstore.integration.internal.BaseTestInitializer;
|
import org.jclouds.blobstore.integration.internal.BaseTestInitializer;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,12 +40,14 @@ import com.google.inject.Module;
|
||||||
public class AzureBlobTestInitializer extends
|
public class AzureBlobTestInitializer extends
|
||||||
BaseTestInitializer<AzureBlobAsyncClient, AzureBlobClient> {
|
BaseTestInitializer<AzureBlobAsyncClient, AzureBlobClient> {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected BlobStoreContext<AzureBlobAsyncClient, AzureBlobClient> createLiveContext(
|
protected BlobStoreContext<AzureBlobAsyncClient, AzureBlobClient> createLiveContext(
|
||||||
Module configurationModule, String url, String app, String account, String key) {
|
Module configurationModule, String url, String app, String account, String key)
|
||||||
return new AzureBlobStoreContextBuilder(new AzureBlobPropertiesBuilder(account, key)
|
throws IOException {
|
||||||
.relaxSSLHostname().build()).withModules(configurationModule,
|
return (BlobStoreContext<AzureBlobAsyncClient, AzureBlobClient>) new BlobStoreContextFactory()
|
||||||
new Log4JLoggingModule()).buildContext();
|
.createContext("azureblob", account, key, ImmutableSet.of(configurationModule,
|
||||||
|
new Log4JLoggingModule()), new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -71,13 +71,62 @@ public interface BlobStore {
|
||||||
* @param container
|
* @param container
|
||||||
*/
|
*/
|
||||||
void clearContainer(String container);
|
void clearContainer(String container);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a {@code Blob} representing the data at location {@code container/blob.metadata.name}
|
||||||
|
*
|
||||||
|
* @param container
|
||||||
|
* container to place the blob.
|
||||||
|
* @param blob
|
||||||
|
* fully qualified name relative to the container.
|
||||||
|
* @param options
|
||||||
|
* byte range or condition options
|
||||||
|
* @return etag of the blob you uploaded, possibly null where etags are unsupported
|
||||||
|
* @throws ContainerNotFoundException
|
||||||
|
* if the container doesn't exist
|
||||||
|
*/
|
||||||
String putBlob(String container, Blob blob);
|
String putBlob(String container, Blob blob);
|
||||||
|
|
||||||
Blob getBlob(String container, String key, GetOptions... options);
|
/**
|
||||||
|
* Retrieves a {@code Blob} representing the data at location {@code container/name}
|
||||||
|
*
|
||||||
|
* @param container
|
||||||
|
* container where this exists.
|
||||||
|
* @param name
|
||||||
|
* fully qualified name relative to the container.
|
||||||
|
* @param options
|
||||||
|
* byte range or condition options
|
||||||
|
* @return the blob you intended to receive.
|
||||||
|
* @throws ContainerNotFoundException
|
||||||
|
* if the container doesn't exist
|
||||||
|
* @throws KeyNotFoundException
|
||||||
|
* if the container doesn't exist
|
||||||
|
*/
|
||||||
|
Blob getBlob(String container, String name, GetOptions... options);
|
||||||
|
|
||||||
BlobMetadata blobMetadata(String container, String key);
|
/**
|
||||||
|
* Retrieves the metadata of a {@code Blob} at location {@code container/name}
|
||||||
|
*
|
||||||
|
* @param container
|
||||||
|
* container where this exists.
|
||||||
|
* @param name
|
||||||
|
* fully qualified name relative to the container.
|
||||||
|
* @return null if name isn't present or the blob you intended to receive.
|
||||||
|
* @throws ContainerNotFoundException
|
||||||
|
* if the container doesn't exist
|
||||||
|
*/
|
||||||
|
BlobMetadata blobMetadata(String container, String name);
|
||||||
|
|
||||||
void removeBlob(String container, String key);
|
/**
|
||||||
|
* Deletes a {@code Blob} representing the data at location {@code container/name}
|
||||||
|
*
|
||||||
|
* @param container
|
||||||
|
* container where this exists.
|
||||||
|
* @param name
|
||||||
|
* fully qualified name relative to the container.
|
||||||
|
* @throws ContainerNotFoundException
|
||||||
|
* if the container doesn't exist
|
||||||
|
*/
|
||||||
|
void removeBlob(String container, String name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,91 +18,39 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.blobstore;
|
package org.jclouds.blobstore;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.rest.RestContextFactory;
|
||||||
import org.jclouds.http.HttpPropertiesBuilder;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.io.Resources;
|
|
||||||
import com.google.inject.Module;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Helper class to instantiate {@code BlobStoreContext} instances.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class BlobStoreContextFactory {
|
public class BlobStoreContextFactory extends
|
||||||
private final Properties properties;
|
RestContextFactory<BlobStoreContext<?, ?>, BlobStoreContextBuilder<?, ?>> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes with the default properties built-in to jclouds. This is typically stored in the
|
||||||
|
* classpath resource {@code blobstore.properties}
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
* if the default properties file cannot be loaded
|
||||||
|
* @see #init
|
||||||
|
*/
|
||||||
public BlobStoreContextFactory() throws IOException {
|
public BlobStoreContextFactory() throws IOException {
|
||||||
this(init());
|
super("blobstore.properties");
|
||||||
}
|
|
||||||
|
|
||||||
static Properties init() throws IOException {
|
|
||||||
Properties properties = new Properties();
|
|
||||||
properties.load(Resources.newInputStreamSupplier(
|
|
||||||
Resources.getResource("blobstore.properties")).getInput());
|
|
||||||
return properties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Initializes the {@code BlobStoreContext) definitions from the specified properties.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public BlobStoreContextFactory(Properties properties) {
|
public BlobStoreContextFactory(Properties properties) {
|
||||||
this.properties = properties;
|
super(properties);
|
||||||
}
|
|
||||||
|
|
||||||
public BlobStoreContext<?, ?> createContext(URI blobStore, Iterable<? extends Module> modules) {
|
|
||||||
return createContext(blobStore, Credentials.parse(blobStore), modules);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlobStoreContext<?, ?> createContext(URI blobStore) {
|
|
||||||
return createContext(blobStore, ImmutableSet.<Module> of());
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlobStoreContext<?, ?> createContext(URI blobStore, Credentials creds,
|
|
||||||
Iterable<? extends Module> modules) {
|
|
||||||
return createContext(checkNotNull(blobStore.getHost(), "host"), checkNotNull(creds.account,
|
|
||||||
"account"), creds.key, modules);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlobStoreContext<?, ?> createContext(URI blobStore, Credentials creds) {
|
|
||||||
return createContext(blobStore, creds, ImmutableSet.<Module> of());
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlobStoreContext<?, ?> createContext(String hint, String account, String key) {
|
|
||||||
return createContext(hint, account, key, ImmutableSet.<Module> of());
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public BlobStoreContext<?, ?> createContext(String hint, String account, String key,
|
|
||||||
Iterable<? extends Module> modules) {
|
|
||||||
checkNotNull(hint, "hint");
|
|
||||||
checkNotNull(account, "account");
|
|
||||||
String propertiesBuilderKey = String.format("%s.propertiesbuilder", hint);
|
|
||||||
String propertiesBuilderClassName = checkNotNull(
|
|
||||||
properties.getProperty(propertiesBuilderKey), hint + " service not supported");
|
|
||||||
|
|
||||||
String contextBuilderKey = String.format("%s.contextbuilder", hint);
|
|
||||||
String contextBuilderClassName = checkNotNull(properties.getProperty(contextBuilderKey),
|
|
||||||
contextBuilderKey);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Class<HttpPropertiesBuilder> propertiesBuilderClass = (Class<HttpPropertiesBuilder>) Class
|
|
||||||
.forName(propertiesBuilderClassName);
|
|
||||||
Class<BlobStoreContextBuilder<?, ?>> contextBuilderClass = (Class<BlobStoreContextBuilder<?, ?>>) Class
|
|
||||||
.forName(contextBuilderClassName);
|
|
||||||
HttpPropertiesBuilder builder = propertiesBuilderClass.getConstructor(String.class,
|
|
||||||
String.class).newInstance(account, key);
|
|
||||||
return contextBuilderClass.getConstructor(Properties.class).newInstance(builder.build())
|
|
||||||
.withModules(Iterables.toArray(modules, Module.class)).buildContext();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("error instantiating " + contextBuilderClassName, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.blobstore.integration.internal;
|
package org.jclouds.blobstore.integration.internal;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
import org.testng.ITestContext;
|
import org.testng.ITestContext;
|
||||||
|
|
||||||
|
@ -49,5 +51,5 @@ public abstract class BaseTestInitializer<A, S> {
|
||||||
protected abstract BlobStoreContext<A, S> createStubContext();
|
protected abstract BlobStoreContext<A, S> createStubContext();
|
||||||
|
|
||||||
protected abstract BlobStoreContext<A, S> createLiveContext(Module configurationModule,
|
protected abstract BlobStoreContext<A, S> createLiveContext(Module configurationModule,
|
||||||
String url, String app, String account, String key);
|
String url, String app, String account, String key) throws IOException;
|
||||||
}
|
}
|
|
@ -18,93 +18,39 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.compute;
|
package org.jclouds.compute;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.rest.RestContextFactory;
|
||||||
import org.jclouds.http.HttpPropertiesBuilder;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.io.Resources;
|
|
||||||
import com.google.inject.Module;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Helper class to instantiate {@code ComputeServiceContext} instances.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class ComputeServiceContextFactory {
|
public class ComputeServiceContextFactory extends
|
||||||
private final Properties properties;
|
RestContextFactory<ComputeServiceContext<?, ?>, ComputeServiceContextBuilder<?, ?>> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes with the default properties built-in to jclouds. This is typically stored in the
|
||||||
|
* classpath resource {@code compute.properties}
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
* if the default properties file cannot be loaded
|
||||||
|
* @see #init
|
||||||
|
*/
|
||||||
public ComputeServiceContextFactory() throws IOException {
|
public ComputeServiceContextFactory() throws IOException {
|
||||||
this(init());
|
super("compute.properties");
|
||||||
}
|
|
||||||
|
|
||||||
static Properties init() throws IOException {
|
|
||||||
Properties properties = new Properties();
|
|
||||||
properties.load(Resources.newInputStreamSupplier(Resources.getResource("compute.properties"))
|
|
||||||
.getInput());
|
|
||||||
return properties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Initializes the {@code ComputeServiceContext) definitions from the specified properties.
|
||||||
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public ComputeServiceContextFactory(Properties properties) {
|
public ComputeServiceContextFactory(Properties properties) {
|
||||||
this.properties = properties;
|
super(properties);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public ComputeServiceContext<?, ?> createContext(URI blobStore,
|
|
||||||
Iterable<? extends Module> modules) {
|
|
||||||
return createContext(blobStore, Credentials.parse(blobStore), modules);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComputeServiceContext<?, ?> createContext(URI blobStore) {
|
|
||||||
return createContext(blobStore, ImmutableSet.<Module> of());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComputeServiceContext<?, ?> createContext(URI blobStore, Credentials creds,
|
|
||||||
Iterable<? extends Module> modules) {
|
|
||||||
return createContext(checkNotNull(blobStore.getHost(), "host"), checkNotNull(creds.account,
|
|
||||||
"account"), creds.key, modules);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComputeServiceContext<?, ?> createContext(URI blobStore, Credentials creds) {
|
|
||||||
return createContext(blobStore, creds, ImmutableSet.<Module> of());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComputeServiceContext<?, ?> createContext(String hint, String account, String key) {
|
|
||||||
return createContext(hint, account, key, ImmutableSet.<Module> of());
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public ComputeServiceContext<?, ?> createContext(String hint, String account, String key,
|
|
||||||
Iterable<? extends Module> modules) {
|
|
||||||
checkNotNull(hint, "hint");
|
|
||||||
checkNotNull(account, "account");
|
|
||||||
String propertiesBuilderKey = String.format("%s.propertiesbuilder", hint);
|
|
||||||
String propertiesBuilderClassName = checkNotNull(
|
|
||||||
properties.getProperty(propertiesBuilderKey), hint + " service not supported");
|
|
||||||
|
|
||||||
String contextBuilderKey = String.format("%s.contextbuilder", hint);
|
|
||||||
String contextBuilderClassName = checkNotNull(properties.getProperty(contextBuilderKey),
|
|
||||||
contextBuilderKey);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Class<HttpPropertiesBuilder> propertiesBuilderClass = (Class<HttpPropertiesBuilder>) Class
|
|
||||||
.forName(propertiesBuilderClassName);
|
|
||||||
Class<ComputeServiceContextBuilder<?, ?>> contextBuilderClass = (Class<ComputeServiceContextBuilder<?, ?>>) Class
|
|
||||||
.forName(contextBuilderClassName);
|
|
||||||
|
|
||||||
HttpPropertiesBuilder builder = propertiesBuilderClass.getConstructor(String.class,
|
|
||||||
String.class).newInstance(account, key);
|
|
||||||
return contextBuilderClass.getConstructor(Properties.class).newInstance(builder.build())
|
|
||||||
.withModules(Iterables.toArray(modules, Module.class)).buildContext();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("error instantiating " + contextBuilderClassName, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -42,16 +42,16 @@ public class HttpPropertiesBuilder {
|
||||||
/**
|
/**
|
||||||
* allow mismatches between the certificate and the hostname of ssl requests.
|
* allow mismatches between the certificate and the hostname of ssl requests.
|
||||||
*/
|
*/
|
||||||
public HttpPropertiesBuilder relaxSSLHostname() {
|
public HttpPropertiesBuilder relaxSSLHostname(boolean relax) {
|
||||||
properties.setProperty(PROPERTY_HTTP_RELAX_HOSTNAME, "true");
|
properties.setProperty(PROPERTY_HTTP_RELAX_HOSTNAME, relax+"");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpPropertiesBuilder useSystemProxies(boolean useSystemProxies) {
|
public HttpPropertiesBuilder useSystemProxies(boolean useSystemProxies) {
|
||||||
properties.setProperty(PROPERTY_HTTP_PROXY_SYSTEM, useSystemProxies+"");
|
properties.setProperty(PROPERTY_HTTP_PROXY_SYSTEM, useSystemProxies + "");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpPropertiesBuilder withHttpMaxRetries(int httpMaxRetries) {
|
public HttpPropertiesBuilder withHttpMaxRetries(int httpMaxRetries) {
|
||||||
properties.setProperty(PROPERTY_HTTP_MAX_RETRIES, Integer.toString(httpMaxRetries));
|
properties.setProperty(PROPERTY_HTTP_MAX_RETRIES, Integer.toString(httpMaxRetries));
|
||||||
return this;
|
return this;
|
||||||
|
@ -109,6 +109,10 @@ public class HttpPropertiesBuilder {
|
||||||
this.properties.putAll(properties);
|
this.properties.putAll(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HttpPropertiesBuilder withCredentials(String account, String key) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public Properties build() {
|
public Properties build() {
|
||||||
return properties;
|
return properties;
|
||||||
|
|
|
@ -62,12 +62,13 @@ public class JavaUrlHttpCommandExecutorService extends
|
||||||
@Named(HttpConstants.PROPERTY_HTTP_RELAX_HOSTNAME)
|
@Named(HttpConstants.PROPERTY_HTTP_RELAX_HOSTNAME)
|
||||||
private boolean relaxHostname = false;
|
private boolean relaxHostname = false;
|
||||||
private final Map<String, String> sslMap;
|
private final Map<String, String> sslMap;
|
||||||
|
|
||||||
@Inject(optional = true)
|
@Inject(optional = true)
|
||||||
@Named(HttpConstants.PROPERTY_HTTP_PROXY_SYSTEM)
|
@Named(HttpConstants.PROPERTY_HTTP_PROXY_SYSTEM)
|
||||||
private boolean systemProxies = System.getProperty("java.net.useSystemProxies") != null ?
|
private boolean systemProxies = System.getProperty("java.net.useSystemProxies") != null ? Boolean
|
||||||
Boolean.parseBoolean(System.getProperty("java.net.useSystemProxies")) : false;
|
.parseBoolean(System.getProperty("java.net.useSystemProxies"))
|
||||||
|
: false;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public JavaUrlHttpCommandExecutorService(ExecutorService executorService,
|
public JavaUrlHttpCommandExecutorService(ExecutorService executorService,
|
||||||
DelegatingRetryHandler retryHandler, DelegatingErrorHandler errorHandler, HttpWire wire) {
|
DelegatingRetryHandler retryHandler, DelegatingErrorHandler errorHandler, HttpWire wire) {
|
||||||
|
@ -120,7 +121,7 @@ public class JavaUrlHttpCommandExecutorService extends
|
||||||
Proxy proxy = Iterables.getLast(proxies);
|
Proxy proxy = Iterables.getLast(proxies);
|
||||||
connection = (HttpURLConnection) url.openConnection(proxy);
|
connection = (HttpURLConnection) url.openConnection(proxy);
|
||||||
} else {
|
} else {
|
||||||
connection = (HttpURLConnection) url.openConnection();
|
connection = (HttpURLConnection) url.openConnection();
|
||||||
}
|
}
|
||||||
if (relaxHostname && connection instanceof HttpsURLConnection) {
|
if (relaxHostname && connection instanceof HttpsURLConnection) {
|
||||||
HttpsURLConnection sslCon = (HttpsURLConnection) connection;
|
HttpsURLConnection sslCon = (HttpsURLConnection) connection;
|
||||||
|
|
|
@ -0,0 +1,158 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 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.rest;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.jclouds.domain.Credentials;
|
||||||
|
import org.jclouds.http.HttpPropertiesBuilder;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.io.Resources;
|
||||||
|
import com.google.inject.Module;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class to instantiate {@code RestContext} instances. "blobstore.properties"
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class RestContextFactory<T extends RestContext<?, ?>, B extends RestContextBuilder<?, ?>> {
|
||||||
|
private final static Properties NO_PROPERTIES = new Properties();
|
||||||
|
private final Properties properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes with the default properties built-in to jclouds. This is typically stored in the
|
||||||
|
* classpath resource {@code filename}
|
||||||
|
*
|
||||||
|
* @parma filename name of the properties file to initialize from
|
||||||
|
* @throws IOException
|
||||||
|
* if the default properties file cannot be loaded
|
||||||
|
* @see #init
|
||||||
|
*/
|
||||||
|
public RestContextFactory(String filename) throws IOException {
|
||||||
|
this(getPropertiesFromResource(filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the default properties that define the {@code RestContext} objects. <h3>properties file
|
||||||
|
* format</h3>
|
||||||
|
*
|
||||||
|
* Two properties are needed per context:
|
||||||
|
* <ul>
|
||||||
|
* <li>tag.contextbuilder=classname extends RestContextBuilder</li>
|
||||||
|
* <li>tag.propertiesbuilder=classname extends HttpPropertiesBuilder</li>
|
||||||
|
* </ul>
|
||||||
|
* Ex.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* azureblob.contextbuilder=org.jclouds.azure.storage.blob.blobstore.AzureRestContextBuilder
|
||||||
|
* azureblob.propertiesbuilder=org.jclouds.azure.storage.blob.AzureBlobPropertiesBuilder
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param filename
|
||||||
|
* name of file to load from in the resource path
|
||||||
|
* @return properties object with these items loaded for each tag
|
||||||
|
* @throws IOException
|
||||||
|
* if {@code filename} cannot load.
|
||||||
|
*/
|
||||||
|
static Properties getPropertiesFromResource(String filename) throws IOException {
|
||||||
|
Properties properties = new Properties();
|
||||||
|
properties.load(Resources.newInputStreamSupplier(Resources.getResource(filename)).getInput());
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the {@code RestContext} definitions from the specified properties.
|
||||||
|
*/
|
||||||
|
@Inject
|
||||||
|
public RestContextFactory(Properties properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T createContext(URI blobStore, Iterable<? extends Module> modules, Properties overrides) {
|
||||||
|
return createContext(blobStore, Credentials.parse(blobStore), modules, overrides);
|
||||||
|
}
|
||||||
|
|
||||||
|
public T createContext(URI blobStore) {
|
||||||
|
return createContext(blobStore, ImmutableSet.<Module> of(), NO_PROPERTIES);
|
||||||
|
}
|
||||||
|
|
||||||
|
public T createContext(URI blobStore, Credentials creds, Iterable<? extends Module> modules,
|
||||||
|
Properties overrides) {
|
||||||
|
return createContext(checkNotNull(blobStore.getHost(), "host"), checkNotNull(creds.account,
|
||||||
|
"account"), checkNotNull(creds.key, "key"), checkNotNull(modules, "modules"),
|
||||||
|
checkNotNull(overrides, "overrides"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public T createContext(URI blobStore, Credentials creds) {
|
||||||
|
return createContext(blobStore, creds, ImmutableSet.<Module> of(), NO_PROPERTIES);
|
||||||
|
}
|
||||||
|
|
||||||
|
public T createContext(String hint, String account, String key) {
|
||||||
|
return createContext(hint, account, key, ImmutableSet.<Module> of(), NO_PROPERTIES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* FIXME Comment this // ImmutableSet.<Module>of(new ExecutorServiceModule(myexecutor))
|
||||||
|
*
|
||||||
|
* @param hint
|
||||||
|
* @param account
|
||||||
|
* @param key
|
||||||
|
* @param modules
|
||||||
|
* @param overrides
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public T createContext(String hint, String account, String key,
|
||||||
|
Iterable<? extends Module> modules, Properties overrides) {
|
||||||
|
checkNotNull(hint, "hint");
|
||||||
|
checkNotNull(account, "account");
|
||||||
|
checkNotNull(key, "key");
|
||||||
|
checkNotNull(modules, "modules");
|
||||||
|
checkNotNull(overrides, "overrides");
|
||||||
|
String propertiesBuilderKey = String.format("%s.propertiesbuilder", hint);
|
||||||
|
String propertiesBuilderClassName = checkNotNull(
|
||||||
|
properties.getProperty(propertiesBuilderKey), hint + " service not supported");
|
||||||
|
|
||||||
|
String contextBuilderKey = String.format("%s.contextbuilder", hint);
|
||||||
|
String contextBuilderClassName = checkNotNull(properties.getProperty(contextBuilderKey),
|
||||||
|
contextBuilderKey);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class<HttpPropertiesBuilder> propertiesBuilderClass = (Class<HttpPropertiesBuilder>) Class
|
||||||
|
.forName(propertiesBuilderClassName);
|
||||||
|
Class<B> contextBuilderClass = (Class<B>) Class.forName(contextBuilderClassName);
|
||||||
|
HttpPropertiesBuilder builder = propertiesBuilderClass.getConstructor(Properties.class)
|
||||||
|
.newInstance(overrides).withCredentials(account, key);
|
||||||
|
return (T) contextBuilderClass.getConstructor(Properties.class).newInstance(
|
||||||
|
builder.build()).withModules(Iterables.toArray(modules, Module.class))
|
||||||
|
.buildContext();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("error instantiating " + contextBuilderClassName, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,17 +18,20 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.rackspace.cloudfiles.blobstore.integration;
|
package org.jclouds.rackspace.cloudfiles.blobstore.integration;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
|
import org.jclouds.blobstore.BlobStoreContextFactory;
|
||||||
import org.jclouds.blobstore.integration.internal.BaseTestInitializer;
|
import org.jclouds.blobstore.integration.internal.BaseTestInitializer;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
import org.jclouds.rackspace.StubRackspaceAuthenticationModule;
|
import org.jclouds.rackspace.StubRackspaceAuthenticationModule;
|
||||||
import org.jclouds.rackspace.cloudfiles.CloudFilesAsyncClient;
|
import org.jclouds.rackspace.cloudfiles.CloudFilesAsyncClient;
|
||||||
import org.jclouds.rackspace.cloudfiles.CloudFilesClient;
|
import org.jclouds.rackspace.cloudfiles.CloudFilesClient;
|
||||||
import org.jclouds.rackspace.cloudfiles.CloudFilesPropertiesBuilder;
|
|
||||||
import org.jclouds.rackspace.cloudfiles.blobstore.CloudFilesBlobStoreContextBuilder;
|
|
||||||
import org.jclouds.rackspace.cloudfiles.blobstore.CloudFilesBlobStoreContextFactory;
|
import org.jclouds.rackspace.cloudfiles.blobstore.CloudFilesBlobStoreContextFactory;
|
||||||
import org.jclouds.rackspace.cloudfiles.config.CloudFilesStubClientModule;
|
import org.jclouds.rackspace.cloudfiles.config.CloudFilesStubClientModule;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,12 +41,14 @@ import com.google.inject.Module;
|
||||||
public class CloudFilesTestInitializer extends
|
public class CloudFilesTestInitializer extends
|
||||||
BaseTestInitializer<CloudFilesAsyncClient, CloudFilesClient> {
|
BaseTestInitializer<CloudFilesAsyncClient, CloudFilesClient> {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected BlobStoreContext<CloudFilesAsyncClient, CloudFilesClient> createLiveContext(
|
protected BlobStoreContext<CloudFilesAsyncClient, CloudFilesClient> createLiveContext(
|
||||||
Module configurationModule, String url, String app, String account, String key) {
|
Module configurationModule, String url, String app, String account, String key)
|
||||||
return new CloudFilesBlobStoreContextBuilder(new CloudFilesPropertiesBuilder(account, key)
|
throws IOException {
|
||||||
.relaxSSLHostname().build()).withModules(configurationModule,
|
return (BlobStoreContext<CloudFilesAsyncClient, CloudFilesClient>) new BlobStoreContextFactory()
|
||||||
new Log4JLoggingModule()).buildContext();
|
.createContext("cloudfiles", account, key, ImmutableSet.of(configurationModule,
|
||||||
|
new Log4JLoggingModule()), new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -41,7 +41,7 @@ import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code TerremarkVCloudClient}
|
* Tests behavior of {@code TerremarkVCloudClient}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", sequential = true, testName = "rimuhosting.RimuHostingComputeClientLiveTest")
|
@Test(groups = "live", sequential = true, testName = "rimuhosting.RimuHostingComputeClientLiveTest")
|
||||||
|
@ -51,7 +51,6 @@ public class RimuHostingComputeClientLiveTest {
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
private InetAddress publicIp;
|
private InetAddress publicIp;
|
||||||
private Predicate<InetAddress> addressTester;
|
private Predicate<InetAddress> addressTester;
|
||||||
|
|
||||||
|
@ -78,7 +77,8 @@ public class RimuHostingComputeClientLiveTest {
|
||||||
@BeforeGroups(groups = { "live" })
|
@BeforeGroups(groups = { "live" })
|
||||||
public void setupClient() {
|
public void setupClient() {
|
||||||
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
Injector injector = new RimuHostingContextBuilder(new RimuHostingPropertiesBuilder(key).relaxSSLHostname().build()).withModules(new Log4JLoggingModule(),
|
Injector injector = new RimuHostingContextBuilder(new RimuHostingPropertiesBuilder(key)
|
||||||
|
.relaxSSLHostname(true).build()).withModules(new Log4JLoggingModule(),
|
||||||
new JschSshClientModule(), new AbstractModule() {
|
new JschSshClientModule(), new AbstractModule() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -99,7 +99,6 @@ public class RimuHostingComputeClientLiveTest {
|
||||||
return new RetryablePredicate<InetAddress>(reachable, 60, 5, TimeUnit.SECONDS);
|
return new RetryablePredicate<InetAddress>(reachable, 60, 5, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}).buildInjector();
|
}).buildInjector();
|
||||||
client = injector.getInstance(RimuHostingComputeClient.class);
|
client = injector.getInstance(RimuHostingComputeClient.class);
|
||||||
rhClient = injector.getInstance(RimuHostingClient.class);
|
rhClient = injector.getInstance(RimuHostingClient.class);
|
||||||
|
|
|
@ -28,6 +28,7 @@ import static org.testng.Assert.assertNotNull;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
@ -79,7 +80,7 @@ public class RimuHostingComputeServiceLiveTest {
|
||||||
public void setupClient() throws IOException {
|
public void setupClient() throws IOException {
|
||||||
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
context = new ComputeServiceContextFactory().createContext("rimuhosting", key, key,
|
context = new ComputeServiceContextFactory().createContext("rimuhosting", key, key,
|
||||||
ImmutableSet.of(new Log4JLoggingModule()));
|
ImmutableSet.of(new Log4JLoggingModule()), new Properties());
|
||||||
Injector injector = Guice.createInjector(new JschSshClientModule());
|
Injector injector = Guice.createInjector(new JschSshClientModule());
|
||||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
<artifact:dependencies pathId="jclouds.classpath">
|
<artifact:dependencies pathId="jclouds.classpath">
|
||||||
<dependency groupId="org.jclouds" artifactId="jclouds-antcontrib" version="1.0-SNAPSHOT" />
|
<dependency groupId="org.jclouds" artifactId="jclouds-antcontrib" version="1.0-SNAPSHOT" />
|
||||||
|
<dependency groupId="org.jclouds" artifactId="jclouds-hostingdotcom" version="1.0-SNAPSHOT" />
|
||||||
|
<dependency groupId="org.jclouds" artifactId="jclouds-rimuhosting" version="1.0-SNAPSHOT" />
|
||||||
<dependency groupId="org.jclouds" artifactId="jclouds-aws" version="1.0-SNAPSHOT" />
|
<dependency groupId="org.jclouds" artifactId="jclouds-aws" version="1.0-SNAPSHOT" />
|
||||||
<dependency groupId="org.jclouds" artifactId="jclouds-terremark" version="1.0-SNAPSHOT" />
|
<dependency groupId="org.jclouds" artifactId="jclouds-terremark" version="1.0-SNAPSHOT" />
|
||||||
<localRepository refid="local.repository" />
|
<localRepository refid="local.repository" />
|
||||||
|
@ -41,8 +43,8 @@
|
||||||
<typedef name="compute" classname="org.jclouds.tools.ant.taskdefs.compute.ComputeTask" classpathref="jclouds.classpath" />
|
<typedef name="compute" classname="org.jclouds.tools.ant.taskdefs.compute.ComputeTask" classpathref="jclouds.classpath" />
|
||||||
|
|
||||||
<input
|
<input
|
||||||
message="Which service would you like to use (ec2, terremark)?"
|
message="Which service would you like to use (ec2, terremark, rimuhosting, hostingdotcom)?"
|
||||||
validargs="ec2,terremark"
|
validargs="ec2,terremark,rimuhosting,hostingdotcom"
|
||||||
addproperty="service"
|
addproperty="service"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -56,6 +58,12 @@
|
||||||
addproperty="key"
|
addproperty="key"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<input
|
||||||
|
message="What is the image you want to use (CENTOS_53, UBUNTU_90)?"
|
||||||
|
validargs="CENTOS_53,UBUNTU_90"
|
||||||
|
addproperty="image"
|
||||||
|
/>
|
||||||
|
|
||||||
<property name="jclouds.compute.url" value="compute://${account}:${key}@${service}" />
|
<property name="jclouds.compute.url" value="compute://${account}:${key}@${service}" />
|
||||||
<property name="nodename" value="testforjcloud2" />
|
<property name="nodename" value="testforjcloud2" />
|
||||||
|
|
||||||
|
@ -81,7 +89,7 @@
|
||||||
|
|
||||||
<target name="create" description="create the node ${nodename}">
|
<target name="create" description="create the node ${nodename}">
|
||||||
<compute action="create" provider="${jclouds.compute.url}">
|
<compute action="create" provider="${jclouds.compute.url}">
|
||||||
<node name="${nodename}" image="UBUNTU_90" profile="SMALLEST" hostproperty="host" usernameproperty="username" passwordproperty="password" />
|
<node name="${nodename}" image="${image}" profile="SMALLEST" hostproperty="host" usernameproperty="username" passwordproperty="password" />
|
||||||
</compute>
|
</compute>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ import com.google.common.base.Function;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.MapMaker;
|
import com.google.common.collect.MapMaker;
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import com.google.common.io.Resources;
|
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
|
|
||||||
|
@ -74,28 +73,41 @@ public class ComputeTask extends Task {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* we don't have a reference to the project during the constructor, so we need to defer expansion
|
||||||
|
* with a Provider.
|
||||||
|
*/
|
||||||
|
private static Provider<Properties> defaultPropertiesProvider = new Provider<Properties>() {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public Properties get() {
|
||||||
|
Properties props = new Properties();
|
||||||
|
props.putAll(project.getProperties());
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
public ComputeTask(Map<URI, ComputeServiceContext<?, ?>> computeMap) {
|
public ComputeTask(Map<URI, ComputeServiceContext<?, ?>> computeMap) {
|
||||||
this.computeMap = computeMap;
|
this.computeMap = computeMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ComputeTask() throws IOException {
|
public ComputeTask() throws IOException {
|
||||||
this(buildComputeMap(loadDefaultProperties()));
|
this(buildComputeMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
static Properties loadDefaultProperties() throws IOException {
|
static Map<URI, ComputeServiceContext<?, ?>> buildComputeMap() {
|
||||||
Properties properties = new Properties();
|
|
||||||
properties.load(Resources.newInputStreamSupplier(Resources.getResource("compute.properties"))
|
|
||||||
.getInput());
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<URI, ComputeServiceContext<?, ?>> buildComputeMap(final Properties props) {
|
|
||||||
return new MapMaker().makeComputingMap(new Function<URI, ComputeServiceContext<?, ?>>() {
|
return new MapMaker().makeComputingMap(new Function<URI, ComputeServiceContext<?, ?>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ComputeServiceContext<?, ?> apply(URI from) {
|
public ComputeServiceContext<?, ?> apply(URI from) {
|
||||||
return new ComputeServiceContextFactory(props).createContext(from,
|
try {
|
||||||
defaultModulesProvider.get());
|
return new ComputeServiceContextFactory().createContext(from, defaultModulesProvider
|
||||||
|
.get(), defaultPropertiesProvider.get());
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.net.URI;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.commons.vfs.Capability;
|
import org.apache.commons.vfs.Capability;
|
||||||
import org.apache.commons.vfs.FileName;
|
import org.apache.commons.vfs.FileName;
|
||||||
|
@ -86,8 +87,8 @@ public class BlobStoreFileProvider extends AbstractOriginatingFileProvider {
|
||||||
.toChar(rootName.getUserName()))), UserAuthenticatorUtils
|
.toChar(rootName.getUserName()))), UserAuthenticatorUtils
|
||||||
.toString(UserAuthenticatorUtils.getData(authData,
|
.toString(UserAuthenticatorUtils.getData(authData,
|
||||||
UserAuthenticationData.PASSWORD, UserAuthenticatorUtils
|
UserAuthenticationData.PASSWORD, UserAuthenticatorUtils
|
||||||
.toChar(rootName.getPassword())))), modules)
|
.toChar(rootName.getPassword())))), modules,
|
||||||
.getBlobStore();
|
new Properties()).getBlobStore();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new FileSystemException("vfs.provider.blobstore/properties.error", name, e);
|
throw new FileSystemException("vfs.provider.blobstore/properties.error", name, e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class VCloudComputeClientLiveTest {
|
||||||
String account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
String account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
Injector injector = new VCloudContextBuilder(new VCloudPropertiesBuilder(
|
Injector injector = new VCloudContextBuilder(new VCloudPropertiesBuilder(
|
||||||
URI.create(endpoint), account, key).relaxSSLHostname().build()).withModules(
|
URI.create(endpoint), account, key).build()).withModules(
|
||||||
new Log4JLoggingModule(), new JschSshClientModule()).buildInjector();
|
new Log4JLoggingModule(), new JschSshClientModule()).buildInjector();
|
||||||
client = injector.getInstance(VCloudComputeClient.class);
|
client = injector.getInstance(VCloudComputeClient.class);
|
||||||
tmClient = injector.getInstance(VCloudClient.class);
|
tmClient = injector.getInstance(VCloudClient.class);
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
public interface HostingDotComVCloudClient extends VCloudClient {
|
public interface HostingDotComVCloudClient extends VCloudClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 600, timeUnit = TimeUnit.SECONDS)
|
||||||
HostingDotComVApp instantiateVAppTemplateInVDC(String vDCId, String appName, String templateId,
|
HostingDotComVApp instantiateVAppTemplateInVDC(String vDCId, String appName, String templateId,
|
||||||
InstantiateVAppTemplateOptions... options);
|
InstantiateVAppTemplateOptions... options);
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,21 @@ public class HostingDotComVCloudComputeClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Image, String> imageCatalogIdMap = ImmutableMap.<Image, String> builder().put(
|
private Map<Image, String> imageCatalogIdMap = ImmutableMap.<Image, String> builder().put(
|
||||||
Image.CENTOS_53, "3").put(Image.RHEL_53, "8").put(Image.UBUNTU_90, "10").put(
|
Image.CENTOS_53, "3").build();
|
||||||
Image.UBUNTU_JEOS_90, "11").build();
|
|
||||||
|
|
||||||
|
// <ResourceEntity href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/1"
|
||||||
|
// type="application/vnd.vmware.vcloud.vAppTemplate+xml"
|
||||||
|
// name="Plesk (Linux) 64-bit Template" />
|
||||||
|
// <ResourceEntity href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"
|
||||||
|
// type="application/vnd.vmware.vcloud.vAppTemplate+xml"
|
||||||
|
// name="Windows 2008 Datacenter 64 Bit Template" />
|
||||||
|
// <ResourceEntity href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"
|
||||||
|
// type="application/vnd.vmware.vcloud.vAppTemplate+xml"
|
||||||
|
// name="Cent OS 64 Bit Template" />
|
||||||
|
// <ResourceEntity href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/4"
|
||||||
|
// type="application/vnd.vmware.vcloud.vAppTemplate+xml"
|
||||||
|
// name="cPanel (Linux) 64 Bit Template" />
|
||||||
|
|
||||||
public Map<String, String> start(String name, Image image, int minCores, int minMegs,
|
public Map<String, String> start(String name, Image image, int minCores, int minMegs,
|
||||||
long diskSize, Map<String, String> properties) {
|
long diskSize, Map<String, String> properties) {
|
||||||
checkArgument(imageCatalogIdMap.containsKey(image), "image not configured: " + image);
|
checkArgument(imageCatalogIdMap.containsKey(image), "image not configured: " + image);
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class HostingDotComVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
Injector injector = new HostingDotComVCloudContextBuilder(
|
Injector injector = new HostingDotComVCloudContextBuilder(
|
||||||
new HostingDotComVCloudPropertiesBuilder(account, key).relaxSSLHostname().build())
|
new HostingDotComVCloudPropertiesBuilder(account, key).build())
|
||||||
.withModules(new Log4JLoggingModule(), new JschSshClientModule()).buildInjector();
|
.withModules(new Log4JLoggingModule(), new JschSshClientModule()).buildInjector();
|
||||||
|
|
||||||
connection = injector.getInstance(HostingDotComVCloudClient.class);
|
connection = injector.getInstance(HostingDotComVCloudClient.class);
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class HostingDotComVCloudComputeClientLiveTest {
|
||||||
String account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
String account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
Injector injector = new HostingDotComVCloudContextBuilder(
|
Injector injector = new HostingDotComVCloudContextBuilder(
|
||||||
new HostingDotComVCloudPropertiesBuilder(account, key).relaxSSLHostname().build())
|
new HostingDotComVCloudPropertiesBuilder(account, key).build())
|
||||||
.withModules(new Log4JLoggingModule(), new JschSshClientModule()).buildInjector();
|
.withModules(new Log4JLoggingModule(), new JschSshClientModule()).buildInjector();
|
||||||
client = injector.getInstance(HostingDotComVCloudComputeClient.class);
|
client = injector.getInstance(HostingDotComVCloudComputeClient.class);
|
||||||
hostingClient = injector.getInstance(HostingDotComVCloudClient.class);
|
hostingClient = injector.getInstance(HostingDotComVCloudClient.class);
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class InternetServiceLiveTest {
|
||||||
String account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
String account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
Injector injector = new TerremarkVCloudContextBuilder(new TerremarkVCloudPropertiesBuilder(
|
Injector injector = new TerremarkVCloudContextBuilder(new TerremarkVCloudPropertiesBuilder(
|
||||||
account, key).relaxSSLHostname().build()).withModules(new Log4JLoggingModule(),
|
account, key).build()).withModules(new Log4JLoggingModule(),
|
||||||
new JschSshClientModule()).buildInjector();
|
new JschSshClientModule()).buildInjector();
|
||||||
|
|
||||||
tmClient = injector.getInstance(TerremarkVCloudClient.class);
|
tmClient = injector.getInstance(TerremarkVCloudClient.class);
|
||||||
|
|
|
@ -444,7 +444,7 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
Injector injector = new TerremarkVCloudContextBuilder(new TerremarkVCloudPropertiesBuilder(
|
Injector injector = new TerremarkVCloudContextBuilder(new TerremarkVCloudPropertiesBuilder(
|
||||||
account, key).relaxSSLHostname().build()).withModules(new Log4JLoggingModule(),
|
account, key).build()).withModules(new Log4JLoggingModule(),
|
||||||
new JschSshClientModule()).buildInjector();
|
new JschSshClientModule()).buildInjector();
|
||||||
|
|
||||||
connection = tmClient = injector.getInstance(TerremarkVCloudClient.class);
|
connection = tmClient = injector.getInstance(TerremarkVCloudClient.class);
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class TerremarkVCloudComputeClientLiveTest {
|
||||||
String account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
String account = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
Injector injector = new TerremarkVCloudContextBuilder(new TerremarkVCloudPropertiesBuilder(
|
Injector injector = new TerremarkVCloudContextBuilder(new TerremarkVCloudPropertiesBuilder(
|
||||||
account, key).relaxSSLHostname().build()).withModules(new Log4JLoggingModule(),
|
account, key).build()).withModules(new Log4JLoggingModule(),
|
||||||
new JschSshClientModule()).buildInjector();
|
new JschSshClientModule()).buildInjector();
|
||||||
client = injector.getInstance(TerremarkVCloudComputeClient.class);
|
client = injector.getInstance(TerremarkVCloudComputeClient.class);
|
||||||
tmClient = injector.getInstance(TerremarkVCloudClient.class);
|
tmClient = injector.getInstance(TerremarkVCloudClient.class);
|
||||||
|
|
Loading…
Reference in New Issue