From a6145cfae98ab16461cf10c7d28253a09ff59432 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Tue, 4 Jan 2011 23:41:38 +0100 Subject: [PATCH] Issue 440: added provider module for googlestorage --- allblobstore/pom.xml | 5 + .../org/jclouds/s3/S3AsyncClientTest.java | 128 ++++++++-------- apis/s3/src/test/resources/log4j.xml | 63 +------- providers/googlestorage/pom.xml | 143 ++++++++++++++++++ .../GoogleStoragePropertiesBuilder.java | 52 +++++++ .../GoogleStorageAsyncClientTestDisabled.java | 37 +++++ .../GoogleStorageClientLiveTest.java | 33 ++++ .../GoogleStorageBlobIntegrationLiveTest.java | 40 +++++ .../blobstore/GoogleStorageBlobLiveTest.java | 31 ++++ ...ogleStorageBlobMapIntegrationLiveTest.java | 31 ++++ .../GoogleStorageBlobSignerLiveTest.java | 32 ++++ ...leStorageContainerIntegrationLiveTest.java | 31 ++++ .../GoogleStorageContainerLiveTest.java | 31 ++++ ...rageInputStreamMapIntegrationLiveTest.java | 31 ++++ ...ogleStorageServiceIntegrationLiveTest.java | 31 ++++ .../GoogleStorageTestInitializer.java | 51 +++++++ providers/pom.xml | 1 + 17 files changed, 647 insertions(+), 124 deletions(-) create mode 100644 providers/googlestorage/pom.xml create mode 100644 providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStoragePropertiesBuilder.java create mode 100644 providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageAsyncClientTestDisabled.java create mode 100644 providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageClientLiveTest.java create mode 100644 providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobIntegrationLiveTest.java create mode 100644 providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobLiveTest.java create mode 100644 providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobMapIntegrationLiveTest.java create mode 100644 providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobSignerLiveTest.java create mode 100644 providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerIntegrationLiveTest.java create mode 100644 providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerLiveTest.java create mode 100644 providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageInputStreamMapIntegrationLiveTest.java create mode 100644 providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageServiceIntegrationLiveTest.java create mode 100644 providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageTestInitializer.java diff --git a/allblobstore/pom.xml b/allblobstore/pom.xml index e3521ae5cf..caeb0c5d05 100644 --- a/allblobstore/pom.xml +++ b/allblobstore/pom.xml @@ -39,6 +39,11 @@ aws-s3 ${project.version} + + org.jclouds.provider + googlestorage + ${project.version} + ${project.groupId} jclouds-azure diff --git a/apis/s3/src/test/java/org/jclouds/s3/S3AsyncClientTest.java b/apis/s3/src/test/java/org/jclouds/s3/S3AsyncClientTest.java index b852ab3804..6d60aaebaf 100644 --- a/apis/s3/src/test/java/org/jclouds/s3/S3AsyncClientTest.java +++ b/apis/s3/src/test/java/org/jclouds/s3/S3AsyncClientTest.java @@ -82,6 +82,8 @@ import com.google.inject.Module; @Test(groups = "unit", testName = "S3AsyncClientTest") public class S3AsyncClientTest extends BaseS3AsyncClientTest { + protected String url = "s3.amazonaws.com"; + public void testAllRegions() throws SecurityException, NoSuchMethodException, IOException { Method method = S3AsyncClient.class.getMethod("putBucketInRegion", String.class, String.class, Array.newInstance(PutBucketOptions.class, 0).getClass()); @@ -94,16 +96,16 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("getBucketLocation", String.class); HttpRequest request = processor.createRequest(method, "bucket"); - assertRequestLineEquals(request, "GET https://bucket.s3.amazonaws.com/?location HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "GET https://bucket." + url + "/?location HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); request = filter.filter(request); - assertRequestLineEquals(request, "GET https://bucket.s3.amazonaws.com/?location HTTP/1.1"); - assertNonPayloadHeadersEqual( - request, - "Authorization: AWS identity:2fFTeYJTDwiJmaAkKj732RjNbOg=\nDate: 2009-11-08T15:54:08.897Z\nHost: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "GET https://bucket." + url + "/?location HTTP/1.1"); + assertNonPayloadHeadersEqual(request, + "Authorization: AWS identity:2fFTeYJTDwiJmaAkKj732RjNbOg=\nDate: 2009-11-08T15:54:08.897Z\nHost: bucket." + + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -117,8 +119,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("getBucketPayer", String.class); HttpRequest request = processor.createRequest(method, "bucket"); - assertRequestLineEquals(request, "GET https://bucket.s3.amazonaws.com/?requestPayment HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "GET https://bucket." + url + "/?requestPayment HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -132,12 +134,10 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("setBucketPayer", String.class, Payer.class); HttpRequest request = processor.createRequest(method, "bucket", Payer.BUCKET_OWNER); - assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/?requestPayment HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); - assertPayloadEquals( - request, - "BucketOwner", - "text/xml", false); + assertRequestLineEquals(request, "PUT https://bucket." + url + "/?requestPayment HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); + assertPayloadEquals(request, "BucketOwner", "text/xml", false); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertSaxResponseParserClassEquals(method, null); @@ -150,12 +150,10 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("setBucketPayer", String.class, Payer.class); HttpRequest request = processor.createRequest(method, "bucket", Payer.REQUESTER); - assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/?requestPayment HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); - assertPayloadEquals( - request, - "Requester", - "text/xml", false); + assertRequestLineEquals(request, "PUT https://bucket." + url + "/?requestPayment HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); + assertPayloadEquals(request, "Requester", "text/xml", false); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertSaxResponseParserClassEquals(method, null); @@ -169,8 +167,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Array.newInstance(ListBucketOptions.class, 0).getClass()); HttpRequest request = processor.createRequest(method, "bucket"); - assertRequestLineEquals(request, "GET https://bucket.s3.amazonaws.com/ HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "GET https://bucket." + url + "/ HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -184,8 +182,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("bucketExists", String.class); HttpRequest request = processor.createRequest(method, "bucket"); - assertRequestLineEquals(request, "HEAD https://bucket.s3.amazonaws.com/?max-keys=0 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "HEAD https://bucket." + url + "/?max-keys=0 HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); @@ -211,9 +209,9 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { HttpRequest request = processor.createRequest(method, "sourceBucket", "sourceObject", "destinationbucket", "destinationObject"); - assertRequestLineEquals(request, "PUT https://destinationbucket.s3.amazonaws.com/destinationObject HTTP/1.1"); - assertNonPayloadHeadersEqual(request, - "Host: destinationbucket.s3.amazonaws.com\nx-amz-copy-source: /sourceBucket/sourceObject\n"); + assertRequestLineEquals(request, "PUT https://destinationbucket." + url + "/destinationObject HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: destinationbucket." + url + + "\nx-amz-copy-source: /sourceBucket/sourceObject\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -227,8 +225,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("deleteBucketIfEmpty", String.class); HttpRequest request = processor.createRequest(method, "bucket"); - assertRequestLineEquals(request, "DELETE https://bucket.s3.amazonaws.com/ HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "DELETE https://bucket." + url + "/ HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); @@ -242,8 +240,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("deleteObject", String.class, String.class); HttpRequest request = processor.createRequest(method, "bucket", "object"); - assertRequestLineEquals(request, "DELETE https://bucket.s3.amazonaws.com/object HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "DELETE https://bucket." + url + "/object HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); @@ -258,8 +256,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("getBucketACL", String.class); HttpRequest request = processor.createRequest(method, "bucket"); - assertRequestLineEquals(request, "GET https://bucket.s3.amazonaws.com/?acl HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "GET https://bucket." + url + "/?acl HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -274,8 +272,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("getObject", String.class, String.class, GetOptions[].class); HttpRequest request = processor.createRequest(method, "bucket", "object"); - assertRequestLineEquals(request, "GET https://bucket.s3.amazonaws.com/object HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "GET https://bucket." + url + "/object HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseObjectFromHeadersAndHttpContent.class); @@ -290,8 +288,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("getObjectACL", String.class, String.class); HttpRequest request = processor.createRequest(method, "bucket", "object"); - assertRequestLineEquals(request, "GET https://bucket.s3.amazonaws.com/object?acl HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "GET https://bucket." + url + "/object?acl HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -306,8 +304,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("objectExists", String.class, String.class); HttpRequest request = processor.createRequest(method, "bucket", "object"); - assertRequestLineEquals(request, "HEAD https://bucket.s3.amazonaws.com/object HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "HEAD https://bucket." + url + "/object HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); @@ -322,8 +320,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("headObject", String.class, String.class); HttpRequest request = processor.createRequest(method, "bucket", "object"); - assertRequestLineEquals(request, "HEAD https://bucket.s3.amazonaws.com/object HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "HEAD https://bucket." + url + "/object HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseObjectMetadataFromHeaders.class); @@ -337,8 +335,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("listOwnedBuckets"); HttpRequest request = processor.createRequest(method); - assertRequestLineEquals(request, "GET https://s3.amazonaws.com/ HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: s3.amazonaws.com\n"); + assertRequestLineEquals(request, "GET https://" + url + "/ HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: " + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -358,11 +356,13 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { HttpRequest request = processor.createRequest(method, "bucket", AccessControlList.fromCannedAccessPolicy(CannedAccessPolicy.PRIVATE, "1234")); - assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/?acl HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "PUT https://bucket." + url + "/?acl HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals( request, - "12341234FULL_CONTROL", + "12341234FULL_CONTROL", "text/xml", false); assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); @@ -378,8 +378,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Array.newInstance(PutBucketOptions.class, 0).getClass()); HttpRequest request = processor.createRequest(method, (String) null, "bucket"); - assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/ HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "PUT https://bucket." + url + "/ HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); @@ -395,8 +395,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Array.newInstance(PutBucketOptions.class, 0).getClass()); HttpRequest request = processor.createRequest(method, "EU", "bucket"); - assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/ HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "PUT https://bucket." + url + "/ HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, "EU", "text/xml", false); @@ -416,8 +416,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { HttpRequest request = processor.createRequest(method, "bucket", blobToS3Object.apply(BindBlobToMultipartFormTest.TEST_BLOB)); - assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/hello HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "PUT https://bucket." + url + "/hello HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, "hello", "text/plain", false); assertResponseParserClassEquals(method, request, ParseETagHeader.class); @@ -433,11 +433,13 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { HttpRequest request = processor.createRequest(method, "bucket", "key", AccessControlList.fromCannedAccessPolicy(CannedAccessPolicy.PRIVATE, "1234")); - assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/key?acl HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "PUT https://bucket." + url + "/key?acl HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals( request, - "12341234FULL_CONTROL", + "12341234FULL_CONTROL", "text/xml", false); assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); @@ -451,8 +453,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("getBucketLogging", String.class); HttpRequest request = processor.createRequest(method, "bucket"); - assertRequestLineEquals(request, "GET https://bucket.s3.amazonaws.com/?logging HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "GET https://bucket." + url + "/?logging HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseSax.class); @@ -466,10 +468,10 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { Method method = S3AsyncClient.class.getMethod("disableBucketLogging", String.class); HttpRequest request = processor.createRequest(method, "bucket"); - assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/?logging HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); - assertPayloadEquals(request, "", - "text/xml", false); + assertRequestLineEquals(request, "PUT https://bucket." + url + "/?logging HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); + assertPayloadEquals(request, "", "text/xml", + false); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertSaxResponseParserClassEquals(method, null); @@ -487,8 +489,8 @@ public class S3AsyncClientTest extends BaseS3AsyncClientTest { new BucketLogging("mylogs", "access_log-", ImmutableSet. of(new Grant(new EmailAddressGrantee( "adrian@jclouds.org"), Permission.FULL_CONTROL)))); - assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/?logging HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n"); + assertRequestLineEquals(request, "PUT https://bucket." + url + "/?logging HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n"); assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/bucket_logging.xml")), "text/xml", false); diff --git a/apis/s3/src/test/resources/log4j.xml b/apis/s3/src/test/resources/log4j.xml index 5b548a0f48..8799a8dd70 100644 --- a/apis/s3/src/test/resources/log4j.xml +++ b/apis/s3/src/test/resources/log4j.xml @@ -81,58 +81,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -158,22 +106,15 @@ - - - - + - - - - @@ -182,4 +123,4 @@ - \ No newline at end of file + diff --git a/providers/googlestorage/pom.xml b/providers/googlestorage/pom.xml new file mode 100644 index 0000000000..fbc309b92a --- /dev/null +++ b/providers/googlestorage/pom.xml @@ -0,0 +1,143 @@ + + + + + 4.0.0 + + org.jclouds.provider + jclouds-providers-project + 1.0-SNAPSHOT + ../pom.xml + + googlestorage + jclouds Google Storage for Developers provider + Simple Storage Service (S3) implementation targeted to Google Storage for Developers + + + org.jclouds.googlestorage.blobstore.GoogleStorageTestInitializer + https://commondatastorage.googleapis.com + 2006-03-01 + ${test.googlestorage.identity} + ${test.googlestorage.credential} + + + + + org.jclouds.api + s3 + ${project.version} + jar + + + org.jclouds.api + s3 + ${project.version} + test-jar + test + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds + jclouds-blobstore + ${project.version} + test-jar + test + + + org.jclouds + jclouds-log4j + ${project.version} + test + + + log4j + log4j + 1.2.16 + test + + + + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration + integration-test + + test + + + + + test.googlestorage.endpoint + ${test.googlestorage.endpoint} + + + test.googlestorage.apiversion + ${test.googlestorage.apiversion} + + + test.googlestorage.identity + ${test.googlestorage.identity} + + + test.googlestorage.credential + ${test.googlestorage.credential} + + + test.initializer + ${test.initializer} + + + jclouds.blobstore.httpstream.url + ${jclouds.blobstore.httpstream.url} + + + jclouds.blobstore.httpstream.md5 + ${jclouds.blobstore.httpstream.md5} + + + + + + + + + + + + + + diff --git a/providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStoragePropertiesBuilder.java b/providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStoragePropertiesBuilder.java new file mode 100644 index 0000000000..066c59c3e1 --- /dev/null +++ b/providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStoragePropertiesBuilder.java @@ -0,0 +1,52 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage; + +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.location.reference.LocationConstants.PROPERTY_REGIONS; + +import java.util.Properties; + +import org.jclouds.s3.S3PropertiesBuilder; + +/** + * Builds properties used in Google Storage + * + * @author Adrian Cole + */ +public class GoogleStoragePropertiesBuilder extends S3PropertiesBuilder { + @Override + protected Properties defaultProperties() { + Properties properties = super.defaultProperties(); + properties.setProperty(PROPERTY_AUTH_TAG, "GOOG1"); + properties.setProperty(PROPERTY_HEADER_TAG, "goog"); + properties.setProperty(PROPERTY_REGIONS, "GoogleStorage"); + properties.setProperty(PROPERTY_ENDPOINT, "https://commondatastorage.googleapis.com"); + properties.setProperty(PROPERTY_ENDPOINT + ".GoogleStorage", "https://commondatastorage.googleapis.com"); + return properties; + } + + public GoogleStoragePropertiesBuilder(Properties properties) { + super(properties); + } + +} diff --git a/providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageAsyncClientTestDisabled.java b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageAsyncClientTestDisabled.java new file mode 100644 index 0000000000..93de2e29a8 --- /dev/null +++ b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageAsyncClientTestDisabled.java @@ -0,0 +1,37 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage; + +import org.testng.annotations.Test; + +/** + * @author Adrian Cole + */ +// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire +@Test(enabled = false, groups = "unit", testName = "GoogleStorageAsyncClientTest") +public class GoogleStorageAsyncClientTestDisabled extends org.jclouds.s3.S3AsyncClientTest { + + public GoogleStorageAsyncClientTestDisabled() { + this.provider = "googlestorage"; + this.url = "commondatastorage.googleapis.com"; + } + + // TODO parameterize this test so that it can pass +} diff --git a/providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageClientLiveTest.java b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageClientLiveTest.java new file mode 100644 index 0000000000..cb67cab3a3 --- /dev/null +++ b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageClientLiveTest.java @@ -0,0 +1,33 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage; + +import org.jclouds.s3.S3ClientLiveTest; +import org.testng.annotations.Test; + +/** + * Tests behavior of {@code S3Client} + * + * @author Adrian Cole + */ +@Test(groups = "live", sequential = true, testName = "GoogleStorageClientLiveTest") +public class GoogleStorageClientLiveTest extends S3ClientLiveTest { + +} diff --git a/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobIntegrationLiveTest.java b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobIntegrationLiveTest.java new file mode 100644 index 0000000000..04401d42ef --- /dev/null +++ b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobIntegrationLiveTest.java @@ -0,0 +1,40 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage.blobstore; + +import java.io.IOException; +import java.util.concurrent.ExecutionException; + +import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest; +import org.testng.annotations.Test; + +/** + * @author Adrian Cole + */ +@Test(groups = "live", testName = "GoogleStorageBlobIntegrationLiveTest") +public class GoogleStorageBlobIntegrationLiveTest extends BaseBlobIntegrationTest { + + @Override + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPutObjectStream() throws InterruptedException, IOException, ExecutionException { + super.testPutObjectStream(); + } + +} diff --git a/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobLiveTest.java b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobLiveTest.java new file mode 100644 index 0000000000..d91695b220 --- /dev/null +++ b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobLiveTest.java @@ -0,0 +1,31 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage.blobstore; + +import org.jclouds.blobstore.integration.internal.BaseBlobLiveTest; +import org.testng.annotations.Test; + +/** + * @author Adrian Cole + */ +@Test(groups = "live", testName = "GoogleStorageBlobLiveTest") +public class GoogleStorageBlobLiveTest extends BaseBlobLiveTest { + +} diff --git a/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobMapIntegrationLiveTest.java b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobMapIntegrationLiveTest.java new file mode 100644 index 0000000000..cd08198a48 --- /dev/null +++ b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobMapIntegrationLiveTest.java @@ -0,0 +1,31 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage.blobstore; + +import org.jclouds.blobstore.integration.internal.BaseBlobMapIntegrationTest; +import org.testng.annotations.Test; + +/** + * @author Adrian Cole + */ +@Test(groups = "live", testName = "GoogleStorageBlobMapIntegrationLiveTest") +public class GoogleStorageBlobMapIntegrationLiveTest extends BaseBlobMapIntegrationTest { + +} diff --git a/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobSignerLiveTest.java b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobSignerLiveTest.java new file mode 100644 index 0000000000..6db43758c9 --- /dev/null +++ b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobSignerLiveTest.java @@ -0,0 +1,32 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage.blobstore; + +import org.jclouds.blobstore.integration.internal.BaseBlobSignerLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "GoogleStorageBlobSignerLiveTest") +public class GoogleStorageBlobSignerLiveTest extends BaseBlobSignerLiveTest { + +} diff --git a/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerIntegrationLiveTest.java b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerIntegrationLiveTest.java new file mode 100644 index 0000000000..dbef99f800 --- /dev/null +++ b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerIntegrationLiveTest.java @@ -0,0 +1,31 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage.blobstore; + +import org.jclouds.blobstore.integration.internal.BaseContainerIntegrationTest; +import org.testng.annotations.Test; + +/** + * @author Adrian Cole + */ +@Test(groups = "live", testName = "GoogleStorageContainerIntegrationLiveTest") +public class GoogleStorageContainerIntegrationLiveTest extends BaseContainerIntegrationTest { + +} diff --git a/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerLiveTest.java b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerLiveTest.java new file mode 100644 index 0000000000..d553a6da29 --- /dev/null +++ b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerLiveTest.java @@ -0,0 +1,31 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage.blobstore; + +import org.jclouds.blobstore.integration.internal.BaseContainerLiveTest; +import org.testng.annotations.Test; + +/** + * @author Adrian Cole + */ +@Test(groups = "live", testName = "GoogleStorageContainerLiveTest") +public class GoogleStorageContainerLiveTest extends BaseContainerLiveTest { + +} diff --git a/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageInputStreamMapIntegrationLiveTest.java b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageInputStreamMapIntegrationLiveTest.java new file mode 100644 index 0000000000..7d7d0ee071 --- /dev/null +++ b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageInputStreamMapIntegrationLiveTest.java @@ -0,0 +1,31 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage.blobstore; + +import org.jclouds.blobstore.integration.internal.BaseInputStreamMapIntegrationTest; +import org.testng.annotations.Test; + +/** + * @author Adrian Cole + */ +@Test(groups = "live", testName = "GoogleStorageInputStreamMapIntegrationLiveTest") +public class GoogleStorageInputStreamMapIntegrationLiveTest extends BaseInputStreamMapIntegrationTest { + +} diff --git a/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageServiceIntegrationLiveTest.java b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageServiceIntegrationLiveTest.java new file mode 100644 index 0000000000..27f1deef4f --- /dev/null +++ b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageServiceIntegrationLiveTest.java @@ -0,0 +1,31 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage.blobstore; + +import org.jclouds.blobstore.integration.internal.BaseServiceIntegrationTest; +import org.testng.annotations.Test; + +/** + * @author Adrian Cole + */ +@Test(groups = "live", testName = "GoogleStorageServiceIntegrationLiveTest") +public class GoogleStorageServiceIntegrationLiveTest extends BaseServiceIntegrationTest { + +} diff --git a/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageTestInitializer.java b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageTestInitializer.java new file mode 100644 index 0000000000..990d54f204 --- /dev/null +++ b/providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageTestInitializer.java @@ -0,0 +1,51 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.googlestorage.blobstore; + +import java.io.IOException; + +import org.jclouds.blobstore.BlobStoreContext; +import org.jclouds.blobstore.BlobStoreContextFactory; +import org.jclouds.blobstore.integration.TransientBlobStoreTestInitializer; +import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest; +import org.jclouds.logging.log4j.config.Log4JLoggingModule; + +import com.google.common.collect.ImmutableSet; +import com.google.inject.Module; + +/** + * + * @author Adrian Cole + */ +public class GoogleStorageTestInitializer extends TransientBlobStoreTestInitializer { + + public GoogleStorageTestInitializer() { + provider = "googlestorage"; + BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true; + } + + @Override + protected BlobStoreContext createLiveContext(Module configurationModule, String endpoint, String apiversion, + String app, String identity, String credential) throws IOException { + return new BlobStoreContextFactory().createContext(provider, ImmutableSet.of(configurationModule, + new Log4JLoggingModule()), setupProperties(endpoint, apiversion, identity, credential)); + } + +} diff --git a/providers/pom.xml b/providers/pom.xml index 5444b45935..57f49f6283 100644 --- a/providers/pom.xml +++ b/providers/pom.xml @@ -39,5 +39,6 @@ aws-simpledb aws-elb aws-s3 + googlestorage