From 96c9758da8849553330dfbd4544942cc344f460f Mon Sep 17 00:00:00 2001 From: "adrian.f.cole" Date: Tue, 15 Dec 2009 01:05:58 +0000 Subject: [PATCH] Issue 128: added atmos to vfs git-svn-id: http://jclouds.googlecode.com/svn/trunk@2427 3d8758e0-26b5-11de-8745-db77d3ebf521 --- .../saas/config/AtmosStorageRestClientModuleTest.java | 4 ++-- .../saas/internal/StubAtmosStorageAsyncClient.java | 2 +- core/src/main/java/org/jclouds/http/HttpUtils.java | 2 +- .../src/test/java/org/jclouds/domain/CredentialsTest.java | 8 +++++++- core/src/test/java/org/jclouds/util/HttpUtilsTest.java | 7 +++++++ pom.xml | 1 + tools/vfs/pom.xml | 5 +++++ tools/vfs/src/main/resources/jclouds.properties | 4 +++- tools/vfs/src/test/resources/jclouds.properties | 4 +++- .../jclouds/vcloud/terremark/InternetServiceLiveTest.java | 8 ++++---- 10 files changed, 34 insertions(+), 11 deletions(-) diff --git a/atmos/src/test/java/org/jclouds/atmosonline/saas/config/AtmosStorageRestClientModuleTest.java b/atmos/src/test/java/org/jclouds/atmosonline/saas/config/AtmosStorageRestClientModuleTest.java index fe71cbb9fc..319cff64e6 100644 --- a/atmos/src/test/java/org/jclouds/atmosonline/saas/config/AtmosStorageRestClientModuleTest.java +++ b/atmos/src/test/java/org/jclouds/atmosonline/saas/config/AtmosStorageRestClientModuleTest.java @@ -26,13 +26,13 @@ package org.jclouds.atmosonline.saas.config; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; -import org.bouncycastle.util.encoders.Base64; import org.jclouds.atmosonline.saas.handlers.AtmosStorageClientErrorRetryHandler; import org.jclouds.atmosonline.saas.handlers.ParseAtmosStorageErrorFromXmlContent; import org.jclouds.atmosonline.saas.reference.AtmosStorageConstants; import org.jclouds.concurrent.WithinThreadExecutorService; import org.jclouds.concurrent.config.ExecutorServiceModule; import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.encryption.internal.Base64; import org.jclouds.http.functions.config.ParserModule; import org.jclouds.http.handlers.DelegatingErrorHandler; import org.jclouds.http.handlers.DelegatingRetryHandler; @@ -62,7 +62,7 @@ public class AtmosStorageRestClientModuleTest { bindConstant().annotatedWith(Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_UID)) .to("uid"); bindConstant().annotatedWith(Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_KEY)) - .to(new String(Base64.encode("key".getBytes()))); + .to(new String(Base64.encodeBytes("key".getBytes()))); bindConstant().annotatedWith( Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_SESSIONINTERVAL)).to("2"); } diff --git a/atmos/src/test/java/org/jclouds/atmosonline/saas/internal/StubAtmosStorageAsyncClient.java b/atmos/src/test/java/org/jclouds/atmosonline/saas/internal/StubAtmosStorageAsyncClient.java index 43c2a1d0cf..3f0beb0e29 100644 --- a/atmos/src/test/java/org/jclouds/atmosonline/saas/internal/StubAtmosStorageAsyncClient.java +++ b/atmos/src/test/java/org/jclouds/atmosonline/saas/internal/StubAtmosStorageAsyncClient.java @@ -215,7 +215,7 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient { String container = path.substring(0, path.indexOf('/')); String blobName = path.substring(path.indexOf('/') + 1); try { - blobStore.blobMetadata(container, blobName); + blobStore.blobMetadata(container, blobName).get(); return true; } catch (KeyNotFoundException e) { return false; diff --git a/core/src/main/java/org/jclouds/http/HttpUtils.java b/core/src/main/java/org/jclouds/http/HttpUtils.java index 14c6fe5866..2526172d80 100644 --- a/core/src/main/java/org/jclouds/http/HttpUtils.java +++ b/core/src/main/java/org/jclouds/http/HttpUtils.java @@ -170,7 +170,7 @@ public class HttpUtils { String account = matcher.group(2); String key = matcher.group(3); return URI - .create(String.format("%s://%s:%s@%s", scheme, account, urlEncode(key), rest)); + .create(String.format("%s://%s:%s@%s", scheme, urlEncode(account), urlEncode(key), rest)); } else { throw new IllegalArgumentException("bad syntax"); } diff --git a/core/src/test/java/org/jclouds/domain/CredentialsTest.java b/core/src/test/java/org/jclouds/domain/CredentialsTest.java index 5c1ac78eb1..aa856de7ab 100644 --- a/core/src/test/java/org/jclouds/domain/CredentialsTest.java +++ b/core/src/test/java/org/jclouds/domain/CredentialsTest.java @@ -40,7 +40,13 @@ public class CredentialsTest { .create("blobstore://account:Base64==@azureblob/container-hyphen/prefix")); assertEquals(creds.account, "account"); assertEquals(creds.key, "Base64=="); - + } + + public void testAtmos() { + Credentials creds = Credentials.parse(URI + .create("blobstore://domain%2Fuser:Base64%3D%3D@azureblob/container-hyphen/prefix")); + assertEquals(creds.account, "domain/user"); + assertEquals(creds.key, "Base64=="); } public void testCloudFiles() { diff --git a/core/src/test/java/org/jclouds/util/HttpUtilsTest.java b/core/src/test/java/org/jclouds/util/HttpUtilsTest.java index 0c1e32403c..abcf7414c0 100644 --- a/core/src/test/java/org/jclouds/util/HttpUtilsTest.java +++ b/core/src/test/java/org/jclouds/util/HttpUtilsTest.java @@ -50,6 +50,13 @@ public class HttpUtilsTest extends PerformanceTest { assertEquals(HttpUtils.urlEncode("/read-tests/ tep", '/'), "/read-tests/%20tep"); } + public void testAtmos() { + URI creds = HttpUtils + .createUri("blobstore://domain/user:Base64==@azureblob/container-hyphen/prefix"); + assertEquals(creds, URI + .create("blobstore://domain%2Fuser:Base64%3D%3D@azureblob/container-hyphen/prefix")); + } + public void testAzure() { URI creds = HttpUtils .createUri("blobstore://account:Base64==@azureblob/container-hyphen/prefix"); diff --git a/pom.xml b/pom.xml index 381ca6e458..3243c76a18 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,7 @@ scriptbuilder aws azure + atmos mezeo nirvanix rackspace diff --git a/tools/vfs/pom.xml b/tools/vfs/pom.xml index 410d0c4192..811fa94c54 100644 --- a/tools/vfs/pom.xml +++ b/tools/vfs/pom.xml @@ -57,6 +57,11 @@ jclouds-aws ${project.version} + + ${project.groupId} + jclouds-atmos + ${project.version} + ${project.groupId} jclouds-azure diff --git a/tools/vfs/src/main/resources/jclouds.properties b/tools/vfs/src/main/resources/jclouds.properties index 9dbb7e82e7..dda19bcb6c 100644 --- a/tools/vfs/src/main/resources/jclouds.properties +++ b/tools/vfs/src/main/resources/jclouds.properties @@ -21,9 +21,11 @@ # under the License. # ==================================================================== # +atmos.contextbuilder=org.jclouds.atmosonline.saas.blobstore.AtmosBlobStoreContextBuilder +atmos.propertiesbuilder=org.jclouds.atmosonline.saas.AtmosStoragePropertiesBuilder azureblob.contextbuilder=org.jclouds.azure.storage.blob.blobstore.AzureBlobStoreContextBuilder azureblob.propertiesbuilder=org.jclouds.azure.storage.blob.AzureBlobPropertiesBuilder cloudfiles.contextbuilder=org.jclouds.rackspace.cloudfiles.blobstore.CloudFilesBlobStoreContextBuilder cloudfiles.propertiesbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesPropertiesBuilder s3.contextbuilder=org.jclouds.aws.s3.blobstore.S3BlobStoreContextBuilder -s3.propertiesbuilder=org.jclouds.aws.s3.S3PropertiesBuilder \ No newline at end of file +s3.propertiesbuilder=org.jclouds.aws.s3.S3PropertiesBuilder diff --git a/tools/vfs/src/test/resources/jclouds.properties b/tools/vfs/src/test/resources/jclouds.properties index 7c2e244c6f..ed3294bf95 100644 --- a/tools/vfs/src/test/resources/jclouds.properties +++ b/tools/vfs/src/test/resources/jclouds.properties @@ -21,6 +21,8 @@ # under the License. # ==================================================================== # +atmos.contextbuilder=org.jclouds.atmosonline.saas.blobstore.AtmosBlobStoreContextBuilder +atmos.propertiesbuilder=org.jclouds.atmosonline.saas.AtmosStoragePropertiesBuilder azureblob.contextbuilder=org.jclouds.azure.storage.blob.blobstore.AzureBlobStoreContextBuilder azureblob.propertiesbuilder=org.jclouds.azure.storage.blob.AzureBlobPropertiesBuilder cloudfiles.contextbuilder=org.jclouds.rackspace.cloudfiles.blobstore.CloudFilesBlobStoreContextBuilder @@ -28,4 +30,4 @@ cloudfiles.propertiesbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesProperti s3.contextbuilder=org.jclouds.aws.s3.blobstore.S3BlobStoreContextBuilder s3.propertiesbuilder=org.jclouds.aws.s3.S3PropertiesBuilder stub.contextbuilder=org.jclouds.blobstore.integration.StubBlobStoreContextBuilder -stub.propertiesbuilder=org.jclouds.blobstore.integration.StubPropertiesBuilder \ No newline at end of file +stub.propertiesbuilder=org.jclouds.blobstore.integration.StubPropertiesBuilder diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/InternetServiceLiveTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/InternetServiceLiveTest.java index 42725208e7..e8c93e2469 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/InternetServiceLiveTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/InternetServiceLiveTest.java @@ -67,10 +67,10 @@ public class InternetServiceLiveTest { services.add(is); PublicIpAddress ip = is.getPublicIpAddress(); // current bug in terremark - // for (int port : new int[] { 80, 8080 }) { - // services.add(tmClient.addInternetServiceToExistingIp(ip.getId(), "test-" + port, - // Protocol.HTTP, port)); - // } +// for (int port : new int[] { 80, 8080 }) { +// services.add(tmClient.addInternetServiceToExistingIp(ip.getId(), "test-" + port, +// Protocol.HTTP, port)); +// } print(tmClient.getInternetServicesOnPublicIp(ip.getId())); }