Issue 128: added atmos to vfs

git-svn-id: http://jclouds.googlecode.com/svn/trunk@2427 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-12-15 01:05:58 +00:00
parent 6e74a573df
commit 96c9758da8
10 changed files with 34 additions and 11 deletions

View File

@ -26,13 +26,13 @@ package org.jclouds.atmosonline.saas.config;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse; 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.AtmosStorageClientErrorRetryHandler;
import org.jclouds.atmosonline.saas.handlers.ParseAtmosStorageErrorFromXmlContent; import org.jclouds.atmosonline.saas.handlers.ParseAtmosStorageErrorFromXmlContent;
import org.jclouds.atmosonline.saas.reference.AtmosStorageConstants; import org.jclouds.atmosonline.saas.reference.AtmosStorageConstants;
import org.jclouds.concurrent.WithinThreadExecutorService; import org.jclouds.concurrent.WithinThreadExecutorService;
import org.jclouds.concurrent.config.ExecutorServiceModule; import org.jclouds.concurrent.config.ExecutorServiceModule;
import org.jclouds.date.internal.SimpleDateFormatDateService; import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.encryption.internal.Base64;
import org.jclouds.http.functions.config.ParserModule; import org.jclouds.http.functions.config.ParserModule;
import org.jclouds.http.handlers.DelegatingErrorHandler; import org.jclouds.http.handlers.DelegatingErrorHandler;
import org.jclouds.http.handlers.DelegatingRetryHandler; import org.jclouds.http.handlers.DelegatingRetryHandler;
@ -62,7 +62,7 @@ public class AtmosStorageRestClientModuleTest {
bindConstant().annotatedWith(Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_UID)) bindConstant().annotatedWith(Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_UID))
.to("uid"); .to("uid");
bindConstant().annotatedWith(Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_KEY)) bindConstant().annotatedWith(Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_KEY))
.to(new String(Base64.encode("key".getBytes()))); .to(new String(Base64.encodeBytes("key".getBytes())));
bindConstant().annotatedWith( bindConstant().annotatedWith(
Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_SESSIONINTERVAL)).to("2"); Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_SESSIONINTERVAL)).to("2");
} }

View File

@ -215,7 +215,7 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
String container = path.substring(0, path.indexOf('/')); String container = path.substring(0, path.indexOf('/'));
String blobName = path.substring(path.indexOf('/') + 1); String blobName = path.substring(path.indexOf('/') + 1);
try { try {
blobStore.blobMetadata(container, blobName); blobStore.blobMetadata(container, blobName).get();
return true; return true;
} catch (KeyNotFoundException e) { } catch (KeyNotFoundException e) {
return false; return false;

View File

@ -170,7 +170,7 @@ public class HttpUtils {
String account = matcher.group(2); String account = matcher.group(2);
String key = matcher.group(3); String key = matcher.group(3);
return URI 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 { } else {
throw new IllegalArgumentException("bad syntax"); throw new IllegalArgumentException("bad syntax");
} }

View File

@ -40,7 +40,13 @@ public class CredentialsTest {
.create("blobstore://account:Base64==@azureblob/container-hyphen/prefix")); .create("blobstore://account:Base64==@azureblob/container-hyphen/prefix"));
assertEquals(creds.account, "account"); assertEquals(creds.account, "account");
assertEquals(creds.key, "Base64=="); 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() { public void testCloudFiles() {

View File

@ -50,6 +50,13 @@ public class HttpUtilsTest extends PerformanceTest {
assertEquals(HttpUtils.urlEncode("/read-tests/ tep", '/'), "/read-tests/%20tep"); 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() { public void testAzure() {
URI creds = HttpUtils URI creds = HttpUtils
.createUri("blobstore://account:Base64==@azureblob/container-hyphen/prefix"); .createUri("blobstore://account:Base64==@azureblob/container-hyphen/prefix");

View File

@ -46,6 +46,7 @@
<module>scriptbuilder</module> <module>scriptbuilder</module>
<module>aws</module> <module>aws</module>
<module>azure</module> <module>azure</module>
<module>atmos</module>
<module>mezeo</module> <module>mezeo</module>
<module>nirvanix</module> <module>nirvanix</module>
<module>rackspace</module> <module>rackspace</module>

View File

@ -57,6 +57,11 @@
<artifactId>jclouds-aws</artifactId> <artifactId>jclouds-aws</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jclouds-atmos</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>jclouds-azure</artifactId> <artifactId>jclouds-azure</artifactId>

View File

@ -21,6 +21,8 @@
# under the License. # 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.contextbuilder=org.jclouds.azure.storage.blob.blobstore.AzureBlobStoreContextBuilder
azureblob.propertiesbuilder=org.jclouds.azure.storage.blob.AzureBlobPropertiesBuilder azureblob.propertiesbuilder=org.jclouds.azure.storage.blob.AzureBlobPropertiesBuilder
cloudfiles.contextbuilder=org.jclouds.rackspace.cloudfiles.blobstore.CloudFilesBlobStoreContextBuilder cloudfiles.contextbuilder=org.jclouds.rackspace.cloudfiles.blobstore.CloudFilesBlobStoreContextBuilder

View File

@ -21,6 +21,8 @@
# under the License. # 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.contextbuilder=org.jclouds.azure.storage.blob.blobstore.AzureBlobStoreContextBuilder
azureblob.propertiesbuilder=org.jclouds.azure.storage.blob.AzureBlobPropertiesBuilder azureblob.propertiesbuilder=org.jclouds.azure.storage.blob.AzureBlobPropertiesBuilder
cloudfiles.contextbuilder=org.jclouds.rackspace.cloudfiles.blobstore.CloudFilesBlobStoreContextBuilder cloudfiles.contextbuilder=org.jclouds.rackspace.cloudfiles.blobstore.CloudFilesBlobStoreContextBuilder