You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by an...@apache.org on 2014/10/07 00:30:38 UTC
[01/52] [abbrv] JCLOUDS-150 add SubmissionAsyncBlobStore;
unasync s3 and aws-s3
Repository: jclouds
Updated Branches:
refs/heads/use-agentproxy-008 54fdff0ad -> 5ee084af1 (forced update)
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
index 56b0a13..bb25f2f 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
@@ -36,10 +36,8 @@ import javax.annotation.Resource;
import javax.inject.Named;
import org.jclouds.Constants;
-import org.jclouds.aws.s3.AWSS3ApiMetadata;
-import org.jclouds.aws.s3.AWSS3AsyncClient;
import org.jclouds.aws.s3.AWSS3Client;
-import org.jclouds.aws.s3.blobstore.AWSS3AsyncBlobStore;
+import org.jclouds.aws.s3.blobstore.AWSS3BlobStore;
import org.jclouds.aws.s3.blobstore.strategy.AsyncMultipartUploadStrategy;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.internal.BlobRuntimeException;
@@ -93,13 +91,13 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
@Named(Constants.PROPERTY_REQUEST_TIMEOUT)
protected Long maxTime;
- protected final AWSS3AsyncBlobStore ablobstore;
+ protected final AWSS3BlobStore blobstore;
protected final PayloadSlicer slicer;
@Inject
- public ParallelMultipartUploadStrategy(AWSS3AsyncBlobStore ablobstore, PayloadSlicer slicer,
+ public ParallelMultipartUploadStrategy(AWSS3BlobStore blobstore, PayloadSlicer slicer,
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor) {
- this.ablobstore = checkNotNull(ablobstore, "ablobstore");
+ this.blobstore = checkNotNull(blobstore, "blobstore");
this.slicer = checkNotNull(slicer, "slicer");
this.ioExecutor = checkNotNull(ioExecutor, "ioExecutor");
}
@@ -116,11 +114,15 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
latch.countDown();
return;
}
- final AWSS3AsyncClient client = ablobstore.getContext().unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getAsyncApi();
- Payload chunkedPart = slicer.slice(payload, offset, size);
+ final AWSS3Client client = blobstore.getContext().unwrapApi(AWSS3Client.class);
+ final Payload chunkedPart = slicer.slice(payload, offset, size);
logger.debug(String.format("async uploading part %s of %s to container %s with uploadId %s", part, key, container, uploadId));
final long start = System.currentTimeMillis();
- final ListenableFuture<String> futureETag = client.uploadPart(container, key, part, uploadId, chunkedPart);
+ final ListenableFuture<String> futureETag = ioExecutor.submit(new Callable<String>() {
+ @Override public String call() throws Exception {
+ return client.uploadPart(container, key, part, uploadId, chunkedPart);
+ }
+ });
futureETag.addListener(new Runnable() {
@Override
public void run() {
@@ -164,8 +166,7 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
long chunkSize = algorithm.getChunkSize();
long remaining = algorithm.getRemaining();
if (parts > 0) {
- AWSS3Client client = ablobstore
- .getContext().unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi();
+ final AWSS3Client client = blobstore.getContext().unwrapApi(AWSS3Client.class);
String uploadId = null;
final Map<Integer, ListenableFuture<String>> futureParts =
new ConcurrentHashMap<Integer, ListenableFuture<String>>();
@@ -240,8 +241,12 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
// Issue 936: don't just call putBlob, as that will see options=multiPart and
// recursively call this execute method again; instead mark as not multipart
// because it can all fit in one go.
- PutOptions nonMultipartOptions = PutOptions.Builder.multipart(false);
- ListenableFuture<String> futureETag = ablobstore.putBlob(container, blob, nonMultipartOptions);
+ final PutOptions nonMultipartOptions = PutOptions.Builder.multipart(false);
+ ListenableFuture<String> futureETag = ioExecutor.submit(new Callable<String>() {
+ @Override public String call() throws Exception {
+ return blobstore.putBlob(container, blob, nonMultipartOptions);
+ }
+ });
return maxTime != null ?
futureETag.get(maxTime, TimeUnit.SECONDS) : futureETag.get();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3HttpApiModule.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3HttpApiModule.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3HttpApiModule.java
new file mode 100644
index 0000000..dea5438
--- /dev/null
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3HttpApiModule.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.aws.s3.config;
+
+import static org.jclouds.aws.domain.Region.US_STANDARD;
+
+import javax.inject.Singleton;
+
+import org.jclouds.aws.s3.AWSS3Client;
+import org.jclouds.aws.s3.filters.AWSRequestAuthorizeSignature;
+import org.jclouds.aws.s3.predicates.validators.AWSS3BucketNameValidator;
+import org.jclouds.location.Region;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.s3.S3Client;
+import org.jclouds.s3.config.S3HttpApiModule;
+import org.jclouds.s3.filters.RequestAuthorizeSignature;
+import org.jclouds.s3.predicates.validators.BucketNameValidator;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+
+/**
+ * Configures the S3 connection.
+ */
+@ConfiguresHttpApi
+public class AWSS3HttpApiModule extends S3HttpApiModule<AWSS3Client> {
+
+ public AWSS3HttpApiModule() {
+ super(AWSS3Client.class);
+ }
+
+ @Override
+ protected Supplier<String> defaultRegionForBucket(@Region Supplier<String> defaultRegion) {
+ return Suppliers.ofInstance(US_STANDARD);
+ }
+
+ @Override
+ protected void configure() {
+ bind(BucketNameValidator.class).to(AWSS3BucketNameValidator.class);
+ super.configure();
+ }
+
+ @Override
+ protected void bindRequestSigner() {
+ bind(RequestAuthorizeSignature.class).to(AWSRequestAuthorizeSignature.class).in(Scopes.SINGLETON);
+ }
+
+ @Singleton
+ @Provides
+ S3Client provide(AWSS3Client in) {
+ return in;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3RestClientModule.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3RestClientModule.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3RestClientModule.java
deleted file mode 100644
index d7cce11..0000000
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3RestClientModule.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.aws.s3.config;
-
-import static org.jclouds.aws.domain.Region.US_STANDARD;
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import javax.inject.Singleton;
-
-import org.jclouds.aws.s3.AWSS3AsyncClient;
-import org.jclouds.aws.s3.AWSS3Client;
-import org.jclouds.aws.s3.filters.AWSRequestAuthorizeSignature;
-import org.jclouds.aws.s3.predicates.validators.AWSS3BucketNameValidator;
-import org.jclouds.location.Region;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.s3.S3AsyncClient;
-import org.jclouds.s3.S3Client;
-import org.jclouds.s3.config.S3RestClientModule;
-import org.jclouds.s3.filters.RequestAuthorizeSignature;
-import org.jclouds.s3.predicates.validators.BucketNameValidator;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-
-/**
- * Configures the S3 connection.
- */
-@ConfiguresRestClient
-public class AWSS3RestClientModule extends S3RestClientModule<AWSS3Client, AWSS3AsyncClient> {
-
- public AWSS3RestClientModule() {
- super(typeToken(AWSS3Client.class), typeToken(AWSS3AsyncClient.class));
- }
-
- @Override
- protected Supplier<String> defaultRegionForBucket(@Region Supplier<String> defaultRegion) {
- return Suppliers.ofInstance(US_STANDARD);
- }
-
- @Override
- protected void configure() {
- bind(BucketNameValidator.class).to(AWSS3BucketNameValidator.class);
- super.configure();
- }
-
- @Override
- protected void bindRequestSigner() {
- bind(RequestAuthorizeSignature.class).to(AWSRequestAuthorizeSignature.class).in(Scopes.SINGLETON);
- }
-
- @Singleton
- @Provides
- S3Client provide(AWSS3Client in) {
- return in;
- }
-
- @Singleton
- @Provides
- S3AsyncClient provide(AWSS3AsyncClient in) {
- return in;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/domain/DeleteResult.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/domain/DeleteResult.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/domain/DeleteResult.java
index 13b0d38..bc76c65 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/domain/DeleteResult.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/domain/DeleteResult.java
@@ -16,23 +16,21 @@
*/
package org.jclouds.aws.s3.domain;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+import java.util.Set;
+
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.ForwardingSet;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import java.util.Map;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
/**
* Multi-object delete API response
* <p/>
* Contains a list of the keys that were deleted
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/API/multiobjectdeleteapi.html" />
*/
public class DeleteResult extends ForwardingSet<String> {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/AWSRequestAuthorizeSignature.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/AWSRequestAuthorizeSignature.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/AWSRequestAuthorizeSignature.java
index 6bd4ca0..86c1bb9 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/AWSRequestAuthorizeSignature.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/AWSRequestAuthorizeSignature.java
@@ -38,13 +38,7 @@ import org.jclouds.s3.filters.RequestAuthorizeSignature;
import com.google.common.base.Supplier;
-/**
- * Signs the AWS S3 request, supporting temporary signatures.
- *
- * @see <a href=
- * "http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/index.html?RESTAuthentication.html"
- * />
- */
+/** Signs the AWS S3 request, supporting temporary signatures. */
@Singleton
public class AWSRequestAuthorizeSignature extends RequestAuthorizeSignature {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/package-info.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/package-info.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/package-info.java
index b9a9542..c7b006f 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/package-info.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/package-info.java
@@ -14,8 +14,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * This package contains HttpRequestFilters needed to operate the REST api.
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/RESTAuthentication.html" />
- */
+/** This package contains HttpRequestFilters needed to operate the REST api. */
package org.jclouds.aws.s3.filters;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/functions/ETagFromHttpResponseViaRegex.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/functions/ETagFromHttpResponseViaRegex.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/functions/ETagFromHttpResponseViaRegex.java
index a0cae98..46f5837 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/functions/ETagFromHttpResponseViaRegex.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/functions/ETagFromHttpResponseViaRegex.java
@@ -27,9 +27,6 @@ import org.jclouds.http.functions.ReturnStringIf2xx;
import com.google.common.base.Function;
-/**
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadComplete.html" />
- */
@Singleton
public class ETagFromHttpResponseViaRegex implements Function<HttpResponse, String> {
private static Pattern pattern = Pattern.compile("<ETag>([\\S&&[^<]]+)</ETag>");
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/functions/UploadIdFromHttpResponseViaRegex.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/functions/UploadIdFromHttpResponseViaRegex.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/functions/UploadIdFromHttpResponseViaRegex.java
index f537692..9b42714 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/functions/UploadIdFromHttpResponseViaRegex.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/functions/UploadIdFromHttpResponseViaRegex.java
@@ -27,11 +27,6 @@ import org.jclouds.http.functions.ReturnStringIf2xx;
import com.google.common.base.Function;
-/**
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/latest/API/index.html?mpUploadInitiate.html"
- * />
- */
@Singleton
public class UploadIdFromHttpResponseViaRegex implements Function<HttpResponse, String> {
Pattern pattern = Pattern.compile("<UploadId>([\\S&&[^<]]+)</UploadId>");
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/xml/DeleteResultHandler.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/xml/DeleteResultHandler.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/xml/DeleteResultHandler.java
index 5cc796c..96ac8d4 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/xml/DeleteResultHandler.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/xml/DeleteResultHandler.java
@@ -16,14 +16,15 @@
*/
package org.jclouds.aws.s3.xml;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+
import org.jclouds.aws.s3.domain.DeleteResult;
import org.jclouds.http.functions.ParseSax;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
-import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
public class DeleteResultHandler extends ParseSax.HandlerForGeneratedRequestWithResult<DeleteResult> {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/xml/ErrorEntryHandler.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/xml/ErrorEntryHandler.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/xml/ErrorEntryHandler.java
index 1674a89..95305a3 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/xml/ErrorEntryHandler.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/xml/ErrorEntryHandler.java
@@ -16,14 +16,15 @@
*/
package org.jclouds.aws.s3.xml;
-import com.google.common.collect.Maps;
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+
+import java.util.Map;
+
import org.jclouds.aws.s3.domain.DeleteResult;
import org.jclouds.http.functions.ParseSax;
import org.xml.sax.SAXException;
-import java.util.Map;
-
-import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+import com.google.common.collect.Maps;
public class ErrorEntryHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Map.Entry<String, DeleteResult.Error>> {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3AsyncClientTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3AsyncClientTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3AsyncClientTest.java
deleted file mode 100644
index 8b436d3..0000000
--- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3AsyncClientTest.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.aws.s3;
-
-import static org.jclouds.reflect.Reflection2.method;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
-
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.aws.s3.config.AWSS3RestClientModule;
-import org.jclouds.aws.s3.filters.AWSRequestAuthorizeSignature;
-import org.jclouds.aws.s3.functions.ETagFromHttpResponseViaRegex;
-import org.jclouds.aws.s3.functions.UploadIdFromHttpResponseViaRegex;
-import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest;
-import org.jclouds.date.TimeStamp;
-import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.functions.ParseETagHeader;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.http.functions.ReleasePayloadAndReturn;
-import org.jclouds.http.functions.ReturnTrueIf2xx;
-import org.jclouds.io.Payload;
-import org.jclouds.io.Payloads;
-import org.jclouds.location.Region;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.s3.S3AsyncClient;
-import org.jclouds.s3.S3AsyncClientTest;
-import org.jclouds.s3.S3Client;
-import org.jclouds.s3.domain.ObjectMetadata;
-import org.jclouds.s3.domain.ObjectMetadataBuilder;
-import org.jclouds.s3.domain.S3Object;
-import org.jclouds.s3.fallbacks.FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists;
-import org.jclouds.s3.options.CopyObjectOptions;
-import org.jclouds.s3.options.PutBucketOptions;
-import org.jclouds.s3.options.PutObjectOptions;
-import org.jclouds.s3.xml.LocationConstraintHandler;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Functions;
-import com.google.common.base.Optional;
-import com.google.common.base.Supplier;
-import com.google.common.cache.CacheLoader;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.common.reflect.Invokable;
-import com.google.inject.Module;
-
-// NOTE:without testName, this will not call @Before* and fail w/NPE during
-// surefire
-@Test(groups = "unit", testName = "AWSS3AsyncClientTest")
-public class AWSS3AsyncClientTest extends S3AsyncClientTest<AWSS3AsyncClient> {
-
- @Override
- protected void checkFilters(HttpRequest request) {
- assertEquals(request.getFilters().size(), 1);
- assertEquals(request.getFilters().get(0).getClass(), AWSRequestAuthorizeSignature.class);
- }
-
- @Override
- public void testCopyObjectInvalidName() throws ArrayIndexOutOfBoundsException, SecurityException,
- IllegalArgumentException, NoSuchMethodException, IOException {
- // For AWS S3, S3AsyncClientTest#testCopyObjectInvalidName() will not throw an exception
- Invokable<?, ?> method = method(S3AsyncClient.class, "copyObject", String.class, String.class, String.class,
- String.class,
- CopyObjectOptions[].class);
- processor.createRequest(method, ImmutableList.<Object> of("sourceBucket", "sourceObject", "destinationbucket", "destinationObject"));
- }
-
- public void testGetBucketLocationEUIsStillDefault() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AWSS3AsyncClient.class, "getBucketLocation", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket-eu-west-1"));
-
- assertRequestLineEquals(request, "GET https://bucket-eu-west-1.s3.amazonaws.com/?location HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket-eu-west-1.s3.amazonaws.com\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, LocationConstraintHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- @Override
- public void testPutObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
- NoSuchMethodException, IOException {
-
- Invokable<?, ?> method = method(AWSS3AsyncClient.class, "putObject", String.class, S3Object.class,
- PutObjectOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket",
- blobToS3Object.apply(BindBlobToMultipartFormTest.TEST_BLOB)));
-
- assertRequestLineEquals(request, "PUT https://bucket." + url + "/hello HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Expect: 100-continue\nHost: bucket." + url + "\n");
- assertPayloadEquals(request, "hello", "text/plain", false);
-
- assertResponseParserClassEquals(method, request, ParseETagHeader.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- @Override
- public void testGetBucketLocation() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AWSS3AsyncClient.class, "getBucketLocation", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
-
- assertRequestLineEquals(request, "GET https://bucket.s3.amazonaws.com/?location HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n");
- assertPayloadEquals(request, null, null, false);
-
- request = (GeneratedHttpRequest) 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");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, LocationConstraintHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- @Override
- public void testPutBucketDefault() throws ArrayIndexOutOfBoundsException, SecurityException,
- IllegalArgumentException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AWSS3AsyncClient.class, "putBucketInRegion", String.class, String.class,
- PutBucketOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "bucket"));
-
- assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/ HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.class);
-
- checkFilters(request);
- }
-
- public void testInitiateMultipartUpload() throws SecurityException, NegativeArraySizeException,
- NoSuchMethodException {
- Invokable<?, ?> method = method(AWSS3AsyncClient.class, "initiateMultipartUpload", String.class, ObjectMetadata.class,
- PutObjectOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", ObjectMetadataBuilder.create().key("foo")
- .contentMD5(new byte[16]).build()));
-
- assertRequestLineEquals(request, "POST https://bucket." + url + "/foo?uploads HTTP/1.1");
- assertNonPayloadHeadersEqual(request,
- "Content-MD5: AAAAAAAAAAAAAAAAAAAAAA==\n" +
- "Content-Type: binary/octet-stream\n" +
- "Host: bucket." + url + "\n");
- assertPayloadEquals(request, null, null, false);
-
- // as this is a payload-related command, but with no payload, be careful
- // that we check
- // filtering and do not ignore if this fails later.
- request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
-
- assertRequestLineEquals(request, "POST https://bucket." + url + "/foo?uploads HTTP/1.1");
- assertNonPayloadHeadersEqual(request,
- "Authorization: AWS identity:972m/Bqn2L5FIaB+wWDeY83mGvU=\n" +
- "Content-MD5: AAAAAAAAAAAAAAAAAAAAAA==\n" +
- "Content-Type: binary/octet-stream\n" +
- "Date: 2009-11-08T15:54:08.897Z\n" +
- "Host: bucket." + url + "\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UploadIdFromHttpResponseViaRegex.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
-
- checkFilters(request);
- }
-
- public void testAbortMultipartUpload() throws SecurityException, NegativeArraySizeException, NoSuchMethodException {
- Invokable<?, ?> method = method(AWSS3AsyncClient.class, "abortMultipartUpload", String.class, String.class, String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "foo", "asdsadasdas", 1,
- Payloads.newStringPayload("")));
-
- assertRequestLineEquals(request, "DELETE https://bucket." + url + "/foo?uploadId=asdsadasdas HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
- assertPayloadEquals(request, "", "application/unknown", false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testUploadPart() throws SecurityException, NegativeArraySizeException, NoSuchMethodException {
- Invokable<?, ?> method = method(AWSS3AsyncClient.class, "uploadPart", String.class, String.class, int.class,
- String.class, Payload.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "foo", 1, "asdsadasdas",
- Payloads.newStringPayload("")));
-
- assertRequestLineEquals(request, "PUT https://bucket." + url + "/foo?partNumber=1&uploadId=asdsadasdas HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
- assertPayloadEquals(request, "", "application/unknown", false);
-
- assertResponseParserClassEquals(method, request, ParseETagHeader.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
-
- checkFilters(request);
- }
-
- public void testCompleteMultipartUpload() throws SecurityException, NegativeArraySizeException,
- NoSuchMethodException {
- Invokable<?, ?> method = method(AWSS3AsyncClient.class, "completeMultipartUpload", String.class, String.class,
- String.class, Map.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "foo", "asdsadasdas",
- ImmutableMap.<Integer, String> of(1, "\"a54357aff0632cce46d942af68356b38\"")));
-
- assertRequestLineEquals(request, "POST https://bucket." + url + "/foo?uploadId=asdsadasdas HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
- assertPayloadEquals(
- request,
- "<CompleteMultipartUpload><Part><PartNumber>1</PartNumber><ETag>\"a54357aff0632cce46d942af68356b38\"</ETag></Part></CompleteMultipartUpload>",
- "text/xml", false);
-
- assertResponseParserClassEquals(method, request, ETagFromHttpResponseViaRegex.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
-
- checkFilters(request);
- }
-
- public void testPutBucketEu() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
- NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AWSS3AsyncClient.class, "putBucketInRegion", String.class, String.class,
- PutBucketOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("EU", "bucket"));
-
- assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/ HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n");
- assertPayloadEquals(request,
- "<CreateBucketConfiguration><LocationConstraint>EU</LocationConstraint></CreateBucketConfiguration>",
- "text/xml", false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.class);
-
- checkFilters(request);
- }
-
- @ConfiguresRestClient
- private static final class TestAWSS3RestClientModule extends AWSS3RestClientModule {
-
- @Override
- protected CacheLoader<String, Optional<String>> bucketToRegion(@Region Supplier<Set<String>> regionSupplier,
- final S3Client client) {
- return CacheLoader.<String, Optional<String>> from(Functions.forMap(ImmutableMap
- .<String, Optional<String>> builder()
- .put("bucket", Optional.<String> absent())
- .put("destinationbucket", Optional.<String> absent())
- .put("bucket-us-standard", Optional.of("us-standard"))
- .put("bucket-us-west-1", Optional.of("us-west-1"))
- .put("bucket-us-west-2", Optional.of("us-west-2"))
- .put("bucket-eu-west-1", Optional.of("eu-west-1"))
- .put("bucket-sa-east-1", Optional.of("sa-east-1"))
- .put("bucket-ap-southeast-1", Optional.of("ap-southeast-1"))
- .put("bucket-ap-northeast-1", Optional.of("ap-northeast-1"))
- .build()));
- }
-
- @Override
- protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
- return "2009-11-08T15:54:08.897Z";
- }
- }
-
- @Override
- protected Module createModule() {
- return new TestAWSS3RestClientModule();
- }
-
- @Override
- public AWSS3ProviderMetadata createProviderMetadata() {
- return new AWSS3ProviderMetadata();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java
index 14e0c74..865f42c 100644
--- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java
+++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java
@@ -73,7 +73,7 @@ public class AWSS3ClientLiveTest extends S3ClientLiveTest {
@Override
public AWSS3Client getApi() {
- return view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi();
+ return view.unwrapApi(AWSS3Client.class);
}
@BeforeClass(groups = { "integration", "live" })
@@ -171,7 +171,7 @@ public class AWSS3ClientLiveTest extends S3ClientLiveTest {
blobStore.putBlob(containerName, blob,
storageClass(StorageClass.REDUCED_REDUNDANCY));
- S3Client s3Client = S3Client.class.cast(view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi());
+ S3Client s3Client = view.unwrapApi(S3Client.class);
ListBucketResponse response = s3Client.listBucket(containerName, withPrefix(blobName));
ObjectMetadata metadata = response.iterator().next();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientTest.java
new file mode 100644
index 0000000..783cc43
--- /dev/null
+++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientTest.java
@@ -0,0 +1,307 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.aws.s3;
+
+import static org.jclouds.reflect.Reflection2.method;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.aws.s3.config.AWSS3HttpApiModule;
+import org.jclouds.aws.s3.filters.AWSRequestAuthorizeSignature;
+import org.jclouds.aws.s3.functions.ETagFromHttpResponseViaRegex;
+import org.jclouds.aws.s3.functions.UploadIdFromHttpResponseViaRegex;
+import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest;
+import org.jclouds.date.TimeStamp;
+import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.functions.ParseETagHeader;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.http.functions.ReturnTrueIf2xx;
+import org.jclouds.io.Payload;
+import org.jclouds.io.Payloads;
+import org.jclouds.location.Region;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.s3.S3Client;
+import org.jclouds.s3.S3ClientTest;
+import org.jclouds.s3.domain.ObjectMetadata;
+import org.jclouds.s3.domain.ObjectMetadataBuilder;
+import org.jclouds.s3.domain.S3Object;
+import org.jclouds.s3.fallbacks.FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists;
+import org.jclouds.s3.options.CopyObjectOptions;
+import org.jclouds.s3.options.PutBucketOptions;
+import org.jclouds.s3.options.PutObjectOptions;
+import org.jclouds.s3.xml.LocationConstraintHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Functions;
+import com.google.common.base.Optional;
+import com.google.common.base.Supplier;
+import com.google.common.cache.CacheLoader;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.reflect.Invokable;
+import com.google.inject.Module;
+
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "AWSS3ClientTest")
+public class AWSS3ClientTest extends S3ClientTest<AWSS3Client> {
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ assertEquals(request.getFilters().get(0).getClass(), AWSRequestAuthorizeSignature.class);
+ }
+
+ @Override
+ public void testCopyObjectInvalidName() throws ArrayIndexOutOfBoundsException, SecurityException,
+ IllegalArgumentException, NoSuchMethodException, IOException {
+ // For AWS S3, S3AsyncClientTest#testCopyObjectInvalidName() will not throw an exception
+ Invokable<?, ?> method = method(AWSS3Client.class, "copyObject", String.class, String.class, String.class,
+ String.class,
+ CopyObjectOptions[].class);
+ processor.createRequest(method, ImmutableList.<Object> of("sourceBucket", "sourceObject", "destinationbucket", "destinationObject"));
+ }
+
+ public void testGetBucketLocationEUIsStillDefault() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AWSS3Client.class, "getBucketLocation", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket-eu-west-1"));
+
+ assertRequestLineEquals(request, "GET https://bucket-eu-west-1.s3.amazonaws.com/?location HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket-eu-west-1.s3.amazonaws.com\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, LocationConstraintHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Override
+ public void testPutObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
+ NoSuchMethodException, IOException {
+
+ Invokable<?, ?> method = method(AWSS3Client.class, "putObject", String.class, S3Object.class,
+ PutObjectOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket",
+ blobToS3Object.apply(BindBlobToMultipartFormTest.TEST_BLOB)));
+
+ assertRequestLineEquals(request, "PUT https://bucket." + url + "/hello HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Expect: 100-continue\nHost: bucket." + url + "\n");
+ assertPayloadEquals(request, "hello", "text/plain", false);
+
+ assertResponseParserClassEquals(method, request, ParseETagHeader.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Override
+ public void testGetBucketLocation() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AWSS3Client.class, "getBucketLocation", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
+
+ assertRequestLineEquals(request, "GET https://bucket.s3.amazonaws.com/?location HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n");
+ assertPayloadEquals(request, null, null, false);
+
+ request = (GeneratedHttpRequest) 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");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, LocationConstraintHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Override
+ public void testPutBucketDefault() throws ArrayIndexOutOfBoundsException, SecurityException,
+ IllegalArgumentException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AWSS3Client.class, "putBucketInRegion", String.class, String.class,
+ PutBucketOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "bucket"));
+
+ assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/ HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.class);
+
+ checkFilters(request);
+ }
+
+ public void testInitiateMultipartUpload() throws SecurityException, NegativeArraySizeException,
+ NoSuchMethodException {
+ Invokable<?, ?> method = method(AWSS3Client.class, "initiateMultipartUpload", String.class, ObjectMetadata.class,
+ PutObjectOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", ObjectMetadataBuilder.create().key("foo")
+ .contentMD5(new byte[16]).build()));
+
+ assertRequestLineEquals(request, "POST https://bucket." + url + "/foo?uploads HTTP/1.1");
+ assertNonPayloadHeadersEqual(request,
+ "Content-MD5: AAAAAAAAAAAAAAAAAAAAAA==\n" +
+ "Content-Type: binary/octet-stream\n" +
+ "Host: bucket." + url + "\n");
+ assertPayloadEquals(request, null, null, false);
+
+ // as this is a payload-related command, but with no payload, be careful
+ // that we check
+ // filtering and do not ignore if this fails later.
+ request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
+
+ assertRequestLineEquals(request, "POST https://bucket." + url + "/foo?uploads HTTP/1.1");
+ assertNonPayloadHeadersEqual(request,
+ "Authorization: AWS identity:972m/Bqn2L5FIaB+wWDeY83mGvU=\n" +
+ "Content-MD5: AAAAAAAAAAAAAAAAAAAAAA==\n" +
+ "Content-Type: binary/octet-stream\n" +
+ "Date: 2009-11-08T15:54:08.897Z\n" +
+ "Host: bucket." + url + "\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UploadIdFromHttpResponseViaRegex.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+ checkFilters(request);
+ }
+
+ public void testAbortMultipartUpload() throws SecurityException, NegativeArraySizeException, NoSuchMethodException {
+ Invokable<?, ?> method = method(AWSS3Client.class, "abortMultipartUpload", String.class, String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "foo", "asdsadasdas", 1,
+ Payloads.newStringPayload("")));
+
+ assertRequestLineEquals(request, "DELETE https://bucket." + url + "/foo?uploadId=asdsadasdas HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
+ assertPayloadEquals(request, "", "application/unknown", false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testUploadPart() throws SecurityException, NegativeArraySizeException, NoSuchMethodException {
+ Invokable<?, ?> method = method(AWSS3Client.class, "uploadPart", String.class, String.class, int.class,
+ String.class, Payload.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "foo", 1, "asdsadasdas",
+ Payloads.newStringPayload("")));
+
+ assertRequestLineEquals(request, "PUT https://bucket." + url + "/foo?partNumber=1&uploadId=asdsadasdas HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
+ assertPayloadEquals(request, "", "application/unknown", false);
+
+ assertResponseParserClassEquals(method, request, ParseETagHeader.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+ checkFilters(request);
+ }
+
+ public void testCompleteMultipartUpload() throws SecurityException, NegativeArraySizeException,
+ NoSuchMethodException {
+ Invokable<?, ?> method = method(AWSS3Client.class, "completeMultipartUpload", String.class, String.class,
+ String.class, Map.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "foo", "asdsadasdas",
+ ImmutableMap.<Integer, String> of(1, "\"a54357aff0632cce46d942af68356b38\"")));
+
+ assertRequestLineEquals(request, "POST https://bucket." + url + "/foo?uploadId=asdsadasdas HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
+ assertPayloadEquals(
+ request,
+ "<CompleteMultipartUpload><Part><PartNumber>1</PartNumber><ETag>\"a54357aff0632cce46d942af68356b38\"</ETag></Part></CompleteMultipartUpload>",
+ "text/xml", false);
+
+ assertResponseParserClassEquals(method, request, ETagFromHttpResponseViaRegex.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+ checkFilters(request);
+ }
+
+ public void testPutBucketEu() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
+ NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AWSS3Client.class, "putBucketInRegion", String.class, String.class,
+ PutBucketOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("EU", "bucket"));
+
+ assertRequestLineEquals(request, "PUT https://bucket.s3.amazonaws.com/ HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket.s3.amazonaws.com\n");
+ assertPayloadEquals(request,
+ "<CreateBucketConfiguration><LocationConstraint>EU</LocationConstraint></CreateBucketConfiguration>",
+ "text/xml", false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.class);
+
+ checkFilters(request);
+ }
+
+ @ConfiguresHttpApi
+ private static final class TestAWSS3HttpApiModule extends AWSS3HttpApiModule {
+
+ @Override
+ protected CacheLoader<String, Optional<String>> bucketToRegion(@Region Supplier<Set<String>> regionSupplier,
+ final S3Client client) {
+ return CacheLoader.<String, Optional<String>> from(Functions.forMap(ImmutableMap
+ .<String, Optional<String>> builder()
+ .put("bucket", Optional.<String> absent())
+ .put("destinationbucket", Optional.<String> absent())
+ .put("bucket-us-standard", Optional.of("us-standard"))
+ .put("bucket-us-west-1", Optional.of("us-west-1"))
+ .put("bucket-us-west-2", Optional.of("us-west-2"))
+ .put("bucket-eu-west-1", Optional.of("eu-west-1"))
+ .put("bucket-sa-east-1", Optional.of("sa-east-1"))
+ .put("bucket-ap-southeast-1", Optional.of("ap-southeast-1"))
+ .put("bucket-ap-northeast-1", Optional.of("ap-northeast-1"))
+ .build()));
+ }
+
+ @Override
+ protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
+ return "2009-11-08T15:54:08.897Z";
+ }
+ }
+
+ @Override
+ protected Module createModule() {
+ return new TestAWSS3HttpApiModule();
+ }
+
+ @Override
+ public AWSS3ProviderMetadata createProviderMetadata() {
+ return new AWSS3ProviderMetadata();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindIterableAsPayloadToDeleteRequestTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindIterableAsPayloadToDeleteRequestTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindIterableAsPayloadToDeleteRequestTest.java
index aa43888..0560ce5 100644
--- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindIterableAsPayloadToDeleteRequestTest.java
+++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindIterableAsPayloadToDeleteRequestTest.java
@@ -16,16 +16,17 @@
*/
package org.jclouds.aws.s3.binders;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
+import static org.testng.Assert.assertEquals;
+
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.http.HttpRequest;
import org.jclouds.io.Payload;
import org.jclouds.io.Payloads;
import org.testng.annotations.Test;
-import javax.ws.rs.core.MediaType;
-
-import static org.testng.Assert.assertEquals;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
public class BindIterableAsPayloadToDeleteRequestTest {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequestTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequestTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequestTest.java
index 3802c7e..ff60120 100644
--- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequestTest.java
+++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequestTest.java
@@ -22,10 +22,10 @@ import java.io.File;
import org.jclouds.blobstore.binders.BindMapToHeadersWithPrefix;
import org.jclouds.http.HttpRequest;
-import org.jclouds.s3.S3AsyncClient;
+import org.jclouds.s3.S3Client;
import org.jclouds.s3.domain.ObjectMetadata;
import org.jclouds.s3.domain.ObjectMetadataBuilder;
-import org.jclouds.s3.internal.BaseS3AsyncClientTest;
+import org.jclouds.s3.internal.BaseS3ClientTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
@@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableMultimap;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "BindObjectMetadataToRequestTest")
-public class BindObjectMetadataToRequestTest extends BaseS3AsyncClientTest<S3AsyncClient> {
+public class BindObjectMetadataToRequestTest extends BaseS3ClientTest<S3Client> {
@Test
public void testPassWithMinimumDetailsAndPayload5GB() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/AWSS3BlobSignerExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/AWSS3BlobSignerExpectTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/AWSS3BlobSignerExpectTest.java
index 60649a2..aed33d6 100644
--- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/AWSS3BlobSignerExpectTest.java
+++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/AWSS3BlobSignerExpectTest.java
@@ -18,12 +18,12 @@ package org.jclouds.aws.s3.blobstore;
import static org.testng.Assert.assertEquals;
-import org.jclouds.aws.s3.config.AWSS3RestClientModule;
+import org.jclouds.aws.s3.config.AWSS3HttpApiModule;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.s3.blobstore.S3BlobSignerExpectTest;
import org.testng.annotations.Test;
@@ -116,11 +116,11 @@ public class AWSS3BlobSignerExpectTest extends S3BlobSignerExpectTest {
@Override
protected Module createModule() {
- return new TestAWSS3RestClientModule();
+ return new TestAWSS3HttpApiModule();
}
- @ConfiguresRestClient
- private static final class TestAWSS3RestClientModule extends AWSS3RestClientModule {
+ @ConfiguresHttpApi
+ private static final class TestAWSS3HttpApiModule extends AWSS3HttpApiModule {
@Override
@TimeStamp
protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/test/java/org/jclouds/aws/s3/internal/BaseAWSS3ClientExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/internal/BaseAWSS3ClientExpectTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/internal/BaseAWSS3ClientExpectTest.java
index 124aab3..9613b86 100644
--- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/internal/BaseAWSS3ClientExpectTest.java
+++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/internal/BaseAWSS3ClientExpectTest.java
@@ -18,10 +18,10 @@ package org.jclouds.aws.s3.internal;
import org.jclouds.aws.s3.AWSS3Client;
import org.jclouds.aws.s3.AWSS3ProviderMetadata;
-import org.jclouds.aws.s3.config.AWSS3RestClientModule;
+import org.jclouds.aws.s3.config.AWSS3HttpApiModule;
import org.jclouds.date.TimeStamp;
import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.internal.BaseRestClientExpectTest;
import com.google.common.base.Supplier;
@@ -44,8 +44,8 @@ public class BaseAWSS3ClientExpectTest extends BaseRestClientExpectTest<AWSS3Cli
return new AWSS3ProviderMetadata();
}
- @ConfiguresRestClient
- private static final class TestAWSS3RestClientModule extends AWSS3RestClientModule {
+ @ConfiguresHttpApi
+ private static final class TestAWSS3HttpApiModule extends AWSS3HttpApiModule {
@Override
protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
return CONSTANT_DATE;
@@ -54,7 +54,7 @@ public class BaseAWSS3ClientExpectTest extends BaseRestClientExpectTest<AWSS3Cli
@Override
protected Module createModule() {
- return new TestAWSS3RestClientModule();
+ return new TestAWSS3HttpApiModule();
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/test/java/org/jclouds/aws/s3/xml/DeleteResultHandlerTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/xml/DeleteResultHandlerTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/xml/DeleteResultHandlerTest.java
index fd3ba94..85ce10a 100644
--- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/xml/DeleteResultHandlerTest.java
+++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/xml/DeleteResultHandlerTest.java
@@ -16,13 +16,13 @@
*/
package org.jclouds.aws.s3.xml;
-import org.jclouds.aws.s3.domain.DeleteResult;
-import org.jclouds.http.functions.BaseHandlerTest;
-import org.testng.annotations.Test;
+import static org.testng.Assert.assertEquals;
import java.io.InputStream;
-import static org.testng.Assert.assertEquals;
+import org.jclouds.aws.s3.domain.DeleteResult;
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.testng.annotations.Test;
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "DeleteResultHandlerTest")
[51/52] [abbrv] git commit: Using net.java.dev.jna:jna 4.0.0 for
jsch.agentproxy
Posted by an...@apache.org.
Using net.java.dev.jna:jna 4.0.0 for jsch.agentproxy
The default version 3.4.0 is only LGPL-licensed.
This commit can be reverted once SMX4-1859 is published and we can
update to 0.0.8 agentproxy versions.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/53fc5687
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/53fc5687
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/53fc5687
Branch: refs/heads/use-agentproxy-008
Commit: 53fc568743bb13a0001223b6c5f5cc549627296e
Parents: b0f2962
Author: Andrew Phillips <an...@apache.org>
Authored: Wed Sep 17 17:18:36 2014 -0400
Committer: Andrew Phillips <an...@apache.org>
Committed: Mon Oct 6 18:26:24 2014 -0400
----------------------------------------------------------------------
drivers/jsch/pom.xml | 22 ++++++++++++++++++++++
drivers/sshj/pom.xml | 22 ++++++++++++++++++++++
2 files changed, 44 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/53fc5687/drivers/jsch/pom.xml
----------------------------------------------------------------------
diff --git a/drivers/jsch/pom.xml b/drivers/jsch/pom.xml
index a163046..078a9bc 100644
--- a/drivers/jsch/pom.xml
+++ b/drivers/jsch/pom.xml
@@ -95,6 +95,28 @@
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.connector-factory</artifactId>
<version>0.0.7</version>
+ <exclusions>
+ <!-- provided versions are LGPL-only -->
+ <exclusion>
+ <groupId>net.java.dev.jna</groupId>
+ <artifactId>jna</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>net.java.dev.jna</groupId>
+ <artifactId>platform</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- dual-licensed under LGPL and ASL 2 -->
+ <dependency>
+ <groupId>net.java.dev.jna</groupId>
+ <artifactId>jna</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>net.java.dev.jna</groupId>
+ <artifactId>jna-platform</artifactId>
+ <version>4.0.0</version>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/53fc5687/drivers/sshj/pom.xml
----------------------------------------------------------------------
diff --git a/drivers/sshj/pom.xml b/drivers/sshj/pom.xml
index 3d2c215..be6efc8 100644
--- a/drivers/sshj/pom.xml
+++ b/drivers/sshj/pom.xml
@@ -113,6 +113,28 @@
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.connector-factory</artifactId>
<version>0.0.7</version>
+ <exclusions>
+ <!-- provided versions are LGPL-only -->
+ <exclusion>
+ <groupId>net.java.dev.jna</groupId>
+ <artifactId>jna</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>net.java.dev.jna</groupId>
+ <artifactId>platform</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- dual-licensed under LGPL and ASL 2 -->
+ <dependency>
+ <groupId>net.java.dev.jna</groupId>
+ <artifactId>jna</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>net.java.dev.jna</groupId>
+ <artifactId>jna-platform</artifactId>
+ <version>4.0.0</version>
</dependency>
</dependencies>
[18/52] [abbrv] JCLOUDS-296 unasync legacy cloudservers provider.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java
deleted file mode 100644
index 9ced9a2..0000000
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java
+++ /dev/null
@@ -1,902 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudservers;
-
-import static org.jclouds.Constants.PROPERTY_API_VERSION;
-import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withFile;
-import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withMetadata;
-import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withSharedIpGroup;
-import static org.jclouds.cloudservers.options.CreateSharedIpGroupOptions.Builder.withServer;
-import static org.jclouds.cloudservers.options.ListOptions.Builder.changesSince;
-import static org.jclouds.cloudservers.options.ListOptions.Builder.withDetails;
-import static org.jclouds.cloudservers.options.RebuildServerOptions.Builder.withImage;
-import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
-import static org.jclouds.reflect.Reflection2.method;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.Date;
-import java.util.Properties;
-
-import javax.inject.Singleton;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.cloudservers.config.CloudServersRestClientModule;
-import org.jclouds.cloudservers.domain.BackupSchedule;
-import org.jclouds.cloudservers.domain.DailyBackup;
-import org.jclouds.cloudservers.domain.RebootType;
-import org.jclouds.cloudservers.domain.WeeklyBackup;
-import org.jclouds.cloudservers.options.CreateServerOptions;
-import org.jclouds.cloudservers.options.CreateSharedIpGroupOptions;
-import org.jclouds.cloudservers.options.ListOptions;
-import org.jclouds.cloudservers.options.RebuildServerOptions;
-import org.jclouds.domain.Credentials;
-import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.functions.ReleasePayloadAndReturn;
-import org.jclouds.http.functions.ReturnTrueIf2xx;
-import org.jclouds.http.functions.UnwrapOnlyJsonValue;
-import org.jclouds.openstack.filters.AddTimestampQuery;
-import org.jclouds.openstack.filters.AuthenticateRequest;
-import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule.GetAuth;
-import org.jclouds.openstack.keystone.v1_1.domain.Auth;
-import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.reflect.Invokable;
-import com.google.inject.Module;
-import com.google.inject.Provides;
-/**
- * Tests behavior of {@code CloudServersAsyncClient}
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during
-// surefire
-@Test(groups = "unit", singleThreaded = true, testName = "CloudServersAsyncClientTest")
-public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServersAsyncClient> {
-
- public void testCreateServer() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createServer", String.class, int.class, int.class,
- CreateServerOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1}}",
- "application/json", false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
-
- }
-
- public void testCreateServerWithIpGroup() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createServer", String.class, int.class, int.class,
- CreateServerOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1, withSharedIpGroup(2)));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request,
- "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1,\"sharedIpGroupId\":2}}",
- "application/json", false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testCreateServerWithFile() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createServer", String.class, int.class, int.class,
- CreateServerOptions[].class);
- GeneratedHttpRequest request = processor
- .createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1, withFile("/etc/jclouds", "foo".getBytes())));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(
- request,
- "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1,\"personality\":[{\"path\":\"/etc/jclouds\",\"contents\":\"Zm9v\"}]}}",
- "application/json", false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
-
- }
-
- public void testCreateServerWithMetadata() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createServer", String.class, int.class, int.class,
- CreateServerOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1,
- withMetadata(ImmutableMap.of("foo", "bar"))));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request,
- "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1,\"metadata\":{\"foo\":\"bar\"}}}",
- "application/json", false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
-
- }
-
- public void testCreateServerWithIpGroupAndSharedIp() throws IOException, SecurityException, NoSuchMethodException,
- UnknownHostException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createServer", String.class, int.class, int.class,
- CreateServerOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1,
- withSharedIpGroup(2).withSharedIp("127.0.0.1")));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(
- request,
- "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1,\"sharedIpGroupId\":2,\"addresses\":{\"public\":[\"127.0.0.1\"]}}}",
- "application/json", false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testDeleteImage() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "deleteImage", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testLimits() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getLimits");
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/limits?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListServers() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listServers", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- Date now = new Date(10000000l);
-
- public void testListServersOptions() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listServers", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
-
- assertRequestLineEquals(request,
- "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListServersDetail() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listServers", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/detail?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testGetServer() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getServer", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListFlavors() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listFlavors", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListFlavorsOptions() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listFlavors", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
-
- assertRequestLineEquals(request,
- "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListFlavorsDetail() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listFlavors", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors/detail?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListFlavorsDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listFlavors", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
-
- assertRequestLineEquals(request,
- "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors/detail?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testGetFlavor() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getFlavor", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors/2?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListImages() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listImages", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListImagesDetail() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listImages", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/detail?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListImagesOptions() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listImages", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
-
- assertRequestLineEquals(request,
- "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListImagesDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listImages", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
-
- assertRequestLineEquals(request,
- "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/detail?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testGetImage() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getImage", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/2?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testDeleteServer() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "deleteServer", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testShareIpNoConfig() throws IOException, SecurityException, NoSuchMethodException, UnknownHostException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "shareIp", String.class, int.class, int.class,
- boolean.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, false));
-
- assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public/127.0.0.1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, "{\"shareIp\":{\"sharedIpGroupId\":3,\"configureServer\":false}}",
- MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
-
- }
-
- public void testShareIpConfig() throws IOException, SecurityException, NoSuchMethodException, UnknownHostException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "shareIp", String.class, int.class, int.class,
- boolean.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, true));
-
- assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public/127.0.0.1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, "{\"shareIp\":{\"sharedIpGroupId\":3,\"configureServer\":true}}",
- MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
-
- }
-
- public void testUnshareIpNoConfig() throws IOException, SecurityException, NoSuchMethodException,
- UnknownHostException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "unshareIp", String.class, int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, false));
-
- assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public/127.0.0.1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
-
- checkFilters(request);
-
- }
-
- public void testReplaceBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "replaceBackupSchedule", int.class, BackupSchedule.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, BackupSchedule.builder().weekly(WeeklyBackup.MONDAY)
- .daily(DailyBackup.H_0800_1000).enabled(true).build()));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/backup_schedule HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request,
- "{\"backupSchedule\":{\"daily\":\"H_0800_1000\",\"enabled\":true,\"weekly\":\"MONDAY\"}}",
- MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
-
- checkFilters(request);
-
- }
-
- public void testDeleteBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "deleteBackupSchedule", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/backup_schedule HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
-
- checkFilters(request);
-
- }
-
- public void testChangeAdminPass() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "changeAdminPass", int.class, String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, "foo"));
-
- assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, "{\"server\":{\"adminPass\":\"foo\"}}", MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
-
- }
-
- public void testChangeServerName() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "renameServer", int.class, String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, "foo"));
-
- assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, "{\"server\":{\"name\":\"foo\"}}", MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
-
- }
-
- public void testListSharedIpGroups() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listSharedIpGroups", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListSharedIpGroupsOptions() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listSharedIpGroups", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
-
- assertRequestLineEquals(request,
- "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListSharedIpGroupsDetail() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listSharedIpGroups", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/detail?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListSharedIpGroupsDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listSharedIpGroups", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
-
- assertRequestLineEquals(request,
- "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/detail?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testGetSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getSharedIpGroup", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/2?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testCreateSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createSharedIpGroup", String.class,
- CreateSharedIpGroupOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie"));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, "{\"sharedIpGroup\":{\"name\":\"ralphie\"}}", MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
-
- }
-
- public void testCreateSharedIpGroupWithIpGroup() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createSharedIpGroup", String.class,
- CreateSharedIpGroupOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", withServer(2)));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, "{\"sharedIpGroup\":{\"name\":\"ralphie\",\"server\":2}}",
- MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testDeleteSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "deleteSharedIpGroup", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListAddresses() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getAddresses", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testListPublicAddresses() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listPublicAddresses", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListPrivateAddresses() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listPrivateAddresses", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/private?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testListBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getBackupSchedule", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/backup_schedule?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
-
- checkFilters(request);
- }
-
- public void testCreateImageWithIpGroup() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createImageFromServer", String.class, int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
- assertPayloadEquals(request, "{\"image\":{\"serverId\":2,\"name\":\"ralphie\"}}", MediaType.APPLICATION_JSON,
- false);
-
- assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
-
- }
-
- public void testRebuildServer() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "rebuildServer", int.class,
- RebuildServerOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(3));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/3/action?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, "{\"rebuild\":{}}", MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testRebuildServerWithImage() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "rebuildServer", int.class,
- RebuildServerOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(3, withImage(2)));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/3/action?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, "{\"rebuild\":{\"imageId\":2}}", MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testReboot() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "rebootServer", int.class, RebootType.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, RebootType.HARD));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, "{\"reboot\":{\"type\":\"HARD\"}}", MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testResize() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "resizeServer", int.class, int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, 3));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, "{\"resize\":{\"flavorId\":3}}", MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
-
- }
-
- public void testConfirmResize() throws IOException, IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "confirmResizeServer", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, "{\"confirmResize\":null}", MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testRevertResize() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(CloudServersAsyncClient.class, "revertResizeServer", int.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
-
- assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, "{\"revertResize\":null}", MediaType.APPLICATION_JSON, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- @Override
- protected void checkFilters(HttpRequest request) {
- assertEquals(request.getFilters().size(), 2);
- assertEquals(request.getFilters().get(0).getClass(), AuthenticateRequest.class);
- assertEquals(request.getFilters().get(1).getClass(), AddTimestampQuery.class);
-
- }
-
- @Override
- protected Module createModule() {
- return new TestCloudServersRestClientModule();
- }
-
- @ConfiguresRestClient
- protected static class TestCloudServersRestClientModule extends CloudServersRestClientModule {
-
- @Provides
- @Singleton
- GetAuth provideGetAuth() {
- return new GetAuth(null) {
- @Override
- public Auth load(Credentials in) {
- return new ParseAuthTest().expected();
- }
- };
- }
-
- }
-
- protected String provider = "cloudservers";
-
- @Override
- protected ApiMetadata createApiMetadata() {
- return new CloudServersApiMetadata();
- }
-
- @Override
- protected Properties setupProperties() {
- Properties overrides = new Properties();
- overrides.setProperty(PROPERTY_REGIONS, "US");
- overrides.setProperty(PROPERTY_API_VERSION, "1");
- overrides.setProperty(provider + ".endpoint", "https://auth");
- return overrides;
- }
-}
[29/52] [abbrv] git commit: Adding apache-snapshots as a plugin repo
Posted by an...@apache.org.
Adding apache-snapshots as a plugin repo
A couple of plugins depend on jclouds-resources
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/79d4b48d
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/79d4b48d
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/79d4b48d
Branch: refs/heads/use-agentproxy-008
Commit: 79d4b48d0151667db062a7035b23b28d7a1e1daf
Parents: cacc986
Author: Andrew Phillips <an...@apache.org>
Authored: Sun Oct 5 14:24:41 2014 -0500
Committer: Andrew Phillips <an...@apache.org>
Committed: Sun Oct 5 18:33:01 2014 -0400
----------------------------------------------------------------------
project/pom.xml | 14 ++++++++++++++
1 file changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/79d4b48d/project/pom.xml
----------------------------------------------------------------------
diff --git a/project/pom.xml b/project/pom.xml
index 4aba813..c799d04 100644
--- a/project/pom.xml
+++ b/project/pom.xml
@@ -98,6 +98,20 @@
</repository>
</repositories>
+ <!-- to allow downstream projects to access jclouds-resources in plugin config -->
+ <pluginRepositories>
+ <pluginRepository>
+ <id>apache-snapshots</id>
+ <url>https://repository.apache.org/content/repositories/snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
<distributionManagement>
<site>
<id>jclouds-github-pages-site</id>
[17/52] [abbrv] JCLOUDS-296 unasync legacy cloudservers provider.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java
new file mode 100644
index 0000000..67ecd33
--- /dev/null
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java
@@ -0,0 +1,898 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.cloudservers;
+
+import static org.jclouds.Constants.PROPERTY_API_VERSION;
+import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withFile;
+import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withMetadata;
+import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withSharedIpGroup;
+import static org.jclouds.cloudservers.options.CreateSharedIpGroupOptions.Builder.withServer;
+import static org.jclouds.cloudservers.options.ListOptions.Builder.changesSince;
+import static org.jclouds.cloudservers.options.ListOptions.Builder.withDetails;
+import static org.jclouds.cloudservers.options.RebuildServerOptions.Builder.withImage;
+import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
+import static org.jclouds.reflect.Reflection2.method;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.util.Date;
+import java.util.Properties;
+
+import javax.inject.Singleton;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.cloudservers.config.CloudServersHttpApiModule;
+import org.jclouds.cloudservers.domain.BackupSchedule;
+import org.jclouds.cloudservers.domain.DailyBackup;
+import org.jclouds.cloudservers.domain.RebootType;
+import org.jclouds.cloudservers.domain.WeeklyBackup;
+import org.jclouds.cloudservers.options.CreateServerOptions;
+import org.jclouds.cloudservers.options.CreateSharedIpGroupOptions;
+import org.jclouds.cloudservers.options.ListOptions;
+import org.jclouds.cloudservers.options.RebuildServerOptions;
+import org.jclouds.domain.Credentials;
+import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.http.functions.ReturnTrueIf2xx;
+import org.jclouds.http.functions.UnwrapOnlyJsonValue;
+import org.jclouds.openstack.filters.AddTimestampQuery;
+import org.jclouds.openstack.filters.AuthenticateRequest;
+import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule.GetAuth;
+import org.jclouds.openstack.keystone.v1_1.domain.Auth;
+import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.reflect.Invokable;
+import com.google.inject.Module;
+import com.google.inject.Provides;
+
+@Test(groups = "unit", singleThreaded = true, testName = "CloudServersClientTest")
+public class CloudServersClientTest extends BaseAsyncClientTest<CloudServersClient> {
+
+ public void testCreateServer() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "createServer", String.class, int.class, int.class,
+ CreateServerOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1}}",
+ "application/json", false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+
+ }
+
+ public void testCreateServerWithIpGroup() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "createServer", String.class, int.class, int.class,
+ CreateServerOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1, withSharedIpGroup(2)));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request,
+ "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1,\"sharedIpGroupId\":2}}",
+ "application/json", false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testCreateServerWithFile() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "createServer", String.class, int.class, int.class,
+ CreateServerOptions[].class);
+ GeneratedHttpRequest request = processor
+ .createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1, withFile("/etc/jclouds", "foo".getBytes())));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(
+ request,
+ "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1,\"personality\":[{\"path\":\"/etc/jclouds\",\"contents\":\"Zm9v\"}]}}",
+ "application/json", false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+
+ }
+
+ public void testCreateServerWithMetadata() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "createServer", String.class, int.class, int.class,
+ CreateServerOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1,
+ withMetadata(ImmutableMap.of("foo", "bar"))));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request,
+ "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1,\"metadata\":{\"foo\":\"bar\"}}}",
+ "application/json", false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+
+ }
+
+ public void testCreateServerWithIpGroupAndSharedIp() throws IOException, SecurityException, NoSuchMethodException,
+ UnknownHostException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "createServer", String.class, int.class, int.class,
+ CreateServerOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1,
+ withSharedIpGroup(2).withSharedIp("127.0.0.1")));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(
+ request,
+ "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1,\"sharedIpGroupId\":2,\"addresses\":{\"public\":[\"127.0.0.1\"]}}}",
+ "application/json", false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeleteImage() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "deleteImage", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testLimits() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "getLimits");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/limits?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListServers() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listServers", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ Date now = new Date(10000000l);
+
+ public void testListServersOptions() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listServers", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
+
+ assertRequestLineEquals(request,
+ "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListServersDetail() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listServers", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/detail?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetServer() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "getServer", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListFlavors() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listFlavors", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListFlavorsOptions() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listFlavors", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
+
+ assertRequestLineEquals(request,
+ "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListFlavorsDetail() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listFlavors", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors/detail?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListFlavorsDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listFlavors", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
+
+ assertRequestLineEquals(request,
+ "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors/detail?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetFlavor() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "getFlavor", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors/2?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListImages() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listImages", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListImagesDetail() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listImages", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/detail?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListImagesOptions() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listImages", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
+
+ assertRequestLineEquals(request,
+ "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListImagesDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listImages", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
+
+ assertRequestLineEquals(request,
+ "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/detail?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetImage() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "getImage", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/2?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testDeleteServer() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "deleteServer", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testShareIpNoConfig() throws IOException, SecurityException, NoSuchMethodException, UnknownHostException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "shareIp", String.class, int.class, int.class,
+ boolean.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, false));
+
+ assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public/127.0.0.1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, "{\"shareIp\":{\"sharedIpGroupId\":3,\"configureServer\":false}}",
+ MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+
+ }
+
+ public void testShareIpConfig() throws IOException, SecurityException, NoSuchMethodException, UnknownHostException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "shareIp", String.class, int.class, int.class,
+ boolean.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, true));
+
+ assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public/127.0.0.1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, "{\"shareIp\":{\"sharedIpGroupId\":3,\"configureServer\":true}}",
+ MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+
+ }
+
+ public void testUnshareIpNoConfig() throws IOException, SecurityException, NoSuchMethodException,
+ UnknownHostException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "unshareIp", String.class, int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, false));
+
+ assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public/127.0.0.1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
+
+ checkFilters(request);
+
+ }
+
+ public void testReplaceBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "replaceBackupSchedule", int.class, BackupSchedule.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, BackupSchedule.builder().weekly(WeeklyBackup.MONDAY)
+ .daily(DailyBackup.H_0800_1000).enabled(true).build()));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/backup_schedule HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request,
+ "{\"backupSchedule\":{\"daily\":\"H_0800_1000\",\"enabled\":true,\"weekly\":\"MONDAY\"}}",
+ MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+ checkFilters(request);
+
+ }
+
+ public void testDeleteBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "deleteBackupSchedule", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/backup_schedule HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
+
+ checkFilters(request);
+
+ }
+
+ public void testChangeAdminPass() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "changeAdminPass", int.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, "foo"));
+
+ assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, "{\"server\":{\"adminPass\":\"foo\"}}", MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+
+ }
+
+ public void testChangeServerName() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "renameServer", int.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, "foo"));
+
+ assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, "{\"server\":{\"name\":\"foo\"}}", MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+
+ }
+
+ public void testListSharedIpGroups() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listSharedIpGroups", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListSharedIpGroupsOptions() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listSharedIpGroups", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
+
+ assertRequestLineEquals(request,
+ "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListSharedIpGroupsDetail() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listSharedIpGroups", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/detail?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListSharedIpGroupsDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listSharedIpGroups", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
+
+ assertRequestLineEquals(request,
+ "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/detail?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "getSharedIpGroup", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/2?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCreateSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "createSharedIpGroup", String.class,
+ CreateSharedIpGroupOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie"));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, "{\"sharedIpGroup\":{\"name\":\"ralphie\"}}", MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+
+ }
+
+ public void testCreateSharedIpGroupWithIpGroup() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "createSharedIpGroup", String.class,
+ CreateSharedIpGroupOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", withServer(2)));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, "{\"sharedIpGroup\":{\"name\":\"ralphie\",\"server\":2}}",
+ MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeleteSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "deleteSharedIpGroup", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListAddresses() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "getAddresses", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testListPublicAddresses() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listPublicAddresses", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListPrivateAddresses() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "listPrivateAddresses", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/private?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "getBackupSchedule", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/backup_schedule?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+ checkFilters(request);
+ }
+
+ public void testCreateImageWithIpGroup() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "createImageFromServer", String.class, int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
+ assertPayloadEquals(request, "{\"image\":{\"serverId\":2,\"name\":\"ralphie\"}}", MediaType.APPLICATION_JSON,
+ false);
+
+ assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+
+ }
+
+ public void testRebuildServer() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "rebuildServer", int.class,
+ RebuildServerOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(3));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/3/action?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, "{\"rebuild\":{}}", MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testRebuildServerWithImage() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "rebuildServer", int.class,
+ RebuildServerOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(3, withImage(2)));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/3/action?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, "{\"rebuild\":{\"imageId\":2}}", MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testReboot() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "rebootServer", int.class, RebootType.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, RebootType.HARD));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, "{\"reboot\":{\"type\":\"HARD\"}}", MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testResize() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "resizeServer", int.class, int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, 3));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, "{\"resize\":{\"flavorId\":3}}", MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+
+ }
+
+ public void testConfirmResize() throws IOException, IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "confirmResizeServer", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, "{\"confirmResize\":null}", MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testRevertResize() throws IOException, SecurityException, NoSuchMethodException {
+ Invokable<?, ?> method = method(CloudServersClient.class, "revertResizeServer", int.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
+
+ assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, "{\"revertResize\":null}", MediaType.APPLICATION_JSON, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 2);
+ assertEquals(request.getFilters().get(0).getClass(), AuthenticateRequest.class);
+ assertEquals(request.getFilters().get(1).getClass(), AddTimestampQuery.class);
+
+ }
+
+ @Override
+ protected Module createModule() {
+ return new TestCloudServersHttpApiModule();
+ }
+
+ @ConfiguresHttpApi
+ protected static class TestCloudServersHttpApiModule extends CloudServersHttpApiModule {
+
+ @Provides
+ @Singleton
+ GetAuth provideGetAuth() {
+ return new GetAuth(null) {
+ @Override
+ public Auth load(Credentials in) {
+ return new ParseAuthTest().expected();
+ }
+ };
+ }
+
+ }
+
+ protected String provider = "cloudservers";
+
+ @Override
+ protected ApiMetadata createApiMetadata() {
+ return new CloudServersApiMetadata();
+ }
+
+ @Override
+ protected Properties setupProperties() {
+ Properties overrides = new Properties();
+ overrides.setProperty(PROPERTY_REGIONS, "US");
+ overrides.setProperty(PROPERTY_API_VERSION, "1");
+ overrides.setProperty(provider + ".endpoint", "https://auth");
+ return overrides;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersComputeServiceExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersComputeServiceExpectTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersComputeServiceExpectTest.java
index f8be4a6..c49e365 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersComputeServiceExpectTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersComputeServiceExpectTest.java
@@ -23,14 +23,14 @@ import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.cloudservers.CloudServersApiMetadata;
-import org.jclouds.cloudservers.config.CloudServersRestClientModule;
+import org.jclouds.cloudservers.config.CloudServersHttpApiModule;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule;
import org.jclouds.openstack.keystone.v1_1.internal.BaseKeystoneRestClientExpectTest;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
@@ -54,11 +54,11 @@ public abstract class BaseCloudServersComputeServiceExpectTest<T> extends BaseKe
@Override
protected Module createModule() {
- return new TestCloudServersRestClientModule();
+ return new TestCloudServersHttpApiModule();
}
- @ConfiguresRestClient
- protected static class TestCloudServersRestClientModule extends CloudServersRestClientModule {
+ @ConfiguresHttpApi
+ protected static class TestCloudServersHttpApiModule extends CloudServersHttpApiModule {
@Override
public Supplier<Date> provideCacheBusterDate() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersRestClientExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersRestClientExpectTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersRestClientExpectTest.java
index edc2477..fcb875a 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersRestClientExpectTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersRestClientExpectTest.java
@@ -24,10 +24,10 @@ import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.cloudservers.CloudServersApiMetadata;
import org.jclouds.cloudservers.CloudServersClient;
-import org.jclouds.cloudservers.config.CloudServersRestClientModule;
+import org.jclouds.cloudservers.config.CloudServersHttpApiModule;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.openstack.keystone.v1_1.internal.BaseKeystoneRestClientExpectTest;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import com.google.common.base.Supplier;
import com.google.inject.Module;
@@ -63,11 +63,11 @@ public class BaseCloudServersRestClientExpectTest extends BaseKeystoneRestClient
*/
@Override
protected Module createModule() {
- return new TestCloudServersRestClientModule();
+ return new TestCloudServersHttpApiModule();
}
- @ConfiguresRestClient
- protected static class TestCloudServersRestClientModule extends CloudServersRestClientModule {
+ @ConfiguresHttpApi
+ protected static class TestCloudServersHttpApiModule extends CloudServersHttpApiModule {
@Override
public Supplier<Date> provideCacheBusterDate() {
[39/52] [abbrv] git commit: JCLOUDS-40 one last Async reference in
GAE driver.
Posted by an...@apache.org.
JCLOUDS-40 one last Async reference in GAE driver.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/9d77a06a
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/9d77a06a
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/9d77a06a
Branch: refs/heads/use-agentproxy-008
Commit: 9d77a06a5ff778ad63a28ec3f3a6d83b34999e71
Parents: 100d433
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 18:09:11 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 22:32:37 2014 -0700
----------------------------------------------------------------------
.../gae/src/test/java/org/jclouds/gae/GaeSocketOpenTest.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9d77a06a/drivers/gae/src/test/java/org/jclouds/gae/GaeSocketOpenTest.java
----------------------------------------------------------------------
diff --git a/drivers/gae/src/test/java/org/jclouds/gae/GaeSocketOpenTest.java b/drivers/gae/src/test/java/org/jclouds/gae/GaeSocketOpenTest.java
index b2b0451..b2d8c40 100644
--- a/drivers/gae/src/test/java/org/jclouds/gae/GaeSocketOpenTest.java
+++ b/drivers/gae/src/test/java/org/jclouds/gae/GaeSocketOpenTest.java
@@ -16,13 +16,13 @@
*/
package org.jclouds.gae;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
+
import org.jclouds.Context;
import org.jclouds.ContextBuilder;
import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
import org.jclouds.predicates.SocketOpen;
-import org.jclouds.providers.AnonymousProviderMetadata;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
@@ -32,9 +32,7 @@ public class GaeSocketOpenTest {
@Test(expectedExceptions = UnsupportedOperationException.class)
public void testSocketOpenThrowsUnsupported() {
- Context context = ContextBuilder.newBuilder(
- AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(IntegrationTestClient.class, IntegrationTestAsyncClient.class,
- "dummyurl"))
+ Context context = ContextBuilder.newBuilder(forApiOnEndpoint(IntegrationTestClient.class, "dummyurl"))
.modules(ImmutableSet.of(new GoogleAppEngineConfigurationModule()))
.build();
[50/52] [abbrv] git commit: Revert "JCLOUDS-736: Revert "Fail build
on checkstyle warnings""
Posted by an...@apache.org.
Revert "JCLOUDS-736: Revert "Fail build on checkstyle warnings""
This reverts commit 80d51f409aa36f1a5505214eb4ac6e1128213c92.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/b0f2962c
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/b0f2962c
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/b0f2962c
Branch: refs/heads/use-agentproxy-008
Commit: b0f2962c22c471ee34c1960a58b63f66f8bbe4b0
Parents: 67a0498
Author: Andrew Phillips <an...@apache.org>
Authored: Mon Oct 6 15:11:48 2014 -0400
Committer: Andrew Phillips <an...@apache.org>
Committed: Mon Oct 6 18:14:16 2014 -0400
----------------------------------------------------------------------
project/pom.xml | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b0f2962c/project/pom.xml
----------------------------------------------------------------------
diff --git a/project/pom.xml b/project/pom.xml
index c5e6693..c337938 100644
--- a/project/pom.xml
+++ b/project/pom.xml
@@ -709,6 +709,18 @@
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.13</version>
<!-- configuration and dependencies set via profiles -->
+ <executions>
+ <execution>
+ <id>checkstyle</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <failOnViolation>true</failOnViolation>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.gaul</groupId>
@@ -1072,6 +1084,14 @@
<failsOnError>true</failsOnError>
<violationSeverity>warning</violationSeverity>
</configuration>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.gaul</groupId>
@@ -1114,6 +1134,14 @@
<failsOnError>true</failsOnError>
<violationSeverity>warning</violationSeverity>
</configuration>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.gaul</groupId>
[36/52] [abbrv] git commit: Fixing Checkstyle violations
Posted by an...@apache.org.
Fixing Checkstyle violations
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/e42cc800
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/e42cc800
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/e42cc800
Branch: refs/heads/use-agentproxy-008
Commit: e42cc800920330f61fcf289e8af730d7da325417
Parents: 044223e
Author: Andrew Phillips <an...@apache.org>
Authored: Mon Oct 6 00:31:00 2014 -0400
Committer: Andrew Phillips <an...@apache.org>
Committed: Mon Oct 6 00:31:00 2014 -0400
----------------------------------------------------------------------
.../java/org/jclouds/cloudservers/CloudServersClient.java | 9 ++++-----
.../openstack/keystone/v2_0/KeystoneApiMetadata.java | 1 -
.../java/org/jclouds/openstack/swift/CommonSwiftClient.java | 2 +-
.../hpcloud/objectstorage/HPCloudObjectStorageApi.java | 1 -
4 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e42cc800/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
index ff9b21e..5b0d5d8 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
@@ -17,7 +17,10 @@
package org.jclouds.cloudservers;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import static org.jclouds.Fallbacks.*;
+import static org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
+import static org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import static org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import java.io.Closeable;
import java.util.Set;
@@ -30,9 +33,7 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks;
import org.jclouds.cloudservers.binders.BindBackupScheduleToJsonPayload;
import org.jclouds.cloudservers.domain.Addresses;
import org.jclouds.cloudservers.domain.BackupSchedule;
@@ -59,8 +60,6 @@ import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.Unwrap;
-import com.google.common.util.concurrent.ListenableFuture;
-
/**
* Provides access to Cloud Servers via their REST API.
*
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e42cc800/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java
index a46df20..0c76a58 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java
@@ -32,7 +32,6 @@ import org.jclouds.openstack.v2_0.ServiceType;
import org.jclouds.rest.internal.BaseHttpApiMetadata;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
/**
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e42cc800/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java
index dc7dfdc..1b2bc8b 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java
@@ -376,4 +376,4 @@ public interface CommonSwiftClient extends Closeable {
@ResponseParser(ParseETagHeader.class)
@Headers(keys = "X-Object-Manifest", values = "{container}/{name}/")
String putObjectManifest(@PathParam("container") String container, @PathParam("name") String name);
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e42cc800/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApi.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApi.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApi.java
index 4dbceb5..669c852 100644
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApi.java
+++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApi.java
@@ -42,7 +42,6 @@ import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import com.google.common.base.Optional;
-import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.Provides;
/** Provides synchronous access to HP Cloud Object Storage via the REST API. */
[24/52] [abbrv] git commit: JCLOUDS-40 remove all implementations of
AsyncBlobStore except Submission in preparation for complete removal.
Posted by an...@apache.org.
JCLOUDS-40 remove all implementations of AsyncBlobStore except Submission in preparation for complete removal.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/dfb583b6
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/dfb583b6
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/dfb583b6
Branch: refs/heads/use-agentproxy-008
Commit: dfb583b67aba421f9aa48e97ebfbc5303420d3b7
Parents: 8c520d3
Author: Adrian Cole <ac...@twitter.com>
Authored: Sat Oct 4 22:35:32 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 08:49:38 2014 -0700
----------------------------------------------------------------------
.../config/AtmosBlobStoreContextModule.java | 3 -
.../FilesystemBlobStoreContextModule.java | 8 -
.../config/S3BlobStoreContextModule.java | 3 -
.../config/SwiftBlobStoreContextModule.java | 3 -
.../org/jclouds/blobstore/AsyncBlobStore.java | 3 +
.../jclouds/blobstore/LocalAsyncBlobStore.java | 558 ------------------
.../blobstore/config/LocalBlobStore.java | 562 ++++++++++++++++++-
.../config/TransientBlobStoreContextModule.java | 10 -
.../blobstore/internal/BaseAsyncBlobStore.java | 310 ----------
.../TransientBlobRequestSignerTest.java | 3 +-
.../config/AzureBlobStoreContextModule.java | 3 -
...loudObjectStorageBlobStoreContextModule.java | 4 -
12 files changed, 566 insertions(+), 904 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
index a562ed6..c83dbf3 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
@@ -23,11 +23,9 @@ import javax.inject.Singleton;
import org.jclouds.atmos.AtmosClient;
import org.jclouds.atmos.blobstore.AtmosBlobRequestSigner;
import org.jclouds.atmos.blobstore.AtmosBlobStore;
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
-import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
@@ -41,7 +39,6 @@ public class AtmosBlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
- bind(AsyncBlobStore.class).to(SubmissionAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(AtmosBlobStore.class).in(Scopes.SINGLETON);
bind(BlobRequestSigner.class).to(AtmosBlobRequestSigner.class);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/apis/filesystem/src/main/java/org/jclouds/filesystem/config/FilesystemBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/main/java/org/jclouds/filesystem/config/FilesystemBlobStoreContextModule.java b/apis/filesystem/src/main/java/org/jclouds/filesystem/config/FilesystemBlobStoreContextModule.java
index 972abe9..9294450 100644
--- a/apis/filesystem/src/main/java/org/jclouds/filesystem/config/FilesystemBlobStoreContextModule.java
+++ b/apis/filesystem/src/main/java/org/jclouds/filesystem/config/FilesystemBlobStoreContextModule.java
@@ -16,12 +16,8 @@
*/
package org.jclouds.filesystem.config;
-import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncApi;
-
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.LocalAsyncBlobStore;
import org.jclouds.blobstore.LocalBlobRequestSigner;
import org.jclouds.blobstore.LocalStorageStrategy;
import org.jclouds.blobstore.attr.ConsistencyModel;
@@ -41,11 +37,7 @@ public class FilesystemBlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
- bind(AsyncBlobStore.class).to(LocalAsyncBlobStore.class).asEagerSingleton();
- // forward all requests from TransientBlobStore to TransientAsyncBlobStore. needs above binding as cannot proxy a class
- bindSyncToAsyncApi(binder(), LocalBlobStore.class, AsyncBlobStore.class);
bind(BlobStore.class).to(LocalBlobStore.class);
-
install(new BlobStoreObjectModule());
bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
bind(LocalStorageStrategy.class).to(FilesystemStorageStrategyImpl.class);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/apis/s3/src/main/java/org/jclouds/s3/blobstore/config/S3BlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/blobstore/config/S3BlobStoreContextModule.java b/apis/s3/src/main/java/org/jclouds/s3/blobstore/config/S3BlobStoreContextModule.java
index 525f9bd..f820308 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/blobstore/config/S3BlobStoreContextModule.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/blobstore/config/S3BlobStoreContextModule.java
@@ -22,11 +22,9 @@ import java.util.concurrent.TimeUnit;
import javax.inject.Singleton;
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
-import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
import org.jclouds.domain.Location;
import org.jclouds.s3.S3Client;
import org.jclouds.s3.blobstore.S3BlobRequestSigner;
@@ -47,7 +45,6 @@ public class S3BlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
- bind(AsyncBlobStore.class).to(SubmissionAsyncBlobStore.class).in(SINGLETON);
bind(BlobStore.class).to(S3BlobStore.class).in(SINGLETON);
bind(new TypeLiteral<Function<String, Location>>() {
}).to(LocationFromBucketName.class);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java
index 5387b8a..2ecdc88 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java
@@ -16,10 +16,8 @@
*/
package org.jclouds.openstack.swift.blobstore.config;
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
-import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
import org.jclouds.openstack.swift.blobstore.SwiftBlobStore;
import com.google.inject.AbstractModule;
@@ -30,7 +28,6 @@ public class SwiftBlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
- bind(AsyncBlobStore.class).to(SubmissionAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(SwiftBlobStore.class).in(Scopes.SINGLETON);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/blobstore/src/main/java/org/jclouds/blobstore/AsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/AsyncBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/AsyncBlobStore.java
index 22feebd..a121455 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/AsyncBlobStore.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/AsyncBlobStore.java
@@ -23,6 +23,7 @@ import org.jclouds.blobstore.domain.BlobBuilder;
import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.blobstore.domain.PageSet;
import org.jclouds.blobstore.domain.StorageMetadata;
+import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
import org.jclouds.blobstore.options.CreateContainerOptions;
import org.jclouds.blobstore.options.GetOptions;
import org.jclouds.blobstore.options.ListContainerOptions;
@@ -31,6 +32,7 @@ import org.jclouds.domain.Location;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.inject.ImplementedBy;
/**
* Provides hooks needed to run a blob store asynchronously
@@ -40,6 +42,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* supported. Please use {@link org.jclouds.blobstore.BlobStore}
*/
@Deprecated
+@ImplementedBy(SubmissionAsyncBlobStore.class)
public interface AsyncBlobStore {
/**
* @see BlobStore#getContext
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/blobstore/src/main/java/org/jclouds/blobstore/LocalAsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/LocalAsyncBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/LocalAsyncBlobStore.java
deleted file mode 100644
index 42e4124..0000000
--- a/blobstore/src/main/java/org/jclouds/blobstore/LocalAsyncBlobStore.java
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.blobstore;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.base.Throwables.getCausalChain;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.size;
-import static com.google.common.collect.Iterables.transform;
-import static com.google.common.collect.Sets.filter;
-import static com.google.common.collect.Sets.newTreeSet;
-import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.regex.Pattern;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.Constants;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.Blob.Factory;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.MutableBlobMetadata;
-import org.jclouds.blobstore.domain.MutableStorageMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.domain.StorageType;
-import org.jclouds.blobstore.domain.internal.MutableStorageMetadataImpl;
-import org.jclouds.blobstore.domain.internal.PageSetImpl;
-import org.jclouds.blobstore.domain.internal.StorageMetadataImpl;
-import org.jclouds.blobstore.internal.BaseAsyncBlobStore;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.blobstore.options.GetOptions;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.options.PutOptions;
-import org.jclouds.blobstore.strategy.IfDirectoryReturnNameStrategy;
-import org.jclouds.blobstore.util.BlobStoreUtils;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.http.HttpUtils;
-import org.jclouds.io.ByteStreams2;
-import org.jclouds.io.ContentMetadata;
-import org.jclouds.io.ContentMetadataCodec;
-import org.jclouds.io.Payload;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * Implementation of {@link BaseAsyncBlobStore} which uses a pluggable
- * LocalStorageStrategy.
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported. Please create and use {@link LocalBlobStore}
- */
-@Deprecated
-public class LocalAsyncBlobStore extends BaseAsyncBlobStore {
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- protected final ContentMetadataCodec contentMetadataCodec;
- protected final IfDirectoryReturnNameStrategy ifDirectoryReturnName;
- protected final Factory blobFactory;
- protected final LocalStorageStrategy storageStrategy;
-
- @Inject
- protected LocalAsyncBlobStore(BlobStoreContext context,
- BlobUtils blobUtils,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- Supplier<Location> defaultLocation,
- @Memoized Supplier<Set<? extends Location>> locations,
- ContentMetadataCodec contentMetadataCodec,
- IfDirectoryReturnNameStrategy ifDirectoryReturnName,
- Factory blobFactory, LocalStorageStrategy storageStrategy) {
- super(context, blobUtils, userExecutor, defaultLocation, locations);
- this.blobFactory = blobFactory;
- this.contentMetadataCodec = contentMetadataCodec;
- this.ifDirectoryReturnName = ifDirectoryReturnName;
- this.storageStrategy = storageStrategy;
- }
-
- /**
- * default maxResults is 1000
- */
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list(final String container, ListContainerOptions options) {
-
- // Check if the container exists
- if (!storageStrategy.containerExists(container))
- return immediateFailedFuture(cnfe(container));
-
- // Loading blobs from container
- Iterable<String> blobBelongingToContainer = null;
- try {
- blobBelongingToContainer = storageStrategy.getBlobKeysInsideContainer(container);
- } catch (IOException e) {
- logger.error(e, "An error occurred loading blobs contained into container %s", container);
- Throwables.propagate(e);
- }
-
- SortedSet<StorageMetadata> contents = newTreeSet(transform(blobBelongingToContainer,
- new Function<String, StorageMetadata>() {
- public StorageMetadata apply(String key) {
- if (!storageStrategy.blobExists(container, key)) {
- // handle directory
- return new StorageMetadataImpl(StorageType.FOLDER, /*id=*/ null, key,
- /*location=*/ null, /*uri=*/ null, /*eTag=*/ null, /*creationDate=*/ null,
- /*lastModified=*/ null, ImmutableMap.<String, String>of());
- }
- Blob oldBlob = loadBlob(container, key);
- checkState(oldBlob != null, "blob " + key + " is not present although it was in the list of "
- + container);
- checkState(oldBlob.getMetadata() != null, "blob " + container + "/" + key + " has no metadata");
- MutableBlobMetadata md = BlobStoreUtils.copy(oldBlob.getMetadata());
- String directoryName = ifDirectoryReturnName.execute(md);
- if (directoryName != null) {
- md.setName(directoryName);
- md.setType(StorageType.RELATIVE_PATH);
- }
- return md;
- }
- }));
-
- String marker = null;
- if (options != null) {
- if (options.getMarker() != null) {
- final String finalMarker = options.getMarker();
- StorageMetadata lastMarkerMetadata = find(contents, new Predicate<StorageMetadata>() {
- public boolean apply(StorageMetadata metadata) {
- return metadata.getName().compareTo(finalMarker) > 0;
- }
- });
- contents = contents.tailSet(lastMarkerMetadata);
- }
-
- final String prefix = options.getDir();
- if (prefix != null) {
- contents = newTreeSet(filter(contents, new Predicate<StorageMetadata>() {
- public boolean apply(StorageMetadata o) {
- return o != null && o.getName().startsWith(prefix) && !o.getName().equals(prefix);
- }
- }));
- }
-
- int maxResults = options.getMaxResults() != null ? options.getMaxResults() : 1000;
- if (!contents.isEmpty()) {
- StorageMetadata lastElement = contents.last();
- contents = newTreeSet(Iterables.limit(contents, maxResults));
- if (!contents.contains(lastElement)) {
- // Partial listing
- marker = contents.last().getName();
- }
- }
-
- if (!options.isRecursive()) {
- String delimiter = storageStrategy.getSeparator();
- SortedSet<String> commonPrefixes = newTreeSet(
- transform(contents, new CommonPrefixes(prefix, delimiter)));
- commonPrefixes.remove(CommonPrefixes.NO_PREFIX);
-
- contents = newTreeSet(filter(contents, new DelimiterFilter(prefix, delimiter)));
-
- for (String o : commonPrefixes) {
- MutableStorageMetadata md = new MutableStorageMetadataImpl();
- md.setType(StorageType.RELATIVE_PATH);
- md.setName(o);
- contents.add(md);
- }
- }
-
- // trim metadata, if the response isn't supposed to be detailed.
- if (!options.isDetailed()) {
- for (StorageMetadata md : contents) {
- md.getUserMetadata().clear();
- }
- }
- }
-
- return Futures.<PageSet<? extends StorageMetadata>> immediateFuture(new PageSetImpl<StorageMetadata>(contents,
- marker));
-
- }
-
- private ContainerNotFoundException cnfe(final String name) {
- return new ContainerNotFoundException(name, String.format(
- "container %s not in %s", name,
- storageStrategy.getAllContainerNames()));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListenableFuture<Void> removeBlob(final String container, final String key) {
- if (!storageStrategy.containerExists(container)) {
- return Futures.immediateFailedFuture(cnfe(container));
- }
- storageStrategy.removeBlob(container, key);
- return immediateFuture(null);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListenableFuture<Void> clearContainer(final String container) {
- storageStrategy.clearContainer(container);
- return immediateFuture(null);
- }
-
- /**
- * Override parent method because it uses strange futures and listenables
- * that creates problem in the test if more than one test that deletes the
- * container is executed
- *
- * @param container
- * @return
- */
- @Override
- public ListenableFuture<Void> deleteContainer(final String container) {
- deleteAndVerifyContainerGone(container);
- return immediateFuture(null);
- }
-
- @Override
- public ListenableFuture<Boolean> deleteContainerIfEmpty(final String container) {
- Boolean returnVal = true;
- if (storageStrategy.containerExists(container)) {
- try {
- if (Iterables.isEmpty(storageStrategy.getBlobKeysInsideContainer(container)))
- storageStrategy.deleteContainer(container);
- else
- returnVal = false;
- } catch (IOException e) {
- logger.error(e, "An error occurred loading blobs contained into container %s", container);
- Throwables.propagate(e);
- }
- }
- return immediateFuture(returnVal);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListenableFuture<Boolean> containerExists(final String containerName) {
- return immediateFuture(storageStrategy.containerExists(containerName));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list() {
- Iterable<String> containers = storageStrategy.getAllContainerNames();
-
- return Futures.<PageSet<? extends StorageMetadata>> immediateFuture(new PageSetImpl<StorageMetadata>(transform(
- containers, new Function<String, StorageMetadata>() {
- public StorageMetadata apply(String name) {
- MutableStorageMetadata cmd = create();
- cmd.setName(name);
- cmd.setType(StorageType.CONTAINER);
- cmd.setLocation(storageStrategy.getLocation(name));
- return cmd;
- }
- }), null));
- }
-
- protected MutableStorageMetadata create() {
- return new MutableStorageMetadataImpl();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(final Location location,
- final String name) {
- boolean result = storageStrategy.createContainerInLocation(name, location);
- return immediateFuture(result);
- }
-
- private Blob loadBlob(final String container, final String key) {
- logger.debug("Opening blob in container: %s - %s", container, key);
- return storageStrategy.getBlob(container, key);
- }
-
- protected static class DelimiterFilter implements Predicate<StorageMetadata> {
- private final String prefix;
- private final String delimiter;
-
- public DelimiterFilter(String prefix, String delimiter) {
- this.prefix = prefix;
- this.delimiter = delimiter;
- }
-
- public boolean apply(StorageMetadata metadata) {
- if (prefix == null)
- return metadata.getName().indexOf(delimiter) == -1;
- // ensure we don't accidentally append twice
- String toMatch = prefix.endsWith("/") ? prefix : prefix + delimiter;
- if (metadata.getName().startsWith(toMatch)) {
- String unprefixedName = metadata.getName().replaceFirst(Pattern.quote(toMatch), "");
- if (unprefixedName.equals("")) {
- // we are the prefix in this case, return false
- return false;
- }
- return unprefixedName.indexOf(delimiter) == -1;
- }
- return false;
- }
- }
-
- protected static class CommonPrefixes implements Function<StorageMetadata, String> {
- private final String prefix;
- private final String delimiter;
- public static final String NO_PREFIX = "NO_PREFIX";
-
- public CommonPrefixes(String prefix, String delimiter) {
- this.prefix = prefix;
- this.delimiter = delimiter;
- }
-
- public String apply(StorageMetadata metadata) {
- String working = metadata.getName();
- if (prefix != null) {
- // ensure we don't accidentally append twice
- String toMatch = prefix.endsWith("/") ? prefix : prefix + delimiter;
- if (working.startsWith(toMatch)) {
- working = working.replaceFirst(Pattern.quote(toMatch), "");
- }
- }
- if (working.contains(delimiter)) {
- return working.substring(0, working.indexOf(delimiter));
- }
- return NO_PREFIX;
- }
- }
-
- public static HttpResponseException returnResponseException(int code) {
- HttpResponse response = HttpResponse.builder().statusCode(code).build();
- return new HttpResponseException(new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub")
- .build()), response);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListenableFuture<String> putBlob(String containerName, Blob blob) {
- checkNotNull(containerName, "containerName must be set");
- checkNotNull(blob, "blob must be set");
- String blobKey = blob.getMetadata().getName();
-
- logger.debug("Put blob with key [%s] to container [%s]", blobKey, containerName);
- if (!storageStrategy.containerExists(containerName)) {
- return Futures.immediateFailedFuture(cnfe(containerName));
- }
-
- try {
- return immediateFuture(storageStrategy.putBlob(containerName, blob));
- } catch (IOException e) {
- String message = e.getMessage();
- if (message != null && message.startsWith("MD5 hash code mismatch")) {
- HttpResponseException exception = returnResponseException(400);
- exception.initCause(e);
- throw exception;
- }
- logger.error(e, "An error occurred storing the new blob with name [%s] to container [%s].", blobKey,
- containerName);
- throw Throwables.propagate(e);
- }
- }
-
- private void copyPayloadHeadersToBlob(Payload payload, Blob blob) {
- blob.getAllHeaders().putAll(contentMetadataCodec.toHeaders(payload.getContentMetadata()));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListenableFuture<Boolean> blobExists(final String containerName, final String key) {
- if (!storageStrategy.containerExists(containerName))
- return immediateFailedFuture(cnfe(containerName));
- return immediateFuture(storageStrategy.blobExists(containerName, key));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListenableFuture<Blob> getBlob(final String containerName, final String key, GetOptions options) {
- logger.debug("Retrieving blob with key %s from container %s", key, containerName);
- // If the container doesn't exist, an exception is thrown
- if (!storageStrategy.containerExists(containerName)) {
- logger.debug("Container %s does not exist", containerName);
- return immediateFailedFuture(cnfe(containerName));
- }
- // If the blob doesn't exist, a null object is returned
- if (!storageStrategy.blobExists(containerName, key)) {
- logger.debug("Item %s does not exist in container %s", key, containerName);
- return immediateFuture(null);
- }
-
- Blob blob = loadBlob(containerName, key);
-
- if (options != null) {
- if (options.getIfMatch() != null) {
- if (!blob.getMetadata().getETag().equals(options.getIfMatch()))
- return immediateFailedFuture(returnResponseException(412));
- }
- if (options.getIfNoneMatch() != null) {
- if (blob.getMetadata().getETag().equals(options.getIfNoneMatch()))
- return immediateFailedFuture(returnResponseException(304));
- }
- if (options.getIfModifiedSince() != null) {
- Date modifiedSince = options.getIfModifiedSince();
- if (blob.getMetadata().getLastModified().before(modifiedSince)) {
- HttpResponse response = HttpResponse.builder().statusCode(304).build();
- return immediateFailedFuture(new HttpResponseException(String.format("%1$s is before %2$s", blob
- .getMetadata().getLastModified(), modifiedSince), null, response));
- }
-
- }
- if (options.getIfUnmodifiedSince() != null) {
- Date unmodifiedSince = options.getIfUnmodifiedSince();
- if (blob.getMetadata().getLastModified().after(unmodifiedSince)) {
- HttpResponse response = HttpResponse.builder().statusCode(412).build();
- return immediateFailedFuture(new HttpResponseException(String.format("%1$s is after %2$s", blob
- .getMetadata().getLastModified(), unmodifiedSince), null, response));
- }
- }
- blob = copyBlob(blob);
-
- if (options.getRanges() != null && !options.getRanges().isEmpty()) {
- byte[] data;
- try {
- data = ByteStreams2.toByteArrayAndClose(blob.getPayload().openStream());
- } catch (IOException e) {
- return immediateFailedFuture(new RuntimeException(e));
- }
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- for (String s : options.getRanges()) {
- // HTTP uses a closed interval while Java array indexing uses a
- // half-open interval.
- int offset = 0;
- int last = data.length - 1;
- if (s.startsWith("-")) {
- offset = last - Integer.parseInt(s.substring(1)) + 1;
- } else if (s.endsWith("-")) {
- offset = Integer.parseInt(s.substring(0, s.length() - 1));
- } else if (s.contains("-")) {
- String[] firstLast = s.split("\\-");
- offset = Integer.parseInt(firstLast[0]);
- last = Integer.parseInt(firstLast[1]);
- } else {
- return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
- }
-
- if (offset > last) {
- return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
- }
- if (last + 1 > data.length) {
- last = data.length - 1;
- }
- out.write(data, offset, last - offset + 1);
- }
- ContentMetadata cmd = blob.getPayload().getContentMetadata();
- byte[] byteArray = out.toByteArray();
- blob.setPayload(byteArray);
- HttpUtils.copy(cmd, blob.getPayload().getContentMetadata());
- blob.getPayload().getContentMetadata().setContentLength(Long.valueOf(byteArray.length));
- }
- }
- checkNotNull(blob.getPayload(), "payload " + blob);
- return immediateFuture(blob);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListenableFuture<BlobMetadata> blobMetadata(final String container, final String key) {
- try {
- Blob blob = getBlob(container, key).get();
- return immediateFuture(blob != null ? (BlobMetadata) BlobStoreUtils.copy(blob.getMetadata()) : null);
- } catch (Exception e) {
- if (size(filter(getCausalChain(e), KeyNotFoundException.class)) >= 1)
- return immediateFuture(null);
- return immediateFailedFuture(e);
- }
- }
-
- private Blob copyBlob(Blob blob) {
- Blob returnVal = blobFactory.create(BlobStoreUtils.copy(blob.getMetadata()));
- returnVal.setPayload(blob.getPayload());
- copyPayloadHeadersToBlob(blob.getPayload(), returnVal);
- return returnVal;
- }
-
- @Override
- protected boolean deleteAndVerifyContainerGone(final String container) {
- storageStrategy.deleteContainer(container);
- return storageStrategy.containerExists(container);
- }
-
- @Override
- public ListenableFuture<String> putBlob(String container, Blob blob, PutOptions options) {
- // TODO implement options
- return putBlob(container, blob);
- }
-
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, String container,
- CreateContainerOptions options) {
- if (options.isPublicRead())
- throw new UnsupportedOperationException("publicRead");
- return createContainerInLocation(location, container);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
index 5245db6..8af40e9 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
@@ -16,8 +16,568 @@
*/
package org.jclouds.blobstore.config;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Throwables.getCausalChain;
+import static com.google.common.base.Throwables.propagate;
+import static com.google.common.collect.Iterables.find;
+import static com.google.common.collect.Iterables.size;
+import static com.google.common.collect.Iterables.transform;
+import static com.google.common.collect.Sets.filter;
+import static com.google.common.collect.Sets.newTreeSet;
+import static org.jclouds.blobstore.options.ListContainerOptions.Builder.recursive;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.regex.Pattern;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
import org.jclouds.blobstore.BlobStore;
+import org.jclouds.blobstore.BlobStoreContext;
+import org.jclouds.blobstore.ContainerNotFoundException;
+import org.jclouds.blobstore.KeyNotFoundException;
+import org.jclouds.blobstore.LocalStorageStrategy;
+import org.jclouds.blobstore.domain.Blob;
+import org.jclouds.blobstore.domain.BlobBuilder;
+import org.jclouds.blobstore.domain.BlobMetadata;
+import org.jclouds.blobstore.domain.MutableBlobMetadata;
+import org.jclouds.blobstore.domain.MutableStorageMetadata;
+import org.jclouds.blobstore.domain.PageSet;
+import org.jclouds.blobstore.domain.StorageMetadata;
+import org.jclouds.blobstore.domain.StorageType;
+import org.jclouds.blobstore.domain.internal.MutableStorageMetadataImpl;
+import org.jclouds.blobstore.domain.internal.PageSetImpl;
+import org.jclouds.blobstore.domain.internal.StorageMetadataImpl;
+import org.jclouds.blobstore.options.CreateContainerOptions;
+import org.jclouds.blobstore.options.GetOptions;
+import org.jclouds.blobstore.options.ListContainerOptions;
+import org.jclouds.blobstore.options.PutOptions;
+import org.jclouds.blobstore.strategy.IfDirectoryReturnNameStrategy;
+import org.jclouds.blobstore.util.BlobStoreUtils;
+import org.jclouds.blobstore.util.BlobUtils;
+import org.jclouds.collect.Memoized;
+import org.jclouds.domain.Location;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.http.HttpUtils;
+import org.jclouds.io.ByteStreams2;
+import org.jclouds.io.ContentMetadata;
+import org.jclouds.io.ContentMetadataCodec;
+import org.jclouds.io.Payload;
+import org.jclouds.logging.Logger;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+
+@Singleton
+public final class LocalBlobStore implements BlobStore {
+
+ @Resource
+ private Logger logger = Logger.NULL;
+
+ private final BlobStoreContext context;
+ private final BlobUtils blobUtils;
+ private final Supplier<Set<? extends Location>> locations;
+ private final ContentMetadataCodec contentMetadataCodec;
+ private final IfDirectoryReturnNameStrategy ifDirectoryReturnName;
+ private final Blob.Factory blobFactory;
+ private final LocalStorageStrategy storageStrategy;
+
+ @Inject
+ LocalBlobStore(BlobStoreContext context,
+ BlobUtils blobUtils,
+ @Memoized Supplier<Set<? extends Location>> locations,
+ ContentMetadataCodec contentMetadataCodec,
+ IfDirectoryReturnNameStrategy ifDirectoryReturnName,
+ Blob.Factory blobFactory, LocalStorageStrategy storageStrategy) {
+ this.context = checkNotNull(context, "context");
+ this.blobUtils = checkNotNull(blobUtils, "blobUtils");
+ this.locations = checkNotNull(locations, "locations");
+ this.blobFactory = blobFactory;
+ this.contentMetadataCodec = contentMetadataCodec;
+ this.ifDirectoryReturnName = ifDirectoryReturnName;
+ this.storageStrategy = storageStrategy;
+ }
+
+ @Override
+ public BlobStoreContext getContext() {
+ return context;
+ }
+
+ @Override
+ public BlobBuilder blobBuilder(String name) {
+ return blobUtils.blobBuilder().name(name);
+ }
+
+ /** This implementation invokes {@link #list(String, ListContainerOptions)} */
+ @Override
+ public PageSet<? extends StorageMetadata> list(String containerName) {
+ return this.list(containerName, ListContainerOptions.NONE);
+ }
+
+ /**
+ * This implementation invokes {@link #countBlobs} with the
+ * {@link ListContainerOptions#recursive} option.
+ */
+ @Override
+ public long countBlobs(String containerName) {
+ return countBlobs(containerName, recursive());
+ }
+
+ /**
+ * This implementation invokes {@link BlobUtils#countBlobs}
+ */
+ @Override
+ public long countBlobs(final String containerName, final ListContainerOptions options) {
+ return blobUtils.countBlobs(containerName, options);
+ }
+
+ /**
+ * This implementation invokes {@link #clearContainer} with the
+ * {@link ListContainerOptions#recursive} option.
+ */
+ @Override
+ public void clearContainer(String containerName) {
+ clearContainer(containerName, recursive());
+ }
+
+ @Override
+ public void clearContainer(String containerName, ListContainerOptions options) {
+ blobUtils.clearContainer(containerName, options);
+ }
+
+ @Override
+ public void deleteDirectory(final String containerName, final String directory) {
+ blobUtils.deleteDirectory(containerName, directory);
+ }
+
+ @Override
+ public boolean directoryExists(String containerName, String directory) {
+ return blobUtils.directoryExists(containerName, directory);
+ }
+
+ @Override
+ public void createDirectory(String containerName, String directory) {
+ if (!blobUtils.directoryExists(containerName, directory)) {
+ blobUtils.createDirectory(containerName, directory);
+ }
+ }
+
+ /**
+ * This implementation invokes {@link #getBlob(String,String, GetOptions)}
+ */
+ @Override
+ public Blob getBlob(String containerName, String key) {
+ return getBlob(containerName, key, GetOptions.NONE);
+ }
+
+ /**
+ * This implementation invokes {@link #deleteAndVerifyContainerGone}
+ */
+ @Override
+ public void deleteContainer(String containerName) {
+ deleteAndVerifyContainerGone(containerName);
+ }
+
+ @Override
+ public Set<? extends Location> listAssignableLocations() {
+ return locations.get();
+ }
+
+ /**
+ * default maxResults is 1000
+ */
+ @Override
+ public PageSet<? extends StorageMetadata> list(final String containerName, ListContainerOptions options) {
+
+ // Check if the container exists
+ if (!storageStrategy.containerExists(containerName))
+ throw cnfe(containerName);
+
+ // Loading blobs from container
+ Iterable<String> blobBelongingToContainer = null;
+ try {
+ blobBelongingToContainer = storageStrategy.getBlobKeysInsideContainer(containerName);
+ } catch (IOException e) {
+ logger.error(e, "An error occurred loading blobs contained into container %s", containerName);
+ propagate(e);
+ }
+
+ SortedSet<StorageMetadata> contents = newTreeSet(transform(blobBelongingToContainer,
+ new Function<String, StorageMetadata>() {
+ public StorageMetadata apply(String key) {
+ if (!storageStrategy.blobExists(containerName, key)) {
+ // handle directory
+ return new StorageMetadataImpl(StorageType.FOLDER, /*id=*/ null, key,
+ /*location=*/ null, /*uri=*/ null, /*eTag=*/ null, /*creationDate=*/ null,
+ /*lastModified=*/ null, ImmutableMap.<String, String>of());
+ }
+ Blob oldBlob = loadBlob(containerName, key);
+ checkState(oldBlob != null, "blob " + key + " is not present although it was in the list of "
+ + containerName);
+ checkState(oldBlob.getMetadata() != null, "blob " + containerName + "/" + key + " has no metadata");
+ MutableBlobMetadata md = BlobStoreUtils.copy(oldBlob.getMetadata());
+ String directoryName = ifDirectoryReturnName.execute(md);
+ if (directoryName != null) {
+ md.setName(directoryName);
+ md.setType(StorageType.RELATIVE_PATH);
+ }
+ return md;
+ }
+ }));
+
+ String marker = null;
+ if (options != null) {
+ if (options.getMarker() != null) {
+ final String finalMarker = options.getMarker();
+ StorageMetadata lastMarkerMetadata = find(contents, new Predicate<StorageMetadata>() {
+ public boolean apply(StorageMetadata metadata) {
+ return metadata.getName().compareTo(finalMarker) > 0;
+ }
+ });
+ contents = contents.tailSet(lastMarkerMetadata);
+ }
+
+ final String prefix = options.getDir();
+ if (prefix != null) {
+ contents = newTreeSet(filter(contents, new Predicate<StorageMetadata>() {
+ public boolean apply(StorageMetadata o) {
+ return o != null && o.getName().startsWith(prefix) && !o.getName().equals(prefix);
+ }
+ }));
+ }
+
+ int maxResults = options.getMaxResults() != null ? options.getMaxResults() : 1000;
+ if (!contents.isEmpty()) {
+ StorageMetadata lastElement = contents.last();
+ contents = newTreeSet(Iterables.limit(contents, maxResults));
+ if (!contents.contains(lastElement)) {
+ // Partial listing
+ marker = contents.last().getName();
+ }
+ }
+
+ if (!options.isRecursive()) {
+ String delimiter = storageStrategy.getSeparator();
+ SortedSet<String> commonPrefixes = newTreeSet(
+ transform(contents, new CommonPrefixes(prefix, delimiter)));
+ commonPrefixes.remove(CommonPrefixes.NO_PREFIX);
+
+ contents = newTreeSet(filter(contents, new DelimiterFilter(prefix, delimiter)));
+
+ for (String o : commonPrefixes) {
+ MutableStorageMetadata md = new MutableStorageMetadataImpl();
+ md.setType(StorageType.RELATIVE_PATH);
+ md.setName(o);
+ contents.add(md);
+ }
+ }
+
+ // trim metadata, if the response isn't supposed to be detailed.
+ if (!options.isDetailed()) {
+ for (StorageMetadata md : contents) {
+ md.getUserMetadata().clear();
+ }
+ }
+ }
+
+ return new PageSetImpl<StorageMetadata>(contents, marker);
+ }
+
+ private ContainerNotFoundException cnfe(final String name) {
+ return new ContainerNotFoundException(name, String.format(
+ "container %s not in %s", name,
+ storageStrategy.getAllContainerNames()));
+ }
+
+ @Override
+ public void removeBlob(String containerName, final String key) {
+ if (!storageStrategy.containerExists(containerName)) {
+ throw cnfe(containerName);
+ }
+ storageStrategy.removeBlob(containerName, key);
+ }
+
+ @Override
+ public boolean deleteContainerIfEmpty(String containerName) {
+ boolean returnVal = true;
+ if (storageStrategy.containerExists(containerName)) {
+ try {
+ if (Iterables.isEmpty(storageStrategy.getBlobKeysInsideContainer(containerName)))
+ storageStrategy.deleteContainer(containerName);
+ else
+ returnVal = false;
+ } catch (IOException e) {
+ logger.error(e, "An error occurred loading blobs contained into container %s", containerName);
+ throw propagate(e);
+ }
+ }
+ return returnVal;
+ }
+
+ @Override
+ public boolean containerExists(String containerName) {
+ return storageStrategy.containerExists(containerName);
+ }
+
+ @Override
+ public PageSet<? extends StorageMetadata> list() {
+ Iterable<String> containers = storageStrategy.getAllContainerNames();
+
+ return new PageSetImpl<StorageMetadata>(transform(
+ containers, new Function<String, StorageMetadata>() {
+ public StorageMetadata apply(String name) {
+ MutableStorageMetadata cmd = create();
+ cmd.setName(name);
+ cmd.setType(StorageType.CONTAINER);
+ cmd.setLocation(storageStrategy.getLocation(name));
+ return cmd;
+ }
+ }), null);
+ }
+
+ private MutableStorageMetadata create() {
+ return new MutableStorageMetadataImpl();
+ }
+
+ @Override
+ public boolean createContainerInLocation(Location location, String name) {
+ return storageStrategy.createContainerInLocation(name, location);
+ }
+
+ private Blob loadBlob(final String container, final String key) {
+ logger.debug("Opening blob in container: %s - %s", container, key);
+ return storageStrategy.getBlob(container, key);
+ }
+
+ private static class DelimiterFilter implements Predicate<StorageMetadata> {
+ private final String prefix;
+ private final String delimiter;
+
+ public DelimiterFilter(String prefix, String delimiter) {
+ this.prefix = prefix;
+ this.delimiter = delimiter;
+ }
+
+ public boolean apply(StorageMetadata metadata) {
+ if (prefix == null)
+ return metadata.getName().indexOf(delimiter) == -1;
+ // ensure we don't accidentally append twice
+ String toMatch = prefix.endsWith("/") ? prefix : prefix + delimiter;
+ if (metadata.getName().startsWith(toMatch)) {
+ String unprefixedName = metadata.getName().replaceFirst(Pattern.quote(toMatch), "");
+ if (unprefixedName.equals("")) {
+ // we are the prefix in this case, return false
+ return false;
+ }
+ return unprefixedName.indexOf(delimiter) == -1;
+ }
+ return false;
+ }
+ }
+
+ private static class CommonPrefixes implements Function<StorageMetadata, String> {
+ private final String prefix;
+ private final String delimiter;
+ public static final String NO_PREFIX = "NO_PREFIX";
+
+ public CommonPrefixes(String prefix, String delimiter) {
+ this.prefix = prefix;
+ this.delimiter = delimiter;
+ }
+
+ public String apply(StorageMetadata metadata) {
+ String working = metadata.getName();
+ if (prefix != null) {
+ // ensure we don't accidentally append twice
+ String toMatch = prefix.endsWith("/") ? prefix : prefix + delimiter;
+ if (working.startsWith(toMatch)) {
+ working = working.replaceFirst(Pattern.quote(toMatch), "");
+ }
+ }
+ if (working.contains(delimiter)) {
+ return working.substring(0, working.indexOf(delimiter));
+ }
+ return NO_PREFIX;
+ }
+ }
+
+ private static HttpResponseException returnResponseException(int code) {
+ HttpResponse response = HttpResponse.builder().statusCode(code).build();
+ return new HttpResponseException(new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub")
+ .build()), response);
+ }
+
+ @Override
+ public String putBlob(String containerName, Blob blob) {
+ checkNotNull(containerName, "containerName must be set");
+ checkNotNull(blob, "blob must be set");
+ String blobKey = blob.getMetadata().getName();
+
+ logger.debug("Put blob with key [%s] to container [%s]", blobKey, containerName);
+ if (!storageStrategy.containerExists(containerName)) {
+ throw cnfe(containerName);
+ }
+
+ try {
+ return storageStrategy.putBlob(containerName, blob);
+ } catch (IOException e) {
+ String message = e.getMessage();
+ if (message != null && message.startsWith("MD5 hash code mismatch")) {
+ HttpResponseException exception = returnResponseException(400);
+ exception.initCause(e);
+ throw exception;
+ }
+ logger.error(e, "An error occurred storing the new blob with name [%s] to container [%s].", blobKey,
+ containerName);
+ throw propagate(e);
+ }
+ }
+
+ private void copyPayloadHeadersToBlob(Payload payload, Blob blob) {
+ blob.getAllHeaders().putAll(contentMetadataCodec.toHeaders(payload.getContentMetadata()));
+ }
+
+ @Override
+ public boolean blobExists(String containerName, String key) {
+ if (!storageStrategy.containerExists(containerName))
+ throw cnfe(containerName);
+ return storageStrategy.blobExists(containerName, key);
+ }
+
+ @Override
+ public Blob getBlob(String containerName, String key, GetOptions options) {
+ logger.debug("Retrieving blob with key %s from container %s", key, containerName);
+ // If the container doesn't exist, an exception is thrown
+ if (!storageStrategy.containerExists(containerName)) {
+ logger.debug("Container %s does not exist", containerName);
+ throw cnfe(containerName);
+ }
+ // If the blob doesn't exist, a null object is returned
+ if (!storageStrategy.blobExists(containerName, key)) {
+ logger.debug("Item %s does not exist in container %s", key, containerName);
+ return null;
+ }
+
+ Blob blob = loadBlob(containerName, key);
+
+ if (options != null) {
+ if (options.getIfMatch() != null) {
+ if (!blob.getMetadata().getETag().equals(options.getIfMatch()))
+ throw returnResponseException(412);
+ }
+ if (options.getIfNoneMatch() != null) {
+ if (blob.getMetadata().getETag().equals(options.getIfNoneMatch()))
+ throw returnResponseException(304);
+ }
+ if (options.getIfModifiedSince() != null) {
+ Date modifiedSince = options.getIfModifiedSince();
+ if (blob.getMetadata().getLastModified().before(modifiedSince)) {
+ HttpResponse response = HttpResponse.builder().statusCode(304).build();
+ throw new HttpResponseException(String.format("%1$s is before %2$s", blob
+ .getMetadata().getLastModified(), modifiedSince), null, response);
+ }
+
+ }
+ if (options.getIfUnmodifiedSince() != null) {
+ Date unmodifiedSince = options.getIfUnmodifiedSince();
+ if (blob.getMetadata().getLastModified().after(unmodifiedSince)) {
+ HttpResponse response = HttpResponse.builder().statusCode(412).build();
+ throw new HttpResponseException(String.format("%1$s is after %2$s", blob
+ .getMetadata().getLastModified(), unmodifiedSince), null, response);
+ }
+ }
+ blob = copyBlob(blob);
+
+ if (options.getRanges() != null && !options.getRanges().isEmpty()) {
+ byte[] data;
+ try {
+ data = ByteStreams2.toByteArrayAndClose(blob.getPayload().openStream());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ for (String s : options.getRanges()) {
+ // HTTP uses a closed interval while Java array indexing uses a
+ // half-open interval.
+ int offset = 0;
+ int last = data.length - 1;
+ if (s.startsWith("-")) {
+ offset = last - Integer.parseInt(s.substring(1)) + 1;
+ } else if (s.endsWith("-")) {
+ offset = Integer.parseInt(s.substring(0, s.length() - 1));
+ } else if (s.contains("-")) {
+ String[] firstLast = s.split("\\-");
+ offset = Integer.parseInt(firstLast[0]);
+ last = Integer.parseInt(firstLast[1]);
+ } else {
+ throw new IllegalArgumentException("illegal range: " + s);
+ }
+
+ if (offset > last) {
+ throw new IllegalArgumentException("illegal range: " + s);
+ }
+ if (last + 1 > data.length) {
+ last = data.length - 1;
+ }
+ out.write(data, offset, last - offset + 1);
+ }
+ ContentMetadata cmd = blob.getPayload().getContentMetadata();
+ byte[] byteArray = out.toByteArray();
+ blob.setPayload(byteArray);
+ HttpUtils.copy(cmd, blob.getPayload().getContentMetadata());
+ blob.getPayload().getContentMetadata().setContentLength(Long.valueOf(byteArray.length));
+ }
+ }
+ checkNotNull(blob.getPayload(), "payload " + blob);
+ return blob;
+ }
+
+ @Override
+ public BlobMetadata blobMetadata(String containerName, String key) {
+ try {
+ Blob blob = getBlob(containerName, key);
+ return blob != null ? (BlobMetadata) BlobStoreUtils.copy(blob.getMetadata()) : null;
+ } catch (Exception e) {
+ if (size(Iterables.filter(getCausalChain(e), KeyNotFoundException.class)) >= 1)
+ return null;
+ throw e;
+ }
+ }
+
+ private Blob copyBlob(Blob blob) {
+ Blob returnVal = blobFactory.create(BlobStoreUtils.copy(blob.getMetadata()));
+ returnVal.setPayload(blob.getPayload());
+ copyPayloadHeadersToBlob(blob.getPayload(), returnVal);
+ return returnVal;
+ }
+
+ private boolean deleteAndVerifyContainerGone(final String container) {
+ storageStrategy.deleteContainer(container);
+ return storageStrategy.containerExists(container);
+ }
-public interface LocalBlobStore extends BlobStore {
+ @Override
+ public String putBlob(String containerName, Blob blob, PutOptions options) {
+ // TODO implement options
+ return putBlob(containerName, blob);
+ }
+ @Override
+ public boolean createContainerInLocation(Location location, String container, CreateContainerOptions options) {
+ if (options.isPublicRead())
+ throw new UnsupportedOperationException("publicRead");
+ return createContainerInLocation(location, container);
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/blobstore/src/main/java/org/jclouds/blobstore/config/TransientBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/config/TransientBlobStoreContextModule.java b/blobstore/src/main/java/org/jclouds/blobstore/config/TransientBlobStoreContextModule.java
index 2f73741..7df30b5 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/config/TransientBlobStoreContextModule.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/config/TransientBlobStoreContextModule.java
@@ -16,12 +16,8 @@
*/
package org.jclouds.blobstore.config;
-import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncApi;
-
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.LocalAsyncBlobStore;
import org.jclouds.blobstore.LocalBlobRequestSigner;
import org.jclouds.blobstore.LocalStorageStrategy;
import org.jclouds.blobstore.TransientStorageStrategy;
@@ -29,15 +25,9 @@ import org.jclouds.blobstore.attr.ConsistencyModel;
import com.google.inject.AbstractModule;
-/**
- * Configures the {@link TransientBlobStoreContext}; requires {@link TransientAsyncBlobStore} bound.
- */
public class TransientBlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
- bind(AsyncBlobStore.class).to(LocalAsyncBlobStore.class).asEagerSingleton();
- // forward all requests from TransientBlobStore to TransientAsyncBlobStore. needs above binding as cannot proxy a class
- bindSyncToAsyncApi(binder(), LocalBlobStore.class, AsyncBlobStore.class);
install(new BlobStoreObjectModule());
bind(BlobStore.class).to(LocalBlobStore.class);
bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/blobstore/src/main/java/org/jclouds/blobstore/internal/BaseAsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/internal/BaseAsyncBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/internal/BaseAsyncBlobStore.java
deleted file mode 100644
index 8bddf7f..0000000
--- a/blobstore/src/main/java/org/jclouds/blobstore/internal/BaseAsyncBlobStore.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.blobstore.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.blobstore.options.ListContainerOptions.Builder.recursive;
-import static org.jclouds.util.Predicates2.retry;
-
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.Constants;
-import org.jclouds.blobstore.AsyncBlobStore;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.ContainerNotFoundException;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobBuilder;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported. Please use {@link org.jclouds.blobstore.BlobStore}
- */
-@Deprecated
-public abstract class BaseAsyncBlobStore implements AsyncBlobStore {
-
- protected final BlobStoreContext context;
- protected final BlobUtils blobUtils;
- protected final ListeningExecutorService userExecutor;
- protected final Supplier<Location> defaultLocation;
- protected final Supplier<Set<? extends Location>> locations;
-
- @Inject
- protected BaseAsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, Supplier<Location> defaultLocation,
- @Memoized Supplier<Set<? extends Location>> locations) {
- this.context = checkNotNull(context, "context");
- this.blobUtils = checkNotNull(blobUtils, "blobUtils");
- this.userExecutor = checkNotNull(userExecutor, "userExecutor");
- this.defaultLocation = checkNotNull(defaultLocation, "defaultLocation");
- this.locations = checkNotNull(locations, "locations");
- }
-
- @Override
- public BlobStoreContext getContext() {
- return context;
- }
-
- /**
- * invokes {@link BlobUtilsImpl#blobBuilder }
- */
- @Override
- public BlobBuilder blobBuilder(String name) {
- return blobUtils.blobBuilder().name(name);
- }
-
- /**
- * This implementation invokes
- * {@link #list(String,org.jclouds.blobstore.options.ListContainerOptions)}
- *
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list(String container) {
- return this.list(container, org.jclouds.blobstore.options.ListContainerOptions.NONE);
- }
-
- /**
- * This implementation invokes {@link #countBlobs} with the
- * {@link ListContainerOptions#recursive} option.
- *
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<Long> countBlobs(String container) {
- return countBlobs(container, recursive());
- }
-
- /**
- * This implementation invokes {@link BlobUtilsImpl#countBlobs}
- *
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<Long> countBlobs(final String containerName, final ListContainerOptions options) {
- return userExecutor.submit(new Callable<Long>() {
- public Long call() throws Exception {
- return blobUtils.countBlobs(containerName, options);
- }
-
- @Override
- public String toString() {
- return "countBlobs(" + containerName + ")";
- }
- });
- }
-
- /**
- * This implementation invokes {@link #clearContainer} with the
- * {@link ListContainerOptions#recursive} option.
- *
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<Void> clearContainer(final String container) {
- return clearContainer(container, recursive());
- }
-
- /**
- * This implementation invokes {@link BlobUtilsImpl#clearContainer}
- *
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<Void> clearContainer(final String containerName, final ListContainerOptions options) {
- return userExecutor.submit(new Callable<Void>() {
-
- public Void call() throws Exception {
- blobUtils.clearContainer(containerName, options);
- return null;
- }
-
- @Override
- public String toString() {
- return "clearContainer(" + containerName + ")";
- }
- });
- }
-
- /**
- * This implementation invokes {@link BlobUtilsImpl#deleteDirectory}.
- *
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<Void> deleteDirectory(final String containerName, final String directory) {
- return userExecutor.submit(new Callable<Void>() {
-
- public Void call() throws Exception {
- blobUtils.deleteDirectory(containerName, directory);
- return null;
- }
-
- @Override
- public String toString() {
- return "deleteDirectory(" + containerName + "," + directory + ")";
- }
- });
- }
-
- /**
- * This implementation invokes {@link BlobUtilsImpl#directoryExists}
- *
- * @param container
- * container name
- * @param directory
- * virtual path
- */
- public ListenableFuture<Boolean> directoryExists(final String containerName, final String directory) {
- return userExecutor.submit(new Callable<Boolean>() {
-
- public Boolean call() throws Exception {
- return blobUtils.directoryExists(containerName, directory);
- }
-
- @Override
- public String toString() {
- return "directoryExists(" + containerName + "," + directory + ")";
- }
- });
- }
-
- /**
- * This implementation invokes {@link BlobUtilsImpl#createDirectory}
- *
- * @param container
- * container name
- * @param directory
- * virtual path
- */
-
- public ListenableFuture<Void> createDirectory(final String containerName, final String directory) {
- return blobUtils.directoryExists(containerName, directory) ? Futures.immediateFuture((Void) null)
- : userExecutor.submit(new Callable<Void>() {
- public Void call() throws Exception {
- blobUtils.createDirectory(containerName, directory);
- return null;
- }
-
- @Override
- public String toString() {
- return "createDirectory(" + containerName + "," + directory + ")";
- }
- });
- }
-
- /**
- * This implementation invokes
- * {@link #getBlob(String,String,org.jclouds.blobstore.options.GetOptions)}
- *
- * @param container
- * container name
- * @param key
- * blob key
- */
- @Override
- public ListenableFuture<Blob> getBlob(String container, String key) {
- return getBlob(container, key, org.jclouds.blobstore.options.GetOptions.NONE);
- }
-
- /**
- * This implementation invokes {@link #deleteAndEnsurePathGone}
- *
- * @param container
- * bucket name
- */
- @Override
- public ListenableFuture<Void> deleteContainer(final String container) {
- return userExecutor.submit(new Callable<Void>() {
-
- public Void call() throws Exception {
- deletePathAndEnsureGone(container);
- return null;
- }
-
- @Override
- public String toString() {
- return "deleteContainer(" + container + ")";
- }
- });
- }
-
- @Override
- public ListenableFuture<Boolean> deleteContainerIfEmpty(final String container) {
- return userExecutor.submit(new Callable<Boolean>() {
-
- public Boolean call() throws Exception {
- return deleteAndVerifyContainerGone(container);
- }
-
- @Override
- public String toString() {
- return "deleteContainerIfEmpty(" + container + ")";
- }
- });
- }
-
- protected void deletePathAndEnsureGone(String path) {
- checkState(retry(new Predicate<String>() {
- public boolean apply(String in) {
- try {
- blobUtils.clearContainer(in, recursive());
- return deleteAndVerifyContainerGone(in);
- } catch (ContainerNotFoundException e) {
- return true;
- }
- }
- }, 30000).apply(path), "%s still exists after deleting!", path);
- }
-
- @Override
- public ListenableFuture<Set<? extends Location>> listAssignableLocations() {
- return Futures.<Set<? extends Location>> immediateFuture(locations.get());
- }
-
- /**
- * Delete a container if it is empty.
- *
- * @param container what to delete
- * @return true if the container was deleted or does not exist
- */
- protected abstract boolean deleteAndVerifyContainerGone(String container);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java
----------------------------------------------------------------------
diff --git a/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java b/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java
index ff833ab..fb1e89b 100644
--- a/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java
+++ b/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import javax.inject.Provider;
import org.jclouds.apis.ApiMetadata;
+import org.jclouds.blobstore.config.LocalBlobStore;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobBuilder;
import org.jclouds.http.HttpRequest;
@@ -40,7 +41,7 @@ import com.google.common.io.ByteSource;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "TransientBlobRequestSignerTest")
-public class TransientBlobRequestSignerTest extends BaseAsyncClientTest<LocalAsyncBlobStore> {
+public class TransientBlobRequestSignerTest extends BaseAsyncClientTest<LocalBlobStore> {
private BlobRequestSigner signer;
private Provider<BlobBuilder> blobFactory;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
index aef156d..9721617 100644
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
+++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
@@ -24,11 +24,9 @@ import org.jclouds.azureblob.AzureBlobClient;
import org.jclouds.azureblob.blobstore.AzureBlobRequestSigner;
import org.jclouds.azureblob.blobstore.AzureBlobStore;
import org.jclouds.azureblob.domain.PublicAccess;
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
-import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
@@ -42,7 +40,6 @@ public class AzureBlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
- bind(AsyncBlobStore.class).to(SubmissionAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(AzureBlobStore.class).in(Scopes.SINGLETON);
bind(BlobRequestSigner.class).to(AzureBlobRequestSigner.class);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dfb583b6/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/config/HPCloudObjectStorageBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/config/HPCloudObjectStorageBlobStoreContextModule.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/config/HPCloudObjectStorageBlobStoreContextModule.java
index e33788e..a636b4d 100644
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/config/HPCloudObjectStorageBlobStoreContextModule.java
+++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/config/HPCloudObjectStorageBlobStoreContextModule.java
@@ -26,10 +26,8 @@ import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Singleton;
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
-import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageApi;
import org.jclouds.hpcloud.objectstorage.blobstore.HPCloudObjectStorageBlobStore;
import org.jclouds.hpcloud.objectstorage.blobstore.functions.HPCloudObjectStorageObjectToBlobMetadata;
@@ -46,7 +44,6 @@ import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.inject.Provides;
-import com.google.inject.Scopes;
public class HPCloudObjectStorageBlobStoreContextModule extends SwiftBlobStoreContextModule {
@@ -96,7 +93,6 @@ public class HPCloudObjectStorageBlobStoreContextModule extends SwiftBlobStoreCo
protected void configure() {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
bind(BlobStore.class).to(HPCloudObjectStorageBlobStore.class);
- bind(AsyncBlobStore.class).to(SubmissionAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(ObjectToBlobMetadata.class).to(HPCloudObjectStorageObjectToBlobMetadata.class);
}
}
[19/52] [abbrv] git commit: JCLOUDS-296 unasync legacy cloudservers
provider.
Posted by an...@apache.org.
JCLOUDS-296 unasync legacy cloudservers provider.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/e3ada5b7
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/e3ada5b7
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/e3ada5b7
Branch: refs/heads/use-agentproxy-008
Commit: e3ada5b7268c87deddc7b4dfb619f05ebf1a872e
Parents: 0ab1988
Author: Adrian Cole <ac...@twitter.com>
Authored: Fri Oct 3 19:13:22 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Fri Oct 3 23:14:21 2014 -0700
----------------------------------------------------------------------
.../cloudservers/CloudServersApiMetadata.java | 28 +-
.../cloudservers/CloudServersAsyncClient.java | 387 --------
.../cloudservers/CloudServersClient.java | 240 ++++-
...CloudServersComputeServiceContextModule.java | 4 -
.../config/CloudServersHttpApiModule.java | 87 ++
.../config/CloudServersRestClientModule.java | 88 --
.../CloudServersAsyncClientTest.java | 902 -------------------
.../cloudservers/CloudServersClientTest.java | 898 ++++++++++++++++++
...aseCloudServersComputeServiceExpectTest.java | 10 +-
.../BaseCloudServersRestClientExpectTest.java | 10 +-
10 files changed, 1209 insertions(+), 1445 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
index 8c6fbd8..04ed2e7 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
@@ -22,27 +22,14 @@ import java.net.URI;
import java.util.Properties;
import org.jclouds.cloudservers.compute.config.CloudServersComputeServiceContextModule;
-import org.jclouds.cloudservers.config.CloudServersRestClientModule;
+import org.jclouds.cloudservers.config.CloudServersHttpApiModule;
import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
-/**
- * Implementation of {@link ApiMetadata} for CloudServers 1.0 API
- */
-public class CloudServersApiMetadata extends BaseRestApiMetadata {
-
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudServersClient.class)} as
- * {@link CloudServersAsyncClient} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<CloudServersClient, CloudServersAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CloudServersClient, CloudServersAsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
+public class CloudServersApiMetadata extends BaseHttpApiMetadata {
@Override
public Builder toBuilder() {
@@ -58,15 +45,14 @@ public class CloudServersApiMetadata extends BaseRestApiMetadata {
}
public static Properties defaultProperties() {
- Properties properties = BaseRestApiMetadata.defaultProperties();
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
return properties;
}
- public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
+ public static class Builder extends BaseHttpApiMetadata.Builder<CloudServersClient, Builder> {
- @SuppressWarnings("deprecation")
protected Builder() {
- super(CloudServersClient.class, CloudServersAsyncClient.class);
+ super(CloudServersClient.class);
id("cloudservers")
.name("Rackspace Cloud Servers API")
.identityName("Username")
@@ -76,7 +62,7 @@ public class CloudServersApiMetadata extends BaseRestApiMetadata {
.defaultEndpoint("https://auth.api.rackspacecloud.com")
.defaultProperties(CloudServersApiMetadata.defaultProperties())
.view(typeToken(ComputeServiceContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudServersRestClientModule.class, CloudServersComputeServiceContextModule.class));
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudServersHttpApiModule.class, CloudServersComputeServiceContextModule.class));
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java
deleted file mode 100644
index 75aebdb..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudservers;
-
-import java.io.Closeable;
-import java.util.Set;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.cloudservers.binders.BindBackupScheduleToJsonPayload;
-import org.jclouds.cloudservers.domain.Addresses;
-import org.jclouds.cloudservers.domain.BackupSchedule;
-import org.jclouds.cloudservers.domain.Flavor;
-import org.jclouds.cloudservers.domain.Image;
-import org.jclouds.cloudservers.domain.Limits;
-import org.jclouds.cloudservers.domain.RebootType;
-import org.jclouds.cloudservers.domain.Server;
-import org.jclouds.cloudservers.domain.SharedIpGroup;
-import org.jclouds.cloudservers.options.CreateServerOptions;
-import org.jclouds.cloudservers.options.CreateSharedIpGroupOptions;
-import org.jclouds.cloudservers.options.ListOptions;
-import org.jclouds.cloudservers.options.RebuildServerOptions;
-import org.jclouds.openstack.filters.AddTimestampQuery;
-import org.jclouds.openstack.filters.AuthenticateRequest;
-import org.jclouds.openstack.services.Compute;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.Unwrap;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Cloud Servers via their REST API.
- * <p/>
- * All commands return a ListenableFuture of the result from Cloud Servers. Any exceptions incurred
- * during processing will be backend in an {@link ExecutionException} as documented in
- * {@link ListenableFuture#get()}.
- *
- * @see CloudServersClient
- *
- * @deprecated The Rackspace First-Gen Cloud Servers product has been deprecated. Please refer to the
- * <a href="http://jclouds.apache.org/guides/rackspace">Rackspace Getting Started Guide</a>
- * for accessing the Rackspace Cloud. This API will be removed in 2.0.
- */
-@Deprecated
-@RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class })
-@Endpoint(Compute.class)
-public interface CloudServersAsyncClient extends Closeable {
-
- /**
- * @see CloudServersClient#getLimits
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/limits")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Limits> getLimits();
-
- /**
- * @see CloudServersClient#listServers
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<Server>> listServers(ListOptions... options);
-
- /**
- * @see CloudServersClient#getServer
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Fallback(NullOnNotFoundOr404.class)
- @Path("/servers/{id}")
- ListenableFuture<Server> getServer(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#deleteServer
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/servers/{id}")
- ListenableFuture<Boolean> deleteServer(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#rebootServer
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"reboot\":%7B\"type\":\"{type}\"%7D%7D")
- ListenableFuture<Void> rebootServer(@PathParam("id") int id, @PayloadParam("type") RebootType rebootType);
-
- /**
- * @see CloudServersClient#resizeServer
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"resize\":%7B\"flavorId\":{flavorId}%7D%7D")
- ListenableFuture<Void> resizeServer(@PathParam("id") int id, @PayloadParam("flavorId") int flavorId);
-
- /**
- * @see CloudServersClient#confirmResizeServer
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"confirmResize\":null}")
- ListenableFuture<Void> confirmResizeServer(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#revertResizeServer
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"revertResize\":null}")
- ListenableFuture<Void> revertResizeServer(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#createServer
- */
- @POST
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers")
- @MapBinder(CreateServerOptions.class)
- ListenableFuture<Server> createServer(@PayloadParam("name") String name, @PayloadParam("imageId") int imageId,
- @PayloadParam("flavorId") int flavorId, CreateServerOptions... options);
-
- /**
- * @see CloudServersClient#rebuildServer
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @MapBinder(RebuildServerOptions.class)
- ListenableFuture<Void> rebuildServer(@PathParam("id") int id, RebuildServerOptions... options);
-
- /**
- * @see CloudServersClient#shareIp
- */
- @PUT
- @Path("/servers/{id}/ips/public/{address}")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"shareIp\":%7B\"sharedIpGroupId\":{sharedIpGroupId},\"configureServer\":{configureServer}%7D%7D")
- ListenableFuture<Void> shareIp(@PathParam("address") String addressToShare,
- @PathParam("id") int serverToTosignBindressTo, @PayloadParam("sharedIpGroupId") int sharedIpGroup,
- @PayloadParam("configureServer") boolean configureServer);
-
- /**
- * @see CloudServersClient#unshareIp
- */
- @DELETE
- @Path("/servers/{id}/ips/public/{address}")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> unshareIp(@PathParam("address") String addressToShare,
- @PathParam("id") int serverToTosignBindressTo);
-
- /**
- * @see CloudServersClient#changeAdminPass
- */
- @PUT
- @Path("/servers/{id}")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"server\":%7B\"adminPass\":\"{adminPass}\"%7D%7D")
- ListenableFuture<Void> changeAdminPass(@PathParam("id") int id, @PayloadParam("adminPass") String adminPass);
-
- /**
- * @see CloudServersClient#renameServer
- */
- @PUT
- @Path("/servers/{id}")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"server\":%7B\"name\":\"{name}\"%7D%7D")
- ListenableFuture<Void> renameServer(@PathParam("id") int id, @PayloadParam("name") String newName);
-
- /**
- * @see CloudServersClient#listFlavors
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/flavors")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<Flavor>> listFlavors(ListOptions... options);
-
- /**
- * @see CloudServersClient#getFlavor
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/flavors/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Flavor> getFlavor(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#listImages
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/images")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<Image>> listImages(ListOptions... options);
-
- /**
- * @see CloudServersClient#getImage
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- @QueryParams(keys = "format", values = "json")
- @Path("/images/{id}")
- ListenableFuture<Image> getImage(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#deleteImage
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/images/{id}")
- ListenableFuture<Boolean> deleteImage(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#createImageFromServer
- */
- @POST
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/images")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"image\":%7B\"serverId\":{serverId},\"name\":\"{name}\"%7D%7D")
- ListenableFuture<Image> createImageFromServer(@PayloadParam("name") String imageName,
- @PayloadParam("serverId") int serverId);
-
- /**
- * @see CloudServersClient#listSharedIpGroups
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<SharedIpGroup>> listSharedIpGroups(ListOptions... options);
-
- /**
- * @see CloudServersClient#getSharedIpGroup
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<SharedIpGroup> getSharedIpGroup(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#createSharedIpGroup
- */
- @POST
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups")
- @MapBinder(CreateSharedIpGroupOptions.class)
- ListenableFuture<SharedIpGroup> createSharedIpGroup(@PayloadParam("name") String name,
- CreateSharedIpGroupOptions... options);
-
- /**
- * @see CloudServersClient#deleteSharedIpGroup
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/shared_ip_groups/{id}")
- ListenableFuture<Boolean> deleteSharedIpGroup(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#listBackupSchedule
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/backup_schedule")
- ListenableFuture<BackupSchedule> getBackupSchedule(@PathParam("id") int serverId);
-
- /**
- * @see CloudServersClient#deleteBackupSchedule
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/servers/{id}/backup_schedule")
- ListenableFuture<Boolean> deleteBackupSchedule(@PathParam("id") int serverId);
-
- /**
- * @see CloudServersClient#replaceBackupSchedule
- */
- @POST
- @Path("/servers/{id}/backup_schedule")
- ListenableFuture<Void> replaceBackupSchedule(@PathParam("id") int id,
- @BinderParam(BindBackupScheduleToJsonPayload.class) BackupSchedule backupSchedule);
-
- /**
- * @see CloudServersClient#listAddresses
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/ips")
- ListenableFuture<Addresses> getAddresses(@PathParam("id") int serverId);
-
- /**
- * @see CloudServersClient#listPublicAddresses
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/ips/public")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<String>> listPublicAddresses(@PathParam("id") int serverId);
-
- /**
- * @see CloudServersClient#listPrivateAddresses
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/ips/private")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<String>> listPrivateAddresses(@PathParam("id") int serverId);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
index 4fe9761..ff9b21e 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
@@ -16,10 +16,24 @@
*/
package org.jclouds.cloudservers;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.jclouds.Fallbacks.*;
+
import java.io.Closeable;
import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import org.jclouds.Fallbacks;
+import org.jclouds.cloudservers.binders.BindBackupScheduleToJsonPayload;
import org.jclouds.cloudservers.domain.Addresses;
import org.jclouds.cloudservers.domain.BackupSchedule;
import org.jclouds.cloudservers.domain.Flavor;
@@ -32,20 +46,31 @@ import org.jclouds.cloudservers.options.CreateServerOptions;
import org.jclouds.cloudservers.options.CreateSharedIpGroupOptions;
import org.jclouds.cloudservers.options.ListOptions;
import org.jclouds.cloudservers.options.RebuildServerOptions;
+import org.jclouds.openstack.filters.AddTimestampQuery;
+import org.jclouds.openstack.filters.AuthenticateRequest;
+import org.jclouds.openstack.services.Compute;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.Unwrap;
+
+import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides access to Cloud Servers via their REST API.
- * <p/>
- * All commands return a Future of the result from Cloud Servers. Any exceptions incurred during
- * processing will be backend in an {@link ExecutionException} as documented in {@link Future#get()}.
- *
- * @see CloudServersAsyncClient
*
* @deprecated The Rackspace First-Gen Cloud Servers product has been deprecated. Please refer to the
* <a href="http://jclouds.apache.org/guides/rackspace">Rackspace Getting Started Guide</a>
* for accessing the Rackspace Cloud. This API will be removed in 2.0.
*/
@Deprecated
+@RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class })
+@Endpoint(Compute.class)
public interface CloudServersClient extends Closeable {
/**
* All accounts, by default, have a preconfigured set of thresholds (or limits) to manage
@@ -55,6 +80,12 @@ public interface CloudServersClient extends Closeable {
*
* @return limits on the account
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/limits")
+ @Fallback(NullOnNotFoundOr404.class)
Limits getLimits();
/**
@@ -67,6 +98,12 @@ public interface CloudServersClient extends Closeable {
* in order to retrieve all details, pass the option {@link ListOptions#withDetails()
* withDetails()}
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers")
+ @Fallback(EmptySetOnNotFoundOr404.class)
Set<Server> listServers(ListOptions... options);
/**
@@ -76,6 +113,12 @@ public interface CloudServersClient extends Closeable {
* @return null, if the server is not found
* @see Server
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Path("/servers/{id}")
Server getServer(@PathParam("id") int id);
/**
@@ -87,6 +130,9 @@ public interface CloudServersClient extends Closeable {
* @return false if the server is not found
* @see Server
*/
+ @DELETE
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Path("/servers/{id}")
boolean deleteServer(@PathParam("id") int id);
/**
@@ -103,7 +149,12 @@ public interface CloudServersClient extends Closeable {
* graceful shutdown of all processes. A hard reboot is the equivalent of power cycling
* the server.
*/
- void rebootServer(int id, RebootType rebootType);
+ @POST
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/action")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"reboot\":%7B\"type\":\"{type}\"%7D%7D")
+ void rebootServer(@PathParam("id") int id, @PayloadParam("type") RebootType rebootType);
/**
* The resize function converts an existing server to a different flavor, in essence, scaling the
@@ -118,7 +169,12 @@ public interface CloudServersClient extends Closeable {
* <p/>
* ACTIVE - QUEUE_RESIZE - ACTIVE (on error)
*/
- void resizeServer(int id, int flavorId);
+ @POST
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/action")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"resize\":%7B\"flavorId\":{flavorId}%7D%7D")
+ void resizeServer(@PathParam("id") int id, @PayloadParam("flavorId") int flavorId);
/**
* The resize function converts an existing server to a different flavor, in essence, scaling the
@@ -131,7 +187,12 @@ public interface CloudServersClient extends Closeable {
* <p/>
* VERIFY_RESIZE - ACTIVE
*/
- void confirmResizeServer(int id);
+ @POST
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/action")
+ @Produces(APPLICATION_JSON)
+ @Payload("{\"confirmResize\":null}")
+ void confirmResizeServer(@PathParam("id") int id);
/**
* The resize function converts an existing server to a different flavor, in essence, scaling the
@@ -144,7 +205,12 @@ public interface CloudServersClient extends Closeable {
* <p/>
* VERIFY_RESIZE - ACTIVE
*/
- void revertResizeServer(int id);
+ @POST
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/action")
+ @Produces(APPLICATION_JSON)
+ @Payload("{\"revertResize\":null}")
+ void revertResizeServer(@PathParam("id") int id);
/**
* This operation asynchronously provisions a new server. The progress of this operation depends
@@ -157,7 +223,14 @@ public interface CloudServersClient extends Closeable {
* @param options
* - used to specify extra files, metadata, or ip parameters during server creation.
*/
- Server createServer(String name, int imageId, int flavorId, CreateServerOptions... options);
+ @POST
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers")
+ @MapBinder(CreateServerOptions.class)
+ Server createServer(@PayloadParam("name") String name, @PayloadParam("imageId") int imageId,
+ @PayloadParam("flavorId") int flavorId, CreateServerOptions... options);
/**
* The rebuild function removes all data on the server and replaces it with the specified image.
@@ -174,7 +247,11 @@ public interface CloudServersClient extends Closeable {
* - imageId is an optional argument. If it is not specified, the server is rebuilt
* with the original imageId.
*/
- void rebuildServer(int id, RebuildServerOptions... options);
+ @POST
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/action")
+ @MapBinder(RebuildServerOptions.class)
+ void rebuildServer(@PathParam("id") int id, RebuildServerOptions... options);
/**
* /** This operation allows you share an IP address to the specified server
@@ -196,7 +273,12 @@ public interface CloudServersClient extends Closeable {
* (e.g. keepalived) can then be used within the servers to perform health checks and
* manage IP failover.
*/
- void shareIp(String addressToShare, int serverToTosignBindressTo, int sharedIpGroup, boolean configureServer);
+ @PUT
+ @Path("/servers/{id}/ips/public/{address}")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"shareIp\":%7B\"sharedIpGroupId\":{sharedIpGroupId},\"configureServer\":{configureServer}%7D%7D")
+ void shareIp(@PathParam("address") String addressToShare, @PathParam("id") int serverToTosignBindressTo,
+ @PayloadParam("sharedIpGroupId") int sharedIpGroup, @PayloadParam("configureServer") boolean configureServer);
/**
* This operation removes a shared IP address from the specified server.
@@ -207,7 +289,10 @@ public interface CloudServersClient extends Closeable {
* @param serverToTosignBindressTo
* @return
*/
- void unshareIp(String addressToShare, int serverToTosignBindressTo);
+ @DELETE
+ @Path("/servers/{id}/ips/public/{address}")
+ @Fallback(VoidOnNotFoundOr404.class)
+ void unshareIp(@PathParam("address") String addressToShare, @PathParam("id") int serverToTosignBindressTo);
/**
* This operation allows you to change the administrative password.
@@ -215,7 +300,11 @@ public interface CloudServersClient extends Closeable {
* Status Transition: ACTIVE - PASSWORD - ACTIVE
*
*/
- void changeAdminPass(int id, String adminPass);
+ @PUT
+ @Path("/servers/{id}")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"server\":%7B\"adminPass\":\"{adminPass}\"%7D%7D")
+ void changeAdminPass(@PathParam("id") int id, @PayloadParam("adminPass") String adminPass);
/**
* This operation allows you to update the name of the server. This operation changes the name of
@@ -224,7 +313,11 @@ public interface CloudServersClient extends Closeable {
* Status Transition: ACTIVE - PASSWORD - ACTIVE
*
*/
- void renameServer(int id, String newName);
+ @PUT
+ @Path("/servers/{id}")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"server\":%7B\"name\":\"{name}\"%7D%7D")
+ void renameServer(@PathParam("id") int id, @PayloadParam("name") String newName);
/**
*
@@ -233,6 +326,12 @@ public interface CloudServersClient extends Closeable {
* in order to retrieve all details, pass the option {@link ListOptions#withDetails()
* withDetails()}
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/flavors")
+ @Fallback(EmptySetOnNotFoundOr404.class)
Set<Flavor> listFlavors(ListOptions... options);
/**
@@ -242,7 +341,13 @@ public interface CloudServersClient extends Closeable {
* @return null, if the flavor is not found
* @see Flavor
*/
- Flavor getFlavor(int id);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/flavors/{id}")
+ @Fallback(NullOnNotFoundOr404.class)
+ Flavor getFlavor(@PathParam("id") int id);
/**
*
@@ -251,6 +356,12 @@ public interface CloudServersClient extends Closeable {
* in order to retrieve all details, pass the option {@link ListOptions#withDetails()
* withDetails()}
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/images")
+ @Fallback(EmptySetOnNotFoundOr404.class)
Set<Image> listImages(ListOptions... options);
/**
@@ -261,7 +372,13 @@ public interface CloudServersClient extends Closeable {
*
* @see Image
*/
- Image getImage(int id);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/images/{id}")
+ Image getImage(@PathParam("id") int id);
/**
*
@@ -273,7 +390,10 @@ public interface CloudServersClient extends Closeable {
* @return false if the image is not found
* @see Image
*/
- boolean deleteImage(int id);
+ @DELETE
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Path("/images/{id}")
+ boolean deleteImage(@PathParam("id") int id);
/**
*
@@ -291,11 +411,17 @@ public interface CloudServersClient extends Closeable {
* Note: At present, image creation is an asynchronous operation, so coordinating the creation
* with data quiescence, etc. is currently not possible.
*
- * @throws ResourceNotFoundException
- * if the server is not found
+ * @throws ResourceNotFoundException if the server is not found
* @see Image
*/
- Image createImageFromServer(String imageName, int serverId);
+ @POST
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/images")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"image\":%7B\"serverId\":{serverId},\"name\":\"{name}\"%7D%7D")
+ Image createImageFromServer(@PayloadParam("name") String imageName, @PayloadParam("serverId") int serverId);
/**
*
@@ -304,6 +430,12 @@ public interface CloudServersClient extends Closeable {
* in order to retrieve all details, pass the option {@link ListOptions#withDetails()
* withDetails()}
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/shared_ip_groups")
+ @Fallback(EmptySetOnNotFoundOr404.class)
Set<SharedIpGroup> listSharedIpGroups(ListOptions... options);
/**
@@ -314,7 +446,13 @@ public interface CloudServersClient extends Closeable {
*
* @see SharedIpGroup
*/
- SharedIpGroup getSharedIpGroup(int id);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/shared_ip_groups/{id}")
+ @Fallback(NullOnNotFoundOr404.class)
+ SharedIpGroup getSharedIpGroup(@PathParam("id") int id);
/**
* This operation creates a new shared IP group. Please note, all responses to requests for
@@ -322,7 +460,14 @@ public interface CloudServersClient extends Closeable {
* can be created empty or can be initially populated with a single server. Use
* {@link CreateSharedIpGroupOptions} to specify an server.
*/
- SharedIpGroup createSharedIpGroup(String name, CreateSharedIpGroupOptions... options);
+ @POST
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/shared_ip_groups")
+ @MapBinder(CreateSharedIpGroupOptions.class)
+ SharedIpGroup createSharedIpGroup(@PayloadParam("name") String name,
+ CreateSharedIpGroupOptions... options);
/**
* This operation deletes the specified shared IP group. This operation will ONLY succeed if 1)
@@ -332,15 +477,22 @@ public interface CloudServersClient extends Closeable {
* @return false if the shared ip group is not found
* @see SharedIpGroup
*/
- boolean deleteSharedIpGroup(int id);
+ @DELETE
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Path("/shared_ip_groups/{id}")
+ boolean deleteSharedIpGroup(@PathParam("id") int id);
/**
* List the backup schedule for the specified server
*
- * @throws ResourceNotFoundException
- * , if the server doesn't exist
+ * @throws ResourceNotFoundException, if the server doesn't exist
*/
- BackupSchedule getBackupSchedule(int serverId);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/backup_schedule")
+ BackupSchedule getBackupSchedule(@PathParam("id") int serverId);
/**
* Delete backup schedule for the specified server.
@@ -349,33 +501,55 @@ public interface CloudServersClient extends Closeable {
*
* @return false if the schedule is not found
*/
- boolean deleteBackupSchedule(int serverId);
+ @DELETE
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Path("/servers/{id}/backup_schedule")
+ boolean deleteBackupSchedule(@PathParam("id") int serverId);
/**
* Enable/update the backup schedule for the specified server
*
*/
- void replaceBackupSchedule(int id, BackupSchedule backupSchedule);
+ @POST
+ @Path("/servers/{id}/backup_schedule")
+ void replaceBackupSchedule(@PathParam("id") int id,
+ @BinderParam(BindBackupScheduleToJsonPayload.class) BackupSchedule backupSchedule);
/**
* List all server addresses
*
* returns empty set if the server doesn't exist
*/
- Addresses getAddresses(int serverId);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/ips")
+ Addresses getAddresses(@PathParam("id") int serverId);
/**
* List all public server addresses
*
* returns empty set if the server doesn't exist
*/
- Set<String> listPublicAddresses(int serverId);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/ips/public")
+ @Fallback(EmptySetOnNotFoundOr404.class)
+ Set<String> listPublicAddresses(@PathParam("id") int serverId);
/**
* List all private server addresses
*
* returns empty set if the server doesn't exist
*/
- Set<String> listPrivateAddresses(int serverId);
-
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/ips/private")
+ @Fallback(EmptySetOnNotFoundOr404.class)
+ Set<String> listPrivateAddresses(@PathParam("id") int serverId);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
index 44d9ec4..44cbb95 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
@@ -48,10 +48,6 @@ import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
-/**
- * Configures the {@link CloudServersComputeServiceContext}; requires {@link BaseComputeService}
- * bound.
- */
public class CloudServersComputeServiceContextModule extends
ComputeServiceAdapterContextModule<Server, Flavor, org.jclouds.cloudservers.domain.Image, Location> {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java
new file mode 100644
index 0000000..71aa0a6
--- /dev/null
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.cloudservers.config;
+
+import static com.google.common.base.Suppliers.memoizeWithExpiration;
+import static org.jclouds.util.Suppliers2.getLastValueInMap;
+
+import java.net.URI;
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+
+import javax.inject.Singleton;
+
+import org.jclouds.cloudservers.CloudServersClient;
+import org.jclouds.cloudservers.handlers.ParseCloudServersErrorFromHttpResponse;
+import org.jclouds.date.TimeStamp;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.json.config.GsonModule.DateAdapter;
+import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
+import org.jclouds.location.suppliers.RegionIdToURISupplier;
+import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule;
+import org.jclouds.openstack.services.Compute;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.annotations.ApiVersion;
+import org.jclouds.rest.config.HttpApiModule;
+
+import com.google.common.base.Supplier;
+import com.google.inject.Provides;
+
+@ConfiguresHttpApi
+public class CloudServersHttpApiModule extends HttpApiModule<CloudServersClient> {
+
+ @Override
+ protected void configure() {
+ bind(DateAdapter.class).to(Iso8601DateAdapter.class);
+ super.configure();
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseCloudServersErrorFromHttpResponse.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseCloudServersErrorFromHttpResponse.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseCloudServersErrorFromHttpResponse.class);
+ }
+
+ @Override
+ protected void installLocations() {
+ super.installLocations();
+ install(new AuthenticationServiceModule());
+ }
+
+ @Provides
+ @Singleton
+ @Compute
+ protected Supplier<URI> provideCloudServers(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) {
+ return getLastValueInMap(factory.createForApiTypeAndVersion("cloudServers", apiVersion));
+ }
+
+ // TODO: see if we still need this.
+ @Provides
+ @Singleton
+ @TimeStamp
+ protected Supplier<Date> provideCacheBusterDate() {
+ return memoizeWithExpiration(new Supplier<Date>() {
+ public Date get() {
+ return new Date();
+ }
+ }, 1, TimeUnit.SECONDS);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java
deleted file mode 100644
index 82609b7..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudservers.config;
-
-import static com.google.common.base.Suppliers.memoizeWithExpiration;
-import static org.jclouds.util.Suppliers2.getLastValueInMap;
-
-import java.net.URI;
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Singleton;
-
-import org.jclouds.cloudservers.CloudServersAsyncClient;
-import org.jclouds.cloudservers.CloudServersClient;
-import org.jclouds.cloudservers.handlers.ParseCloudServersErrorFromHttpResponse;
-import org.jclouds.date.TimeStamp;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.json.config.GsonModule.DateAdapter;
-import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
-import org.jclouds.location.suppliers.RegionIdToURISupplier;
-import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule;
-import org.jclouds.openstack.services.Compute;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.annotations.ApiVersion;
-import org.jclouds.rest.config.RestClientModule;
-
-import com.google.common.base.Supplier;
-import com.google.inject.Provides;
-
-@ConfiguresRestClient
-public class CloudServersRestClientModule extends RestClientModule<CloudServersClient, CloudServersAsyncClient> {
-
- @Override
- protected void configure() {
- bind(DateAdapter.class).to(Iso8601DateAdapter.class);
- super.configure();
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseCloudServersErrorFromHttpResponse.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseCloudServersErrorFromHttpResponse.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseCloudServersErrorFromHttpResponse.class);
- }
-
- @Override
- protected void installLocations() {
- super.installLocations();
- install(new AuthenticationServiceModule());
- }
-
- @Provides
- @Singleton
- @Compute
- protected Supplier<URI> provideCloudServers(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) {
- return getLastValueInMap(factory.createForApiTypeAndVersion("cloudServers", apiVersion));
- }
-
- // TODO: see if we still need this.
- @Provides
- @Singleton
- @TimeStamp
- protected Supplier<Date> provideCacheBusterDate() {
- return memoizeWithExpiration(new Supplier<Date>() {
- public Date get() {
- return new Date();
- }
- }, 1, TimeUnit.SECONDS);
- }
-}
[21/52] [abbrv] git commit: Update mailmap for acole@twitter.com
Posted by an...@apache.org.
Update mailmap for acole@twitter.com
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/8639f5cf
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/8639f5cf
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/8639f5cf
Branch: refs/heads/use-agentproxy-008
Commit: 8639f5cf9427c86fe111926159f8d71e8b0f2aa2
Parents: e243fa5
Author: Adrian Cole <ad...@apache.org>
Authored: Sat Oct 4 09:21:15 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Sat Oct 4 09:22:01 2014 -0700
----------------------------------------------------------------------
.mailmap | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8639f5cf/.mailmap
----------------------------------------------------------------------
diff --git a/.mailmap b/.mailmap
index 0d2a044..71e0da0 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1,4 +1,5 @@
Adrian Cole <ac...@.eng.vmware.com>
+Adrian Cole <ac...@twitter.com>
Adrian Cole <ad...@3d8758e0-26b5-11de-8745-db77d3ebf521>
Adrian Cole <ad...@gmail.com>
Adrian Cole <fe...@3d8758e0-26b5-11de-8745-db77d3ebf521>
[16/52] [abbrv] git commit: JCLOUDS-296 unasync legacy cloudfiles
provider.
Posted by an...@apache.org.
JCLOUDS-296 unasync legacy cloudfiles provider.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/0ab1988a
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/0ab1988a
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/0ab1988a
Branch: refs/heads/use-agentproxy-008
Commit: 0ab1988a7f0b38c35985243e35c4232e62ae72ad
Parents: bbad831
Author: Adrian Cole <ac...@twitter.com>
Authored: Fri Oct 3 19:12:56 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Fri Oct 3 23:14:12 2014 -0700
----------------------------------------------------------------------
.../cloudfiles/CloudFilesApiMetadata.java | 30 +--
.../cloudfiles/CloudFilesAsyncClient.java | 214 -------------------
.../jclouds/cloudfiles/CloudFilesClient.java | 138 ++++++++++--
.../blobstore/CloudFilesAsyncBlobStore.java | 98 ---------
.../CloudFilesBlobStoreContextModule.java | 3 -
.../config/CloudFilesHttpApiModule.java | 92 ++++++++
.../config/CloudFilesRestClientModule.java | 99 ---------
.../cloudfiles/CloudFilesClientLiveTest.java | 2 +-
.../CloudFilesBlobSignerExpectTest.java | 6 +-
.../config/CloudFilesRestClientModuleTest.java | 12 +-
.../cloudfiles/CloudFilesUKClientLiveTest.java | 3 +-
11 files changed, 232 insertions(+), 465 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0ab1988a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java
index ce8f261..1c81946 100644
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java
+++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java
@@ -21,31 +21,18 @@ import java.util.Properties;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.cloudfiles.blobstore.config.CloudFilesBlobStoreContextModule;
-import org.jclouds.cloudfiles.config.CloudFilesRestClientModule;
-import org.jclouds.cloudfiles.config.CloudFilesRestClientModule.StorageAndCDNManagementEndpointModule;
+import org.jclouds.cloudfiles.config.CloudFilesHttpApiModule;
+import org.jclouds.cloudfiles.config.CloudFilesHttpApiModule.StorageAndCDNManagementEndpointModule;
import org.jclouds.openstack.swift.SwiftApiMetadata;
import org.jclouds.openstack.swift.blobstore.SwiftBlobSigner;
import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
import com.google.inject.TypeLiteral;
-/**
- * Implementation of {@link ApiMetadata} for Rackspace Cloud Files API
- */
public class CloudFilesApiMetadata extends SwiftApiMetadata {
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudFilesClient.class)} as
- * {@link CloudFilesAsyncClient} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<CloudFilesClient, CloudFilesAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CloudFilesClient, CloudFilesAsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
-
@Override
public Builder toBuilder() {
return new Builder().fromApiMetadata(this);
@@ -64,20 +51,19 @@ public class CloudFilesApiMetadata extends SwiftApiMetadata {
return properties;
}
- public static class Builder extends SwiftApiMetadata.Builder<Builder> {
- @SuppressWarnings("deprecation")
+ public static class Builder extends SwiftApiMetadata.Builder<CloudFilesClient, Builder> {
+
protected Builder() {
- super(CloudFilesClient.class, CloudFilesAsyncClient.class);
+ super(CloudFilesClient.class);
id("cloudfiles")
.name("Rackspace Cloud Files API")
.identityName("Username")
.credentialName("API Key")
.documentation(URI.create("http://docs.rackspacecloud.com/files/api/v1/cfdevguide_d5/content/ch01.html"))
.defaultProperties(CloudFilesApiMetadata.defaultProperties())
- .context(CONTEXT_TOKEN)
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(StorageAndCDNManagementEndpointModule.class)
- .add(CloudFilesRestClientModule.class)
+ .add(CloudFilesHttpApiModule.class)
.add(CloudFilesBlobStoreContextModule.class)
.add(CloudFilesTemporaryUrlExtensionModule.class).build());
}
@@ -93,10 +79,10 @@ public class CloudFilesApiMetadata extends SwiftApiMetadata {
}
}
- public static class CloudFilesTemporaryUrlExtensionModule extends TemporaryUrlExtensionModule<CloudFilesAsyncClient> {
+ public static class CloudFilesTemporaryUrlExtensionModule extends TemporaryUrlExtensionModule<CloudFilesClient> {
@Override
protected void bindRequestSigner() {
- bind(BlobRequestSigner.class).to(new TypeLiteral<SwiftBlobSigner<CloudFilesAsyncClient>>() {
+ bind(BlobRequestSigner.class).to(new TypeLiteral<SwiftBlobSigner<CloudFilesClient>>() {
});
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0ab1988a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java
deleted file mode 100644
index 388534b..0000000
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudfiles;
-
-import java.net.URI;
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnContainerNotFound;
-import org.jclouds.cloudfiles.binders.BindIterableToHeadersWithPurgeCDNObjectEmail;
-import org.jclouds.cloudfiles.domain.ContainerCDNMetadata;
-import org.jclouds.cloudfiles.functions.ParseCdnUriFromHeaders;
-import org.jclouds.cloudfiles.functions.ParseContainerCDNMetadataFromHeaders;
-import org.jclouds.cloudfiles.options.ListCdnContainerOptions;
-import org.jclouds.cloudfiles.reference.CloudFilesHeaders;
-import org.jclouds.openstack.filters.AuthenticateRequest;
-import org.jclouds.openstack.swift.Storage;
-import org.jclouds.openstack.swift.SwiftAsyncClient;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Cloud Files via their REST API.
- * <p/>
- * All commands return a ListenableFuture of the result from Cloud Files. Any exceptions incurred
- * during processing will be backend in an {@link ExecutionException} as documented in
- * {@link ListenableFuture#get()}.
- *
- * @see CloudFilesClient
- * @see <a href="http://www.rackspacecloud.com/cf-devguide-20090812.pdf" />
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudFilesClient.class)} as
- * {@link CloudFilesAsyncClient} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-@RequestFilters(AuthenticateRequest.class)
-@Endpoint(Storage.class)
-public interface CloudFilesAsyncClient extends SwiftAsyncClient {
-
- /**
- * @see CloudFilesClient#listCDNContainers
- */
- @Named("ListCDNEnabledContainers")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/")
- @Endpoint(CDNManagement.class)
- ListenableFuture<? extends Set<ContainerCDNMetadata>> listCDNContainers(ListCdnContainerOptions... options);
-
- /**
- * @see CloudFilesClient#getCDNMetadata
- */
- @Named("ListCDNEnabledContainerMetadata")
- @HEAD
- @ResponseParser(ParseContainerCDNMetadataFromHeaders.class)
- @Fallback(NullOnContainerNotFound.class)
- @Path("/{container}")
- @Endpoint(CDNManagement.class)
- ListenableFuture<ContainerCDNMetadata> getCDNMetadata(@PathParam("container") String container);
-
- /**
- * @see CloudFilesClient#enableCDN(String, long, boolean);
- */
- @Named("CDNEnableContainer")
- @PUT
- @Path("/{container}")
- @Headers(keys = CloudFilesHeaders.CDN_ENABLED, values = "True")
- @ResponseParser(ParseCdnUriFromHeaders.class)
- @Endpoint(CDNManagement.class)
- ListenableFuture<URI> enableCDN(@PathParam("container") String container,
- @HeaderParam(CloudFilesHeaders.CDN_TTL) long ttl,
- @HeaderParam(CloudFilesHeaders.CDN_LOG_RETENTION) boolean logRetention);
-
- /**
- * @see CloudFilesClient#enableCDN(String, long);
- */
- @Named("CDNEnableContainer")
- @PUT
- @Path("/{container}")
- @Headers(keys = CloudFilesHeaders.CDN_ENABLED, values = "True")
- @ResponseParser(ParseCdnUriFromHeaders.class)
- @Endpoint(CDNManagement.class)
- ListenableFuture<URI> enableCDN(@PathParam("container") String container,
- @HeaderParam(CloudFilesHeaders.CDN_TTL) long ttl);
-
- /**
- * @see CloudFilesClient#enableCDN(String)
- */
- @Named("CDNEnableContainer")
- @PUT
- @Path("/{container}")
- @Headers(keys = CloudFilesHeaders.CDN_ENABLED, values = "True")
- @ResponseParser(ParseCdnUriFromHeaders.class)
- @Endpoint(CDNManagement.class)
- ListenableFuture<URI> enableCDN(@PathParam("container") String container);
-
- /**
- * @see CloudFilesClient#updateCDN(long, boolean)
- */
- @Named("UpdateCDNEnabledContainerMetadata")
- @POST
- @Path("/{container}")
- @ResponseParser(ParseCdnUriFromHeaders.class)
- @Endpoint(CDNManagement.class)
- ListenableFuture<URI> updateCDN(@PathParam("container") String container,
- @HeaderParam(CloudFilesHeaders.CDN_TTL) long ttl,
- @HeaderParam(CloudFilesHeaders.CDN_LOG_RETENTION) boolean logRetention);
-
- /**
- * @see CloudFilesClient#updateCDN(boolean)
- */
- @Named("UpdateCDNEnabledContainerMetadata")
- @POST
- @Path("/{container}")
- @ResponseParser(ParseCdnUriFromHeaders.class)
- @Endpoint(CDNManagement.class)
- ListenableFuture<URI> updateCDN(@PathParam("container") String container,
- @HeaderParam(CloudFilesHeaders.CDN_LOG_RETENTION) boolean logRetention);
-
- /**
- * @see CloudFilesClient#updateCDN(long)
- */
- @Named("UpdateCDNEnabledContainerMetadata")
- @POST
- @Path("/{container}")
- @ResponseParser(ParseCdnUriFromHeaders.class)
- @Endpoint(CDNManagement.class)
- ListenableFuture<URI> updateCDN(@PathParam("container") String container,
- @HeaderParam(CloudFilesHeaders.CDN_TTL) long ttl);
-
- /**
- * @see CloudFilesClient#disableCDN
- */
- @Named("DisableCDNEnabledContainer")
- @POST
- @Path("/{container}")
- @Headers(keys = CloudFilesHeaders.CDN_ENABLED, values = "False")
- @Endpoint(CDNManagement.class)
- ListenableFuture<Boolean> disableCDN(@PathParam("container") String container);
-
- /**
- * @see CloudFilesClient#purgeCDNObject(String, String, Iterable)
- */
- @Named("PurgeCDNEnabledObject")
- @DELETE
- @Path("/{container}/{object}")
- @Headers(keys = CloudFilesHeaders.CDN_CONTAINER_PURGE_OBJECT_EMAIL, values = "{email}")
- @Endpoint(CDNManagement.class)
- ListenableFuture<Boolean> purgeCDNObject(@PathParam("container") String container,
- @PathParam("object") String object,
- @BinderParam(BindIterableToHeadersWithPurgeCDNObjectEmail.class) Iterable<String> emails);
-
- /**
- * @see CloudFilesClient#purgeCDNObject(String, String)
- */
- @Named("PurgeCDNEnabledObject")
- @DELETE
- @Path("/{container}/{object}")
- @Endpoint(CDNManagement.class)
- ListenableFuture<Boolean> purgeCDNObject(@PathParam("container") String container,
- @PathParam("object") String object);
-
- /**
- * @see CloudFilesClient#setCDNStaticWebsiteIndex
- */
- @Named("UpdateCDNEnabledContainerMetadata")
- @POST
- @Path("/{container}")
- @Headers(keys = CloudFilesHeaders.CDN_WEBSITE_INDEX, values = "{index}")
- ListenableFuture<Boolean> setCDNStaticWebsiteIndex(@PathParam("container") String container,
- @PathParam("index") String index);
-
- /**
- * @see CloudFilesClient#setCDNStaticWebsiteError
- */
- @Named("UpdateCDNEnabledContainerMetadata")
- @POST
- @Path("/{container}")
- @Headers(keys = CloudFilesHeaders.CDN_WEBSITE_ERROR, values = "{error}")
- ListenableFuture<Boolean> setCDNStaticWebsiteError(@PathParam("container") String container,
- @PathParam("error") String error);
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0ab1988a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesClient.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesClient.java
index 8adcb80..9834133 100644
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesClient.java
+++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesClient.java
@@ -16,23 +16,59 @@
*/
package org.jclouds.cloudfiles;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.jclouds.blobstore.BlobStoreFallbacks.NullOnContainerNotFound;
+import static org.jclouds.cloudfiles.reference.CloudFilesHeaders.CDN_CONTAINER_PURGE_OBJECT_EMAIL;
+import static org.jclouds.cloudfiles.reference.CloudFilesHeaders.CDN_ENABLED;
+import static org.jclouds.cloudfiles.reference.CloudFilesHeaders.CDN_LOG_RETENTION;
+import static org.jclouds.cloudfiles.reference.CloudFilesHeaders.CDN_TTL;
+import static org.jclouds.cloudfiles.reference.CloudFilesHeaders.CDN_WEBSITE_ERROR;
+import static org.jclouds.cloudfiles.reference.CloudFilesHeaders.CDN_WEBSITE_INDEX;
+
import java.net.URI;
import java.util.Set;
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+import org.jclouds.cloudfiles.binders.BindIterableToHeadersWithPurgeCDNObjectEmail;
import org.jclouds.cloudfiles.domain.ContainerCDNMetadata;
+import org.jclouds.cloudfiles.functions.ParseCdnUriFromHeaders;
+import org.jclouds.cloudfiles.functions.ParseContainerCDNMetadataFromHeaders;
import org.jclouds.cloudfiles.options.ListCdnContainerOptions;
+import org.jclouds.openstack.filters.AuthenticateRequest;
+import org.jclouds.openstack.swift.Storage;
import org.jclouds.openstack.swift.SwiftClient;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
-/**
- * Provides access to Cloud Files via their REST API.
- *
- * @see <a href="http://docs.rackspace.com/files/api/v1/cf-devguide/content/index.html">Cloud Files</a>
- */
+/** Provides access to Cloud Files via their REST API. */
+@RequestFilters(AuthenticateRequest.class)
+@Endpoint(Storage.class)
public interface CloudFilesClient extends SwiftClient {
/**
* Retrieve a list of existing CDN-enabled containers.
*/
+ @Named("ListCDNEnabledContainers")
+ @GET
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/")
+ @Endpoint(CDNManagement.class)
Set<ContainerCDNMetadata> listCDNContainers(ListCdnContainerOptions... options);
/**
@@ -45,7 +81,13 @@ public interface CloudFilesClient extends SwiftClient {
* whether the container is currently marked to allow public serving of objects via CDN. The log_retention setting
* specifies whether the CDN access logs should be collected and stored in the Cloud Files storage system.
*/
- ContainerCDNMetadata getCDNMetadata(String container);
+ @Named("ListCDNEnabledContainerMetadata")
+ @HEAD
+ @ResponseParser(ParseContainerCDNMetadataFromHeaders.class)
+ @Fallback(NullOnContainerNotFound.class)
+ @Path("/{container}")
+ @Endpoint(CDNManagement.class)
+ ContainerCDNMetadata getCDNMetadata(@PathParam("container") String container);
/**
* Before a container can be CDN-enabled, it must exist in the storage system. When a container is CDN-enabled, any
@@ -62,37 +104,80 @@ public interface CloudFilesClient extends SwiftClient {
* will stay populated on CDN edge servers for the entire period. The most popular objects stay cached based on the
* edge location's logic.
*/
- URI enableCDN(String container, long ttl, boolean logRetention);
+ @Named("CDNEnableContainer")
+ @PUT
+ @Path("/{container}")
+ @Headers(keys = CDN_ENABLED, values = "True")
+ @ResponseParser(ParseCdnUriFromHeaders.class)
+ @Endpoint(CDNManagement.class)
+ URI enableCDN(@PathParam("container") String container,
+ @HeaderParam(CDN_TTL) long ttl,
+ @HeaderParam(CDN_LOG_RETENTION) boolean logRetention);
+
/**
* @see CloudFilesClient#enableCDN(String, long, boolean)
*/
- URI enableCDN(String container, long ttl);
+ @Named("CDNEnableContainer")
+ @PUT
+ @Path("/{container}")
+ @Headers(keys = CDN_ENABLED, values = "True")
+ @ResponseParser(ParseCdnUriFromHeaders.class)
+ @Endpoint(CDNManagement.class)
+ URI enableCDN(@PathParam("container") String container, @HeaderParam(CDN_TTL) long ttl);
/**
* @see CloudFilesClient#enableCDN(String, long, boolean)
*/
- URI enableCDN(String container);
+ @Named("CDNEnableContainer")
+ @PUT
+ @Path("/{container}")
+ @Headers(keys = CDN_ENABLED, values = "True")
+ @ResponseParser(ParseCdnUriFromHeaders.class)
+ @Endpoint(CDNManagement.class)
+ URI enableCDN(@PathParam("container") String container);
/**
* @see CloudFilesClient#enableCDN(String, long, boolean)
*/
- URI updateCDN(String container, long ttl, boolean logRetention);
+ @Named("UpdateCDNEnabledContainerMetadata")
+ @POST
+ @Path("/{container}")
+ @ResponseParser(ParseCdnUriFromHeaders.class)
+ @Endpoint(CDNManagement.class)
+ URI updateCDN(@PathParam("container") String container,
+ @HeaderParam(CDN_TTL) long ttl,
+ @HeaderParam(CDN_LOG_RETENTION) boolean logRetention);
/**
* @see CloudFilesClient#enableCDN(String, long, boolean)
*/
- URI updateCDN(String container, boolean logRetention);
+ @Named("UpdateCDNEnabledContainerMetadata")
+ @POST
+ @Path("/{container}")
+ @ResponseParser(ParseCdnUriFromHeaders.class)
+ @Endpoint(CDNManagement.class)
+ URI updateCDN(@PathParam("container") String container, @HeaderParam(CDN_LOG_RETENTION) boolean logRetention);
/**
* @see CloudFilesClient#enableCDN(String, long, boolean)
*/
- URI updateCDN(String container, long ttl);
+ @Named("UpdateCDNEnabledContainerMetadata")
+ @POST
+ @Path("/{container}")
+ @ResponseParser(ParseCdnUriFromHeaders.class)
+ @Endpoint(CDNManagement.class)
+ URI updateCDN(@PathParam("container") String container, @HeaderParam(CDN_TTL) long ttl);
/**
* Remove the container from the CDN. Please note, however, that objects remain public until their TTL expires.
*/
- boolean disableCDN(String container);
+ @Named("DisableCDNEnabledContainer")
+ @POST
+ @Path("/{container}")
+ @Headers(keys = CDN_ENABLED, values = "False")
+ @Endpoint(CDNManagement.class)
+ boolean disableCDN(@PathParam("container") String container);
/**
* You can purge a CDN-enabled object when you find it absolutely necessary to remove the object from public access
@@ -107,12 +192,23 @@ public interface CloudFilesClient extends SwiftClient {
* (2) by creating a support ticket to purge entire containers. The 25-object limit does not apply when purging an
* entire container via Support.
*/
- boolean purgeCDNObject(String container, String object, Iterable<String> emails);
+ @Named("PurgeCDNEnabledObject")
+ @DELETE
+ @Path("/{container}/{object}")
+ @Headers(keys = CDN_CONTAINER_PURGE_OBJECT_EMAIL, values = "{email}")
+ @Endpoint(CDNManagement.class)
+ boolean purgeCDNObject(@PathParam("container") String container, @PathParam("object") String object,
+ @BinderParam(BindIterableToHeadersWithPurgeCDNObjectEmail.class) Iterable<String> emails);
+
/**
* @see CloudFilesClient#purgeCDNObject(String, String, Iterable)
*/
- boolean purgeCDNObject(String container, String object);
+ @Named("PurgeCDNEnabledObject")
+ @DELETE
+ @Path("/{container}/{object}")
+ @Endpoint(CDNManagement.class)
+ boolean purgeCDNObject(@PathParam("container") String container, @PathParam("object") String object);
/**
* You may use your Cloud Files account to create a static website on the World Wide Web. First, you must CDN-enable
@@ -130,7 +226,11 @@ public interface CloudFilesClient extends SwiftClient {
* is outside the scope of this documentation. Once you have your CNAME established, map your domain name to your
* Cloud Files CDN URL to get your site up and running on the Web.
*/
- boolean setCDNStaticWebsiteIndex(String container, String index);
+ @Named("UpdateCDNEnabledContainerMetadata")
+ @POST
+ @Path("/{container}")
+ @Headers(keys = CDN_WEBSITE_INDEX, values = "{index}")
+ boolean setCDNStaticWebsiteIndex(@PathParam("container") String container, @PathParam("index") String index);
/**
* You may create and set custom error pages for visitors to your website; currently, only 401 (Unauthorized) and
@@ -143,5 +243,9 @@ public interface CloudFilesClient extends SwiftClient {
*
* You need only set the error parameter once for your entire static website.
*/
- boolean setCDNStaticWebsiteError(String container, String error);
+ @Named("UpdateCDNEnabledContainerMetadata")
+ @POST
+ @Path("/{container}")
+ @Headers(keys = CDN_WEBSITE_ERROR, values = "{error}")
+ boolean setCDNStaticWebsiteError(@PathParam("container") String container, @PathParam("error") String error);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0ab1988a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesAsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesAsyncBlobStore.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesAsyncBlobStore.java
deleted file mode 100644
index 1f1912c..0000000
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesAsyncBlobStore.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudfiles.blobstore;
-
-import static com.google.common.util.concurrent.Futures.transform;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.cloudfiles.CloudFilesAsyncClient;
-import org.jclouds.cloudfiles.CloudFilesClient;
-import org.jclouds.cloudfiles.blobstore.functions.EnableCDNAndCache;
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-import org.jclouds.openstack.swift.blobstore.SwiftAsyncBlobStore;
-import org.jclouds.openstack.swift.blobstore.functions.BlobStoreListContainerOptionsToListContainerOptions;
-import org.jclouds.openstack.swift.blobstore.functions.BlobToObject;
-import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceList;
-import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceMetadata;
-import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlob;
-import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata;
-import org.jclouds.openstack.swift.blobstore.strategy.internal.AsyncMultipartUploadStrategy;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported. Please use {@link CloudFilesBlobStore}
- */
-@Deprecated
-@Singleton
-public class CloudFilesAsyncBlobStore extends SwiftAsyncBlobStore {
- private final EnableCDNAndCache enableCDNAndCache;
-
- @Inject
- protected CloudFilesAsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, Supplier<Location> defaultLocation,
- @Memoized Supplier<Set<? extends Location>> locations, CloudFilesClient sync, CloudFilesAsyncClient async,
- ContainerToResourceMetadata container2ResourceMd,
- BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
- ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object,
- ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions,
- Provider<FetchBlobMetadata> fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache,
- Provider<AsyncMultipartUploadStrategy> multipartUploadStrategy) {
- super(context, blobUtils, userExecutor, defaultLocation, locations, sync, async, container2ResourceMd,
- container2ContainerListOptions, container2ResourceList, object2Blob, blob2Object, object2BlobMd,
- blob2ObjectGetOptions, fetchBlobMetadataProvider, multipartUploadStrategy);
- this.enableCDNAndCache = enableCDNAndCache;
- }
-
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, final String container,
- CreateContainerOptions options) {
-
- ListenableFuture<Boolean> returnVal = createContainerInLocation(location, container);
- if (options.isPublicRead())
- return transform(createContainerInLocation(location, container), new Function<Boolean, Boolean>() {
-
- @Override
- public Boolean apply(Boolean input) {
- if (Boolean.TRUE.equals(input)) {
- return enableCDNAndCache.apply(container) != null;
- }
- return false;
- }
-
- }, userExecutor);
- return returnVal;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0ab1988a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/config/CloudFilesBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/config/CloudFilesBlobStoreContextModule.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/config/CloudFilesBlobStoreContextModule.java
index 7113a42..6454c50 100644
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/config/CloudFilesBlobStoreContextModule.java
+++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/config/CloudFilesBlobStoreContextModule.java
@@ -22,11 +22,9 @@ import java.util.concurrent.TimeUnit;
import javax.inject.Singleton;
import org.jclouds.cloudfiles.CloudFilesClient;
-import org.jclouds.cloudfiles.blobstore.CloudFilesAsyncBlobStore;
import org.jclouds.cloudfiles.blobstore.CloudFilesBlobStore;
import org.jclouds.cloudfiles.blobstore.functions.CloudFilesObjectToBlobMetadata;
import org.jclouds.cloudfiles.domain.ContainerCDNMetadata;
-import org.jclouds.openstack.swift.blobstore.SwiftAsyncBlobStore;
import org.jclouds.openstack.swift.blobstore.SwiftBlobStore;
import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule;
import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata;
@@ -59,7 +57,6 @@ public class CloudFilesBlobStoreContextModule extends SwiftBlobStoreContextModul
protected void configure() {
super.configure();
bind(SwiftBlobStore.class).to(CloudFilesBlobStore.class);
- bind(SwiftAsyncBlobStore.class).to(CloudFilesAsyncBlobStore.class);
bind(ObjectToBlobMetadata.class).to(CloudFilesObjectToBlobMetadata.class);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0ab1988a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesHttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesHttpApiModule.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesHttpApiModule.java
new file mode 100644
index 0000000..3ce8c3a
--- /dev/null
+++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesHttpApiModule.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.cloudfiles.config;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.inject.Singleton;
+
+import org.jclouds.cloudfiles.CDNManagement;
+import org.jclouds.cloudfiles.CloudFilesClient;
+import org.jclouds.location.suppliers.RegionIdToURISupplier;
+import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule;
+import org.jclouds.openstack.keystone.v1_1.suppliers.V1DefaultRegionIdSupplier;
+import org.jclouds.openstack.swift.CommonSwiftClient;
+import org.jclouds.openstack.swift.Storage;
+import org.jclouds.openstack.swift.config.SwiftHttpApiModule;
+import org.jclouds.rest.ConfiguresHttpApi;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Supplier;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+
+@ConfiguresHttpApi
+public class CloudFilesHttpApiModule extends SwiftHttpApiModule<CloudFilesClient> {
+ public CloudFilesHttpApiModule() {
+ super(CloudFilesClient.class);
+ }
+
+ @Override
+ protected void bindResolvedClientsToCommonSwift() {
+ bind(CommonSwiftClient.class).to(CloudFilesClient.class).in(Scopes.SINGLETON);
+ }
+
+ public static class StorageAndCDNManagementEndpointModule extends AuthenticationServiceModule {
+ @Provides
+ @Singleton
+ @CDNManagement
+ protected Supplier<URI> provideCDNUrl(RegionIdToURISupplier.Factory factory,
+ V1DefaultRegionIdSupplier.Factory defaultRegion) {
+ return valueForKey(factory.createForApiTypeAndVersion("cloudFilesCDN", null),
+ defaultRegion.createForApiType("cloudFilesCDN"));
+ }
+
+ @Provides
+ @Singleton
+ @Storage
+ protected Supplier<URI> provideStorageUrl(RegionIdToURISupplier.Factory factory,
+ V1DefaultRegionIdSupplier.Factory defaultRegion) {
+ return valueForKey(factory.createForApiTypeAndVersion("cloudFiles", null),
+ defaultRegion.createForApiType("cloudFiles"));
+ }
+
+ }
+
+ /**
+ * Supplies a value that corresponds to a particular key in a map, or null, if not found
+ */
+ @VisibleForTesting
+ static <K, V> Supplier<V> valueForKey(final Supplier<Map<K, Supplier<V>>> input, final Supplier<K> key) {
+ return new Supplier<V>() {
+
+ @Override
+ public V get() {
+ K keyToFind = key.get();
+ Supplier<V> value = input.get().get(keyToFind);
+ return value != null ? value.get() : null;
+ }
+
+ @Override
+ public String toString() {
+ return "withKey()";
+ }
+ };
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0ab1988a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java
deleted file mode 100644
index 25c5042..0000000
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudfiles.config;
-
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Singleton;
-
-import org.jclouds.cloudfiles.CDNManagement;
-import org.jclouds.cloudfiles.CloudFilesAsyncClient;
-import org.jclouds.cloudfiles.CloudFilesClient;
-import org.jclouds.location.suppliers.RegionIdToURISupplier;
-import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule;
-import org.jclouds.openstack.keystone.v1_1.suppliers.V1DefaultRegionIdSupplier;
-import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
-import org.jclouds.openstack.swift.CommonSwiftClient;
-import org.jclouds.openstack.swift.Storage;
-import org.jclouds.openstack.swift.config.SwiftRestClientModule;
-import org.jclouds.rest.ConfiguresRestClient;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-
-@ConfiguresRestClient
-public class CloudFilesRestClientModule extends SwiftRestClientModule<CloudFilesClient, CloudFilesAsyncClient> {
- public CloudFilesRestClientModule() {
- super(typeToken(CloudFilesClient.class), typeToken(CloudFilesAsyncClient.class), ImmutableMap
- .<Class<?>, Class<?>> of());
- }
-
- @Override
- protected void bindResolvedClientsToCommonSwift() {
- bind(CommonSwiftClient.class).to(CloudFilesClient.class).in(Scopes.SINGLETON);
- bind(CommonSwiftAsyncClient.class).to(CloudFilesAsyncClient.class).in(Scopes.SINGLETON);
- }
-
- public static class StorageAndCDNManagementEndpointModule extends AuthenticationServiceModule {
- @Provides
- @Singleton
- @CDNManagement
- protected Supplier<URI> provideCDNUrl(RegionIdToURISupplier.Factory factory,
- V1DefaultRegionIdSupplier.Factory defaultRegion) {
- return valueForKey(factory.createForApiTypeAndVersion("cloudFilesCDN", null),
- defaultRegion.createForApiType("cloudFilesCDN"));
- }
-
- @Provides
- @Singleton
- @Storage
- protected Supplier<URI> provideStorageUrl(RegionIdToURISupplier.Factory factory,
- V1DefaultRegionIdSupplier.Factory defaultRegion) {
- return valueForKey(factory.createForApiTypeAndVersion("cloudFiles", null),
- defaultRegion.createForApiType("cloudFiles"));
- }
-
- }
-
- /**
- * Supplies a value that corresponds to a particular key in a map, or null, if not found
- */
- @VisibleForTesting
- static <K, V> Supplier<V> valueForKey(final Supplier<Map<K, Supplier<V>>> input, final Supplier<K> key) {
- return new Supplier<V>() {
-
- @Override
- public V get() {
- K keyToFind = key.get();
- Supplier<V> value = input.get().get(keyToFind);
- return value != null ? value.get() : null;
- }
-
- @Override
- public String toString() {
- return "withKey()";
- }
- };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0ab1988a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java
index b0c8751..3ccdb44 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java
@@ -45,7 +45,7 @@ public class CloudFilesClientLiveTest extends CommonSwiftClientLiveTest<CloudFil
@Override
public CloudFilesClient getApi() {
- return view.unwrap(CloudFilesApiMetadata.CONTEXT_TOKEN).getApi();
+ return view.unwrapApi(CloudFilesClient.class);
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0ab1988a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobSignerExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobSignerExpectTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobSignerExpectTest.java
index 11ef7ba..dc5151d 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobSignerExpectTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobSignerExpectTest.java
@@ -27,8 +27,8 @@ import org.jclouds.blobstore.internal.BaseBlobSignerExpectTest;
import org.jclouds.cloudfiles.CloudFilesApiMetadata;
import org.jclouds.cloudfiles.CloudFilesApiMetadata.CloudFilesTemporaryUrlExtensionModule;
import org.jclouds.cloudfiles.blobstore.config.CloudFilesBlobStoreContextModule;
-import org.jclouds.cloudfiles.config.CloudFilesRestClientModule;
-import org.jclouds.cloudfiles.config.CloudFilesRestClientModule.StorageAndCDNManagementEndpointModule;
+import org.jclouds.cloudfiles.config.CloudFilesHttpApiModule;
+import org.jclouds.cloudfiles.config.CloudFilesHttpApiModule.StorageAndCDNManagementEndpointModule;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.testng.annotations.Test;
@@ -142,7 +142,7 @@ public class CloudFilesBlobSignerExpectTest extends BaseBlobSignerExpectTest {
.defaultModules(
ImmutableSet.<Class<? extends Module>> builder()
.add(StorageAndCDNManagementEndpointModule.class)
- .add(CloudFilesRestClientModule.class)
+ .add(CloudFilesHttpApiModule.class)
.add(CloudFilesBlobStoreContextModule.class)
.add(StaticTimeAndTemporaryUrlKeyModule.class).build()).build();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0ab1988a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModuleTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModuleTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModuleTest.java
index 80c1632..a0066c8 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModuleTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModuleTest.java
@@ -31,16 +31,16 @@ public class CloudFilesRestClientModuleTest {
@Test
public void testWithKey() {
assertEquals(
- CloudFilesRestClientModule.<String, String> valueForKey(
- Suppliers.<Map<String, Supplier<String>>> ofInstance(ImmutableMap.of("foo",
- Suppliers.ofInstance("bar"))), Suppliers.ofInstance("foo")).get(), "bar");
+ CloudFilesHttpApiModule.<String, String> valueForKey(Suppliers
+ .<Map<String, Supplier<String>>>ofInstance(ImmutableMap.of("foo", Suppliers.ofInstance("bar"))),
+ Suppliers.ofInstance("foo")).get(), "bar");
}
@Test
public void testWithKeyUnmatchedIsNull() {
assertEquals(
- CloudFilesRestClientModule.<String, String> valueForKey(
- Suppliers.<Map<String, Supplier<String>>> ofInstance(ImmutableMap.of("boo",
- Suppliers.ofInstance("bar"))), Suppliers.ofInstance("foo")).get(), null);
+ CloudFilesHttpApiModule.<String, String> valueForKey(Suppliers
+ .<Map<String, Supplier<String>>>ofInstance(ImmutableMap.of("boo", Suppliers.ofInstance("bar"))),
+ Suppliers.ofInstance("foo")).get(), null);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0ab1988a/providers/cloudfiles-uk/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesUKClientLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/cloudfiles-uk/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesUKClientLiveTest.java b/providers/cloudfiles-uk/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesUKClientLiveTest.java
index d36ca44..57bb3c1 100644
--- a/providers/cloudfiles-uk/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesUKClientLiveTest.java
+++ b/providers/cloudfiles-uk/src/test/java/org/jclouds/rackspace/cloudfiles/CloudFilesUKClientLiveTest.java
@@ -18,7 +18,6 @@ package org.jclouds.rackspace.cloudfiles;
import static org.testng.Assert.assertEquals;
-import org.jclouds.cloudfiles.CloudFilesApiMetadata;
import org.jclouds.cloudfiles.CloudFilesClient;
import org.jclouds.cloudfiles.CloudFilesClientLiveTest;
import org.jclouds.openstack.swift.domain.SwiftObject;
@@ -37,7 +36,7 @@ public class CloudFilesUKClientLiveTest extends CloudFilesClientLiveTest {
@Override
public CloudFilesClient getApi() {
- return view.unwrap(CloudFilesApiMetadata.CONTEXT_TOKEN).getApi();
+ return view.unwrapApi(CloudFilesClient.class);
}
@Override
[03/52] [abbrv] JCLOUDS-150 add SubmissionAsyncBlobStore;
unasync s3 and aws-s3
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/domain/CannedAccessPolicy.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/domain/CannedAccessPolicy.java b/apis/s3/src/main/java/org/jclouds/s3/domain/CannedAccessPolicy.java
index 75eb991..46a4caf 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/domain/CannedAccessPolicy.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/domain/CannedAccessPolicy.java
@@ -30,9 +30,6 @@ package org.jclouds.s3.domain;
* is written with the private access control policy (even if, in the case of an
* object, the object already exists with some other pre-existing access control
* policy).
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?
- * RESTAccessPolicy.html" />
*/
public enum CannedAccessPolicy {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/domain/CanonicalUser.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/domain/CanonicalUser.java b/apis/s3/src/main/java/org/jclouds/s3/domain/CanonicalUser.java
index 4742a8b..f4fbc55 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/domain/CanonicalUser.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/domain/CanonicalUser.java
@@ -21,9 +21,6 @@ package org.jclouds.s3.domain;
* The owner of a bucket or object cannot be changed. However, if the object is overwritten by
* another user (deleted and rewritten), the new object will have a new owner.
* <p/>
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?
- * RESTAccessPolicy.html" />
*/
public class CanonicalUser {
private final String id;
@@ -40,7 +37,7 @@ public class CanonicalUser {
/**
* To locate the CanonicalUser ID for a user, the user must perform the
- * {@link org.jclouds.s3.blobstore.S3AsyncBlobStore#list(String)} and retrieve
+ * {@link org.jclouds.s3.blobstore.S3BlobStore#list(String)} and retrieve
* {@link BucketMetadata#getOwner()}
*/
public String getId() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/domain/ListBucketResponse.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/domain/ListBucketResponse.java b/apis/s3/src/main/java/org/jclouds/s3/domain/ListBucketResponse.java
index ede375b..cb6f434 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/domain/ListBucketResponse.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/domain/ListBucketResponse.java
@@ -37,8 +37,6 @@ import java.util.Set;
* addressable using the REST API under the domain bucketname.s3.amazonaws.com. For example, if the
* object homepage.html?is stored in the Amazon S3 bucket mybucket its address would be
* http://mybucket.s3.amazonaws.com/homepage.html?
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html" />
*/
public interface ListBucketResponse extends Set<ObjectMetadata> {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/domain/MutableObjectMetadata.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/domain/MutableObjectMetadata.java b/apis/s3/src/main/java/org/jclouds/s3/domain/MutableObjectMetadata.java
index 12fdd77..5af1025 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/domain/MutableObjectMetadata.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/domain/MutableObjectMetadata.java
@@ -26,14 +26,10 @@ import org.jclouds.s3.domain.internal.MutableObjectMetadataImpl;
import com.google.inject.ImplementedBy;
/**
- * /** Amazon S3 is designed to store objects. Objects are stored in {@link S3BucketListing buckets}
- * and consist of a {@link org.jclouds.s3.domain.S3Object#getData() value}, a
- * {@link S3Object#getKey key}, {@link MutableObjectMetadata#getUserMetadata() metadata}, and an
+ * /** Amazon S3 is designed to store objects. Objects are stored in {@link ListBucketResponse buckets}
+ * and consist of a {@link S3Object#getPayload()} value}, a
+ * {@link MutableObjectMetadata#getKey key}, {@link MutableObjectMetadata#getUserMetadata() metadata}, and an
* access control policy.
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?UsingObjects.html"
- *
- * @see <a href= "http://docs.amazonwebservices.com/AmazonS3/2006-03-01/UsingMetadata.html" />
*/
@ImplementedBy(MutableObjectMetadataImpl.class)
public interface MutableObjectMetadata extends ObjectMetadata {
@@ -42,8 +38,6 @@ public interface MutableObjectMetadata extends ObjectMetadata {
* The key is the handle that you assign to an object that allows you retrieve it later. A key is
* a sequence of Unicode characters whose UTF-8 encoding is at most 1024 bytes long. Each object
* in a bucket must have a unique key.
- *
- * @see <a href= "http://docs.amazonwebservices.com/AmazonHTTP/2006-03-01/UsingKeys.html" />
*/
void setKey(String key);
@@ -63,7 +57,7 @@ public interface MutableObjectMetadata extends ObjectMetadata {
/**
* Can be used to specify caching behavior along the request/reply chain.
- *
+ *
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html?sec14.9.
*/
void setCacheControl(String cacheControl);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/domain/ObjectMetadata.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/domain/ObjectMetadata.java b/apis/s3/src/main/java/org/jclouds/s3/domain/ObjectMetadata.java
index 7f3bd91..18002c0 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/domain/ObjectMetadata.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/domain/ObjectMetadata.java
@@ -27,10 +27,6 @@ import org.jclouds.io.ContentMetadata;
* and consist of a {@link org.jclouds.s3.domain.S3Object#getData() value}, a
* {@link S3Object#getKey key}, {@link ObjectMetadata#getUserMetadata() metadata}, and an access
* control policy.
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?UsingObjects.html"
- *
- * @see <a href= "http://docs.amazonwebservices.com/AmazonS3/2006-03-01/UsingMetadata.html" />
*/
public interface ObjectMetadata extends Comparable<ObjectMetadata> {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/domain/Payer.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/domain/Payer.java b/apis/s3/src/main/java/org/jclouds/s3/domain/Payer.java
index 3cce03c..487e96e 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/domain/Payer.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/domain/Payer.java
@@ -52,9 +52,6 @@ import com.google.common.base.CaseFormat;
* You cannot use a Requester Pays bucket as the target bucket for end user logging, or vice versa.
* However, you can turn on end user logging on a Requester Pays bucket where the target bucket is a
* non Requester Pays bucket.
- *
- * @see <a href=
- * "http://docs.amazonwebservices.com/AmazonS3/latest/index.html?RESTrequestPaymentGET.html" />
*/
public enum Payer {
REQUESTER, BUCKET_OWNER, UNRECOGNIZED;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/domain/S3Object.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/domain/S3Object.java b/apis/s3/src/main/java/org/jclouds/s3/domain/S3Object.java
index 9010b48..5de2f4f 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/domain/S3Object.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/domain/S3Object.java
@@ -23,11 +23,8 @@ import com.google.common.collect.Multimap;
/**
* Amazon S3 is designed to store objects. Objects are stored in buckets and consist of a
- * {@link ObjectMetadataS3Object#getInput() value}, a {@link ObjectMetadata#getKey key},
+ * {@link PayloadEnclosing#getPayload() value}, a {@link ObjectMetadata#getKey key},
* {@link ObjectMetadata#getUserMetadata() metadata}, and an access control policy.
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?UsingObjects.html"
- * />
*/
public interface S3Object extends PayloadEnclosing, Comparable<S3Object> {
public interface Factory {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/domain/package-info.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/domain/package-info.java b/apis/s3/src/main/java/org/jclouds/s3/domain/package-info.java
index 41d5b56..6443a40 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/domain/package-info.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/domain/package-info.java
@@ -16,6 +16,5 @@
*/
/**
* This package contains the core components of S3.
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/Components.html" />
*/
package org.jclouds.s3.domain;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/filters/RequestAuthorizeSignature.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/filters/RequestAuthorizeSignature.java b/apis/s3/src/main/java/org/jclouds/s3/filters/RequestAuthorizeSignature.java
index d2ba819..e8009e4 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/filters/RequestAuthorizeSignature.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/filters/RequestAuthorizeSignature.java
@@ -67,10 +67,6 @@ import com.google.common.net.HttpHeaders;
/**
* Signs the S3 request.
- *
- * @see <a href=
- * "http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/index.html?RESTAuthentication.html"
- * />
*/
@Singleton
public class RequestAuthorizeSignature implements HttpRequestFilter, RequestSigner {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/filters/package-info.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/filters/package-info.java b/apis/s3/src/main/java/org/jclouds/s3/filters/package-info.java
index d55b206..ad4a4e1 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/filters/package-info.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/filters/package-info.java
@@ -16,6 +16,5 @@
*/
/**
* This package contains HttpRequestFilters needed to operate the REST api.
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/RESTAuthentication.html" />
*/
package org.jclouds.s3.filters;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/functions/ParseObjectMetadataFromHeaders.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/functions/ParseObjectMetadataFromHeaders.java b/apis/s3/src/main/java/org/jclouds/s3/functions/ParseObjectMetadataFromHeaders.java
index a1bd1f5..71d81f0 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/functions/ParseObjectMetadataFromHeaders.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/functions/ParseObjectMetadataFromHeaders.java
@@ -37,12 +37,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.net.HttpHeaders;
-/**
- * This parses @{link {@link org.jclouds.s3.domain.internal.MutableObjectMetadata} from HTTP
- * headers.
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/RESTObjectGET.html" />
- */
+/** This parses {@ link MutableObjectMetadata} from HTTP headers. */
public class ParseObjectMetadataFromHeaders implements Function<HttpResponse, MutableObjectMetadata>,
InvocationContext<ParseObjectMetadataFromHeaders> {
private final ParseSystemAndUserMetadataFromHeaders blobMetadataParser;
@@ -61,10 +56,7 @@ public class ParseObjectMetadataFromHeaders implements Function<HttpResponse, Mu
// used as content-md5, so filter etags that contain hyphens
static final Pattern MD5_FROM_ETAG = Pattern.compile("^\"?([0-9a-f]+)\"?$");
- /**
- * parses the http response headers to create a new
- * {@link org.jclouds.s3.domain.internal.MutableObjectMetadata} object.
- */
+ /** parses the http response headers to create a new {@link MutableObjectMetadata} object. */
public MutableObjectMetadata apply(HttpResponse from) {
BlobMetadata base = blobMetadataParser.apply(from);
MutableObjectMetadata to = blobToObjectMetadata.apply(base);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/options/CopyObjectOptions.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/options/CopyObjectOptions.java b/apis/s3/src/main/java/org/jclouds/s3/options/CopyObjectOptions.java
index f39e428..25f833c 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/options/CopyObjectOptions.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/options/CopyObjectOptions.java
@@ -67,10 +67,6 @@ import com.google.common.collect.Multimap;
* ifSourceModifiedSince(new Date().minusDays(1))
* );
* <code>
- *
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTObjectCOPY.html?"
- * />
*/
public class CopyObjectOptions extends BaseHttpRequestOptions {
private static final DateService dateService = new SimpleDateFormatDateService();
@@ -121,7 +117,6 @@ public class CopyObjectOptions extends BaseHttpRequestOptions {
* conditional copy headers.
*
* @return valid HTTP date
- * @see <a href="http://rfc.net/rfc2616.html?s3.3"/>
* @see CopyObjectOptions#ifSourceModifiedSince(Date)
*/
public String getIfModifiedSince() {
@@ -138,7 +133,6 @@ public class CopyObjectOptions extends BaseHttpRequestOptions {
* conditional copy headers.
*
* @return valid HTTP date
- * @see <a href="http://rfc.net/rfc2616.html?s3.3"/>
* @see CopyObjectOptions#ifSourceUnmodifiedSince(Date)
*/
public String getIfUnmodifiedSince() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/options/ListBucketOptions.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/options/ListBucketOptions.java b/apis/s3/src/main/java/org/jclouds/s3/options/ListBucketOptions.java
index 7ab2561..480b79e 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/options/ListBucketOptions.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/options/ListBucketOptions.java
@@ -31,12 +31,8 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
* import static org.jclouds.s3.commands.options.GetBucketOptions.Builder.*
* <p/>
* S3Client connection = // get connection
- * Future<S3Bucket> bucket = connection.listBucket("bucketName",withPrefix("home/users").maxKeys(1000));
+ * ListBucketResponse bucket = connection.listBucket("bucketName",withPrefix("home/users").maxKeys(1000));
* <code>
- *
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTBucketGET.html?"
- * />
*/
public class ListBucketOptions extends BaseHttpRequestOptions implements Cloneable {
public static final ListBucketOptions NONE = new ListBucketOptions();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/options/PutBucketOptions.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/options/PutBucketOptions.java b/apis/s3/src/main/java/org/jclouds/s3/options/PutBucketOptions.java
index 5146f8c..5028688 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/options/PutBucketOptions.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/options/PutBucketOptions.java
@@ -44,12 +44,8 @@ import com.google.common.collect.Multimap;
* import org.jclouds.s3.S3Client;
* <p/>
* S3Client connection = // get connection
- * Future<Boolean> createdInEu = connection.putBucketIfNotExists("bucketName",createIn(EU));
+ * boolean createdInEu = connection.putBucketIfNotExists("bucketName",createIn(EU));
* <code>
- *
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTBucketPUT.html?"
- * />
*/
public class PutBucketOptions extends BaseHttpRequestOptions {
private CannedAccessPolicy acl = CannedAccessPolicy.PRIVATE;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/options/PutObjectOptions.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/options/PutObjectOptions.java b/apis/s3/src/main/java/org/jclouds/s3/options/PutObjectOptions.java
index 6b65ff7..3ae6d30 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/options/PutObjectOptions.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/options/PutObjectOptions.java
@@ -46,12 +46,8 @@ import com.google.common.collect.Multimap;
* import org.jclouds.s3.S3Client;
*
* S3Client connection = // get connection
- * Future<Boolean> publicly readable = connection.putObject("bucketName",new S3Object("key","value"), withAcl(CannedAccessPolicy.PUBLIC_READ));
+ * boolean publiclyReadable = connection.putObject("bucketName",new S3Object("key","value"), withAcl(CannedAccessPolicy.PUBLIC_READ));
* <code>
- *
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTObjectPUT.html?"
- * />
*/
public class PutObjectOptions extends BaseHttpRequestOptions {
public static final PutObjectOptions NONE = new PutObjectOptions();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/options/package-info.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/options/package-info.java b/apis/s3/src/main/java/org/jclouds/s3/options/package-info.java
index fd186a8..30fe8b0 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/options/package-info.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/options/package-info.java
@@ -16,7 +16,5 @@
*/
/**
* This package contains request options for S3 REST commands.
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/RESTAPI.html" />
*/
package org.jclouds.s3.options;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/package-info.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/package-info.java b/apis/s3/src/main/java/org/jclouds/s3/package-info.java
index b6eb727..0a28d71 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/package-info.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/package-info.java
@@ -16,7 +16,5 @@
*/
/**
* This package contains an Amazon S3 client implemented by {@link org.jclouds.http.HttpCommandExecutorService} commands.
- *
- * @see <a href="http://amazon.com/s3"/>
*/
package org.jclouds.s3;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/reference/S3Headers.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/reference/S3Headers.java b/apis/s3/src/main/java/org/jclouds/s3/reference/S3Headers.java
index acc7ddc..64fd11a 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/reference/S3Headers.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/reference/S3Headers.java
@@ -16,13 +16,7 @@
*/
package org.jclouds.s3.reference;
-/**
- * Additional headers specified by Amazon S3 REST API.
- *
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/latest/index.html?RESTAuthentication.html"
- * />
- */
+/** Additional headers specified by Amazon S3 REST API. */
public final class S3Headers {
/**
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/xml/AccessControlListHandler.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/xml/AccessControlListHandler.java b/apis/s3/src/main/java/org/jclouds/s3/xml/AccessControlListHandler.java
index ec7c8de..8a55672 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/xml/AccessControlListHandler.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/xml/AccessControlListHandler.java
@@ -33,8 +33,6 @@ import org.xml.sax.Attributes;
* Parses the following XML document:
* <p/>
* AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/"
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html"/>
*/
public class AccessControlListHandler extends ParseSax.HandlerWithResult<AccessControlList> {
private AccessControlList acl = new AccessControlList();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/xml/BucketLoggingHandler.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/xml/BucketLoggingHandler.java b/apis/s3/src/main/java/org/jclouds/s3/xml/BucketLoggingHandler.java
index 7cde74b..a5194d9 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/xml/BucketLoggingHandler.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/xml/BucketLoggingHandler.java
@@ -36,8 +36,6 @@ import com.google.common.collect.Sets;
* Parses the following XML document:
* <p/>
* BucketLoggingStatus xmlns="http://s3.amazonaws.com/doc/2006-03-01/"
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/index.html?ServerLogs.html"/>
*/
public class BucketLoggingHandler extends ParseSax.HandlerWithResult<BucketLogging> {
private Set<Grant> targetGrants = Sets.newHashSet();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/xml/CopyObjectHandler.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/xml/CopyObjectHandler.java b/apis/s3/src/main/java/org/jclouds/s3/xml/CopyObjectHandler.java
index d53bc12..3f3fabb 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/xml/CopyObjectHandler.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/xml/CopyObjectHandler.java
@@ -31,8 +31,6 @@ import org.jclouds.s3.domain.internal.CopyObjectResult;
* Parses the response from Amazon S3 COPY Object command.
* <p/>
* CopyObjectResult is the document we expect to parse.
- *
- * @see <a href= "http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTObjectCOPY.html" />
*/
public class CopyObjectHandler extends ParseSax.HandlerWithResult<ObjectMetadata> {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/xml/ListAllMyBucketsHandler.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/xml/ListAllMyBucketsHandler.java b/apis/s3/src/main/java/org/jclouds/s3/xml/ListAllMyBucketsHandler.java
index 51dda0d..91a5b3b 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/xml/ListAllMyBucketsHandler.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/xml/ListAllMyBucketsHandler.java
@@ -34,10 +34,6 @@ import com.google.common.collect.Sets;
* Parses the following XML document:
* <p/>
* SetAllMyBucketsResult xmlns="http://doc.s3.amazonaws.com/2006-03-01"
- *
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTServiceGET.html"
- * />
*/
public class ListAllMyBucketsHandler extends ParseSax.HandlerWithResult<Set<BucketMetadata>> {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/xml/ListBucketHandler.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/xml/ListBucketHandler.java b/apis/s3/src/main/java/org/jclouds/s3/xml/ListBucketHandler.java
index d7ed117..c5fdb73 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/xml/ListBucketHandler.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/xml/ListBucketHandler.java
@@ -41,10 +41,6 @@ import com.google.common.collect.ImmutableSet.Builder;
* Parses the following XML document:
* <p/>
* ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01"
- *
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTBucketGET.html"
- * />
*/
public class ListBucketHandler extends ParseSax.HandlerWithResult<ListBucketResponse> {
private Builder<ObjectMetadata> contents = ImmutableSet.builder();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/xml/LocationConstraintHandler.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/xml/LocationConstraintHandler.java b/apis/s3/src/main/java/org/jclouds/s3/xml/LocationConstraintHandler.java
index b4a4702..415f345 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/xml/LocationConstraintHandler.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/xml/LocationConstraintHandler.java
@@ -33,10 +33,6 @@ import com.google.common.cache.LoadingCache;
* Parses the response from Amazon S3 GET Bucket Location
* <p/>
* Region is the document we expect to parse.
- *
- * @see <a href=
- * "http://docs.amazonwebservices.com/AmazonS3/latest/RESTBucketLocationGET.html"
- * />
*/
public class LocationConstraintHandler extends ParseSax.HandlerWithResult<String> {
private final LoadingCache<String, Optional<String>> bucketToRegion;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/xml/PayerHandler.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/xml/PayerHandler.java b/apis/s3/src/main/java/org/jclouds/s3/xml/PayerHandler.java
index 14ac098..8bb614f 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/xml/PayerHandler.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/xml/PayerHandler.java
@@ -25,8 +25,6 @@ import org.jclouds.s3.domain.Payer;
* Parses the response from Amazon S3 GET Request Payment
* <p/>
* RequestPaymentConfiguration is the document we expect to parse.
- *
- * @see <a href= "http://docs.amazonwebservices.com/AmazonS3/latest/RESTrequestPaymentGET.html" />
*/
public class PayerHandler extends ParseSax.HandlerWithResult<Payer> {
private StringBuilder currentText = new StringBuilder();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/S3AsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/S3AsyncClientTest.java b/apis/s3/src/test/java/org/jclouds/s3/S3AsyncClientTest.java
deleted file mode 100644
index c0561f4..0000000
--- a/apis/s3/src/test/java/org/jclouds/s3/S3AsyncClientTest.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.s3;
-
-import static org.jclouds.reflect.Reflection2.method;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.aws.domain.Region;
-import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnContainerNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnKeyNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.ThrowContainerNotFoundOn404;
-import org.jclouds.blobstore.BlobStoreFallbacks.ThrowKeyNotFoundOn404;
-import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest;
-import org.jclouds.date.TimeStamp;
-import org.jclouds.http.functions.ParseETagHeader;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.http.functions.ReleasePayloadAndReturn;
-import org.jclouds.http.functions.ReturnTrueIf2xx;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.s3.S3Fallbacks.TrueOn404OrNotFoundFalseOnIllegalState;
-import org.jclouds.s3.config.S3RestClientModule;
-import org.jclouds.s3.domain.AccessControlList;
-import org.jclouds.s3.domain.AccessControlList.EmailAddressGrantee;
-import org.jclouds.s3.domain.AccessControlList.Grant;
-import org.jclouds.s3.domain.AccessControlList.Permission;
-import org.jclouds.s3.domain.BucketLogging;
-import org.jclouds.s3.domain.CannedAccessPolicy;
-import org.jclouds.s3.domain.Payer;
-import org.jclouds.s3.domain.S3Object;
-import org.jclouds.s3.fallbacks.FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists;
-import org.jclouds.s3.functions.ParseObjectFromHeadersAndHttpContent;
-import org.jclouds.s3.functions.ParseObjectMetadataFromHeaders;
-import org.jclouds.s3.internal.BaseS3AsyncClientTest;
-import org.jclouds.s3.options.CopyObjectOptions;
-import org.jclouds.s3.options.ListBucketOptions;
-import org.jclouds.s3.options.PutBucketOptions;
-import org.jclouds.s3.options.PutObjectOptions;
-import org.jclouds.s3.xml.AccessControlListHandler;
-import org.jclouds.s3.xml.BucketLoggingHandler;
-import org.jclouds.s3.xml.CopyObjectHandler;
-import org.jclouds.s3.xml.ListAllMyBucketsHandler;
-import org.jclouds.s3.xml.ListBucketHandler;
-import org.jclouds.s3.xml.LocationConstraintHandler;
-import org.jclouds.s3.xml.PayerHandler;
-import org.jclouds.util.Strings2;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.reflect.Invokable;
-import com.google.inject.Module;
-/**
- * Tests behavior of {@code S3AsyncClient}
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
-@Test(groups = "unit", testName = "S3AsyncClientTest")
-public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClientTest<T> {
-
- protected String url = "s3.amazonaws.com";
-
- public void testAllRegions() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "putBucketInRegion", String.class, String.class,
- PutBucketOptions[].class);
- for (String region : Region.DEFAULT_S3) {
- processor.createRequest(method, ImmutableList.<Object> of(region, "bucket-" + region));
- }
- }
-
- public void testGetBucketLocation() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "getBucketLocation", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
-
- assertRequestLineEquals(request, "GET https://bucket." + url + "/?location HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
- assertPayloadEquals(request, null, null, false);
-
- request = (GeneratedHttpRequest) filter.filter(request);
-
- 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);
- assertSaxResponseParserClassEquals(method, LocationConstraintHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testGetBucketPayer() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "getBucketPayer", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
-
- 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);
- assertSaxResponseParserClassEquals(method, PayerHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testSetBucketPayerOwner() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "setBucketPayer", String.class, Payer.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", Payer.BUCKET_OWNER));
-
- assertRequestLineEquals(request, "PUT https://bucket." + url + "/?requestPayment HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
- assertPayloadEquals(request, "<RequestPaymentConfiguration xmlns=\"http://" + url
- + "/doc/2006-03-01/\"><Payer>BucketOwner</Payer></RequestPaymentConfiguration>", "text/xml", false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testSetBucketPayerRequester() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "setBucketPayer", String.class, Payer.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", Payer.REQUESTER));
-
- assertRequestLineEquals(request, "PUT https://bucket." + url + "/?requestPayment HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
- assertPayloadEquals(request, "<RequestPaymentConfiguration xmlns=\"http://" + url
- + "/doc/2006-03-01/\"><Payer>Requester</Payer></RequestPaymentConfiguration>", "text/xml", false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testListBucket() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "listBucket", String.class,
- ListBucketOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
-
- 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);
- assertSaxResponseParserClassEquals(method, ListBucketHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testBucketExists() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "bucketExists", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
-
- assertRequestLineEquals(request, "HEAD https://bucket." + url + "/ HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseOnContainerNotFound.class);
-
- checkFilters(request);
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testCopyObjectInvalidName() throws ArrayIndexOutOfBoundsException, SecurityException,
- IllegalArgumentException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "copyObject", String.class, String.class, String.class,
- String.class, CopyObjectOptions[].class);
- processor.createRequest(method, ImmutableList.<Object> of("sourceBucket", "sourceObject", "destinationBucket", "destinationObject"));
-
- }
-
- public void testCopyObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
- NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "copyObject", String.class, String.class, String.class,
- String.class, CopyObjectOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("sourceBucket", "sourceObject", "destinationbucket",
- "destinationObject"));
-
- 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);
- assertSaxResponseParserClassEquals(method, CopyObjectHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testDeleteBucketIfEmpty() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "deleteBucketIfEmpty", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
-
- 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);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, TrueOn404OrNotFoundFalseOnIllegalState.class);
-
- checkFilters(request);
- }
-
- public void testDeleteObject() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "deleteObject", String.class, String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
-
- 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);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testGetBucketACL() throws SecurityException, NoSuchMethodException, IOException {
-
- Invokable<?, ?> method = method(S3AsyncClient.class, "getBucketACL", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
-
- 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);
- assertSaxResponseParserClassEquals(method, AccessControlListHandler.class);
- assertFallbackClassEquals(method, ThrowContainerNotFoundOn404.class);
-
- checkFilters(request);
- }
-
- public void testGetObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
- NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "getObject", String.class, String.class, GetOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
-
- 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);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnKeyNotFound.class);
-
- checkFilters(request);
- }
-
- public void testGetObjectACL() throws SecurityException, NoSuchMethodException, IOException {
-
- Invokable<?, ?> method = method(S3AsyncClient.class, "getObjectACL", String.class, String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
-
- 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);
- assertSaxResponseParserClassEquals(method, AccessControlListHandler.class);
- assertFallbackClassEquals(method, ThrowKeyNotFoundOn404.class);
-
- checkFilters(request);
- }
-
- public void testObjectExists() throws SecurityException, NoSuchMethodException, IOException {
-
- Invokable<?, ?> method = method(S3AsyncClient.class, "objectExists", String.class, String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
-
- 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);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseOnKeyNotFound.class);
-
- checkFilters(request);
- }
-
- public void testHeadObject() throws SecurityException, NoSuchMethodException, IOException {
-
- Invokable<?, ?> method = method(S3AsyncClient.class, "headObject", String.class, String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
-
- 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);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnKeyNotFound.class);
-
- checkFilters(request);
- }
-
- public void testListOwnedBuckets() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "listOwnedBuckets");
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request, "GET https://" + url + "/ HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: " + url + "\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, ListAllMyBucketsHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testNewS3Object() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "newS3Object");
- assertEquals(method.getReturnType().getRawType(), S3Object.class);
- }
-
- public void testPutBucketACL() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "putBucketACL", String.class, AccessControlList.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", AccessControlList.fromCannedAccessPolicy(
- CannedAccessPolicy.PRIVATE, "1234")));
-
- assertRequestLineEquals(request, "PUT https://bucket." + url + "/?acl HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
- assertPayloadEquals(
- request,
- "<AccessControlPolicy xmlns=\"http://"
- + url
- + "/doc/2006-03-01/\"><Owner><ID>1234</ID></Owner><AccessControlList><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>1234</ID></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>",
- "text/xml", false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testPutBucketDefault() throws ArrayIndexOutOfBoundsException, SecurityException,
- IllegalArgumentException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "putBucketInRegion", String.class, String.class,
- PutBucketOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "bucket"));
-
- 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);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.class);
-
- checkFilters(request);
- }
-
- public void testPutObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
- NoSuchMethodException, IOException {
-
- Invokable<?, ?> method = method(S3AsyncClient.class, "putObject", String.class, S3Object.class, PutObjectOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", blobToS3Object
- .apply(BindBlobToMultipartFormTest.TEST_BLOB)));
-
- 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);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testPutObjectACL() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "putObjectACL", String.class, String.class, AccessControlList.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "key", AccessControlList.fromCannedAccessPolicy(
- CannedAccessPolicy.PRIVATE, "1234")));
-
- assertRequestLineEquals(request, "PUT https://bucket." + url + "/key?acl HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
- assertPayloadEquals(
- request,
- "<AccessControlPolicy xmlns=\"http://"
- + url
- + "/doc/2006-03-01/\"><Owner><ID>1234</ID></Owner><AccessControlList><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>1234</ID></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>",
- "text/xml", false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testGetBucketLogging() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "getBucketLogging", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
-
- 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);
- assertSaxResponseParserClassEquals(method, BucketLoggingHandler.class);
- assertFallbackClassEquals(method, ThrowContainerNotFoundOn404.class);
-
- checkFilters(request);
- }
-
- public void testDisableBucketLogging() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "disableBucketLogging", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
-
- assertRequestLineEquals(request, "PUT https://bucket." + url + "/?logging HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
- assertPayloadEquals(request, "<BucketLoggingStatus xmlns=\"http://" + url + "/doc/2006-03-01/\"/>", "text/xml",
- false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testEnableBucketLoggingOwner() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "enableBucketLogging", String.class, BucketLogging.class);
- GeneratedHttpRequest request = processor
- .createRequest(method, ImmutableList.<Object> of("bucket", new BucketLogging("mylogs", "access_log-", ImmutableSet
- .<Grant> of(new Grant(new EmailAddressGrantee("adrian@jclouds.org"), Permission.FULL_CONTROL)))));
-
- 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);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- @ConfiguresRestClient
- private static final class TestS3RestClientModule extends S3RestClientModule<S3Client, S3AsyncClient> {
-
- @Override
- protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
- return "2009-11-08T15:54:08.897Z";
- }
- }
-
- @Override
- protected Module createModule() {
- return new TestS3RestClientModule();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/S3ClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/S3ClientLiveTest.java b/apis/s3/src/test/java/org/jclouds/s3/S3ClientLiveTest.java
index d94fda1..04fd5a3 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/S3ClientLiveTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/S3ClientLiveTest.java
@@ -16,8 +16,6 @@
*/
package org.jclouds.s3;
-import static org.jclouds.s3.internal.StubS3AsyncClient.TEST_ACL_EMAIL;
-import static org.jclouds.s3.internal.StubS3AsyncClient.TEST_ACL_ID;
import static org.jclouds.s3.options.CopyObjectOptions.Builder.ifSourceETagDoesntMatch;
import static org.jclouds.s3.options.CopyObjectOptions.Builder.ifSourceETagMatches;
import static org.jclouds.s3.options.CopyObjectOptions.Builder.ifSourceModifiedSince;
@@ -57,12 +55,16 @@ import com.google.common.collect.Maps;
@Test(groups = { "integration", "live" })
public class S3ClientLiveTest extends BaseBlobStoreIntegrationTest {
+ public static final String TEST_ACL_ID = "1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c";
+ public static final String TEST_ACL_EMAIL = "james@misterm.org";
+ public static final String DEFAULT_OWNER_ID = "abc123";
+
public S3ClientLiveTest() {
this.provider = "s3";
}
public S3Client getApi() {
- return view.unwrap(S3ApiMetadata.CONTEXT_TOKEN).getApi();
+ return view.unwrapApi(S3Client.class);
}
/**
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/S3ClientTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/S3ClientTest.java b/apis/s3/src/test/java/org/jclouds/s3/S3ClientTest.java
new file mode 100644
index 0000000..fb5aeb9
--- /dev/null
+++ b/apis/s3/src/test/java/org/jclouds/s3/S3ClientTest.java
@@ -0,0 +1,490 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.s3;
+
+import static org.jclouds.reflect.Reflection2.method;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.aws.domain.Region;
+import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnContainerNotFound;
+import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnKeyNotFound;
+import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyNotFound;
+import org.jclouds.blobstore.BlobStoreFallbacks.ThrowContainerNotFoundOn404;
+import org.jclouds.blobstore.BlobStoreFallbacks.ThrowKeyNotFoundOn404;
+import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest;
+import org.jclouds.date.TimeStamp;
+import org.jclouds.http.functions.ParseETagHeader;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.http.functions.ReturnTrueIf2xx;
+import org.jclouds.http.options.GetOptions;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.s3.S3Fallbacks.TrueOn404OrNotFoundFalseOnIllegalState;
+import org.jclouds.s3.config.S3HttpApiModule;
+import org.jclouds.s3.domain.AccessControlList;
+import org.jclouds.s3.domain.AccessControlList.EmailAddressGrantee;
+import org.jclouds.s3.domain.AccessControlList.Grant;
+import org.jclouds.s3.domain.AccessControlList.Permission;
+import org.jclouds.s3.domain.BucketLogging;
+import org.jclouds.s3.domain.CannedAccessPolicy;
+import org.jclouds.s3.domain.Payer;
+import org.jclouds.s3.domain.S3Object;
+import org.jclouds.s3.fallbacks.FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists;
+import org.jclouds.s3.functions.ParseObjectFromHeadersAndHttpContent;
+import org.jclouds.s3.functions.ParseObjectMetadataFromHeaders;
+import org.jclouds.s3.internal.BaseS3ClientTest;
+import org.jclouds.s3.options.CopyObjectOptions;
+import org.jclouds.s3.options.ListBucketOptions;
+import org.jclouds.s3.options.PutBucketOptions;
+import org.jclouds.s3.options.PutObjectOptions;
+import org.jclouds.s3.xml.AccessControlListHandler;
+import org.jclouds.s3.xml.BucketLoggingHandler;
+import org.jclouds.s3.xml.CopyObjectHandler;
+import org.jclouds.s3.xml.ListAllMyBucketsHandler;
+import org.jclouds.s3.xml.ListBucketHandler;
+import org.jclouds.s3.xml.LocationConstraintHandler;
+import org.jclouds.s3.xml.PayerHandler;
+import org.jclouds.util.Strings2;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.reflect.Invokable;
+import com.google.inject.Module;
+/**
+ * Tests behavior of {@code S3Client}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "S3ClientTest")
+public abstract class S3ClientTest<T extends S3Client> extends BaseS3ClientTest<T> {
+
+ protected String url = "s3.amazonaws.com";
+
+ public void testAllRegions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "putBucketInRegion", String.class, String.class,
+ PutBucketOptions[].class);
+ for (String region : Region.DEFAULT_S3) {
+ processor.createRequest(method, ImmutableList.<Object> of(region, "bucket-" + region));
+ }
+ }
+
+ public void testGetBucketLocation() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "getBucketLocation", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
+
+ assertRequestLineEquals(request, "GET https://bucket." + url + "/?location HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
+ assertPayloadEquals(request, null, null, false);
+
+ request = (GeneratedHttpRequest) filter.filter(request);
+
+ 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);
+ assertSaxResponseParserClassEquals(method, LocationConstraintHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testGetBucketPayer() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "getBucketPayer", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, PayerHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testSetBucketPayerOwner() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "setBucketPayer", String.class, Payer.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", Payer.BUCKET_OWNER));
+
+ assertRequestLineEquals(request, "PUT https://bucket." + url + "/?requestPayment HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
+ assertPayloadEquals(request, "<RequestPaymentConfiguration xmlns=\"http://" + url
+ + "/doc/2006-03-01/\"><Payer>BucketOwner</Payer></RequestPaymentConfiguration>", "text/xml", false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testSetBucketPayerRequester() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "setBucketPayer", String.class, Payer.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", Payer.REQUESTER));
+
+ assertRequestLineEquals(request, "PUT https://bucket." + url + "/?requestPayment HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
+ assertPayloadEquals(request, "<RequestPaymentConfiguration xmlns=\"http://" + url
+ + "/doc/2006-03-01/\"><Payer>Requester</Payer></RequestPaymentConfiguration>", "text/xml", false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testListBucket() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "listBucket", String.class,
+ ListBucketOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, ListBucketHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testBucketExists() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "bucketExists", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
+
+ assertRequestLineEquals(request, "HEAD https://bucket." + url + "/ HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseOnContainerNotFound.class);
+
+ checkFilters(request);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testCopyObjectInvalidName() throws ArrayIndexOutOfBoundsException, SecurityException,
+ IllegalArgumentException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "copyObject", String.class, String.class, String.class,
+ String.class, CopyObjectOptions[].class);
+ processor.createRequest(method, ImmutableList.<Object> of("sourceBucket", "sourceObject", "destinationBucket", "destinationObject"));
+
+ }
+
+ public void testCopyObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
+ NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "copyObject", String.class, String.class, String.class,
+ String.class, CopyObjectOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("sourceBucket", "sourceObject", "destinationbucket",
+ "destinationObject"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, CopyObjectHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeleteBucketIfEmpty() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "deleteBucketIfEmpty", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, TrueOn404OrNotFoundFalseOnIllegalState.class);
+
+ checkFilters(request);
+ }
+
+ public void testDeleteObject() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "deleteObject", String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetBucketACL() throws SecurityException, NoSuchMethodException, IOException {
+
+ Invokable<?, ?> method = method(S3Client.class, "getBucketACL", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, AccessControlListHandler.class);
+ assertFallbackClassEquals(method, ThrowContainerNotFoundOn404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
+ NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "getObject", String.class, String.class, GetOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnKeyNotFound.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetObjectACL() throws SecurityException, NoSuchMethodException, IOException {
+
+ Invokable<?, ?> method = method(S3Client.class, "getObjectACL", String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, AccessControlListHandler.class);
+ assertFallbackClassEquals(method, ThrowKeyNotFoundOn404.class);
+
+ checkFilters(request);
+ }
+
+ public void testObjectExists() throws SecurityException, NoSuchMethodException, IOException {
+
+ Invokable<?, ?> method = method(S3Client.class, "objectExists", String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseOnKeyNotFound.class);
+
+ checkFilters(request);
+ }
+
+ public void testHeadObject() throws SecurityException, NoSuchMethodException, IOException {
+
+ Invokable<?, ?> method = method(S3Client.class, "headObject", String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnKeyNotFound.class);
+
+ checkFilters(request);
+ }
+
+ public void testListOwnedBuckets() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "listOwnedBuckets");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "GET https://" + url + "/ HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: " + url + "\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, ListAllMyBucketsHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testNewS3Object() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "newS3Object");
+ assertEquals(method.getReturnType().getRawType(), S3Object.class);
+ }
+
+ public void testPutBucketACL() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "putBucketACL", String.class, AccessControlList.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", AccessControlList.fromCannedAccessPolicy(
+ CannedAccessPolicy.PRIVATE, "1234")));
+
+ assertRequestLineEquals(request, "PUT https://bucket." + url + "/?acl HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
+ assertPayloadEquals(
+ request,
+ "<AccessControlPolicy xmlns=\"http://"
+ + url
+ + "/doc/2006-03-01/\"><Owner><ID>1234</ID></Owner><AccessControlList><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>1234</ID></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>",
+ "text/xml", false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testPutBucketDefault() throws ArrayIndexOutOfBoundsException, SecurityException,
+ IllegalArgumentException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "putBucketInRegion", String.class, String.class,
+ PutBucketOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "bucket"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.class);
+
+ checkFilters(request);
+ }
+
+ public void testPutObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
+ NoSuchMethodException, IOException {
+
+ Invokable<?, ?> method = method(S3Client.class, "putObject", String.class, S3Object.class, PutObjectOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", blobToS3Object
+ .apply(BindBlobToMultipartFormTest.TEST_BLOB)));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testPutObjectACL() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "putObjectACL", String.class, String.class, AccessControlList.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "key", AccessControlList.fromCannedAccessPolicy(
+ CannedAccessPolicy.PRIVATE, "1234")));
+
+ assertRequestLineEquals(request, "PUT https://bucket." + url + "/key?acl HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
+ assertPayloadEquals(
+ request,
+ "<AccessControlPolicy xmlns=\"http://"
+ + url
+ + "/doc/2006-03-01/\"><Owner><ID>1234</ID></Owner><AccessControlList><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>1234</ID></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>",
+ "text/xml", false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testGetBucketLogging() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "getBucketLogging", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
+
+ 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);
+ assertSaxResponseParserClassEquals(method, BucketLoggingHandler.class);
+ assertFallbackClassEquals(method, ThrowContainerNotFoundOn404.class);
+
+ checkFilters(request);
+ }
+
+ public void testDisableBucketLogging() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "disableBucketLogging", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
+
+ assertRequestLineEquals(request, "PUT https://bucket." + url + "/?logging HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
+ assertPayloadEquals(request, "<BucketLoggingStatus xmlns=\"http://" + url + "/doc/2006-03-01/\"/>", "text/xml",
+ false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testEnableBucketLoggingOwner() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(S3Client.class, "enableBucketLogging", String.class, BucketLogging.class);
+ GeneratedHttpRequest request = processor
+ .createRequest(method, ImmutableList.<Object> of("bucket", new BucketLogging("mylogs", "access_log-", ImmutableSet
+ .<Grant> of(new Grant(new EmailAddressGrantee("adrian@jclouds.org"), Permission.FULL_CONTROL)))));
+
+ 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);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @ConfiguresHttpApi
+ private static final class TestS3HttpApiModule extends S3HttpApiModule<S3Client> {
+
+ @Override
+ protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
+ return "2009-11-08T15:54:08.897Z";
+ }
+ }
+
+ @Override
+ protected Module createModule() {
+ return new TestS3HttpApiModule();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredNoPathTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredNoPathTest.java b/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredNoPathTest.java
index 893f291..a673a0d 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredNoPathTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredNoPathTest.java
@@ -22,8 +22,8 @@ import java.io.IOException;
import java.util.Properties;
import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.s3.S3AsyncClient;
-import org.jclouds.s3.internal.BaseS3AsyncClientTest;
+import org.jclouds.s3.S3Client;
+import org.jclouds.s3.internal.BaseS3ClientTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
@@ -34,11 +34,11 @@ import com.google.common.reflect.Invokable;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "BindAsHostPrefixIfConfiguredNoPathTest")
-public class BindAsHostPrefixIfConfiguredNoPathTest extends BaseS3AsyncClientTest<S3AsyncClient> {
+public class BindAsHostPrefixIfConfiguredNoPathTest extends BaseS3ClientTest<S3Client> {
public void testBucketWithHostnameStyle() throws IOException, SecurityException, NoSuchMethodException {
- Invokable<?, ?> method = method(S3AsyncClient.class, "deleteObject", String.class, String.class);
+ Invokable<?, ?> method = method(S3Client.class, "deleteObject", String.class, String.class);
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("testbucket.example.com", "test.jpg"));
assertRequestLineEquals(request, "DELETE https://s3.amazonaws.com/testbucket.example.com/test.jpg HTTP/1.1");
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredTest.java b/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredTest.java
index e8a2e2e..29bcb91 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/binders/BindAsHostPrefixIfConfiguredTest.java
@@ -25,8 +25,8 @@ import java.io.IOException;
import java.util.Properties;
import org.jclouds.http.HttpRequest;
-import org.jclouds.s3.S3AsyncClient;
-import org.jclouds.s3.internal.BaseS3AsyncClientTest;
+import org.jclouds.s3.S3Client;
+import org.jclouds.s3.internal.BaseS3ClientTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -37,7 +37,7 @@ import com.google.common.reflect.Invokable;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "BindAsHostPrefixIfConfiguredTest")
-public class BindAsHostPrefixIfConfiguredTest extends BaseS3AsyncClientTest<S3AsyncClient> {
+public class BindAsHostPrefixIfConfiguredTest extends BaseS3ClientTest<S3Client> {
public void testBucket() throws IOException {
@@ -57,7 +57,7 @@ public class BindAsHostPrefixIfConfiguredTest extends BaseS3AsyncClientTest<S3As
request = binder.bindToRequest(request, "testbucket.example.com");
assertEquals(request.getRequestLine(), "GET http://euc/services/Walrus/testbucket.example.com HTTP/1.1");
- Invokable<?, ?> method = method(S3AsyncClient.class, "deleteObject", String.class, String.class);
+ Invokable<?, ?> method = method(S3Client.class, "deleteObject", String.class, String.class);
request = processor.createRequest(method, ImmutableList.<Object> of("testbucket.example.com", "test.jpg"));
assertRequestLineEquals(request, "DELETE http://euc/services/Walrus/testbucket.example.com/test.jpg HTTP/1.1");
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/binders/BindNoBucketLoggingToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/binders/BindNoBucketLoggingToXmlPayloadTest.java b/apis/s3/src/test/java/org/jclouds/s3/binders/BindNoBucketLoggingToXmlPayloadTest.java
index 58c5030..f70ff90 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/binders/BindNoBucketLoggingToXmlPayloadTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/binders/BindNoBucketLoggingToXmlPayloadTest.java
@@ -21,8 +21,8 @@ import static org.testng.Assert.assertEquals;
import java.io.IOException;
import org.jclouds.http.HttpRequest;
-import org.jclouds.s3.S3AsyncClient;
-import org.jclouds.s3.internal.BaseS3AsyncClientTest;
+import org.jclouds.s3.S3Client;
+import org.jclouds.s3.internal.BaseS3ClientTest;
import org.testng.annotations.Test;
/**
@@ -30,7 +30,7 @@ import org.testng.annotations.Test;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "BindNoBucketLoggingToXmlPayloadTest")
-public class BindNoBucketLoggingToXmlPayloadTest extends BaseS3AsyncClientTest<S3AsyncClient> {
+public class BindNoBucketLoggingToXmlPayloadTest extends BaseS3ClientTest<S3Client> {
public void testApplyInputStream() throws IOException {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/binders/BindS3ObjectMetadataToRequestTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/binders/BindS3ObjectMetadataToRequestTest.java b/apis/s3/src/test/java/org/jclouds/s3/binders/BindS3ObjectMetadataToRequestTest.java
index 6d9a81e..b65c2b9 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/binders/BindS3ObjectMetadataToRequestTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/binders/BindS3ObjectMetadataToRequestTest.java
@@ -25,9 +25,9 @@ import org.jclouds.blobstore.binders.BindMapToHeadersWithPrefix;
import org.jclouds.http.HttpRequest;
import org.jclouds.io.Payload;
import org.jclouds.io.Payloads;
-import org.jclouds.s3.S3AsyncClient;
+import org.jclouds.s3.S3Client;
import org.jclouds.s3.domain.S3Object;
-import org.jclouds.s3.internal.BaseS3AsyncClientTest;
+import org.jclouds.s3.internal.BaseS3ClientTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
@@ -38,7 +38,7 @@ import com.google.common.collect.ImmutableMultimap;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "BindS3ObjectMetadataToRequestTest")
-public class BindS3ObjectMetadataToRequestTest extends BaseS3AsyncClientTest<S3AsyncClient> {
+public class BindS3ObjectMetadataToRequestTest extends BaseS3ClientTest<S3Client> {
@Test
public void testPassWithMinimumDetailsAndPayload5GB() {
[41/52] [abbrv] JCLOUDS-152 remove RestContext and its dependencies.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/config/BindRestContextWithWildcardExtendsExplicitAndRawTypeTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/config/BindRestContextWithWildcardExtendsExplicitAndRawTypeTest.java b/core/src/test/java/org/jclouds/config/BindRestContextWithWildcardExtendsExplicitAndRawTypeTest.java
deleted file mode 100644
index 3ccf54a..0000000
--- a/core/src/test/java/org/jclouds/config/BindRestContextWithWildcardExtendsExplicitAndRawTypeTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.config;
-
-import static com.google.common.base.Suppliers.ofInstance;
-import static org.easymock.EasyMock.createMock;
-import static org.testng.Assert.assertEquals;
-
-import javax.inject.Inject;
-
-import org.jclouds.Context;
-import org.jclouds.domain.Credentials;
-import org.jclouds.http.IntegrationTestAsyncClient;
-import org.jclouds.http.IntegrationTestClient;
-import org.jclouds.providers.AnonymousProviderMetadata;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.providers.config.BindProviderMetadataContextAndCredentials;
-import org.jclouds.rest.RestApiMetadata;
-import org.jclouds.rest.RestContext;
-import org.jclouds.rest.Utils;
-import org.jclouds.rest.internal.BaseRestApiTest.MockModule;
-import org.testng.annotations.Test;
-
-import com.google.common.reflect.TypeToken;
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-@Test(groups = "unit", testName = "BindRestContextWithWildcardExtendsExplicitAndRawTypeTest")
-public class BindRestContextWithWildcardExtendsExplicitAndRawTypeTest {
-
- @SuppressWarnings("rawtypes")
- private static class ExpectedBindings {
-
- private final RestContext raw;
- private final RestContext<IntegrationTestClient, IntegrationTestAsyncClient> explicit;
-
- @Inject
- public ExpectedBindings(RestContext raw,
- RestContext<IntegrationTestClient, IntegrationTestAsyncClient> explicit) {
- this.raw = raw;
- this.explicit = explicit;
- }
-
- }
-
- @Test
- public void testRawAndExplicit() {
- ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
- IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");
-
- ExpectedBindings bindings = injectorFor(md).getInstance(ExpectedBindings.class);
- assertEquals(bindings.raw, bindings.explicit);
- }
-
- private Injector injectorFor(ProviderMetadata md) {
- return Guice.createInjector(
- new BindNameToContext("test"),
- new BindProviderMetadataContextAndCredentials(md, ofInstance(new Credentials("user", "pass"))),
- new BindRestContextWithWildcardExtendsExplicitAndRawType(RestApiMetadata.class.cast(md
- .getApiMetadata())),
-
- // stuff needed for RestContextImpl
- new MockModule(),
- new AbstractModule() {
-
- @Override
- protected void configure() {
- bind(Utils.class).toInstance(createMock(Utils.class));
- bind(IntegrationTestClient.class).toInstance(createMock(IntegrationTestClient.class));
- bind(IntegrationTestAsyncClient.class).toInstance(createMock(IntegrationTestAsyncClient.class));
- }
- });
- }
-
- @SuppressWarnings("rawtypes")
- private static class ExpectedBindingsWithWildCardExtends {
-
- private final RestContext raw;
- private final RestContext<IntegrationTestClient, IntegrationTestAsyncClient> explicit;
- private final RestContext<? extends IntegrationTestClient, ? extends IntegrationTestAsyncClient> wildcardExtends;
-
- @Inject
- public ExpectedBindingsWithWildCardExtends(RestContext raw,
- RestContext<IntegrationTestClient, IntegrationTestAsyncClient> explicit,
- RestContext<? extends IntegrationTestClient, ? extends IntegrationTestAsyncClient> wildcardExtends) {
- this.raw = raw;
- this.explicit = explicit;
- this.wildcardExtends = wildcardExtends;
- }
-
- }
-
- @Test
- public void testRawExplicitAndWildCardExtends() {
- ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
- IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");
-
- TypeToken<? extends Context> wildCardExtendsType = new TypeToken<RestContext<? extends IntegrationTestClient, ? extends IntegrationTestAsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
-
- md = md.toBuilder().apiMetadata(md.getApiMetadata().toBuilder().context(wildCardExtendsType).build()).build();
-
- ExpectedBindingsWithWildCardExtends bindings = injectorFor(md).getInstance(ExpectedBindingsWithWildCardExtends.class);
- assertEquals(bindings.raw, bindings.explicit);
- assertEquals(bindings.explicit, bindings.wildcardExtends);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/http/BaseJettyTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/http/BaseJettyTest.java b/core/src/test/java/org/jclouds/http/BaseJettyTest.java
index ee2b031..2e28cd0 100644
--- a/core/src/test/java/org/jclouds/http/BaseJettyTest.java
+++ b/core/src/test/java/org/jclouds/http/BaseJettyTest.java
@@ -27,6 +27,7 @@ import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterrup
import static javax.servlet.http.HttpServletResponse.SC_OK;
import static org.jclouds.Constants.PROPERTY_RELAX_HOSTNAME;
import static org.jclouds.Constants.PROPERTY_TRUST_ALL_CERTS;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.jclouds.util.Closeables2.closeQuietly;
import static org.jclouds.util.Strings2.toStringAndClose;
@@ -52,7 +53,6 @@ import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.jclouds.ContextBuilder;
import org.jclouds.io.ByteStreams2;
-import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.utils.TestUtils;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@@ -248,9 +248,7 @@ public abstract class BaseJettyTest {
properties.setProperty(PROPERTY_TRUST_ALL_CERTS, "true");
properties.setProperty(PROPERTY_RELAX_HOSTNAME, "true");
return ContextBuilder
- .newBuilder(
- AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(IntegrationTestClient.class,
- IntegrationTestAsyncClient.class, "http://localhost:" + testPort))
+ .newBuilder(forApiOnEndpoint(IntegrationTestClient.class, "http://localhost:" + testPort))
.modules(ImmutableSet.<Module> copyOf(connectionModules)).overrides(properties);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/http/IntegrationTestAsyncClient.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/http/IntegrationTestAsyncClient.java b/core/src/test/java/org/jclouds/http/IntegrationTestAsyncClient.java
deleted file mode 100644
index dff2bca..0000000
--- a/core/src/test/java/org/jclouds/http/IntegrationTestAsyncClient.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.http;
-
-import static com.google.common.util.concurrent.Futures.immediateFuture;
-
-import java.io.Closeable;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Singleton;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.http.options.HttpRequestOptions;
-import org.jclouds.io.Payload;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.rest.binders.BindToJsonPayload;
-import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.util.Strings2;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.inject.Provides;
-
-/**
- * Sample test for the behaviour of our Integration Test jetty server.
- *
- * @see IntegrationTestClient
- */
-public interface IntegrationTestAsyncClient extends Closeable {
- @Target({ ElementType.METHOD })
- @Retention(RetentionPolicy.RUNTIME)
- @HttpMethod("ROWDY")
- public @interface ROWDY {
- }
-
- @ROWDY
- @Path("/objects/{id}")
- ListenableFuture<String> rowdy(@PathParam("id") String path);
-
- @HEAD
- @Path("/objects/{id}")
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> exists(@PathParam("id") String path);
-
- @GET
- @Path("/objects/{id}")
- ListenableFuture<String> download(@PathParam("id") String id);
-
- ListenableFuture<HttpResponse> invoke(HttpRequest request);
-
- @GET
- @Path("/{path}")
- ListenableFuture<String> synch(@PathParam("path") String id);
-
- @GET
- @Path("/objects/{id}")
- @Fallback(FooOnException.class)
- ListenableFuture<String> downloadException(@PathParam("id") String id, HttpRequestOptions options);
-
- static class FooOnException implements org.jclouds.Fallback<String> {
- public ListenableFuture<String> create(Throwable t) throws Exception {
- return immediateFuture("foo");
- }
-
- public String createOrPropagate(Throwable t) throws Exception {
- return "foo";
- }
- }
-
- @GET
- @Path("/objects/{id}")
- @Fallback(FooOnException.class)
- ListenableFuture<String> synchException(@PathParam("id") String id, @HeaderParam("Range") String header);
-
- @PUT
- @Path("/objects/{id}")
- ListenableFuture<String> upload(@PathParam("id") String id, @BinderParam(BindToStringPayload.class) String toPut);
-
- @POST
- @Path("/objects/{id}")
- ListenableFuture<String> post(@PathParam("id") String id, @BinderParam(BindToStringPayload.class) String toPut);
-
- @POST
- @Path("/objects/{id}")
- ListenableFuture<String> postAsInputStream(@PathParam("id") String id,
- @BinderParam(BindToInputStreamPayload.class) String toPut);
-
- static class BindToInputStreamPayload extends BindToStringPayload {
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
- request.setPayload(Strings2.toInputStream(payload.toString()));
- request.getPayload().getContentMetadata().setContentLength((long) payload.toString().getBytes().length);
- return request;
- }
- }
-
- @Singleton
- static class ResponsePayload implements Function<HttpResponse, Multimap<String, String>> {
-
- public Multimap<String, String> apply(HttpResponse from) {
- return from.getHeaders();
- }
-
- }
-
- @POST
- @Path("/objects/{id}")
- @ResponseParser(ResponsePayload.class)
- ListenableFuture<Multimap<String, String>> postPayloadAndReturnHeaders(@PathParam("id") String id, Payload payload);
-
- @POST
- @Path("/objects/{id}")
- @MapBinder(BindToJsonPayload.class)
- ListenableFuture<String> postJson(@PathParam("id") String id, @PayloadParam("key") String toPut);
-
- @GET
- @Path("/objects/{id}")
- @RequestFilters(Filter.class)
- ListenableFuture<String> downloadFilter(@PathParam("id") String id, @HeaderParam("filterme") String header);
-
- static class Filter implements HttpRequestFilter {
- public HttpRequest filter(HttpRequest request) throws HttpException {
- if (request.getHeaders().containsKey("filterme")) {
- request = request.toBuilder().replaceHeader("test", "test").build();
- }
- return request;
- }
- }
-
- @GET
- @Path("/objects/{id}")
- ListenableFuture<String> download(@PathParam("id") String id, @HeaderParam("test") String header);
-
- @GET
- @Path("/objects/{id}")
- @XMLResponseParser(BarHandler.class)
- ListenableFuture<String> downloadAndParse(@PathParam("id") String id);
-
- public static class BarHandler extends ParseSax.HandlerWithResult<String> {
-
- private String bar = null;
- private StringBuilder currentText = new StringBuilder();
-
- @Override
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("bar")) {
- bar = currentText.toString();
- }
- currentText.setLength(0);
- }
-
- @Override
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
-
- }
-
- @Override
- public String getResult() {
- return bar;
- }
-
- }
-
- @POST
- @Path("/objects/{id}")
- ListenableFuture<Void> postNothing(@PathParam("id") String id);
-
- @PUT
- @Path("/objects/{id}")
- ListenableFuture<Void> putNothing(@PathParam("id") String id);
-
- @Provides
- StringBuilder newStringBuilder();
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/http/handlers/BackoffLimitedRetryHandlerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/http/handlers/BackoffLimitedRetryHandlerTest.java b/core/src/test/java/org/jclouds/http/handlers/BackoffLimitedRetryHandlerTest.java
index 56b0f9d..f421016 100644
--- a/core/src/test/java/org/jclouds/http/handlers/BackoffLimitedRetryHandlerTest.java
+++ b/core/src/test/java/org/jclouds/http/handlers/BackoffLimitedRetryHandlerTest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
package org.jclouds.http.handlers;
+
import static org.jclouds.reflect.Reflection2.method;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
@@ -26,7 +27,6 @@ import org.jclouds.ContextBuilder;
import org.jclouds.http.HttpCommand;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
import org.jclouds.io.Payloads;
import org.jclouds.providers.AnonymousProviderMetadata;
@@ -129,7 +129,7 @@ public class BackoffLimitedRetryHandlerTest {
private HttpCommand createCommand() throws SecurityException, NoSuchMethodException {
- Invokable<IntegrationTestAsyncClient, String> method = method(IntegrationTestAsyncClient.class, "download", String.class);
+ Invokable<IntegrationTestClient, String> method = method(IntegrationTestClient.class, "download", String.class);
return new HttpCommand(processor.apply(Invocation.create(method, ImmutableList.<Object> of("1"))));
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/http/handlers/RedirectionRetryHandlerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/http/handlers/RedirectionRetryHandlerTest.java b/core/src/test/java/org/jclouds/http/handlers/RedirectionRetryHandlerTest.java
index eb9686b..e7df0f8 100644
--- a/core/src/test/java/org/jclouds/http/handlers/RedirectionRetryHandlerTest.java
+++ b/core/src/test/java/org/jclouds/http/handlers/RedirectionRetryHandlerTest.java
@@ -22,14 +22,13 @@ import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import org.jclouds.ContextBuilder;
import org.jclouds.http.HttpCommand;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
-import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.rest.internal.BaseRestApiTest.MockModule;
import org.testng.annotations.Test;
@@ -42,10 +41,8 @@ import com.google.inject.Module;
*/
@Test(groups = "unit")
public class RedirectionRetryHandlerTest {
- Injector injector = ContextBuilder.newBuilder(
- AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(IntegrationTestClient.class,
- IntegrationTestAsyncClient.class, "http://localhost")).modules(
- ImmutableSet.<Module> of(new MockModule())).buildInjector();
+ Injector injector = ContextBuilder.newBuilder(forApiOnEndpoint(IntegrationTestClient.class, "http://localhost"))
+ .modules(ImmutableSet.<Module>of(new MockModule())).buildInjector();
@Test
public void test302DoesNotRetry() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/providers/config/BindProviderMetadataContextAndCredentialsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/providers/config/BindProviderMetadataContextAndCredentialsTest.java b/core/src/test/java/org/jclouds/providers/config/BindProviderMetadataContextAndCredentialsTest.java
index 32b7b00..22cc9f8 100644
--- a/core/src/test/java/org/jclouds/providers/config/BindProviderMetadataContextAndCredentialsTest.java
+++ b/core/src/test/java/org/jclouds/providers/config/BindProviderMetadataContextAndCredentialsTest.java
@@ -16,6 +16,7 @@
*/
package org.jclouds.providers.config;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.testng.Assert.assertEquals;
import java.util.Properties;
@@ -28,13 +29,11 @@ import org.jclouds.Context;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
import org.jclouds.internal.FilterStringsBoundToInjectorByName;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.Iso3166;
import org.jclouds.location.Provider;
-import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.annotations.Api;
import org.jclouds.rest.annotations.ApiVersion;
@@ -94,9 +93,8 @@ public class BindProviderMetadataContextAndCredentialsTest {
@Test
public void testExpectedBindingsWhenCredentialIsNotNull() {
+ ProviderMetadata md = forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");
- ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
- IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");
Supplier<Credentials> creds = Suppliers.<Credentials> ofInstance(LoginCredentials.builder().user("user")
.password("password").build());
@@ -108,9 +106,8 @@ public class BindProviderMetadataContextAndCredentialsTest {
@Test
public void testExpectedBindingsWhenCredentialIsNull() {
+ ProviderMetadata md = forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");
- ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
- IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");
Supplier<Credentials> creds = Suppliers.<Credentials> ofInstance(LoginCredentials.builder().user("user").build());
ExpectedBindings bindings = Guice.createInjector(new BindProviderMetadataContextAndCredentials(md, creds))
@@ -121,9 +118,8 @@ public class BindProviderMetadataContextAndCredentialsTest {
@Test
public void testExpectedBindingsWhenBuildVersionAbsent() {
+ ProviderMetadata md = forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");
- ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
- IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");
ApiMetadata apiMd = md.getApiMetadata().toBuilder().buildVersion(null).build();
md = md.toBuilder().apiMetadata(apiMd).build();
Supplier<Credentials> creds = Suppliers.<Credentials> ofInstance(LoginCredentials.builder().user("user").build());
@@ -135,9 +131,8 @@ public class BindProviderMetadataContextAndCredentialsTest {
@Test
public void testProviderOverridesApiMetadataProperty() {
+ ProviderMetadata md = forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");
- ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
- IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");
Properties defaultProps = md.getDefaultProperties();
defaultProps.setProperty(Constants.PROPERTY_SESSION_INTERVAL, Integer.MAX_VALUE + "");
md = md.toBuilder().defaultProperties(defaultProps).build();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/providers/internal/UpdateProviderMetadataFromPropertiesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/providers/internal/UpdateProviderMetadataFromPropertiesTest.java b/core/src/test/java/org/jclouds/providers/internal/UpdateProviderMetadataFromPropertiesTest.java
index d5a4f1a..8c92002 100644
--- a/core/src/test/java/org/jclouds/providers/internal/UpdateProviderMetadataFromPropertiesTest.java
+++ b/core/src/test/java/org/jclouds/providers/internal/UpdateProviderMetadataFromPropertiesTest.java
@@ -17,14 +17,13 @@
package org.jclouds.providers.internal;
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.testng.Assert.assertEquals;
import java.util.Properties;
import org.jclouds.Constants;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
-import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
import org.testng.annotations.Test;
@@ -35,8 +34,7 @@ public class UpdateProviderMetadataFromPropertiesTest {
@Test
public void testProviderMetadataWithUpdatedEndpointUpdatesAndRetainsAllDefaultPropertiesExceptEndpoint() {
- ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
- IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");
+ ProviderMetadata md = forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");
Properties props = new Properties();
props.putAll(md.getDefaultProperties());
@@ -50,8 +48,7 @@ public class UpdateProviderMetadataFromPropertiesTest {
@Test
public void testProviderMetadataWithUpdatedIso3166CodesUpdatesAndRetainsAllDefaultPropertiesExceptIso3166Codes() {
- ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
- IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");
+ ProviderMetadata md = forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");
Properties props = new Properties();
props.putAll(md.getDefaultProperties());
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/rest/InputParamValidatorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/InputParamValidatorTest.java b/core/src/test/java/org/jclouds/rest/InputParamValidatorTest.java
index 3723035..61f2c5f 100644
--- a/core/src/test/java/org/jclouds/rest/InputParamValidatorTest.java
+++ b/core/src/test/java/org/jclouds/rest/InputParamValidatorTest.java
@@ -16,6 +16,7 @@
*/
package org.jclouds.rest;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.jclouds.reflect.Reflection2.method;
import javax.ws.rs.POST;
@@ -23,10 +24,8 @@ import javax.ws.rs.PathParam;
import org.jclouds.ContextBuilder;
import org.jclouds.http.HttpRequest;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
import org.jclouds.predicates.validators.AllLowerCaseValidator;
-import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.reflect.Invocation;
import org.jclouds.rest.annotations.ParamValidators;
import org.jclouds.rest.internal.RestAnnotationProcessor;
@@ -109,10 +108,8 @@ public class InputParamValidatorTest {
@BeforeClass
void setupFactory() {
- injector = ContextBuilder
- .newBuilder(
- AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(IntegrationTestClient.class, IntegrationTestAsyncClient.class,
- "http://localhost:9999")).buildInjector();
+ injector = ContextBuilder.newBuilder(forApiOnEndpoint(IntegrationTestClient.class, "http://localhost:9999"))
+ .buildInjector();
restAnnotationProcessor = injector.getInstance(RestAnnotationProcessor.class);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/rest/annotationparsing/ClosableApiTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/annotationparsing/ClosableApiTest.java b/core/src/test/java/org/jclouds/rest/annotationparsing/ClosableApiTest.java
index 7e10c8e..ea6b5cd 100644
--- a/core/src/test/java/org/jclouds/rest/annotationparsing/ClosableApiTest.java
+++ b/core/src/test/java/org/jclouds/rest/annotationparsing/ClosableApiTest.java
@@ -20,13 +20,13 @@ import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
-import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint;
import java.io.Closeable;
import java.io.IOException;
import org.jclouds.ContextBuilder;
import org.jclouds.concurrent.config.ExecutorServiceModule;
+import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
import org.testng.annotations.Test;
@@ -45,11 +45,7 @@ public class ClosableApiTest {
interface DelegatingApi extends Closeable {
}
- interface DelegatingAsyncApi extends Closeable {
- }
-
- ProviderMetadata provider = forClientMappedToAsyncClientOnEndpoint(DelegatingApi.class, DelegatingAsyncApi.class,
- "http://mock");
+ ProviderMetadata provider = AnonymousProviderMetadata.forApiOnEndpoint(DelegatingApi.class, "http://mock");
public void testApiClosesExecutorServiceOnClose() throws IOException {
ListeningExecutorService executor = createMock(ListeningExecutorService.class);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/rest/annotationparsing/DelegateAnnotationExpectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/annotationparsing/DelegateAnnotationExpectTest.java b/core/src/test/java/org/jclouds/rest/annotationparsing/DelegateAnnotationExpectTest.java
index 22061c5..03dacec 100644
--- a/core/src/test/java/org/jclouds/rest/annotationparsing/DelegateAnnotationExpectTest.java
+++ b/core/src/test/java/org/jclouds/rest/annotationparsing/DelegateAnnotationExpectTest.java
@@ -16,7 +16,7 @@
*/
package org.jclouds.rest.annotationparsing;
-import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.testng.Assert.assertTrue;
import javax.ws.rs.FormParam;
@@ -29,17 +29,15 @@ import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.config.RestClientModule;
+import org.jclouds.rest.config.HttpApiModule;
import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.testng.annotations.Test;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.Module;
/**
@@ -57,35 +55,18 @@ public class DelegateAnnotationExpectTest extends BaseRestApiExpectTest<Delegate
DiskApi getDiskApiForProject(@PayloadParam("project") @PathParam("project") String projectName);
}
- interface DelegatingAsyncApi {
- @Delegate
- DiskAsyncApi getDiskApiForProjectForm(@FormParam("project") String projectName);
-
- @Delegate
- @Path("/projects/{project}")
- DiskAsyncApi getDiskApiForProject(@PayloadParam("project") @PathParam("project") String projectName);
- }
-
interface DiskApi {
- void form();
-
- void syncAll();
-
- boolean exists(@PathParam("disk") String diskName);
- }
-
- interface DiskAsyncApi {
@POST
- ListenableFuture<Void> form();
+ void form();
@POST
@Payload("<Sync>{project}</Sync>")
- ListenableFuture<Void> syncAll();
-
+ void syncAll();
+
@HEAD
@Path("/disks/{disk}")
@Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> exists(@PathParam("disk") String diskName);
+ boolean exists(@PathParam("disk") String diskName);
}
public void testDelegatingCallTakesIntoConsiderationAndCalleeFormParam() {
@@ -121,22 +102,16 @@ public class DelegateAnnotationExpectTest extends BaseRestApiExpectTest<Delegate
@Override
public ProviderMetadata createProviderMetadata() {
- return forClientMappedToAsyncClientOnEndpoint(DelegatingApi.class, DelegatingAsyncApi.class, "http://mock");
+ return forApiOnEndpoint(DelegatingApi.class, "http://mock");
}
@Override
protected Module createModule() {
- return new DelegatingRestClientModule();
+ return new DelegatingHttpApiModule();
}
- @ConfiguresRestClient
- static class DelegatingRestClientModule extends RestClientModule<DelegatingApi, DelegatingAsyncApi> {
-
- public DelegatingRestClientModule() {
- // right now, we have to define the delegates by hand as opposed to
- // reflection looking for coordinated annotations
- super(ImmutableMap.<Class<?>, Class<?>> of(DiskApi.class, DiskAsyncApi.class));
- }
+ @ConfiguresHttpApi
+ static class DelegatingHttpApiModule extends HttpApiModule<DelegatingApi> {
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java b/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java
index 337490a..20446bf 100644
--- a/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java
+++ b/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java
@@ -16,7 +16,7 @@
*/
package org.jclouds.rest.annotationparsing;
-import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
@@ -38,7 +38,6 @@ import org.testng.annotations.Test;
import com.google.common.base.Function;
import com.google.common.base.Functions;
-import com.google.common.util.concurrent.ListenableFuture;
/**
* Tests the use of the {@link JAXBResponseParser} annotation.
@@ -67,36 +66,26 @@ public class JAXBResponseParserAnnotationExpectTest extends
}
public interface TestJAXBApi extends Closeable {
- TestJAXBDomain jaxbGetWithAnnotation();
-
- Object jaxbGetWithAnnotationAndCustomClass();
-
- TestJAXBDomain jaxbGetWithAcceptHeader();
-
- String jaxbGetWithTransformer();
- }
-
- public interface TestJAXBAsyncApi extends Closeable {
@GET
@Path("/jaxb/annotation")
@JAXBResponseParser
- ListenableFuture<TestJAXBDomain> jaxbGetWithAnnotation();
+ TestJAXBDomain jaxbGetWithAnnotation();
@GET
@Path("/jaxb/custom")
@JAXBResponseParser(TestJAXBDomain.class)
- ListenableFuture<Object> jaxbGetWithAnnotationAndCustomClass();
+ Object jaxbGetWithAnnotationAndCustomClass();
@GET
@Path("/jaxb/header")
@Consumes(MediaType.APPLICATION_XML)
- ListenableFuture<TestJAXBDomain> jaxbGetWithAcceptHeader();
+ TestJAXBDomain jaxbGetWithAcceptHeader();
@GET
@Path("/jaxb/transformer")
@JAXBResponseParser(TestJAXBDomain.class)
@Transform(ToString.class)
- ListenableFuture<String> jaxbGetWithTransformer();
+ String jaxbGetWithTransformer();
}
private static class ToString implements Function<Object, String> {
@@ -150,7 +139,6 @@ public class JAXBResponseParserAnnotationExpectTest extends
@Override
public ProviderMetadata createProviderMetadata() {
- return forClientMappedToAsyncClientOnEndpoint(TestJAXBApi.class, TestJAXBAsyncApi.class, "http://mock");
+ return forApiOnEndpoint(TestJAXBApi.class, "http://mock");
}
-
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java b/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java
index 19260d8..11f190e 100644
--- a/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java
+++ b/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java
@@ -16,7 +16,6 @@
*/
package org.jclouds.rest.annotationparsing;
-import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint;
import static org.testng.Assert.assertEquals;
import java.io.Closeable;
@@ -27,10 +26,11 @@ import javax.inject.Named;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
+import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.config.HttpApiModule;
import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.testng.annotations.Test;
@@ -64,23 +64,6 @@ public class ProvidesAnnotationExpectTest extends BaseRestApiExpectTest<Provides
Set<String> noSuchElementException();
}
- interface ProvidingAsyncApi extends Closeable {
- @Provides
- Set<String> set();
-
- @Named("bar")
- @Provides
- Set<String> foo();
-
- @Named("exception")
- @Provides
- Set<String> exception();
-
- @Named("NoSuchElementException")
- @Provides
- Set<String> noSuchElementException();
- }
-
@Test
public void testProvidesWithGeneric() {
ProvidingApi client = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> of());
@@ -110,16 +93,16 @@ public class ProvidesAnnotationExpectTest extends BaseRestApiExpectTest<Provides
@Override
public ProviderMetadata createProviderMetadata() {
- return forClientMappedToAsyncClientOnEndpoint(ProvidingApi.class, ProvidingAsyncApi.class, "http://mock");
+ return AnonymousProviderMetadata.forApiOnEndpoint(ProvidingApi.class, "http://mock");
}
@Override
protected Module createModule() {
- return new ProvidingRestClientModule();
+ return new ProvidingHttpApiModule();
}
- @ConfiguresRestClient
- static class ProvidingRestClientModule extends RestClientModule<ProvidingApi, ProvidingAsyncApi> {
+ @ConfiguresHttpApi
+ static class ProvidingHttpApiModule extends HttpApiModule<ProvidingApi> {
@Override
protected void configure() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/rest/config/MappedHttpInvocationModuleTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/config/MappedHttpInvocationModuleTest.java b/core/src/test/java/org/jclouds/rest/config/MappedHttpInvocationModuleTest.java
deleted file mode 100644
index bff7f30..0000000
--- a/core/src/test/java/org/jclouds/rest/config/MappedHttpInvocationModuleTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.config;
-
-import static com.google.common.base.Predicates.not;
-import static com.google.common.collect.Maps.filterEntries;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.jclouds.rest.HttpAsyncClient;
-import org.jclouds.rest.HttpClient;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.reflect.Invokable;
-import com.google.common.reflect.TypeToken;
-import com.google.common.util.concurrent.ListenableFuture;
-
-@Test(groups = "unit")
-public class MappedHttpInvocationModuleTest {
- interface Sync {
- String get();
- }
-
- private interface Async {
- ListenableFuture<String> get();
- }
-
- public void testPutInvokablesWhenInterfacesMatch() {
- Cache<Invokable<?, ?>, Invokable<?, ?>> cache = CacheBuilder.newBuilder().build();
- SyncToAsyncHttpInvocationModule.putInvokables(Sync.class, Async.class, cache);
-
- assertEquals(cache.size(), 1);
-
- Invokable<?, ?> sync = cache.asMap().keySet().iterator().next();
- assertEquals(sync.getOwnerType().getRawType(), Sync.class);
- assertEquals(sync.getName(), "get");
- assertEquals(sync.getReturnType(), TypeToken.of(String.class));
-
- Invokable<?, ?> async = cache.getIfPresent(sync);
- assertEquals(async.getOwnerType().getRawType(), Async.class);
- assertEquals(async.getName(), "get");
- assertEquals(async.getReturnType(), new TypeToken<ListenableFuture<String>>() {
- private static final long serialVersionUID = 1L;
- });
- }
-
- private interface AsyncWithException {
- ListenableFuture<String> get() throws IOException;
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".* has different typed exceptions than target .*")
- public void testPutInvokablesWhenInterfacesMatchExceptExceptions() {
- Cache<Invokable<?, ?>, Invokable<?, ?>> cache = CacheBuilder.newBuilder().build();
- SyncToAsyncHttpInvocationModule.putInvokables(Sync.class, AsyncWithException.class, cache);
- }
-
- private interface AsyncWithMisnamedMethod {
- ListenableFuture<String> got();
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "no such method .*")
- public void testPutInvokablesWhenTargetMethodNotFound() {
- Cache<Invokable<?, ?>, Invokable<?, ?>> cache = CacheBuilder.newBuilder().build();
- SyncToAsyncHttpInvocationModule.putInvokables(Sync.class, AsyncWithMisnamedMethod.class, cache);
- }
-
- static final Predicate<Entry<Invokable<?, ?>, Invokable<?, ?>>> isHttpInvokable = new Predicate<Map.Entry<Invokable<?, ?>, Invokable<?, ?>>>() {
- public boolean apply(Map.Entry<Invokable<?, ?>, Invokable<?, ?>> in) {
- return in.getKey().getOwnerType().getRawType().equals(HttpClient.class)
- && in.getValue().getOwnerType().getRawType().equals(HttpAsyncClient.class);
- }
- };
-
- public void testSeedKnownSync2AsyncIncludesHttpClientByDefault() {
- Map<Invokable<?, ?>, Invokable<?, ?>> cache = SyncToAsyncHttpInvocationModule.seedKnownSync2AsyncInvokables(
- ImmutableMap.<Class<?>, Class<?>> of()).asMap();
-
- assertEquals(cache.size(), 6);
- assertEquals(filterEntries(cache, isHttpInvokable), cache);
- }
-
- public void testSeedKnownSync2AsyncInvokablesInterfacesMatch() {
- Map<Invokable<?, ?>, Invokable<?, ?>> cache = SyncToAsyncHttpInvocationModule.seedKnownSync2AsyncInvokables(
- ImmutableMap.<Class<?>, Class<?>> of(Sync.class, Async.class)).asMap();
-
- assertEquals(cache.size(), 7);
-
- cache = filterEntries(cache, not(isHttpInvokable));
-
- assertEquals(cache.size(), 1);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/rest/internal/BaseAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/BaseAsyncClientTest.java b/core/src/test/java/org/jclouds/rest/internal/BaseAsyncClientTest.java
deleted file mode 100644
index 26c4de5..0000000
--- a/core/src/test/java/org/jclouds/rest/internal/BaseAsyncClientTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.internal;
-
-import org.testng.annotations.Test;
-
-@Test(groups = "unit")
-// TODO: remove once abiquo no longer uses this.
-public abstract class BaseAsyncClientTest<T> extends BaseRestAnnotationProcessingTest<T> {
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/rest/internal/BaseRestApiExpectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/BaseRestApiExpectTest.java b/core/src/test/java/org/jclouds/rest/internal/BaseRestApiExpectTest.java
index 0a1f5c2..34a461e 100644
--- a/core/src/test/java/org/jclouds/rest/internal/BaseRestApiExpectTest.java
+++ b/core/src/test/java/org/jclouds/rest/internal/BaseRestApiExpectTest.java
@@ -557,8 +557,6 @@ public abstract class BaseRestApiExpectTest<S> {
ApiMetadata am = builder.getApiMetadata();
if (am instanceof HttpApiMetadata) {
this.api = HttpApiMetadata.class.cast(am).getApi();
- } else if (am instanceof org.jclouds.rest.RestApiMetadata) {
- this.api = org.jclouds.rest.RestApiMetadata.class.cast(am).getApi();
} else {
throw new UnsupportedOperationException("unsupported base type: " + am);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/rest/internal/BaseRestApiMetadataTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/BaseRestApiMetadataTest.java b/core/src/test/java/org/jclouds/rest/internal/BaseRestApiMetadataTest.java
deleted file mode 100644
index 20f4d75..0000000
--- a/core/src/test/java/org/jclouds/rest/internal/BaseRestApiMetadataTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.internal;
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import java.util.Set;
-
-import org.jclouds.View;
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.apis.Apis;
-import org.jclouds.apis.internal.BaseApiMetadataTest;
-import org.jclouds.rest.RestApiMetadata;
-import org.jclouds.rest.RestContext;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
-
-@Test(groups = "unit")
-public abstract class BaseRestApiMetadataTest extends BaseApiMetadataTest {
-
- public BaseRestApiMetadataTest(RestApiMetadata toTest, Set<TypeToken<? extends View>> views) {
- super(toTest, views);
- }
-
- @Test
- public void testContextAssignableFromRestContext() {
- Set<ApiMetadata> all = ImmutableSet.copyOf(Apis.contextAssignableFrom(typeToken(RestContext.class)));
- assert all.contains(toTest) : String.format("%s not found in %s", toTest, all);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/rest/internal/InvokeMappedHttpMethodTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/InvokeMappedHttpMethodTest.java b/core/src/test/java/org/jclouds/rest/internal/InvokeMappedHttpMethodTest.java
deleted file mode 100644
index 6b51810..0000000
--- a/core/src/test/java/org/jclouds/rest/internal/InvokeMappedHttpMethodTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.internal;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.jclouds.reflect.Reflection2.method;
-import static org.testng.Assert.assertEquals;
-
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Named;
-
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpCommandExecutorService;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.reflect.Invocation;
-import org.jclouds.rest.config.InvocationConfig;
-import org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.InvokeAndTransform;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-import com.google.common.util.concurrent.TimeLimiter;
-
-@Test(groups = "unit", singleThreaded = true)
-public class InvokeMappedHttpMethodTest {
-
- public interface ThingApi {
- HttpResponse get();
- }
-
- public interface ThingAsyncApi {
- @Named("ns:get")
- ListenableFuture<HttpResponse> get();
- }
-
- private Invocation get;
- private Invocation asyncGet;
- private Function<Invocation, Invocation> sync2async;
- private HttpRequest getRequest = HttpRequest.builder().method("GET").endpoint("http://get").build();
- private HttpCommand getCommand = new HttpCommand(getRequest);
- private Function<Invocation, HttpRequest> toRequest;
-
- @BeforeClass
- void setupInvocations() throws SecurityException, NoSuchMethodException {
- get = Invocation.create(method(ThingApi.class, "get"), ImmutableList.of());
- asyncGet = Invocation.create(method(ThingAsyncApi.class, "get"), ImmutableList.of());
- sync2async = Functions.forMap(ImmutableMap.of(get, asyncGet));
- toRequest = Functions.forMap(ImmutableMap.of(asyncGet, getRequest));
- }
-
- @SuppressWarnings("unchecked")
- private Function<HttpRequest, Function<HttpResponse, ?>> transformerForRequest = Function.class.cast(Functions
- .constant(Functions.identity()));
- private ListeningExecutorService userThreads = MoreExecutors.newDirectExecutorService();
-
- private HttpResponse response = HttpResponse.builder().statusCode(200).payload("foo").build();
- private HttpCommandExecutorService http;
- private TimeLimiter timeLimiter;
- @SuppressWarnings("rawtypes")
- private org.jclouds.Fallback fallback;
- private InvocationConfig config;
- private InvokeSyncToAsyncHttpMethod invokeHttpMethod;
-
- private ListenableFuture<HttpResponse> future;
-
- @SuppressWarnings("unchecked")
- @BeforeMethod
- void createMocks() {
- http = createMock(HttpCommandExecutorService.class);
- timeLimiter = createMock(TimeLimiter.class);
- fallback = createMock(org.jclouds.Fallback.class);
- config = createMock(InvocationConfig.class);
- future = createMock(ListenableFuture.class);
- invokeHttpMethod = new InvokeSyncToAsyncHttpMethod(sync2async, toRequest, http, transformerForRequest, timeLimiter, config,
- userThreads);
- expect(config.getCommandName(asyncGet)).andReturn("ns:get");
- expect(config.getFallback(asyncGet)).andReturn(fallback);
- }
-
- @AfterMethod
- void verifyMocks() {
- verify(http, timeLimiter, fallback, config, future);
- }
-
- public void testMethodWithTimeoutRunsTimeLimiter() throws Exception {
- expect(config.getTimeoutNanos(asyncGet)).andReturn(Optional.of(250000000l));
- InvokeAndTransform invoke = invokeHttpMethod.new InvokeAndTransform("ns:get", getCommand);
- expect(timeLimiter.callWithTimeout(invoke, 250000000, TimeUnit.NANOSECONDS, true)).andReturn(response);
- replay(http, timeLimiter, fallback, config, future);
- invokeHttpMethod.apply(get);
- }
-
- public void testMethodWithNoTimeoutCallGetDirectly() throws Exception {
- expect(config.getTimeoutNanos(asyncGet)).andReturn(Optional.<Long> absent());
- expect(http.invoke(new HttpCommand(getRequest))).andReturn(response);
- replay(http, timeLimiter, fallback, config, future);
- invokeHttpMethod.apply(get);
- }
-
- public void testAsyncMethodSubmitsRequest() throws Exception {
- expect(http.submit(new HttpCommand(getRequest))).andReturn(future);
- future.addListener(anyObject(Runnable.class), eq(MoreExecutors.directExecutor()));
- replay(http, timeLimiter, fallback, config, future);
- invokeHttpMethod.apply(asyncGet);
- }
-
- private HttpResponse fallbackResponse = HttpResponse.builder().statusCode(200).payload("bar").build();
-
- public void testDirectCallRunsFallbackCreateOrPropagate() throws Exception {
- IllegalStateException exception = new IllegalStateException();
- expect(config.getTimeoutNanos(asyncGet)).andReturn(Optional.<Long> absent());
- expect(http.invoke(new HttpCommand(getRequest))).andThrow(exception);
- expect(fallback.createOrPropagate(exception)).andReturn(fallbackResponse);
- replay(http, timeLimiter, fallback, config, future);
- assertEquals(invokeHttpMethod.apply(get), fallbackResponse);
- }
-
- public void testTimeLimitedRunsFallbackCreateOrPropagate() throws Exception {
- IllegalStateException exception = new IllegalStateException();
- expect(config.getTimeoutNanos(asyncGet)).andReturn(Optional.of(250000000l));
- InvokeAndTransform invoke = invokeHttpMethod.new InvokeAndTransform("ns:get", getCommand);
- expect(timeLimiter.callWithTimeout(invoke, 250000000, TimeUnit.NANOSECONDS, true)).andThrow(exception);
- expect(fallback.createOrPropagate(exception)).andReturn(fallbackResponse);
- replay(http, timeLimiter, fallback, config, future);
- assertEquals(invokeHttpMethod.apply(get), fallbackResponse);
- }
-
- @SuppressWarnings("unchecked")
- public void testSubmitRunsFallbackCreateOnGet() throws Exception {
- IllegalStateException exception = new IllegalStateException();
- expect(http.submit(new HttpCommand(getRequest))).andReturn(
- Futures.<HttpResponse> immediateFailedFuture(exception));
- expect(fallback.create(exception)).andReturn(Futures.<HttpResponse> immediateFuture(fallbackResponse));
- // not using the field, as you can see above we are making an immediate
- // failed future instead.
- future = createMock(ListenableFuture.class);
- replay(http, timeLimiter, fallback, config, future);
- assertEquals(ListenableFuture.class.cast(invokeHttpMethod.apply(asyncGet)).get(), fallbackResponse);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
index 9f6d413..a16eb91 100644
--- a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
+++ b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
@@ -18,8 +18,11 @@ package org.jclouds.rest.internal;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.base.Preconditions.checkNotNull;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static javax.ws.rs.core.MediaType.APPLICATION_XML;
import static org.jclouds.io.Payloads.newInputStreamPayload;
import static org.jclouds.io.Payloads.newStringPayload;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.jclouds.reflect.Reflection2.method;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
@@ -38,6 +41,7 @@ import java.lang.annotation.Target;
import java.net.URI;
import java.net.URLEncoder;
import java.security.NoSuchAlgorithmException;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
@@ -45,6 +49,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ExecutionException;
+
import javax.inject.Named;
import javax.inject.Qualifier;
import javax.inject.Singleton;
@@ -90,10 +95,8 @@ import org.jclouds.io.PayloadEnclosing;
import org.jclouds.io.Payloads;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.logging.config.NullLoggingModule;
-import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.reflect.Invocation;
-import org.jclouds.reflect.InvocationSuccess;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.InvocationContext;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
@@ -119,8 +122,7 @@ import org.jclouds.rest.annotations.WrapWith;
import org.jclouds.rest.binders.BindAsHostPrefix;
import org.jclouds.rest.binders.BindToJsonPayload;
import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.rest.config.RestClientModule;
-import org.jclouds.rest.functions.ImplicitOptionalConverter;
+import org.jclouds.rest.config.HttpApiModule;
import org.jclouds.util.Strings2;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
@@ -144,7 +146,6 @@ import com.google.common.io.ByteSource;
import com.google.common.io.Files;
import com.google.common.net.HttpHeaders;
import com.google.common.reflect.Invokable;
-import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.AbstractModule;
import com.google.inject.ConfigurationException;
@@ -152,19 +153,12 @@ import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
-/**
- * Tests behavior of {@code RestAnnotationProcessor}
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during
-// surefire
+
@Test(groups = "unit", testName = "RestAnnotationProcessorTest")
public class RestAnnotationProcessorTest extends BaseRestApiTest {
- @ConfiguresRestClient
- protected static class CallerModule extends RestClientModule<Caller, AsyncCaller> {
- CallerModule() {
- super(ImmutableMap.<Class<?>, Class<?>> of(Callee.class, AsyncCallee.class, Callee2.class, AsyncCallee2.class));
- }
+ @ConfiguresHttpApi
+ protected static class CallerModule extends HttpApiModule<Caller> {
@Override
protected void configure() {
@@ -176,39 +170,37 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
}
@Path("/client/{jclouds.api-version}")
- public interface AsyncCallee extends Closeable {
+ public interface Callee extends Closeable {
@GET
@Path("/{path}")
- ListenableFuture<Void> onePath(@PathParam("path") String path);
+ void onePath(@PathParam("path") String path);
@POST
- ListenableFuture<Void> testWithoutProducesAndConsumes();
+ void testWithoutProducesAndConsumes();
@POST
- @Produces(MediaType.APPLICATION_XML)
- @Consumes(MediaType.APPLICATION_XML)
- ListenableFuture<Void> testProducesAndConsumesOnMethod();
+ @Produces(APPLICATION_XML)
+ @Consumes(APPLICATION_XML)
+ void testProducesAndConsumesOnMethod();
}
@Path("/client/{jclouds.api-version}")
- @Produces(MediaType.APPLICATION_XML)
- @Consumes(MediaType.APPLICATION_XML)
- public interface AsyncCalleeWithProducesAndConsumesOnClass extends Closeable {
+ @Produces(APPLICATION_XML)
+ @Consumes(APPLICATION_XML)
+ public interface CalleeWithProducesAndConsumesOnClass extends Closeable {
@POST
- ListenableFuture<Void> testProducesAndConsumesOnClass();
+ void testProducesAndConsumesOnClass();
}
@Path("/client/{jclouds.api-version}")
- public interface AsyncCallee2 {
+ public interface Callee2 {
@GET
@Path("/{path}/2")
- ListenableFuture<Void> onePath(@PathParam("path") String path);
+ void onePath(@PathParam("path") String path);
}
@Endpoint(Localhost2.class)
public interface Caller extends Closeable {
-
- // tests that we can pull from suppliers
@Provides
@Localhost2
URI getURI();
@@ -233,98 +225,21 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
Callee getCalleeWithHeader(@EndpointParam URI endpoint, @HeaderParam("header") String header);
@Delegate
+ @Produces(APPLICATION_JSON)
+ @Consumes(APPLICATION_JSON)
Callee getCalleeWithoutProducesAndConsumes();
@Delegate
+ @Produces(APPLICATION_JSON)
+ @Consumes(APPLICATION_JSON)
Callee getCalleeWithProducesAndConsumesOnMethod();
@Delegate
+ @Produces(APPLICATION_JSON)
+ @Consumes(APPLICATION_JSON)
CalleeWithProducesAndConsumesOnClass getCalleeWithProducesAndConsumesOnClass();
}
- public interface Callee extends Closeable {
- void onePath(String path);
- void testWithoutProducesAndConsumes();
- void testProducesAndConsumesOnMethod();
- }
-
- public interface CalleeWithProducesAndConsumesOnClass extends Closeable {
- void testProducesAndConsumesOnClass();
- }
-
- public interface Callee2 {
- void onePath(String path);
- }
-
- public interface AsyncCaller extends Closeable {
- @Provides
- @Localhost2
- URI getURI();
-
- @Delegate
- AsyncCallee getCallee();
-
- @Delegate
- AsyncCallee2 getCallee2();
-
- @Delegate
- AsyncCallee getCallee(@EndpointParam URI endpoint);
-
- @Delegate
- Optional<AsyncCallee> getOptionalCallee(@EndpointParam URI endpoint);
-
- @Delegate
- @Path("/testing/testing/{wibble}")
- AsyncCallee getCalleeWithPath(@EndpointParam URI endpoint, @PathParam("wibble") String wibble);
-
- @Delegate
- AsyncCallee getCalleeWithHeader(@EndpointParam URI endpoint, @HeaderParam("header") String header);
-
- @Delegate
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- AsyncCallee getCalleeWithoutProducesAndConsumes();
-
- @Delegate
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- AsyncCallee getCalleeWithProducesAndConsumesOnMethod();
-
- @Delegate
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- AsyncCalleeWithProducesAndConsumesOnClass getCalleeWithProducesAndConsumesOnClass();
- }
-
- public void testAsyncDelegateIsLazyLoadedAndRequestIncludesVersionAndPath() throws InterruptedException,
- ExecutionException {
- Injector child = injectorForCaller(new HttpCommandExecutorService() {
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- return Futures.immediateFuture(invoke(command));
- }
-
- @Override
- public HttpResponse invoke(HttpCommand command) {
- assertEquals(command.getCurrentRequest().getRequestLine(),
- "GET http://localhost:9999/client/1/foo HTTP/1.1");
- return HttpResponse.builder().build();
- }
-
- });
-
- try {
- child.getInstance(AsyncCallee.class);
- fail("Callee shouldn't be bound yet");
- } catch (ConfigurationException e) {
-
- }
-
- child.getInstance(AsyncCaller.class).getCallee().onePath("foo").get();
-
- }
-
public void testDelegateIsLazyLoadedAndRequestIncludesVersionAndPath() throws InterruptedException,
ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
@@ -332,7 +247,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@Override
public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- return Futures.immediateFuture(invoke(command));
+ throw new AssertionError();
}
@Override
@@ -361,43 +276,13 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
child.getInstance(Caller.class).getCallee().onePath("foo");
}
- public void testAsyncDelegateIsLazyLoadedAndRequestIncludesEndpointVersionAndPath() throws InterruptedException,
- ExecutionException {
- Injector child = injectorForCaller(new HttpCommandExecutorService() {
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- return Futures.immediateFuture(invoke(command));
- }
-
- @Override
- public HttpResponse invoke(HttpCommand command) {
- assertEquals(command.getCurrentRequest().getRequestLine(), "GET http://howdyboys/client/1/foo HTTP/1.1");
- return HttpResponse.builder().build();
- }
-
- });
-
- try {
- child.getInstance(AsyncCallee.class);
- fail("Callee shouldn't be bound yet");
- } catch (ConfigurationException e) {
-
- }
-
- child.getInstance(AsyncCaller.class).getCallee(URI.create("http://howdyboys")).onePath("foo").get();
-
- assertEquals(child.getInstance(AsyncCaller.class).getURI(), URI.create("http://localhost:1111"));
-
- }
-
- public void testAsyncDelegateWithPathParamIsLazyLoadedAndRequestIncludesEndpointVersionAndPath()
+ public void testDelegateWithPathParamIsLazyLoadedAndRequestIncludesEndpointVersionAndPath()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
@Override
public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- return Futures.immediateFuture(invoke(command));
+ throw new AssertionError("jclouds no longer uses the submit method");
}
@Override
@@ -410,25 +295,25 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
});
try {
- child.getInstance(AsyncCallee.class);
+ child.getInstance(Callee.class);
fail("Callee shouldn't be bound yet");
} catch (ConfigurationException e) {
}
- child.getInstance(AsyncCaller.class).getCalleeWithPath(URI.create("http://howdyboys"), "thepathparam")
- .onePath("foo").get();
+ child.getInstance(Caller.class).getCalleeWithPath(URI.create("http://howdyboys"), "thepathparam")
+ .onePath("foo");
- assertEquals(child.getInstance(AsyncCaller.class).getURI(), URI.create("http://localhost:1111"));
+ assertEquals(child.getInstance(Caller.class).getURI(), URI.create("http://localhost:1111"));
}
- public void testAsyncDelegateWithHeaderParamIsLazyLoadedAndRequestIncludesEndpointVersionAndHeader()
+ public void testDelegateWithHeaderParamIsLazyLoadedAndRequestIncludesEndpointVersionAndHeader()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
@Override
public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- return Futures.immediateFuture(invoke(command));
+ throw new AssertionError("jclouds no longer uses the submit method");
}
@Override
@@ -440,146 +325,113 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
});
try {
- child.getInstance(AsyncCallee.class);
+ child.getInstance(Callee.class);
fail("Callee shouldn't be bound yet");
} catch (ConfigurationException e) {
}
- child.getInstance(AsyncCaller.class).getCalleeWithHeader(URI.create("http://howdyboys"), "theheaderparam")
- .onePath("foo").get();
+ child.getInstance(Caller.class).getCalleeWithHeader(URI.create("http://howdyboys"), "theheaderparam")
+ .onePath("foo");
}
- public void testAsyncDelegateWithoutProducesAndConsumes()
+ public void testDelegateWithoutProducesAndConsumes()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
@Override
public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- return Futures.immediateFuture(invoke(command));
+ throw new AssertionError("jclouds no longer uses the submit method");
}
@Override
public HttpResponse invoke(HttpCommand command) {
assertEquals(
command.getCurrentRequest().getPayload().getContentMetadata().getContentType(),
- MediaType.APPLICATION_JSON);
- assertTrue(command.getCurrentRequest().getHeaders().get("Accept").contains(MediaType.APPLICATION_JSON));
+ APPLICATION_JSON);
+ assertTrue(command.getCurrentRequest().getHeaders().get("Accept").contains(APPLICATION_JSON));
return HttpResponse.builder().build();
}
});
try {
- child.getInstance(AsyncCallee.class);
+ child.getInstance(Callee.class);
fail("Callee shouldn't be bound yet");
} catch (ConfigurationException e) {
}
- child.getInstance(AsyncCaller.class).getCalleeWithoutProducesAndConsumes()
- .testWithoutProducesAndConsumes().get();
+ child.getInstance(Caller.class).getCalleeWithoutProducesAndConsumes().testWithoutProducesAndConsumes();
}
- public void testAsyncDelegateWithProducesAndConsumesOnMethodIsLazyLoaded()
+ public void testDelegateWithProducesAndConsumesOnMethodIsLazyLoaded()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
@Override
public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- return Futures.immediateFuture(invoke(command));
+ throw new AssertionError("jclouds no longer uses the submit method");
}
@Override
public HttpResponse invoke(HttpCommand command) {
assertEquals(
command.getCurrentRequest().getPayload().getContentMetadata().getContentType(),
- MediaType.APPLICATION_XML);
- assertTrue(command.getCurrentRequest().getHeaders().get("Accept").contains(MediaType.APPLICATION_XML));
+ APPLICATION_XML);
+ assertTrue(command.getCurrentRequest().getHeaders().get("Accept").contains(APPLICATION_XML));
return HttpResponse.builder().build();
}
});
try {
- child.getInstance(AsyncCallee.class);
+ child.getInstance(Callee.class);
fail("Callee shouldn't be bound yet");
} catch (ConfigurationException e) {
}
- child.getInstance(AsyncCaller.class).getCalleeWithProducesAndConsumesOnMethod()
- .testProducesAndConsumesOnMethod().get();
+ child.getInstance(Caller.class).getCalleeWithProducesAndConsumesOnMethod().testProducesAndConsumesOnMethod();
}
- public void testAsyncDelegateWithProducesAndConsumesOnClassIsLazyLoaded()
+ public void testDelegateWithProducesAndConsumesOnClassIsLazyLoaded()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
@Override
public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- return Futures.immediateFuture(invoke(command));
+ throw new AssertionError("jclouds no longer uses the submit method");
}
@Override
public HttpResponse invoke(HttpCommand command) {
assertEquals(
command.getCurrentRequest().getPayload().getContentMetadata().getContentType(),
- MediaType.APPLICATION_XML);
- assertTrue(command.getCurrentRequest().getHeaders().get("Accept").contains(MediaType.APPLICATION_XML));
- return HttpResponse.builder().build();
- }
-
- });
-
- try {
- child.getInstance(AsyncCallee.class);
- fail("Callee shouldn't be bound yet");
- } catch (ConfigurationException e) {
-
- }
-
- child.getInstance(AsyncCaller.class).getCalleeWithProducesAndConsumesOnClass()
- .testProducesAndConsumesOnClass().get();
- }
-
- public void testAsyncDelegateIsLazyLoadedAndRequestIncludesEndpointVersionAndPathOptionalPresent()
- throws InterruptedException, ExecutionException {
- Injector child = injectorForCaller(new HttpCommandExecutorService() {
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- return Futures.immediateFuture(invoke(command));
- }
-
- @Override
- public HttpResponse invoke(HttpCommand command) {
- assertEquals(command.getCurrentRequest().getRequestLine(), "GET http://howdyboys/client/1/foo HTTP/1.1");
+ APPLICATION_XML);
+ assertTrue(command.getCurrentRequest().getHeaders().get("Accept").contains(APPLICATION_XML));
return HttpResponse.builder().build();
}
});
try {
- child.getInstance(AsyncCallee.class);
+ child.getInstance(Callee.class);
fail("Callee shouldn't be bound yet");
} catch (ConfigurationException e) {
}
- child.getInstance(AsyncCaller.class).getOptionalCallee(URI.create("http://howdyboys")).get().onePath("foo").get();
-
- assertEquals(child.getInstance(AsyncCaller.class).getURI(), URI.create("http://localhost:1111"));
-
+ child.getInstance(Caller.class).getCalleeWithProducesAndConsumesOnClass().testProducesAndConsumesOnClass();
}
- public void testAsyncDelegateIsLazyLoadedAndRequestIncludesEndpointVersionAndPathCanOverrideOptionalBehaviour()
+ public void testDelegateIsLazyLoadedAndRequestIncludesEndpointVersionAndPathOptionalPresent()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
@Override
public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- return Futures.immediateFuture(invoke(command));
+ throw new AssertionError("jclouds no longer uses the submit method");
}
@Override
@@ -588,32 +440,18 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
return HttpResponse.builder().build();
}
- }, new AbstractModule() {
-
- @Override
- protected void configure() {
- bind(ImplicitOptionalConverter.class).toInstance(new ImplicitOptionalConverter() {
-
- @Override
- public Optional<Object> apply(InvocationSuccess input) {
- return Optional.absent();
- }
-
- });
- }
-
});
try {
- child.getInstance(AsyncCallee.class);
+ child.getInstance(Callee.class);
fail("Callee shouldn't be bound yet");
} catch (ConfigurationException e) {
}
- assert !child.getInstance(AsyncCaller.class).getOptionalCallee(URI.create("http://howdyboys")).isPresent();
+ child.getInstance(Caller.class).getOptionalCallee(URI.create("http://howdyboys")).get().onePath("foo");
- assertEquals(child.getInstance(AsyncCaller.class).getURI(), URI.create("http://localhost:1111"));
+ assertEquals(child.getInstance(Caller.class).getURI(), URI.create("http://localhost:1111"));
}
@@ -623,7 +461,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@Override
public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- return Futures.immediateFuture(invoke(command));
+ throw new AssertionError("jclouds no longer uses the submit method");
}
@Override
@@ -646,13 +484,12 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
}
private Injector injectorForCaller(HttpCommandExecutorService service, Module... modules) {
- return ContextBuilder
- .newBuilder(
- AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(Caller.class, AsyncCaller.class,
- "http://localhost:9999"))
- .modules(
- ImmutableSet.<Module> builder().add(new MockModule(service)).add(new NullLoggingModule())
- .add(new CallerModule()).addAll(ImmutableSet.<Module> copyOf(modules)).build()).buildInjector();
+ return ContextBuilder.newBuilder(forApiOnEndpoint(Caller.class, "http://localhost:9999"))
+ .modules(ImmutableSet.<Module> builder()
+ .add(new MockModule(service))
+ .add(new NullLoggingModule())
+ .add(new CallerModule())
+ .addAll(Arrays.asList(modules)).build()).buildInjector();
}
@@ -1256,12 +1093,12 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@GET
@Path("/")
@Consumes("application/json")
- ListenableFuture<Map<String, String>> testGeneric2();
+ Map<String, String> testGeneric2();
@GET
@Path("/")
@Consumes("application/json")
- ListenableFuture<? extends Map<String, String>> testGeneric3();
+ Map<String, String> testGeneric3();
@GET
@Path("/")
@@ -1283,30 +1120,30 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@Path("/")
@Unwrap
@Consumes("application/json")
- ListenableFuture<String> testUnwrap2();
+ String testUnwrap2();
@GET
@Path("/")
@Unwrap
@Consumes("application/json")
- ListenableFuture<Set<String>> testUnwrap3();
+ Set<String> testUnwrap3();
@GET
@Path("/")
@Unwrap
@Consumes("application/json")
- ListenableFuture<? extends Set<String>> testUnwrap4();
+ Set<String> testUnwrap4();
@GET
@Path("/")
@SelectJson("jobid")
- ListenableFuture<Long> selectLong();
+ Long selectLong();
@GET
@Path("/")
@SelectJson("jobid")
@Transform(AddOne.class)
- ListenableFuture<Long> selectLongAddOne();
+ Long selectLongAddOne();
static class AddOne implements Function<Long, Long> {
@@ -1321,7 +1158,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@SelectJson("runit")
@OnlyElement
@Consumes("application/json")
- ListenableFuture<String> selectOnlyElement();
+ String selectOnlyElement();
@Target({ ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@@ -1331,11 +1168,11 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@ROWDY
@Path("/strings/{id}")
- ListenableFuture<Boolean> rowdy(@PathParam("id") String path);
+ Boolean rowdy(@PathParam("id") String path);
@ROWDY
@Path("/ints/{id}")
- ListenableFuture<Boolean> rowdy(@PathParam("id") int path);
+ Boolean rowdy(@PathParam("id") int path);
}
static class View {
@@ -1594,9 +1431,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
// Now let's create a new injector with the property set. Use that to create the annotation processor.
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_STRIP_EXPECT_HEADER, "true");
- Injector injector = ContextBuilder.newBuilder(
- AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(Callee.class, AsyncCallee.class,
- "http://localhost:9999"))
+ Injector injector = ContextBuilder.newBuilder(forApiOnEndpoint(Callee.class, "http://localhost:9999"))
.modules(ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule(), new AbstractModule() {
protected void configure() {
bind(new TypeLiteral<Supplier<URI>>() {
@@ -1931,31 +1766,31 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public interface TestTransformers {
@GET
- ListenableFuture<Integer> noTransformer();
+ Integer noTransformer();
@GET
@ResponseParser(ReturnStringIf2xx.class)
- ListenableFuture<Void> oneTransformer();
+ void oneTransformer();
@GET
@ResponseParser(ReturnStringIf200Context.class)
- ListenableFuture<Void> oneTransformerWithContext();
+ void oneTransformerWithContext();
@GET
- ListenableFuture<InputStream> futureInputStream();
+ InputStream futureInputStream();
@GET
- ListenableFuture<URI> futureUri();
+ URI futureUri();
@PUT
- ListenableFuture<Void> put(Payload payload);
+ void put(Payload payload);
@PUT
@Headers(keys = "Transfer-Encoding", values = "chunked")
- ListenableFuture<Void> putXfer(Payload payload);
+ void putXfer(Payload payload);
@PUT
- ListenableFuture<Void> put(PayloadEnclosing payload);
+ void put(PayloadEnclosing payload);
}
public void testPutPayloadEnclosing() throws SecurityException, NoSuchMethodException, IOException {
@@ -2149,48 +1984,48 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@GET
@VirtualHost
@Path("/{id}")
- ListenableFuture<String> get(@PathParam("id") String id, HttpRequestOptions options);
+ String get(@PathParam("id") String id, HttpRequestOptions options);
@GET
@VirtualHost
@Path("/{id}")
- ListenableFuture<String> get(@PathParam("id") String id, HttpRequestOptions... options);
+ String get(@PathParam("id") String id, HttpRequestOptions... options);
@GET
@Path("/{id}")
@ResponseParser(ReturnStringIf2xx.class)
- ListenableFuture<String> get(@PathParam("id") String id, @HeaderParam(HttpHeaders.HOST) String host);
+ String get(@PathParam("id") String id, @HeaderParam(HttpHeaders.HOST) String host);
@GET
@Path("/{id}")
@QueryParams(keys = "max-keys", values = "0")
- ListenableFuture<String> getQuery(@PathParam("id") String id);
+ String getQuery(@PathParam("id") String id);
@GET
@Path("/{id}")
@QueryParams(keys = "acl")
- ListenableFuture<String> getQueryNull(@PathParam("id") String id);
+ String getQueryNull(@PathParam("id") String id);
@GET
@Path("/{id}")
@QueryParams(keys = "acl", values = "")
- ListenableFuture<String> getQueryEmpty(@PathParam("id") String id);
+ String getQueryEmpty(@PathParam("id") String id);
@PUT
@Path("/{id}")
- ListenableFuture<String> put(@PathParam("id") @ParamParser(FirstCharacter.class) String id,
+ String put(@PathParam("id") @ParamParser(FirstCharacter.class) String id,
@BinderParam(BindToStringPayload.class) String payload);
@PUT
@Path("/{id}")
@VirtualHost
- ListenableFuture<String> putOptions(@PathParam("id") String id, HttpRequestOptions options);
+ String putOptions(@PathParam("id") String id, HttpRequestOptions options);
@PUT
@Path("/{id}")
@Headers(keys = "foo", values = "--{id}--")
@ResponseParser(ReturnTrueIf2xx.class)
- ListenableFuture<String> putHeader(@PathParam("id") String id,
+ String putHeader(@PathParam("id") String id,
@BinderParam(BindToStringPayload.class) String payload);
}
@@ -2335,7 +2170,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@GET
@Path("/{id}")
@VirtualHost
- public ListenableFuture<String> get(@PathParam("id") String id, String foo) {
+ public String get(@PathParam("id") String id, String foo) {
return null;
}
}
@@ -2356,11 +2191,11 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@GET
@Path("/{id}")
@VirtualHost
- ListenableFuture<String> get(@PathParam("id") String id, String foo);
+ String get(@PathParam("id") String id, String foo);
@GET
@Path("/{id}")
- ListenableFuture<String> getPrefix(@PathParam("id") String id, @BinderParam(BindAsHostPrefix.class) String foo);
+ String getPrefix(@PathParam("id") String id, @BinderParam(BindAsHostPrefix.class) String foo);
}
@@ -2501,7 +2336,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@PUT
@Path("/{foo}")
- ListenableFuture<Void> putWithPath(@PathParam("foo") String path,
+ void putWithPath(@PathParam("foo") String path,
@BinderParam(BindToStringPayload.class) String content);
@PUT
@@ -2653,9 +2488,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@BeforeClass
void setupFactory() {
injector = ContextBuilder
- .newBuilder(
- AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(Callee.class, AsyncCallee.class,
- "http://localhost:9999"))
+ .newBuilder(forApiOnEndpoint(Callee.class, "http://localhost:9999"))
.modules(ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule(), new AbstractModule() {
protected void configure() {
bind(new TypeLiteral<Supplier<URI>>() {
[15/52] [abbrv] git commit: JCLOUDS-296 unasync legacy swift provider.
Posted by an...@apache.org.
JCLOUDS-296 unasync legacy swift provider.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/bbad831c
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/bbad831c
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/bbad831c
Branch: refs/heads/use-agentproxy-008
Commit: bbad831c004734f3cee79d748bb99719ba394e2c
Parents: dda43df
Author: Adrian Cole <ac...@twitter.com>
Authored: Fri Oct 3 19:12:19 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Fri Oct 3 23:14:03 2014 -0700
----------------------------------------------------------------------
.../openstack/swift/CommonSwiftAsyncClient.java | 276 -------------------
.../openstack/swift/CommonSwiftClient.java | 213 +++++++++++---
.../openstack/swift/SwiftApiMetadata.java | 45 ++-
.../openstack/swift/SwiftAsyncClient.java | 34 ---
.../jclouds/openstack/swift/SwiftClient.java | 6 +
.../swift/SwiftKeystoneApiMetadata.java | 42 +--
.../swift/SwiftKeystoneAsyncClient.java | 35 ---
.../openstack/swift/SwiftKeystoneClient.java | 6 +
.../swift/blobstore/SwiftAsyncBlobStore.java | 258 -----------------
.../swift/blobstore/SwiftBlobSigner.java | 6 +-
.../config/SwiftBlobStoreContextModule.java | 9 +-
.../config/TemporaryUrlExtensionModule.java | 30 +-
.../ParallelMultipartUploadStrategy.java | 30 +-
.../swift/config/SwiftHttpApiModule.java | 115 ++++++++
.../config/SwiftKeystoneHttpApiModule.java | 35 +++
.../config/SwiftKeystoneRestClientModule.java | 42 ---
.../swift/config/SwiftRestClientModule.java | 123 ---------
.../extensions/KeystoneTemporaryUrlKeyApi.java | 31 +++
.../KeystoneTemporaryUrlKeyAsyncApi.java | 33 ---
.../swift/extensions/TemporaryUrlKeyApi.java | 39 ++-
.../extensions/TemporaryUrlKeyAsyncApi.java | 62 -----
.../openstack/swift/CommonSwiftClientTest.java | 10 +-
.../openstack/swift/SwiftClientLiveTest.java | 3 +-
.../swift/SwiftKeystoneClientLiveTest.java | 2 +-
.../blobstore/SwiftBlobSignerExpectTest.java | 4 +-
.../SwiftKeystoneBlobSignerExpectTest.java | 10 +-
.../KeystoneStorageEndpointModuleTest.java | 2 +-
.../swift/internal/StubSwiftAsyncClient.java | 224 ---------------
28 files changed, 479 insertions(+), 1246 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java
deleted file mode 100644
index f977b08..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.swift;
-
-import static com.google.common.net.HttpHeaders.EXPECT;
-
-import java.io.Closeable;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnContainerNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnKeyNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnContainerNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyNotFound;
-import org.jclouds.blobstore.binders.BindMapToHeadersWithPrefix;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.http.functions.ParseETagHeader;
-import org.jclouds.http.functions.ReturnTrueIf201;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.openstack.swift.SwiftFallbacks.TrueOn404FalseOn409;
-import org.jclouds.openstack.swift.binders.BindIterableToHeadersWithContainerDeleteMetadataPrefix;
-import org.jclouds.openstack.swift.binders.BindMapToHeadersWithContainerMetadataPrefix;
-import org.jclouds.openstack.swift.binders.BindSwiftObjectMetadataToRequest;
-import org.jclouds.openstack.swift.domain.AccountMetadata;
-import org.jclouds.openstack.swift.domain.ContainerMetadata;
-import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata;
-import org.jclouds.openstack.swift.domain.ObjectInfo;
-import org.jclouds.openstack.swift.domain.SwiftObject;
-import org.jclouds.openstack.swift.functions.ObjectName;
-import org.jclouds.openstack.swift.functions.ParseAccountMetadataResponseFromHeaders;
-import org.jclouds.openstack.swift.functions.ParseContainerMetadataFromHeaders;
-import org.jclouds.openstack.swift.functions.ParseObjectFromHeadersAndHttpContent;
-import org.jclouds.openstack.swift.functions.ParseObjectInfoFromHeaders;
-import org.jclouds.openstack.swift.functions.ParseObjectInfoListFromJsonResponse;
-import org.jclouds.openstack.swift.options.CreateContainerOptions;
-import org.jclouds.openstack.swift.options.ListContainerOptions;
-import org.jclouds.openstack.swift.reference.SwiftHeaders;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.ParamParser;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.ResponseParser;
-
-import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.inject.Provides;
-
-/**
- * Common features in OpenStack Swift.
- *
- * @see CommonSwiftClient
- *
- *
- * @deprecated Please use {@code org.jclouds.ContextBuilder#buildApi(CommonSwiftClient.class)} as
- * {@link CommonSwiftAsyncClient} will be removed in jclouds 2.0.
- */
-@Deprecated
-public interface CommonSwiftAsyncClient extends Closeable {
- @Provides
- SwiftObject newSwiftObject();
-
- /**
- * @see CommonSwiftClient#getAccountStatistics
- */
- @Named("GetAccountMetadata")
- @HEAD
- @Path("/")
- @Consumes(MediaType.WILDCARD)
- @ResponseParser(ParseAccountMetadataResponseFromHeaders.class)
- ListenableFuture<AccountMetadata> getAccountStatistics();
-
- /**
- * @see CommonSwiftClient#listContainers
- */
- @Named("ListContainers")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/")
- ListenableFuture<? extends Set<ContainerMetadata>> listContainers(ListContainerOptions... options);
-
- /**
- * @see CommonSwiftClient#getContainerMetadata
- */
- @Named("GetContainerMetadata")
- @Beta
- @HEAD
- @Path("/{container}")
- @Consumes(MediaType.WILDCARD)
- @ResponseParser(ParseContainerMetadataFromHeaders.class)
- @Fallback(NullOnContainerNotFound.class)
- ListenableFuture<ContainerMetadata> getContainerMetadata(@PathParam("container") String container);
-
- /**
- * @see CommonSwiftClient#setContainerMetadata
- */
- @Named("UpdateContainerMetadata")
- @POST
- @Path("/{container}")
- @Fallback(FalseOnContainerNotFound.class)
- ListenableFuture<Boolean> setContainerMetadata(@PathParam("container") String container,
- @BinderParam(BindMapToHeadersWithContainerMetadataPrefix.class) Map<String, String> containerMetadata);
-
- /**
- * @see CommonSwiftClient#deleteContainerMetadata
- */
- @Named("UpdateContainerMetadata")
- @POST
- @Path("/{container}")
- @Fallback(FalseOnContainerNotFound.class)
- ListenableFuture<Boolean> deleteContainerMetadata(@PathParam("container") String container,
- @BinderParam(BindIterableToHeadersWithContainerDeleteMetadataPrefix.class) Iterable<String> metadataKeys);
-
- /**
- * @see CommonSwiftClient#createContainer
- */
- @Named("CreateContainer")
- @PUT
- @ResponseParser(ReturnTrueIf201.class)
- @Path("/{container}")
- ListenableFuture<Boolean> createContainer(@PathParam("container") String container,
- CreateContainerOptions... options);
-
- /**
- * @see CommonSwiftClient#setObjectInfo
- */
- @Named("UpdateObjectMetadata")
- @POST
- @Path("/{container}/{name}")
- ListenableFuture<Boolean> setObjectInfo(@PathParam("container") String container,
- @PathParam("name") String name,
- @BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> userMetadata);
-
- /**
- * @see CommonSwiftClient#createContainer
- */
- @Named("CreateContainer")
- @PUT
- @ResponseParser(ReturnTrueIf201.class)
- @Path("/{container}")
- ListenableFuture<Boolean> createContainer(@PathParam("container") String container);
-
- /**
- * @see CommonSwiftClient#deleteContainerIfEmpty
- */
- @Named("DeleteContainer")
- @DELETE
- @Fallback(TrueOn404FalseOn409.class)
- @Path("/{container}")
- ListenableFuture<Boolean> deleteContainerIfEmpty(@PathParam("container") String container);
-
- /**
- * @see CommonSwiftClient#listObjects
- */
- @Named("ListObjects")
- @GET
- @QueryParams(keys = "format", values = "json")
- @ResponseParser(ParseObjectInfoListFromJsonResponse.class)
- @Path("/{container}")
- ListenableFuture<PageSet<ObjectInfo>> listObjects(@PathParam("container") String container,
- ListContainerOptions... options);
-
- /**
- * @see CommonSwiftClient#containerExists
- */
- @Named("GetContainerMetadata")
- @HEAD
- @Path("/{container}")
- @Consumes(MediaType.WILDCARD)
- @Fallback(FalseOnContainerNotFound.class)
- ListenableFuture<Boolean> containerExists(@PathParam("container") String container);
-
- /**
- * @see CommonSwiftClient#putObject
- */
- @Named("PutObject")
- @PUT
- @Path("/{container}/{name}")
- @Headers(keys = EXPECT, values = "100-continue")
- @ResponseParser(ParseETagHeader.class)
- ListenableFuture<String> putObject(@PathParam("container") String container,
- @PathParam("name") @ParamParser(ObjectName.class) @BinderParam(BindSwiftObjectMetadataToRequest.class) SwiftObject object);
-
- /**
- * @see CommonSwiftClient#copyObject
- */
- @Named("CopyObject")
- @PUT
- @Path("/{destinationContainer}/{destinationObject}")
- @Headers(keys = SwiftHeaders.OBJECT_COPY_FROM, values = "/{sourceContainer}/{sourceObject}")
- @Fallback(FalseOnContainerNotFound.class)
- ListenableFuture<Boolean> copyObject(@PathParam("sourceContainer") String sourceContainer,
- @PathParam("sourceObject") String sourceObject,
- @PathParam("destinationContainer") String destinationContainer,
- @PathParam("destinationObject") String destinationObject);
-
- /**
- * @see CommonSwiftClient#getObject
- */
- @Named("GetObject")
- @GET
- @ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
- @Fallback(NullOnKeyNotFound.class)
- @Path("/{container}/{name}")
- ListenableFuture<SwiftObject> getObject(@PathParam("container") String container,
- @PathParam("name") String name,
- GetOptions... options);
-
- /**
- * @see CommonSwiftClient#getObjectInfo
- */
- @Named("GetObjectMetadata")
- @HEAD
- @ResponseParser(ParseObjectInfoFromHeaders.class)
- @Fallback(NullOnKeyNotFound.class)
- @Path("/{container}/{name}")
- @Consumes(MediaType.WILDCARD)
- ListenableFuture<MutableObjectInfoWithMetadata> getObjectInfo(@PathParam("container") String container,
- @PathParam("name") String name);
-
- /**
- * @see CommonSwiftClient#objectExists
- */
- @Named("GetObjectMetadata")
- @HEAD
- @Fallback(FalseOnKeyNotFound.class)
- @Path("/{container}/{name}")
- @Consumes(MediaType.WILDCARD)
- ListenableFuture<Boolean> objectExists(@PathParam("container") String container,
- @PathParam("name") String name);
-
- /**
- * @see CommonSwiftClient#removeObject
- */
- @Named("RemoveObject")
- @DELETE
- @Fallback(VoidOnNotFoundOr404.class)
- @Path("/{container}/{name}")
- ListenableFuture<Void> removeObject(@PathParam("container") String container,
- @PathParam("name") String name);
-
- @Named("PutObjectManifest")
- @PUT
- @Path("/{container}/{name}")
- @ResponseParser(ParseETagHeader.class)
- @Headers(keys = "X-Object-Manifest", values = "{container}/{name}/")
- ListenableFuture<String> putObjectManifest(@PathParam("container") String container,
- @PathParam("name") String name);
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java
index c995e65..dc7dfdc 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java
@@ -16,19 +16,56 @@
*/
package org.jclouds.openstack.swift;
+import static com.google.common.net.HttpHeaders.EXPECT;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import static org.jclouds.blobstore.BlobStoreFallbacks.FalseOnContainerNotFound;
+import static org.jclouds.blobstore.BlobStoreFallbacks.FalseOnKeyNotFound;
+import static org.jclouds.blobstore.BlobStoreFallbacks.NullOnContainerNotFound;
+import static org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyNotFound;
+import static org.jclouds.openstack.swift.reference.SwiftHeaders.OBJECT_COPY_FROM;
+
import java.io.Closeable;
import java.util.Map;
import java.util.Set;
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+import org.jclouds.blobstore.binders.BindMapToHeadersWithPrefix;
import org.jclouds.blobstore.domain.PageSet;
+import org.jclouds.http.functions.ParseETagHeader;
+import org.jclouds.http.functions.ReturnTrueIf201;
import org.jclouds.http.options.GetOptions;
+import org.jclouds.openstack.swift.binders.BindIterableToHeadersWithContainerDeleteMetadataPrefix;
+import org.jclouds.openstack.swift.binders.BindMapToHeadersWithContainerMetadataPrefix;
+import org.jclouds.openstack.swift.binders.BindSwiftObjectMetadataToRequest;
import org.jclouds.openstack.swift.domain.AccountMetadata;
import org.jclouds.openstack.swift.domain.ContainerMetadata;
import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata;
import org.jclouds.openstack.swift.domain.ObjectInfo;
import org.jclouds.openstack.swift.domain.SwiftObject;
+import org.jclouds.openstack.swift.functions.ObjectName;
+import org.jclouds.openstack.swift.functions.ParseAccountMetadataResponseFromHeaders;
+import org.jclouds.openstack.swift.functions.ParseContainerMetadataFromHeaders;
+import org.jclouds.openstack.swift.functions.ParseObjectFromHeadersAndHttpContent;
+import org.jclouds.openstack.swift.functions.ParseObjectInfoFromHeaders;
+import org.jclouds.openstack.swift.functions.ParseObjectInfoListFromJsonResponse;
import org.jclouds.openstack.swift.options.CreateContainerOptions;
import org.jclouds.openstack.swift.options.ListContainerOptions;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.ParamParser;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.ResponseParser;
import com.google.inject.Provides;
@@ -36,8 +73,8 @@ import com.google.inject.Provides;
* Common features in OpenStack Swift.
*
*
- * @deprecated Please use {@code com.jclouds.openstack.swift.v1.SwiftApi} and related
- * feature APIs in {@code com.jclouds.openstack.swift.v1.features.*} as noted in
+ * @deprecated Please use {@code org.jclouds.openstack.swift.v1.SwiftApi} and related
+ * feature APIs in {@code org.jclouds.openstack.swift.v1.features.*} as noted in
* each method. This interface will be removed in jclouds 2.0.
*/
@Deprecated
@@ -45,7 +82,7 @@ public interface CommonSwiftClient extends Closeable {
/**
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.domain.SwiftObject#builder()}
+ * {@link org.jclouds.openstack.swift.v1.domain.SwiftObject#builder()}
*/
@Deprecated
@Provides
@@ -62,9 +99,14 @@ public interface CommonSwiftClient extends Closeable {
*
* @return the {@link AccountMetadata}
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.AccountApi#get()}
+ * {@link org.jclouds.openstack.swift.v1.features.AccountApi#get()}
*/
@Deprecated
+ @Named("GetAccountMetadata")
+ @HEAD
+ @Path("/")
+ @Consumes()
+ @ResponseParser(ParseAccountMetadataResponseFromHeaders.class)
AccountMetadata getAccountStatistics();
/**
@@ -96,10 +138,15 @@ public interface CommonSwiftClient extends Closeable {
* list is exactly divisible by the limit, the last request will simply have no content.
*
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ContainerApi#list()} and
- * {@link com.jclouds.openstack.swift.v1.features.ContainerApi#list(ListContainerOptions)}
+ * {@link org.jclouds.openstack.swift.v1.features.ContainerApi#list()} and
+ * {@link org.jclouds.openstack.swift.v1.features.ContainerApi#list(ListContainerOptions)}
*/
@Deprecated
+ @Named("ListContainers")
+ @GET
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/")
Set<ContainerMetadata> listContainers(ListContainerOptions... options);
/**
@@ -109,10 +156,16 @@ public interface CommonSwiftClient extends Closeable {
* the container to get the metadata from
* @return the {@link ContainerMetadata}
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ContainerApi#get()}
+ * {@link org.jclouds.openstack.swift.v1.features.ContainerApi#get()}
*/
@Deprecated
- ContainerMetadata getContainerMetadata(String container);
+ @Named("GetContainerMetadata")
+ @HEAD
+ @Path("/{container}")
+ @Consumes()
+ @ResponseParser(ParseContainerMetadataFromHeaders.class)
+ @Fallback(NullOnContainerNotFound.class)
+ ContainerMetadata getContainerMetadata(@PathParam("container") String container);
/**
* Set the {@link ContainerMetadata} on the given container.
@@ -124,10 +177,16 @@ public interface CommonSwiftClient extends Closeable {
* @return {@code true}
* if the Container Metadata was successfully created or updated, false if not.
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ContainerApi#updateMetadata()}
+ * {@link org.jclouds.openstack.swift.v1.features.ContainerApi#updateMetadata()}
*/
@Deprecated
- boolean setContainerMetadata(String container, Map<String, String> containerMetadata);
+ @Named("UpdateContainerMetadata")
+ @POST
+ @Path("/{container}")
+ @Fallback(FalseOnContainerNotFound.class)
+ boolean setContainerMetadata(@PathParam("container") String container,
+ @BinderParam(BindMapToHeadersWithContainerMetadataPrefix.class) Map<String, String> containerMetadata);
+
/**
* Delete the metadata on the given container.
@@ -139,10 +198,15 @@ public interface CommonSwiftClient extends Closeable {
* @return {@code true}
* if the Container was successfully deleted, false if not.
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ContainerApi#deleteMetadata()}
+ * {@link org.jclouds.openstack.swift.v1.features.ContainerApi#deleteMetadata()}
*/
@Deprecated
- boolean deleteContainerMetadata(String container, Iterable<String> metadataKeys);
+ @Named("UpdateContainerMetadata")
+ @POST
+ @Path("/{container}")
+ @Fallback(FalseOnContainerNotFound.class)
+ boolean deleteContainerMetadata(@PathParam("container") String container,
+ @BinderParam(BindIterableToHeadersWithContainerDeleteMetadataPrefix.class) Iterable<String> metadataKeys);
/**
* Create a container.
@@ -152,97 +216,164 @@ public interface CommonSwiftClient extends Closeable {
* @return {@code true}
* if the Container was successfully created, false if not.
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ContainerApi#createIfAbsent()}
+ * {@link org.jclouds.openstack.swift.v1.features.ContainerApi#createIfAbsent()}
*/
@Deprecated
- boolean createContainer(String container);
+ @Named("CreateContainer")
+ @PUT
+ @ResponseParser(ReturnTrueIf201.class)
+ @Path("/{container}")
+ boolean createContainer(@PathParam("container") String container);
/**
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ContainerApi#createIfAbsent()}
+ * {@link org.jclouds.openstack.swift.v1.features.ContainerApi#createIfAbsent()}
*/
@Deprecated
boolean createContainer(String container, CreateContainerOptions... options);
/**
* @deprecated This method will be replaced by
- * (@link com.jclouds.openstack.swift.v1.features.ContainerApi#deleteIfEmpty()}
+ * (@link org.jclouds.openstack.swift.v1.features.ContainerApi#deleteIfEmpty()}
*/
@Deprecated
- boolean deleteContainerIfEmpty(String container);
-
+ @Named("DeleteContainer")
+ @DELETE
+ @Fallback(SwiftFallbacks.TrueOn404FalseOn409.class)
+ @Path("/{container}")
+ boolean deleteContainerIfEmpty(@PathParam("container") String container);
/**
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ContainerApi#head()}
+ * {@link org.jclouds.openstack.swift.v1.features.ContainerApi#head()}
*/
@Deprecated
- boolean containerExists(String container);
+ @Named("GetContainerMetadata")
+ @HEAD
+ @Path("/{container}")
+ @Consumes
+ @Fallback(FalseOnContainerNotFound.class)
+ boolean containerExists(@PathParam("container") String container);
/**
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ObjectApi#list()} and
- * {@link com.jclouds.openstack.swift.v1.features.ObjectApi#list(ListContainerOptions)}
+ * {@link org.jclouds.openstack.swift.v1.features.ObjectApi#list()} and
+ * {@link org.jclouds.openstack.swift.v1.features.ObjectApi#list(ListContainerOptions)}
*/
@Deprecated
- PageSet<ObjectInfo> listObjects(String container, ListContainerOptions... options);
+ @Named("ListObjects")
+ @GET
+ @QueryParams(keys = "format", values = "json")
+ @ResponseParser(ParseObjectInfoListFromJsonResponse.class)
+ @Path("/{container}")
+ PageSet<ObjectInfo> listObjects(@PathParam("container") String container,
+ ListContainerOptions... options);
/**
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ObjectApi#get()}
+ * {@link org.jclouds.openstack.swift.v1.features.ObjectApi#get()}
*/
@Deprecated
- SwiftObject getObject(String container, String name, GetOptions... options);
+ @Named("GetObject")
+ @GET
+ @ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
+ @Fallback(NullOnKeyNotFound.class)
+ @Path("/{container}/{name}")
+ SwiftObject getObject(@PathParam("container") String container, @PathParam("name") String name,
+ GetOptions... options);
/**
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ObjectApi@updateMetadata()}
+ * {@link org.jclouds.openstack.swift.v1.features.ObjectApi@updateMetadata()}
*/
@Deprecated
- boolean setObjectInfo(String container, String name, Map<String, String> userMetadata);
+ @Named("UpdateObjectMetadata")
+ @POST
+ @Path("/{container}/{name}")
+ boolean setObjectInfo(@PathParam("container") String container,
+ @PathParam("name") String name,
+ @BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> userMetadata);
/**
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ObjectApi#head()}
+ * {@link org.jclouds.openstack.swift.v1.features.ObjectApi#head()}
*/
@Deprecated
- MutableObjectInfoWithMetadata getObjectInfo(String container, String name);
+ @Named("GetObjectMetadata")
+ @HEAD
+ @ResponseParser(ParseObjectInfoFromHeaders.class)
+ @Fallback(NullOnKeyNotFound.class)
+ @Path("/{container}/{name}")
+ @Consumes
+ MutableObjectInfoWithMetadata getObjectInfo(@PathParam("container") String container,
+ @PathParam("name") String name);
/**
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ObjectApi#replace()}
+ * {@link org.jclouds.openstack.swift.v1.features.ObjectApi#replace()}
*/
@Deprecated
- String putObject(String container, SwiftObject object);
+ @Named("PutObject")
+ @PUT
+ @Path("/{container}/{name}")
+ @Headers(keys = EXPECT, values = "100-continue")
+ @ResponseParser(ParseETagHeader.class)
+ String putObject(@PathParam("container") String container, @PathParam("name") @ParamParser(ObjectName.class)
+ @BinderParam(BindSwiftObjectMetadataToRequest.class) SwiftObject object);
+
/**
* @return True If the object was copied
* @throws CopyObjectException If the object was not copied
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ObjectApi#copy()}
+ * {@link org.jclouds.openstack.swift.v1.features.ObjectApi#copy()}
*/
@Deprecated
- boolean copyObject(String sourceContainer, String sourceObject, String destinationContainer, String destinationObject);
-
+ @Named("CopyObject")
+ @PUT
+ @Path("/{destinationContainer}/{destinationObject}")
+ @Headers(keys = OBJECT_COPY_FROM, values = "/{sourceContainer}/{sourceObject}")
+ @Fallback(FalseOnContainerNotFound.class)
+ boolean copyObject(@PathParam("sourceContainer") String sourceContainer,
+ @PathParam("sourceObject") String sourceObject,
+ @PathParam("destinationContainer") String destinationContainer,
+ @PathParam("destinationObject") String destinationObject);
+
/**
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ObjectApi#delete()}
+ * {@link org.jclouds.openstack.swift.v1.features.ObjectApi#delete()}
*/
@Deprecated
- void removeObject(String container, String name);
+ @Named("RemoveObject")
+ @DELETE
+ @Fallback(VoidOnNotFoundOr404.class)
+ @Path("/{container}/{name}")
+ void removeObject(@PathParam("container") String container, @PathParam("name") String name);
+
/**
* @throws org.jclouds.blobstore.ContainerNotFoundException
* if the container is not present
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ObjectApi#head()}
+ * {@link org.jclouds.openstack.swift.v1.features.ObjectApi#head()}
*/
@Deprecated
- boolean objectExists(String container, String name);
+ @Named("GetObjectMetadata")
+ @HEAD
+ @Fallback(FalseOnKeyNotFound.class)
+ @Path("/{container}/{name}")
+ @Consumes
+ boolean objectExists(@PathParam("container") String container, @PathParam("name") String name);
/**
* @deprecated This method will be replaced by
- * {@link com.jclouds.openstack.swift.v1.features.ObjectApi#replaceManifest()}
+ * {@link org.jclouds.openstack.swift.v1.features.ObjectApi#replaceManifest()}
*/
@Deprecated
- String putObjectManifest(String container, String name);
-}
+
+ @Named("PutObjectManifest")
+ @PUT
+ @Path("/{container}/{name}")
+ @ResponseParser(ParseETagHeader.class)
+ @Headers(keys = "X-Object-Manifest", values = "{container}/{name}/")
+ String putObjectManifest(@PathParam("container") String container, @PathParam("name") String name);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftApiMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftApiMetadata.java
index 7be8b96..ddafc79 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftApiMetadata.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftApiMetadata.java
@@ -27,30 +27,17 @@ import java.util.Properties;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule;
import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule.SwiftTemporaryUrlExtensionModule;
-import org.jclouds.openstack.swift.config.SwiftRestClientModule;
-import org.jclouds.openstack.swift.config.SwiftRestClientModule.StorageEndpointModule;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
+import org.jclouds.openstack.swift.config.SwiftHttpApiModule;
+import org.jclouds.openstack.swift.config.SwiftHttpApiModule.StorageEndpointModule;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
-/**
- * Implementation of {@link ApiMetadata} for OpenStack Swift
- */
-public class SwiftApiMetadata extends BaseRestApiMetadata {
-
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SwiftClient.class)} as
- * {@link SwiftAsyncClient} interface will be removed in jclouds 2.0.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<? extends SwiftClient, ? extends SwiftAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<? extends SwiftClient, ? extends SwiftAsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
+public class SwiftApiMetadata extends BaseHttpApiMetadata {
@Override
- public Builder<?> toBuilder() {
+ public Builder<?, ?> toBuilder() {
return new ConcreteBuilder().fromApiMetadata(this);
}
@@ -58,12 +45,12 @@ public class SwiftApiMetadata extends BaseRestApiMetadata {
this(new ConcreteBuilder());
}
- protected SwiftApiMetadata(Builder<?> builder) {
+ protected SwiftApiMetadata(Builder<?, ?> builder) {
super(builder);
}
public static Properties defaultProperties() {
- Properties properties = BaseRestApiMetadata.defaultProperties();
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
properties.setProperty(PROPERTY_USER_METADATA_PREFIX, "X-Object-Meta-");
properties.setProperty(PROPERTY_REGIONS, "DEFAULT");
// Keystone 1.1 expires tokens after 24 hours and allows renewal 1 hour
@@ -73,14 +60,15 @@ public class SwiftApiMetadata extends BaseRestApiMetadata {
return properties;
}
- public abstract static class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
- @SuppressWarnings("deprecation")
+ public abstract static class Builder<A extends CommonSwiftClient, T extends Builder<A, T>> extends
+ BaseHttpApiMetadata.Builder<A, T> {
+
protected Builder() {
- this(SwiftClient.class, SwiftAsyncClient.class);
+ this(Class.class.cast(SwiftClient.class));
}
-
- protected Builder(Class<?> syncClient, Class<?> asyncClient) {
- super(syncClient, asyncClient);
+
+ protected Builder(Class<A> syncClient) {
+ super(syncClient);
id("swift")
.name("OpenStack Swift with SwiftAuth")
.identityName("tenantId:user")
@@ -89,10 +77,9 @@ public class SwiftApiMetadata extends BaseRestApiMetadata {
.version("1.0")
.defaultProperties(SwiftApiMetadata.defaultProperties())
.view(typeToken(BlobStoreContext.class))
- .context(CONTEXT_TOKEN)
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(StorageEndpointModule.class)
- .add(SwiftRestClientModule.class)
+ .add(SwiftHttpApiModule.class)
.add(SwiftBlobStoreContextModule.class)
.add(SwiftTemporaryUrlExtensionModule.class).build());
}
@@ -103,7 +90,7 @@ public class SwiftApiMetadata extends BaseRestApiMetadata {
}
}
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ private static class ConcreteBuilder extends Builder<SwiftClient, ConcreteBuilder> {
@Override
protected ConcreteBuilder self() {
return this;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftAsyncClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftAsyncClient.java
deleted file mode 100644
index 4616b46..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftAsyncClient.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.swift;
-
-import org.jclouds.openstack.filters.AuthenticateRequest;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.RequestFilters;
-
-/**
- * Functionality that's in Swift, and not in CloudFiles.
- *
- *
- * @deprecated Please use {@code org.jclouds.ContextBuilder#buildApi(SwiftClient.class)}, as
- * {@link SwiftAsyncClient} will be removed in jclouds 2.0.
- */
-@Deprecated
-@RequestFilters(AuthenticateRequest.class)
-@Endpoint(Storage.class)
-public interface SwiftAsyncClient extends CommonSwiftAsyncClient {
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftClient.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftClient.java
index 6250ff1..4e5e1c6 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftClient.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftClient.java
@@ -16,6 +16,10 @@
*/
package org.jclouds.openstack.swift;
+import org.jclouds.openstack.filters.AuthenticateRequest;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.RequestFilters;
+
/**
* Functionality that's in Swift, and not in CloudFiles.
*
@@ -25,5 +29,7 @@ package org.jclouds.openstack.swift;
* will be removed in jclouds 2.0.
*/
@Deprecated
+@RequestFilters(AuthenticateRequest.class)
+@Endpoint(Storage.class)
public interface SwiftClient extends CommonSwiftClient {
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java
index 300061a..35049df 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java
@@ -16,42 +16,29 @@
*/
package org.jclouds.openstack.swift;
-import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGION;
+import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
import java.util.Properties;
+import org.jclouds.openstack.keystone.v2_0.config.AuthenticationApiModule;
import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
-import org.jclouds.openstack.keystone.v2_0.config.MappedAuthenticationApiModule;
import org.jclouds.openstack.services.ServiceType;
import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule;
import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule.SwiftKeystoneTemporaryUrlExtensionModule;
-import org.jclouds.openstack.swift.config.SwiftKeystoneRestClientModule;
-import org.jclouds.openstack.swift.config.SwiftRestClientModule.KeystoneStorageEndpointModule;
+import org.jclouds.openstack.swift.config.SwiftKeystoneHttpApiModule;
+import org.jclouds.openstack.swift.config.SwiftHttpApiModule.KeystoneStorageEndpointModule;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
-/**
- * Implementation of {@link ApiMetadata} for OpenStack Swift authenticated with KeyStone
- */
public class SwiftKeystoneApiMetadata extends SwiftApiMetadata {
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(SwiftKeystoneClient.class)} as
- * {@link SwiftKeystoneAsyncClient} interface will be removed in jclouds 2.0.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<SwiftKeystoneClient, SwiftKeystoneAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<SwiftKeystoneClient, SwiftKeystoneAsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
-
@Override
- public Builder<?> toBuilder() {
+ public Builder<?, ?> toBuilder() {
return new ConcreteBuilder().fromApiMetadata(this);
}
@@ -59,7 +46,7 @@ public class SwiftKeystoneApiMetadata extends SwiftApiMetadata {
this(new ConcreteBuilder());
}
- protected SwiftKeystoneApiMetadata(Builder<?> builder) {
+ protected SwiftKeystoneApiMetadata(Builder<?, ?> builder) {
super(builder);
}
@@ -72,26 +59,27 @@ public class SwiftKeystoneApiMetadata extends SwiftApiMetadata {
return properties;
}
- public abstract static class Builder<T extends Builder<T>> extends SwiftApiMetadata.Builder<T> {
+ public abstract static class Builder<A extends CommonSwiftClient, T extends Builder<A, T>>
+ extends SwiftApiMetadata.Builder<A, T> {
+
protected Builder() {
- this(SwiftKeystoneClient.class, SwiftKeystoneAsyncClient.class);
+ this(Class.class.cast(SwiftKeystoneClient.class));
}
- protected Builder(Class<?> syncClient, Class<?> asyncClient) {
- super(syncClient, asyncClient);
+ protected Builder(Class<A> syncClient) {
+ super(syncClient);
id("swift-keystone")
.name("OpenStack Swift with Keystone authentication")
.identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant")
.credentialName("${password}")
.endpointName("KeyStone base url ending in /v2.0/")
.defaultEndpoint("http://localhost:5000/v2.0/")
- .context(CONTEXT_TOKEN)
.defaultProperties(SwiftKeystoneApiMetadata.defaultProperties())
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
- .add(MappedAuthenticationApiModule.class)
+ .add(AuthenticationApiModule.class)
.add(KeystoneStorageEndpointModule.class)
.add(KeystoneAuthenticationModule.RegionModule.class)
- .add(SwiftKeystoneRestClientModule.class)
+ .add(SwiftKeystoneHttpApiModule.class)
.add(SwiftBlobStoreContextModule.class)
.add(SwiftKeystoneTemporaryUrlExtensionModule.class).build());
}
@@ -102,7 +90,7 @@ public class SwiftKeystoneApiMetadata extends SwiftApiMetadata {
}
}
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ private static class ConcreteBuilder extends Builder<SwiftKeystoneClient, ConcreteBuilder> {
@Override
protected ConcreteBuilder self() {
return this;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneAsyncClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneAsyncClient.java
deleted file mode 100644
index 58feeef..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneAsyncClient.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.swift;
-
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.RequestFilters;
-
-/**
- * Functionality that's in Swift, and not in CloudFiles.
- *
- *
- * @deprecated Please use {@code org.jclouds.ContextBuilder#buildApi(SwiftKeystoneClient.class)}, as
- * {@link SwiftKeystoneAsyncClient} will be removed in jclouds 2.0.
- */
-@Deprecated
-@RequestFilters(AuthenticateRequest.class)
-@Endpoint(Storage.class)
-public interface SwiftKeystoneAsyncClient extends SwiftAsyncClient {
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneClient.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneClient.java
index 5679db5..9cd38a4 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneClient.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneClient.java
@@ -16,11 +16,17 @@
*/
package org.jclouds.openstack.swift;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.RequestFilters;
+
/**
* Functionality that's in Swift, and not in CloudFiles.
*
* @deprecated This interface will be removed in jclouds 2.0.
*/
@Deprecated
+@RequestFilters(AuthenticateRequest.class)
+@Endpoint(Storage.class)
public interface SwiftKeystoneClient extends SwiftClient {
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftAsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftAsyncBlobStore.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftAsyncBlobStore.java
deleted file mode 100644
index 0fedf68..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftAsyncBlobStore.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.swift.blobstore;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.util.concurrent.Futures.transform;
-import static org.jclouds.blobstore.util.BlobStoreUtils.createParentIfNeededAsync;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.domain.internal.PageSetImpl;
-import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
-import org.jclouds.blobstore.internal.BaseAsyncBlobStore;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.options.PutOptions;
-import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
-import org.jclouds.openstack.swift.CommonSwiftClient;
-import org.jclouds.openstack.swift.blobstore.functions.BlobStoreListContainerOptionsToListContainerOptions;
-import org.jclouds.openstack.swift.blobstore.functions.BlobToObject;
-import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceList;
-import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceMetadata;
-import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlob;
-import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata;
-import org.jclouds.openstack.swift.blobstore.strategy.internal.AsyncMultipartUploadStrategy;
-import org.jclouds.openstack.swift.domain.ContainerMetadata;
-import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata;
-import org.jclouds.openstack.swift.domain.ObjectInfo;
-import org.jclouds.openstack.swift.domain.SwiftObject;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- *
- * @deprecated This class will be removed in jclouds 2.0, as async interfaces are no longer
- * supported. Please use {@link SwiftBlobStore}.
- */
-@Deprecated
-@Singleton
-public class SwiftAsyncBlobStore extends BaseAsyncBlobStore {
- private final CommonSwiftClient sync;
- private final CommonSwiftAsyncClient async;
- private final ContainerToResourceMetadata container2ResourceMd;
- private final BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions;
- private final ContainerToResourceList container2ResourceList;
- private final ObjectToBlob object2Blob;
- private final BlobToObject blob2Object;
- private final ObjectToBlobMetadata object2BlobMd;
- private final BlobToHttpGetOptions blob2ObjectGetOptions;
- private final Provider<FetchBlobMetadata> fetchBlobMetadataProvider;
- private final Provider<AsyncMultipartUploadStrategy> multipartUploadStrategy;
-
- @Inject
- protected SwiftAsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, Supplier<Location> defaultLocation,
- @Memoized Supplier<Set<? extends Location>> locations, CommonSwiftClient sync,
- CommonSwiftAsyncClient async, ContainerToResourceMetadata container2ResourceMd,
- BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
- ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object,
- ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions,
- Provider<FetchBlobMetadata> fetchBlobMetadataProvider,
- Provider<AsyncMultipartUploadStrategy> multipartUploadStrategy) {
- super(context, blobUtils, userExecutor, defaultLocation, locations);
- this.sync = sync;
- this.async = async;
- this.container2ResourceMd = container2ResourceMd;
- this.container2ContainerListOptions = container2ContainerListOptions;
- this.container2ResourceList = container2ResourceList;
- this.object2Blob = object2Blob;
- this.blob2Object = blob2Object;
- this.object2BlobMd = object2BlobMd;
- this.blob2ObjectGetOptions = blob2ObjectGetOptions;
- this.fetchBlobMetadataProvider = checkNotNull(fetchBlobMetadataProvider, "fetchBlobMetadataProvider");
- this.multipartUploadStrategy = multipartUploadStrategy;
- }
-
- /**
- * This implementation invokes {@link CommonSwiftAsyncClient#listContainers}
- */
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list() {
- return transform(async.listContainers(),
- new Function<Set<ContainerMetadata>, org.jclouds.blobstore.domain.PageSet<? extends StorageMetadata>>() {
- public org.jclouds.blobstore.domain.PageSet<? extends StorageMetadata> apply(
- Set<ContainerMetadata> from) {
- return new PageSetImpl<StorageMetadata>(Iterables.transform(from, container2ResourceMd), null);
- }
- }, userExecutor);
- }
-
- /**
- * This implementation invokes {@link CommonSwiftAsyncClient#containerExists}
- *
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<Boolean> containerExists(String container) {
- return async.containerExists(container);
- }
-
- /**
- * Note that location is currently ignored.
- */
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, String container) {
- return async.createContainer(container);
- }
-
- /**
- * This implementation invokes {@link CommonSwiftAsyncClient#listBucket}
- *
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list(String container, ListContainerOptions options) {
- org.jclouds.openstack.swift.options.ListContainerOptions httpOptions = container2ContainerListOptions
- .apply(options);
- ListenableFuture<PageSet<ObjectInfo>> returnVal = async.listObjects(container, httpOptions);
- ListenableFuture<PageSet<? extends StorageMetadata>> list = transform(returnVal, container2ResourceList,
- userExecutor);
- return options.isDetailed() ? transform(list, fetchBlobMetadataProvider.get().setContainerName(container),
- userExecutor) : list;
- }
-
- /**
- * This implementation invokes {@link CommonSwiftAsyncClient#objectExists}
- *
- * @param container
- * container name
- * @param key
- * object key
- */
- @Override
- public ListenableFuture<Boolean> blobExists(String container, String key) {
- return async.objectExists(container, key);
- }
-
- /**
- * This implementation invokes {@link CommonSwiftAsyncClient#headObject}
- *
- * @param container
- * container name
- * @param key
- * object key
- */
- @Override
- public ListenableFuture<BlobMetadata> blobMetadata(String container, String key) {
- return transform(async.getObjectInfo(container, key),
- new Function<MutableObjectInfoWithMetadata, BlobMetadata>() {
-
- @Override
- public BlobMetadata apply(MutableObjectInfoWithMetadata from) {
- return object2BlobMd.apply(from);
- }
-
- }, userExecutor);
- }
-
- /**
- * This implementation invokes {@link CommonSwiftAsyncClient#getObject}
- *
- * @param container
- * container name
- * @param key
- * object key
- */
- @Override
- public ListenableFuture<Blob> getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions options) {
- GetOptions httpOptions = blob2ObjectGetOptions.apply(options);
- ListenableFuture<SwiftObject> returnVal = async.getObject(container, key, httpOptions);
- return transform(returnVal, object2Blob, userExecutor);
- }
-
- /**
- * This implementation invokes {@link CommonSwiftAsyncClient#putObject}
- *
- * @param container
- * container name
- * @param blob
- * object
- */
- @Override
- public ListenableFuture<String> putBlob(String container, Blob blob) {
- createParentIfNeededAsync(this, container, blob);
- return async.putObject(container, blob2Object.apply(blob));
- }
-
- /**
- * This implementation invokes {@link CommonSwiftAsyncClient#removeObject}
- *
- * @param container
- * container name
- * @param key
- * object key
- */
- @Override
- public ListenableFuture<Void> removeBlob(String container, String key) {
- return async.removeObject(container, key);
- }
-
- @Override
- protected boolean deleteAndVerifyContainerGone(String container) {
- return sync.deleteContainerIfEmpty(container);
- }
-
- @Override
- public ListenableFuture<String> putBlob(String container, Blob blob, PutOptions options) {
- if (options.isMultipart()) {
- return multipartUploadStrategy.get().execute(container, blob, options, blob2Object);
- } else {
- return putBlob(container, blob);
- }
- }
-
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, String container,
- CreateContainerOptions options) {
- if (options.isPublicRead())
- throw new UnsupportedOperationException("publicRead");
- return createContainerInLocation(location, container);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSigner.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSigner.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSigner.java
index 21340d8..f68b8f2 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSigner.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSigner.java
@@ -40,7 +40,7 @@ import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpRequestFilter;
import org.jclouds.http.options.GetOptions;
-import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
+import org.jclouds.openstack.swift.CommonSwiftClient;
import org.jclouds.openstack.swift.TemporaryUrlKey;
import org.jclouds.openstack.swift.blobstore.functions.BlobToObject;
import org.jclouds.openstack.swift.domain.SwiftObject;
@@ -56,7 +56,7 @@ import com.google.common.reflect.Invokable;
import com.google.inject.Provider;
@Singleton
-public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRequestSigner {
+public class SwiftBlobSigner<T extends CommonSwiftClient> implements BlobRequestSigner {
private final Function<Invocation, HttpRequest> processor;
private final Crypto crypto;
@@ -75,7 +75,7 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
* create a signer for this subtype of swift
*
* @param processor
- * bound to the current subclass of {@link CommonSwiftAsyncClient}
+ * bound to the current subclass of {@link CommonSwiftClient}
*/
@Inject
protected SwiftBlobSigner(BlobToObject blobToObject, BlobToHttpGetOptions blob2HttpGetOptions, Crypto crypto,
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java
index 33f8e27..5387b8a 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java
@@ -16,26 +16,21 @@
*/
package org.jclouds.openstack.swift.blobstore.config;
-
import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
-import org.jclouds.openstack.swift.blobstore.SwiftAsyncBlobStore;
+import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
import org.jclouds.openstack.swift.blobstore.SwiftBlobStore;
import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
-/**
- * Configures the {@link CloudFilesBlobStoreContext}; requires
- * {@link SwiftAsyncBlobStore} bound.
- */
public class SwiftBlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
- bind(AsyncBlobStore.class).to(SwiftAsyncBlobStore.class).in(Scopes.SINGLETON);
+ bind(AsyncBlobStore.class).to(SubmissionAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(SwiftBlobStore.class).in(Scopes.SINGLETON);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/TemporaryUrlExtensionModule.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/TemporaryUrlExtensionModule.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/TemporaryUrlExtensionModule.java
index ede8761..b514f32 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/TemporaryUrlExtensionModule.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/TemporaryUrlExtensionModule.java
@@ -16,42 +16,42 @@
*/
package org.jclouds.openstack.swift.blobstore.config;
-import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi;
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
import java.util.concurrent.TimeUnit;
+
import javax.inject.Singleton;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.date.TimeStamp;
-import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
-import org.jclouds.openstack.swift.SwiftAsyncClient;
-import org.jclouds.openstack.swift.SwiftKeystoneAsyncClient;
+import org.jclouds.openstack.swift.CommonSwiftClient;
+import org.jclouds.openstack.swift.SwiftClient;
+import org.jclouds.openstack.swift.SwiftKeystoneClient;
import org.jclouds.openstack.swift.TemporaryUrlKey;
import org.jclouds.openstack.swift.blobstore.SwiftBlobSigner;
-import org.jclouds.openstack.swift.extensions.KeystoneTemporaryUrlKeyAsyncApi;
+import org.jclouds.openstack.swift.extensions.KeystoneTemporaryUrlKeyApi;
import org.jclouds.openstack.swift.extensions.TemporaryUrlKeyApi;
-import org.jclouds.openstack.swift.extensions.TemporaryUrlKeyAsyncApi;
import org.jclouds.openstack.swift.suppliers.ReturnOrFetchTemporaryUrlKey;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
-import com.google.inject.name.Named;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
+import com.google.inject.name.Named;
/**
* Isolates dependencies needed for {@link SwiftBlobSigner}
*/
-public abstract class TemporaryUrlExtensionModule<A extends CommonSwiftAsyncClient> extends AbstractModule {
+public abstract class TemporaryUrlExtensionModule<A extends CommonSwiftClient> extends AbstractModule {
- public static class SwiftTemporaryUrlExtensionModule extends TemporaryUrlExtensionModule<SwiftAsyncClient> {
+ public static class SwiftTemporaryUrlExtensionModule extends TemporaryUrlExtensionModule<SwiftClient> {
@Override
protected void bindRequestSigner() {
- bind(BlobRequestSigner.class).to(new TypeLiteral<SwiftBlobSigner<SwiftAsyncClient>>() {
+ bind(BlobRequestSigner.class).to(new TypeLiteral<SwiftBlobSigner<SwiftClient>>() {
});
}
@@ -62,15 +62,16 @@ public abstract class TemporaryUrlExtensionModule<A extends CommonSwiftAsyncClie
*
*/
public static class SwiftKeystoneTemporaryUrlExtensionModule extends
- TemporaryUrlExtensionModule<SwiftKeystoneAsyncClient> {
+ TemporaryUrlExtensionModule<SwiftKeystoneClient> {
protected void bindTemporaryUrlKeyApi() {
- bindSyncToAsyncHttpApi(binder(), TemporaryUrlKeyApi.class, KeystoneTemporaryUrlKeyAsyncApi.class);
+ bindHttpApi(binder(), KeystoneTemporaryUrlKeyApi.class);
+ bind(TemporaryUrlKeyApi.class).to(KeystoneTemporaryUrlKeyApi.class);
}
@Override
protected void bindRequestSigner() {
- bind(BlobRequestSigner.class).to(new TypeLiteral<SwiftBlobSigner<SwiftKeystoneAsyncClient>>() {
+ bind(BlobRequestSigner.class).to(new TypeLiteral<SwiftBlobSigner<SwiftKeystoneClient>>() {
});
}
@@ -110,7 +111,6 @@ public abstract class TemporaryUrlExtensionModule<A extends CommonSwiftAsyncClie
protected abstract void bindRequestSigner();
protected void bindTemporaryUrlKeyApi() {
- bindSyncToAsyncHttpApi(binder(), TemporaryUrlKeyApi.class, TemporaryUrlKeyAsyncApi.class);
+ bindHttpApi(binder(), TemporaryUrlKeyApi.class);
}
-
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
index bf11489..6257799 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
@@ -43,10 +43,8 @@ import org.jclouds.blobstore.reference.BlobStoreConstants;
import org.jclouds.io.Payload;
import org.jclouds.io.PayloadSlicer;
import org.jclouds.logging.Logger;
-import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
import org.jclouds.openstack.swift.CommonSwiftClient;
-import org.jclouds.openstack.swift.SwiftApiMetadata;
-import org.jclouds.openstack.swift.blobstore.SwiftAsyncBlobStore;
+import org.jclouds.openstack.swift.blobstore.SwiftBlobStore;
import org.jclouds.openstack.swift.blobstore.functions.BlobToObject;
import org.jclouds.util.Throwables2;
@@ -93,13 +91,13 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
private final ListeningExecutorService ioExecutor;
- protected final SwiftAsyncBlobStore ablobstore;
+ protected final SwiftBlobStore blobstore;
protected final PayloadSlicer slicer;
@Inject
- public ParallelMultipartUploadStrategy(SwiftAsyncBlobStore ablobstore, PayloadSlicer slicer,
+ public ParallelMultipartUploadStrategy(SwiftBlobStore blobstore, PayloadSlicer slicer,
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor) {
- this.ablobstore = checkNotNull(ablobstore, "ablobstore");
+ this.blobstore = checkNotNull(blobstore, "blobstore");
this.slicer = checkNotNull(slicer, "slicer");
this.ioExecutor = checkNotNull(ioExecutor, "ioExecutor");
}
@@ -112,22 +110,26 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
final Map<Integer, ListenableFuture<String>> futureParts,
final AtomicInteger errors, final int maxRetries, final Map<Integer, Exception> errorMap,
final Queue<Part> toRetry, final CountDownLatch latch,
- BlobToObject blob2Object) {
+ final BlobToObject blob2Object) {
if (errors.get() > maxRetries) {
activeParts.remove(part); // remove part from the bounded-queue without blocking
latch.countDown();
return;
}
- final CommonSwiftAsyncClient client = ablobstore.getContext().unwrap(SwiftApiMetadata.CONTEXT_TOKEN).getAsyncApi();
+ final CommonSwiftClient client = blobstore.getContext().unwrapApi(CommonSwiftClient.class);
Payload chunkedPart = slicer.slice(payload, offset, size);
logger.debug(String.format("async uploading part %s of %s to container %s", part, key, container));
final long start = System.currentTimeMillis();
String blobPartName = blob.getMetadata().getName() + PART_SEPARATOR +
String.valueOf(part);
- Blob blobPart = ablobstore.blobBuilder(blobPartName).payload(chunkedPart).
+ final Blob blobPart = blobstore.blobBuilder(blobPartName).payload(chunkedPart).
contentDisposition(blobPartName).build();
- final ListenableFuture<String> futureETag = client.putObject(container, blob2Object.apply(blobPart));
+ final ListenableFuture<String> futureETag = ioExecutor.submit(new Callable<String>() {
+ @Override public String call() throws Exception {
+ return client.putObject(container, blob2Object.apply(blobPart));
+ }
+ });
futureETag.addListener(new Runnable() {
@Override
public void run() {
@@ -171,7 +173,7 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
long chunkSize = algorithm.getChunkSize();
long remaining = algorithm.getRemaining();
if (parts > 0) {
- CommonSwiftClient client = ablobstore.getContext().unwrap(SwiftApiMetadata.CONTEXT_TOKEN).getApi();
+ final CommonSwiftClient client = blobstore.getContext().unwrapApi(CommonSwiftClient.class);
final Map<Integer, ListenableFuture<String>> futureParts =
new ConcurrentHashMap<Integer, ListenableFuture<String>>();
final Map<Integer, Exception> errorMap = Maps.newHashMap();
@@ -246,7 +248,11 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
throw rtex;
}
} else {
- ListenableFuture<String> futureETag = ablobstore.putBlob(container, blob, options);
+ ListenableFuture<String> futureETag = ioExecutor.submit(new Callable<String>() {
+ @Override public String call() throws Exception {
+ return blobstore.putBlob(container, blob, options);
+ }
+ });
return maxTime != null ?
futureETag.get(maxTime, TimeUnit.SECONDS) : futureETag.get();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftHttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftHttpApiModule.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftHttpApiModule.java
new file mode 100644
index 0000000..3a673be
--- /dev/null
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftHttpApiModule.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.swift.config;
+
+import static org.jclouds.util.Suppliers2.getLastValueInMap;
+import static org.jclouds.util.Suppliers2.getValueInMapOrNull;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.json.config.GsonModule.DateAdapter;
+import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
+import org.jclouds.location.reference.LocationConstants;
+import org.jclouds.location.suppliers.RegionIdToURISupplier;
+import org.jclouds.openstack.config.OpenStackAuthenticationModule;
+import org.jclouds.openstack.functions.URIFromAuthenticationResponseForService;
+import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
+import org.jclouds.openstack.reference.AuthHeaders;
+import org.jclouds.openstack.services.ServiceType;
+import org.jclouds.openstack.swift.CommonSwiftClient;
+import org.jclouds.openstack.swift.Storage;
+import org.jclouds.openstack.swift.SwiftClient;
+import org.jclouds.openstack.swift.handlers.ParseSwiftErrorFromHttpResponse;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.annotations.ApiVersion;
+import org.jclouds.rest.config.HttpApiModule;
+
+import com.google.common.base.Supplier;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+
+@ConfiguresHttpApi
+public class SwiftHttpApiModule<S extends CommonSwiftClient> extends HttpApiModule<S> {
+
+ @SuppressWarnings("unchecked")
+ public SwiftHttpApiModule() {
+ this(Class.class.cast(SwiftClient.class));
+ }
+
+ protected SwiftHttpApiModule(Class<S> syncClientType) {
+ super(syncClientType);
+ }
+
+ public static class StorageEndpointModule extends OpenStackAuthenticationModule {
+ @Provides
+ @Singleton
+ @Storage
+ protected Supplier<URI> provideStorageUrl(URIFromAuthenticationResponseForService.Factory factory) {
+ return factory.create(AuthHeaders.STORAGE_URL);
+ }
+ }
+
+ public static class KeystoneStorageEndpointModule extends KeystoneAuthenticationModule {
+ @Provides
+ @Singleton
+ @Storage
+ protected Supplier<URI> provideStorageUrl(RegionIdToURISupplier.Factory factory,
+ @ApiVersion String apiVersion,
+ @Named(LocationConstants.PROPERTY_REGION) String region) {
+
+ //Get the URI's keyed by their region name
+ Supplier<Map<String, Supplier<URI>>> endpointsSupplier = factory.createForApiTypeAndVersion(ServiceType.OBJECT_STORE, apiVersion);
+
+ //Pick the matching region name (if any) otherwise just return an arbitrary URL if no region name is set
+ //NOTE: The region string should never be null (it can be empty) if this object was instantiated via guice
+ // as it pulls these named strings from a Properties object.
+ if (region.isEmpty()) {
+ return getLastValueInMap(endpointsSupplier);
+ } else {
+ return getValueInMapOrNull(endpointsSupplier, region);
+ }
+ }
+ }
+
+ @Override
+ protected void configure() {
+ install(new SwiftObjectModule());
+ bind(DateAdapter.class).to(Iso8601DateAdapter.class);
+ super.configure();
+ bindResolvedClientsToCommonSwift();
+ }
+
+ protected void bindResolvedClientsToCommonSwift() {
+ bind(CommonSwiftClient.class).to(SwiftClient.class).in(Scopes.SINGLETON);
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseSwiftErrorFromHttpResponse.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseSwiftErrorFromHttpResponse.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseSwiftErrorFromHttpResponse.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftKeystoneHttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftKeystoneHttpApiModule.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftKeystoneHttpApiModule.java
new file mode 100644
index 0000000..dd5f4d0
--- /dev/null
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftKeystoneHttpApiModule.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.swift.config;
+
+import org.jclouds.openstack.swift.CommonSwiftClient;
+import org.jclouds.openstack.swift.SwiftKeystoneClient;
+import org.jclouds.rest.ConfiguresHttpApi;
+
+import com.google.inject.Scopes;
+
+@ConfiguresHttpApi
+public class SwiftKeystoneHttpApiModule extends SwiftHttpApiModule<SwiftKeystoneClient> {
+
+ public SwiftKeystoneHttpApiModule() {
+ super(SwiftKeystoneClient.class);
+ }
+
+ protected void bindResolvedClientsToCommonSwift() {
+ bind(CommonSwiftClient.class).to(SwiftKeystoneClient.class).in(Scopes.SINGLETON);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftKeystoneRestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftKeystoneRestClientModule.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftKeystoneRestClientModule.java
deleted file mode 100644
index bac1de6..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftKeystoneRestClientModule.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.swift.config;
-
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
-import org.jclouds.openstack.swift.CommonSwiftClient;
-import org.jclouds.openstack.swift.SwiftKeystoneAsyncClient;
-import org.jclouds.openstack.swift.SwiftKeystoneClient;
-import org.jclouds.rest.ConfiguresRestClient;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Scopes;
-
-@ConfiguresRestClient
-public class SwiftKeystoneRestClientModule extends SwiftRestClientModule<SwiftKeystoneClient, SwiftKeystoneAsyncClient> {
-
- public SwiftKeystoneRestClientModule() {
- super(typeToken(SwiftKeystoneClient.class), typeToken(SwiftKeystoneAsyncClient.class), ImmutableMap
- .<Class<?>, Class<?>> of());
- }
-
- protected void bindResolvedClientsToCommonSwift() {
- bind(CommonSwiftClient.class).to(SwiftKeystoneClient.class).in(Scopes.SINGLETON);
- bind(CommonSwiftAsyncClient.class).to(SwiftKeystoneAsyncClient.class).in(Scopes.SINGLETON);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftRestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftRestClientModule.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftRestClientModule.java
deleted file mode 100644
index 1a6a9a1..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftRestClientModule.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.swift.config;
-import static org.jclouds.reflect.Reflection2.typeToken;
-import static org.jclouds.util.Suppliers2.getLastValueInMap;
-import static org.jclouds.util.Suppliers2.getValueInMapOrNull;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.json.config.GsonModule.DateAdapter;
-import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
-import org.jclouds.location.reference.LocationConstants;
-import org.jclouds.location.suppliers.RegionIdToURISupplier;
-import org.jclouds.openstack.config.OpenStackAuthenticationModule;
-import org.jclouds.openstack.functions.URIFromAuthenticationResponseForService;
-import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
-import org.jclouds.openstack.reference.AuthHeaders;
-import org.jclouds.openstack.services.ServiceType;
-import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
-import org.jclouds.openstack.swift.CommonSwiftClient;
-import org.jclouds.openstack.swift.Storage;
-import org.jclouds.openstack.swift.SwiftAsyncClient;
-import org.jclouds.openstack.swift.SwiftClient;
-import org.jclouds.openstack.swift.handlers.ParseSwiftErrorFromHttpResponse;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.annotations.ApiVersion;
-import org.jclouds.rest.config.RestClientModule;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.reflect.TypeToken;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-
-@ConfiguresRestClient
-public class SwiftRestClientModule<S extends CommonSwiftClient, A extends CommonSwiftAsyncClient> extends
- RestClientModule<S, A> {
-
- @SuppressWarnings("unchecked")
- public SwiftRestClientModule() {
- this(TypeToken.class.cast(typeToken(SwiftClient.class)), TypeToken.class.cast(typeToken(SwiftAsyncClient.class)),
- ImmutableMap.<Class<?>, Class<?>> of());
- }
-
- protected SwiftRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
- Map<Class<?>, Class<?>> sync2Async) {
- super(syncClientType, asyncClientType, sync2Async);
- }
-
- public static class StorageEndpointModule extends OpenStackAuthenticationModule {
- @Provides
- @Singleton
- @Storage
- protected Supplier<URI> provideStorageUrl(URIFromAuthenticationResponseForService.Factory factory) {
- return factory.create(AuthHeaders.STORAGE_URL);
- }
- }
-
- public static class KeystoneStorageEndpointModule extends KeystoneAuthenticationModule {
- @Provides
- @Singleton
- @Storage
- protected Supplier<URI> provideStorageUrl(RegionIdToURISupplier.Factory factory,
- @ApiVersion String apiVersion,
- @Named(LocationConstants.PROPERTY_REGION) String region) {
-
- //Get the URI's keyed by their region name
- Supplier<Map<String, Supplier<URI>>> endpointsSupplier = factory.createForApiTypeAndVersion(ServiceType.OBJECT_STORE, apiVersion);
-
- //Pick the matching region name (if any) otherwise just return an arbitrary URL if no region name is set
- //NOTE: The region string should never be null (it can be empty) if this object was instantiated via guice
- // as it pulls these named strings from a Properties object.
- if (region.isEmpty()) {
- return getLastValueInMap(endpointsSupplier);
- } else {
- return getValueInMapOrNull(endpointsSupplier, region);
- }
- }
- }
-
- @Override
- protected void configure() {
- install(new SwiftObjectModule());
- bind(DateAdapter.class).to(Iso8601DateAdapter.class);
- super.configure();
- bindResolvedClientsToCommonSwift();
- }
-
- protected void bindResolvedClientsToCommonSwift() {
- bind(CommonSwiftClient.class).to(SwiftClient.class).in(Scopes.SINGLETON);
- bind(CommonSwiftAsyncClient.class).to(SwiftAsyncClient.class).in(Scopes.SINGLETON);
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseSwiftErrorFromHttpResponse.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseSwiftErrorFromHttpResponse.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseSwiftErrorFromHttpResponse.class);
- }
-
-}
[34/52] [abbrv] git commit: Move off confusing test names.
Posted by an...@apache.org.
Move off confusing test names.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/99e217b7
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/99e217b7
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/99e217b7
Branch: refs/heads/use-agentproxy-008
Commit: 99e217b720248e26b081ff379aa2cf4d15281965
Parents: 1b2cee0
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 16:13:39 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 17:22:18 2014 -0700
----------------------------------------------------------------------
.../java/org/jclouds/atmos/AtmosClientTest.java | 4 +-
.../blobstore/AtmosBlobRequestSignerTest.java | 4 +-
.../cloudservers/CloudServersClientTest.java | 4 +-
.../internal/BaseCloudStackApiTest.java | 4 +-
.../internal/BaseCloudStackExpectTest.java | 4 +-
.../jclouds/ec2/features/BaseEC2ApiTest.java | 4 +-
.../jclouds/ec2/internal/BaseEC2ExpectTest.java | 4 +-
.../elasticstack/ElasticStackApiTest.java | 4 +-
.../BaseKeystoneRestClientExpectTest.java | 4 +-
.../s3/internal/BaseS3ClientExpectTest.java | 4 +-
.../jclouds/s3/internal/BaseS3ClientTest.java | 4 +-
.../openstack/swift/CommonSwiftClientTest.java | 4 +-
.../swift/internal/BaseSwiftExpectTest.java | 4 +-
.../internal/BaseSwiftKeystoneExpectTest.java | 4 +-
.../jclouds/vcloud/VCloudVersionsApiTest.java | 5 +-
.../BaseVCloudComputeServiceExpectTest.java | 4 +-
.../vcloud/internal/BaseVCloudApiTest.java | 4 +-
.../vcloud/internal/VCloudLoginApiTest.java | 4 +-
.../TransientBlobRequestSignerTest.java | 4 +-
.../internal/BaseBlobSignerExpectTest.java | 4 +-
.../internal/OpenStackAuthClientTest.java | 4 +-
.../BaseKeystoneRestClientExpectTest.java | 4 +-
.../http/IntegrationTestClientExpectTest.java | 4 +-
.../DelegateAnnotationExpectTest.java | 4 +-
.../JAXBResponseParserAnnotationExpectTest.java | 4 +-
.../PATCHAnnotationExpectTest.java | 4 +-
.../ProvidesAnnotationExpectTest.java | 4 +-
.../jclouds/rest/internal/BaseAsyncApiTest.java | 98 --------------------
.../rest/internal/BaseAsyncClientTest.java | 3 +-
.../BaseRestAnnotationProcessingTest.java | 98 ++++++++++++++++++++
.../rest/internal/BaseRestClientExpectTest.java | 25 -----
.../aws/ec2/features/BaseAWSEC2ApiTest.java | 4 +-
.../s3/internal/BaseAWSS3ClientExpectTest.java | 4 +-
.../jclouds/azureblob/AzureBlobClientTest.java | 4 +-
.../BindAzureBlobMetadataToRequestTest.java | 4 +-
.../blobstore/AzureBlobRequestSignerTest.java | 4 +-
.../java/org/jclouds/glesys/GleSYSApiTest.java | 4 +-
.../gogrid/features/BaseGoGridApiTest.java | 6 +-
.../features/BaseGoGridHttpApiExpectTest.java | 6 +-
...HPCloudObjectStorageBlobStoreExpectTest.java | 4 +-
40 files changed, 175 insertions(+), 198 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientTest.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientTest.java
index 7fa5d4f..8a32b37 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientTest.java
@@ -47,7 +47,7 @@ import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.ReturnTrueIf2xx;
import org.jclouds.http.options.GetOptions;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -59,7 +59,7 @@ import com.google.common.reflect.Invokable;
import com.google.inject.Module;
@Test(groups = "unit", testName = "AtmosClientTest")
-public class AtmosClientTest extends BaseAsyncClientTest<AtmosClient> {
+public class AtmosClientTest extends BaseRestAnnotationProcessingTest<AtmosClient> {
private BlobToObject blobToObject;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java
index 39720ab..46348fb 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java
@@ -32,7 +32,7 @@ import org.jclouds.blobstore.domain.Blob.Factory;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -45,7 +45,7 @@ import com.google.inject.Module;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "AtmosBlobRequestSignerTest")
-public class AtmosBlobRequestSignerTest extends BaseAsyncClientTest<AtmosClient> {
+public class AtmosBlobRequestSignerTest extends BaseRestAnnotationProcessingTest<AtmosClient> {
public AtmosBlobRequestSignerTest() {
// this is base64 decoded in the signer;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java
index 67ecd33..28f9ca6 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java
@@ -62,7 +62,7 @@ import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule.Ge
import org.jclouds.openstack.keystone.v1_1.domain.Auth;
import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.testng.annotations.Test;
@@ -73,7 +73,7 @@ import com.google.inject.Module;
import com.google.inject.Provides;
@Test(groups = "unit", singleThreaded = true, testName = "CloudServersClientTest")
-public class CloudServersClientTest extends BaseAsyncClientTest<CloudServersClient> {
+public class CloudServersClientTest extends BaseRestAnnotationProcessingTest<CloudServersClient> {
public void testCreateServer() throws IOException, SecurityException, NoSuchMethodException {
Invokable<?, ?> method = method(CloudServersClient.class, "createServer", String.class, int.class, int.class,
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiTest.java
index 664758d..5683bdc 100644
--- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiTest.java
+++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiTest.java
@@ -25,11 +25,11 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseAsyncApiTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import com.google.inject.Module;
-public abstract class BaseCloudStackApiTest<T> extends BaseAsyncApiTest<T> {
+public abstract class BaseCloudStackApiTest<T> extends BaseRestAnnotationProcessingTest<T> {
@ConfiguresHttpApi
public static class CloudStackHttpApiModuleExtension extends CloudStackHttpApiModule {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackExpectTest.java
index 5237efc..275bc6f 100644
--- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackExpectTest.java
+++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackExpectTest.java
@@ -28,7 +28,7 @@ import org.jclouds.cloudstack.CloudStackApiMetadata;
import org.jclouds.cloudstack.CloudStackContext;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import com.google.common.base.Function;
import com.google.inject.Module;
@@ -36,7 +36,7 @@ import com.google.inject.Module;
/**
* Base class for writing CloudStack Rest Client Expect tests
*/
-public abstract class BaseCloudStackExpectTest<S> extends BaseRestClientExpectTest<S> {
+public abstract class BaseCloudStackExpectTest<S> extends BaseRestApiExpectTest<S> {
public BaseCloudStackExpectTest() {
provider = "cloudstack";
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/ec2/src/test/java/org/jclouds/ec2/features/BaseEC2ApiTest.java
----------------------------------------------------------------------
diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/features/BaseEC2ApiTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/features/BaseEC2ApiTest.java
index 3a2e645..e70f760 100644
--- a/apis/ec2/src/test/java/org/jclouds/ec2/features/BaseEC2ApiTest.java
+++ b/apis/ec2/src/test/java/org/jclouds/ec2/features/BaseEC2ApiTest.java
@@ -40,7 +40,7 @@ import org.jclouds.location.config.LocationModule;
import org.jclouds.location.suppliers.RegionIdToURISupplier;
import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseAsyncApiTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.util.Suppliers2;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -55,7 +55,7 @@ import com.google.inject.Module;
import com.google.inject.Provides;
@Test(groups = "unit")
-public abstract class BaseEC2ApiTest<T> extends BaseAsyncApiTest<T> {
+public abstract class BaseEC2ApiTest<T> extends BaseRestAnnotationProcessingTest<T> {
@ConfiguresHttpApi
protected static class StubEC2HttpApiModule extends BaseEC2HttpApiModule<EC2Api> {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ExpectTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ExpectTest.java
index 29808b7..d4cb9ec 100644
--- a/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ExpectTest.java
+++ b/apis/ec2/src/test/java/org/jclouds/ec2/internal/BaseEC2ExpectTest.java
@@ -26,7 +26,7 @@ import org.jclouds.date.DateService;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.testng.annotations.BeforeClass;
import com.google.common.base.Functions;
@@ -35,7 +35,7 @@ import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Injector;
-public abstract class BaseEC2ExpectTest<T> extends BaseRestClientExpectTest<T> {
+public abstract class BaseEC2ExpectTest<T> extends BaseRestApiExpectTest<T> {
protected static final String CONSTANT_DATE = "2012-04-16T15:54:08.897Z";
protected DateService dateService = new SimpleDateFormatDateService();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackApiTest.java
----------------------------------------------------------------------
diff --git a/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackApiTest.java b/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackApiTest.java
index b4a77a6..83e0ecd 100644
--- a/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackApiTest.java
+++ b/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackApiTest.java
@@ -46,7 +46,7 @@ import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.io.Payload;
import org.jclouds.io.Payloads;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.testng.annotations.Test;
@@ -61,7 +61,7 @@ import com.google.inject.Scopes;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "ElasticStackApiTest")
-public class ElasticStackApiTest extends BaseAsyncClientTest<ElasticStackApi> {
+public class ElasticStackApiTest extends BaseRestAnnotationProcessingTest<ElasticStackApi> {
public void testListServers() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackApi.class, "listServers");
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/rackspace-cloudidentity/src/test/java/org/jclouds/rackspace/cloudidentity/v1_1/internal/BaseKeystoneRestClientExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/rackspace-cloudidentity/src/test/java/org/jclouds/rackspace/cloudidentity/v1_1/internal/BaseKeystoneRestClientExpectTest.java b/apis/rackspace-cloudidentity/src/test/java/org/jclouds/rackspace/cloudidentity/v1_1/internal/BaseKeystoneRestClientExpectTest.java
index 4638c3e..51bc63b 100644
--- a/apis/rackspace-cloudidentity/src/test/java/org/jclouds/rackspace/cloudidentity/v1_1/internal/BaseKeystoneRestClientExpectTest.java
+++ b/apis/rackspace-cloudidentity/src/test/java/org/jclouds/rackspace/cloudidentity/v1_1/internal/BaseKeystoneRestClientExpectTest.java
@@ -19,14 +19,14 @@ package org.jclouds.rackspace.cloudidentity.v1_1.internal;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.rackspace.cloudidentity.v1_1.config.AuthenticationServiceModule;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import com.google.common.net.HttpHeaders;
/**
* Base class for writing KeyStone Rest Client Expect tests
*/
-public class BaseKeystoneRestClientExpectTest<S> extends BaseRestClientExpectTest<S> {
+public class BaseKeystoneRestClientExpectTest<S> extends BaseRestApiExpectTest<S> {
protected String endpoint = "http://localhost:5000";
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientExpectTest.java b/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientExpectTest.java
index 260a242..b8b64c6 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientExpectTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientExpectTest.java
@@ -18,7 +18,7 @@ package org.jclouds.s3.internal;
import org.jclouds.date.TimeStamp;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.jclouds.s3.S3ApiMetadata;
import org.jclouds.s3.S3Client;
import org.jclouds.s3.config.S3HttpApiModule;
@@ -26,7 +26,7 @@ import org.jclouds.s3.config.S3HttpApiModule;
import com.google.common.base.Supplier;
import com.google.inject.Module;
-public abstract class BaseS3ClientExpectTest extends BaseRestClientExpectTest<S3Client> {
+public abstract class BaseS3ClientExpectTest extends BaseRestApiExpectTest<S3Client> {
protected static final String CONSTANT_DATE = "2009-11-08T15:54:08.897Z";
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientTest.java b/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientTest.java
index 2b418ae..63d4481 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientTest.java
@@ -21,7 +21,7 @@ import static org.testng.Assert.assertEquals;
import java.io.IOException;
import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.s3.S3ApiMetadata;
import org.jclouds.s3.S3Client;
import org.jclouds.s3.blobstore.functions.BlobToObject;
@@ -30,7 +30,7 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test(groups = "unit")
-public abstract class BaseS3ClientTest<T extends S3Client> extends BaseAsyncClientTest<T> {
+public abstract class BaseS3ClientTest<T extends S3Client> extends BaseRestAnnotationProcessingTest<T> {
protected BlobToObject blobToS3Object;
protected RequestAuthorizeSignature filter;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java
index d021eb5..ec5280b 100644
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java
+++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java
@@ -35,7 +35,7 @@ import org.jclouds.openstack.swift.blobstore.SwiftBlobSigner;
import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule;
import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule;
import org.jclouds.openstack.swift.config.SwiftHttpApiModule;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.testng.annotations.Test;
import com.google.common.base.Supplier;
@@ -50,7 +50,7 @@ import com.google.inject.TypeLiteral;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "CommonSwiftClientTest")
-public abstract class CommonSwiftClientTest extends BaseAsyncClientTest<SwiftClient> {
+public abstract class CommonSwiftClientTest extends BaseRestAnnotationProcessingTest<SwiftClient> {
public static final long UNIX_EPOCH_TIMESTAMP = 123456789L;
public static final String TEMPORARY_URL_KEY = "get-or-set-X-Account-Meta-Temp-Url-Key";
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/BaseSwiftExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/BaseSwiftExpectTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/BaseSwiftExpectTest.java
index c28fcaf..96438a1 100644
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/BaseSwiftExpectTest.java
+++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/BaseSwiftExpectTest.java
@@ -20,12 +20,12 @@ import java.util.Properties;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
/**
* Base class for writing Swift Expect tests
*/
-public class BaseSwiftExpectTest<T> extends BaseRestClientExpectTest<T> {
+public class BaseSwiftExpectTest<T> extends BaseRestApiExpectTest<T> {
protected String endpoint = "http://myhost:8080/auth";
protected HttpRequest authRequest;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/BaseSwiftKeystoneExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/BaseSwiftKeystoneExpectTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/BaseSwiftKeystoneExpectTest.java
index 71c0a10..844b5a8 100644
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/BaseSwiftKeystoneExpectTest.java
+++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/BaseSwiftKeystoneExpectTest.java
@@ -23,12 +23,12 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.openstack.keystone.v2_0.internal.KeystoneFixture;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
/**
* Base class for writing Swift Keystone Expect tests
*/
-public class BaseSwiftKeystoneExpectTest<T> extends BaseRestClientExpectTest<T> {
+public class BaseSwiftKeystoneExpectTest<T> extends BaseRestApiExpectTest<T> {
protected HttpRequest keystoneAuthWithUsernameAndPassword;
protected HttpRequest keystoneAuthWithUsernameAndPasswordAndTenantName;
protected HttpRequest keystoneAuthWithAccessKeyAndSecretKeyAndTenantName;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
index ac872f5..6095e1d 100644
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
package org.jclouds.vcloud;
+
import static org.jclouds.reflect.Reflection2.method;
import static org.testng.Assert.assertEquals;
@@ -24,7 +25,7 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.jclouds.vcloud.xml.SupportedVersionsHandler;
import org.testng.annotations.Test;
@@ -37,7 +38,7 @@ import com.google.common.reflect.Invokable;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "VCloudVersionsApiTest")
-public class VCloudVersionsApiTest extends BaseAsyncClientTest<VCloudVersionsApi> {
+public class VCloudVersionsApiTest extends BaseRestAnnotationProcessingTest<VCloudVersionsApi> {
public void testVersions() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(VCloudVersionsApi.class, "getSupportedVersions");
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
index 4fbec0c..f343d6e 100644
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
@@ -25,7 +25,7 @@ import org.jclouds.apis.ApiMetadata;
import org.jclouds.compute.ComputeService;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.jclouds.vcloud.VCloudApiMetadata;
import org.jclouds.vcloud.VCloudMediaType;
@@ -36,7 +36,7 @@ import com.google.inject.Module;
/**
* Base class for writing VCloud Expect tests for ComputeService operations
*/
-public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestClientExpectTest<ComputeService> {
+public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestApiExpectTest<ComputeService> {
protected static final String ENDPOINT = "https://zone.myvcloud.com/api";
protected HttpRequest versionsRequest = HttpRequest.builder().method("GET").endpoint(
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
index 0f97e26..feeec7c 100644
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
@@ -34,7 +34,7 @@ import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.vcloud.VCloudApiMetadata;
import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.VCloudVersionsApi;
@@ -73,7 +73,7 @@ import com.google.inject.TypeLiteral;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "BaseVCloudApiTest")
-public abstract class BaseVCloudApiTest<T> extends BaseAsyncClientTest<T> {
+public abstract class BaseVCloudApiTest<T> extends BaseRestAnnotationProcessingTest<T> {
@Override
protected void checkFilters(HttpRequest request) {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
index 9971e74..c2896dc 100644
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
@@ -27,7 +27,7 @@ import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.location.Provider;
import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.jclouds.vcloud.endpoints.VCloudLogin;
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
@@ -45,7 +45,7 @@ import com.google.inject.Provides;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "VCloudLoginApiTest")
-public class VCloudLoginApiTest extends BaseAsyncClientTest<VCloudLoginApi> {
+public class VCloudLoginApiTest extends BaseRestAnnotationProcessingTest<VCloudLoginApi> {
public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(VCloudLoginApi.class, "login");
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java
----------------------------------------------------------------------
diff --git a/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java b/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java
index fb1e89b..fab598f 100644
--- a/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java
+++ b/blobstore/src/test/java/org/jclouds/blobstore/TransientBlobRequestSignerTest.java
@@ -27,7 +27,7 @@ import org.jclouds.blobstore.config.LocalBlobStore;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobBuilder;
import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -41,7 +41,7 @@ import com.google.common.io.ByteSource;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "TransientBlobRequestSignerTest")
-public class TransientBlobRequestSignerTest extends BaseAsyncClientTest<LocalBlobStore> {
+public class TransientBlobRequestSignerTest extends BaseRestAnnotationProcessingTest<LocalBlobStore> {
private BlobRequestSigner signer;
private Provider<BlobBuilder> blobFactory;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/blobstore/src/test/java/org/jclouds/blobstore/internal/BaseBlobSignerExpectTest.java
----------------------------------------------------------------------
diff --git a/blobstore/src/test/java/org/jclouds/blobstore/internal/BaseBlobSignerExpectTest.java b/blobstore/src/test/java/org/jclouds/blobstore/internal/BaseBlobSignerExpectTest.java
index 02de7f1..7b3aad0 100644
--- a/blobstore/src/test/java/org/jclouds/blobstore/internal/BaseBlobSignerExpectTest.java
+++ b/blobstore/src/test/java/org/jclouds/blobstore/internal/BaseBlobSignerExpectTest.java
@@ -28,7 +28,7 @@ import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.options.GetOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.testng.annotations.Test;
import com.google.common.base.Function;
@@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.hash.HashCode;
import com.google.inject.Module;
-public abstract class BaseBlobSignerExpectTest extends BaseRestClientExpectTest<BlobStore> {
+public abstract class BaseBlobSignerExpectTest extends BaseRestApiExpectTest<BlobStore> {
/**
* define the requests and responses needed to initialize the blobstore. For
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java
----------------------------------------------------------------------
diff --git a/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java b/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java
index 9e14ba7..5829fa8 100644
--- a/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java
+++ b/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java
@@ -27,7 +27,7 @@ import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders;
import org.jclouds.rest.AnonymousRestApiMetadata;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.testng.annotations.Test;
@@ -35,7 +35,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.reflect.Invokable;
@Test(groups = "unit", testName = "OpenStackAuthClientTest")
-public class OpenStackAuthClientTest extends BaseAsyncClientTest<OpenStackAuthClient> {
+public class OpenStackAuthClientTest extends BaseRestAnnotationProcessingTest<OpenStackAuthClient> {
public void testAuthenticate() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(OpenStackAuthClient.class, "authenticate", String.class, String.class);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/common/openstack/src/test/java/org/jclouds/openstack/keystone/v1_1/internal/BaseKeystoneRestClientExpectTest.java
----------------------------------------------------------------------
diff --git a/common/openstack/src/test/java/org/jclouds/openstack/keystone/v1_1/internal/BaseKeystoneRestClientExpectTest.java b/common/openstack/src/test/java/org/jclouds/openstack/keystone/v1_1/internal/BaseKeystoneRestClientExpectTest.java
index beada2b..1a764aa 100644
--- a/common/openstack/src/test/java/org/jclouds/openstack/keystone/v1_1/internal/BaseKeystoneRestClientExpectTest.java
+++ b/common/openstack/src/test/java/org/jclouds/openstack/keystone/v1_1/internal/BaseKeystoneRestClientExpectTest.java
@@ -19,14 +19,14 @@ package org.jclouds.openstack.keystone.v1_1.internal;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import com.google.common.net.HttpHeaders;
/**
* Base class for writing KeyStone Rest Client Expect tests
*/
-public class BaseKeystoneRestClientExpectTest<S> extends BaseRestClientExpectTest<S> {
+public class BaseKeystoneRestClientExpectTest<S> extends BaseRestApiExpectTest<S> {
protected String endpoint = "http://localhost:5000";
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/core/src/test/java/org/jclouds/http/IntegrationTestClientExpectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/http/IntegrationTestClientExpectTest.java b/core/src/test/java/org/jclouds/http/IntegrationTestClientExpectTest.java
index abb64ea..33cb3a3 100644
--- a/core/src/test/java/org/jclouds/http/IntegrationTestClientExpectTest.java
+++ b/core/src/test/java/org/jclouds/http/IntegrationTestClientExpectTest.java
@@ -26,7 +26,7 @@ import javax.net.ssl.SSLException;
import org.jclouds.providers.JcloudsTestBlobStoreProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.testng.annotations.Test;
import com.google.common.base.Function;
@@ -37,7 +37,7 @@ import com.google.common.base.Function;
*/
@Test(groups = "unit", testName = "IntegrationTestClientExpectTest")
// only needed as IntegrationTestClient is not registered in rest.properties
-public class IntegrationTestClientExpectTest extends BaseRestClientExpectTest<IntegrationTestClient> {
+public class IntegrationTestClientExpectTest extends BaseRestApiExpectTest<IntegrationTestClient> {
public void testRetryOnSSLExceptionClose() {
// keeps track of request count
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/core/src/test/java/org/jclouds/rest/annotationparsing/DelegateAnnotationExpectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/annotationparsing/DelegateAnnotationExpectTest.java b/core/src/test/java/org/jclouds/rest/annotationparsing/DelegateAnnotationExpectTest.java
index 5c0e4e5..22061c5 100644
--- a/core/src/test/java/org/jclouds/rest/annotationparsing/DelegateAnnotationExpectTest.java
+++ b/core/src/test/java/org/jclouds/rest/annotationparsing/DelegateAnnotationExpectTest.java
@@ -35,7 +35,7 @@ import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.config.RestClientModule;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
@@ -46,7 +46,7 @@ import com.google.inject.Module;
* Tests the ways that {@link Delegate}
*/
@Test(groups = "unit", testName = "DelegateAnnotationExpectTest")
-public class DelegateAnnotationExpectTest extends BaseRestClientExpectTest<DelegateAnnotationExpectTest.DelegatingApi> {
+public class DelegateAnnotationExpectTest extends BaseRestApiExpectTest<DelegateAnnotationExpectTest.DelegatingApi> {
interface DelegatingApi {
@Delegate
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java b/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java
index 676583a..337490a 100644
--- a/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java
+++ b/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java
@@ -33,7 +33,7 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.Transform;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.testng.annotations.Test;
import com.google.common.base.Function;
@@ -45,7 +45,7 @@ import com.google.common.util.concurrent.ListenableFuture;
*/
@Test(groups = "unit", testName = "JAXBResponseParserAnnotationExpectTest")
public class JAXBResponseParserAnnotationExpectTest extends
- BaseRestClientExpectTest<JAXBResponseParserAnnotationExpectTest.TestJAXBApi> {
+ BaseRestApiExpectTest<JAXBResponseParserAnnotationExpectTest.TestJAXBApi> {
@XmlRootElement(name = "test")
public static class TestJAXBDomain {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/core/src/test/java/org/jclouds/rest/annotationparsing/PATCHAnnotationExpectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/annotationparsing/PATCHAnnotationExpectTest.java b/core/src/test/java/org/jclouds/rest/annotationparsing/PATCHAnnotationExpectTest.java
index befce6d..eaec4cf 100644
--- a/core/src/test/java/org/jclouds/rest/annotationparsing/PATCHAnnotationExpectTest.java
+++ b/core/src/test/java/org/jclouds/rest/annotationparsing/PATCHAnnotationExpectTest.java
@@ -27,7 +27,7 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.annotations.PATCH;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.testng.annotations.Test;
/**
@@ -35,7 +35,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = "unit", testName = "PATCHAnnotationExpectTest")
public class PATCHAnnotationExpectTest extends
- BaseRestClientExpectTest<PATCHAnnotationExpectTest.TestPATCHAnnotationApi> {
+ BaseRestApiExpectTest<PATCHAnnotationExpectTest.TestPATCHAnnotationApi> {
interface TestPATCHAnnotationApi extends Closeable {
@PATCH
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java b/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java
index ca48213..19260d8 100644
--- a/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java
+++ b/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java
@@ -31,7 +31,7 @@ import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.config.RestClientModule;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
@@ -45,7 +45,7 @@ import com.google.inject.name.Names;
* Tests that we can add {@link Provides} methods on interfaces
*/
@Test(groups = "unit", testName = "ProvidesAnnotationExpectTest")
-public class ProvidesAnnotationExpectTest extends BaseRestClientExpectTest<ProvidesAnnotationExpectTest.ProvidingApi> {
+public class ProvidesAnnotationExpectTest extends BaseRestApiExpectTest<ProvidesAnnotationExpectTest.ProvidingApi> {
interface ProvidingApi extends Closeable {
@Provides
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/core/src/test/java/org/jclouds/rest/internal/BaseAsyncApiTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/BaseAsyncApiTest.java b/core/src/test/java/org/jclouds/rest/internal/BaseAsyncApiTest.java
deleted file mode 100644
index 57d4df5..0000000
--- a/core/src/test/java/org/jclouds/rest/internal/BaseAsyncApiTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import org.jclouds.ContextBuilder;
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.logging.config.NullLoggingModule;
-import org.jclouds.providers.ProviderMetadata;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Binder;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-@Test(groups = "unit")
-public abstract class BaseAsyncApiTest<T> extends BaseRestApiTest {
-
- protected RestAnnotationProcessor processor;
-
- protected abstract void checkFilters(HttpRequest request);
-
- protected Module createModule() {
- return new Module() {
-
- @Override
- public void configure(Binder binder) {
-
- }
-
- };
- }
-
- @BeforeClass
- protected void setupFactory() throws IOException {
- injector = createInjector();
- parserFactory = injector.getInstance(ParseSax.Factory.class);
- processor = injector.getInstance(RestAnnotationProcessor.class);
- }
-
- protected String identity = "identity";
- protected String credential = "credential";
-
- /**
- * @see org.jclouds.providers.Providers#withId
- */
- protected ProviderMetadata createProviderMetadata() {
- return null;
- }
-
- /**
- * @see org.jclouds.apis.Apis#withId
- */
- protected ApiMetadata createApiMetadata() {
- return null;
- }
-
- protected Injector createInjector() {
- ProviderMetadata pm = createProviderMetadata();
-
- ContextBuilder builder = pm != null ? ContextBuilder.newBuilder(pm) : ContextBuilder.newBuilder(ApiMetadata.class
- .cast(checkNotNull(createApiMetadata(),
- "either createApiMetadata or createProviderMetadata must be overridden")));
-
- return builder.credentials(identity, credential)
- .modules(ImmutableSet.of(new MockModule(), new NullLoggingModule(), createModule()))
- .overrides(setupProperties()).buildInjector();
- }
-
- /**
- * override this to supply context-specific parameters during tests.
- */
- protected Properties setupProperties() {
- return new Properties();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/core/src/test/java/org/jclouds/rest/internal/BaseAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/BaseAsyncClientTest.java b/core/src/test/java/org/jclouds/rest/internal/BaseAsyncClientTest.java
index be3cab5..26c4de5 100644
--- a/core/src/test/java/org/jclouds/rest/internal/BaseAsyncClientTest.java
+++ b/core/src/test/java/org/jclouds/rest/internal/BaseAsyncClientTest.java
@@ -19,6 +19,7 @@ package org.jclouds.rest.internal;
import org.testng.annotations.Test;
@Test(groups = "unit")
-public abstract class BaseAsyncClientTest<T> extends BaseAsyncApiTest<T> {
+// TODO: remove once abiquo no longer uses this.
+public abstract class BaseAsyncClientTest<T> extends BaseRestAnnotationProcessingTest<T> {
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/core/src/test/java/org/jclouds/rest/internal/BaseRestAnnotationProcessingTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/BaseRestAnnotationProcessingTest.java b/core/src/test/java/org/jclouds/rest/internal/BaseRestAnnotationProcessingTest.java
new file mode 100644
index 0000000..6a4c5d7
--- /dev/null
+++ b/core/src/test/java/org/jclouds/rest/internal/BaseRestAnnotationProcessingTest.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.jclouds.ContextBuilder;
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.logging.config.NullLoggingModule;
+import org.jclouds.providers.ProviderMetadata;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Binder;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+
+@Test(groups = "unit")
+public abstract class BaseRestAnnotationProcessingTest<T> extends BaseRestApiTest {
+
+ protected RestAnnotationProcessor processor;
+
+ protected abstract void checkFilters(HttpRequest request);
+
+ protected Module createModule() {
+ return new Module() {
+
+ @Override
+ public void configure(Binder binder) {
+
+ }
+
+ };
+ }
+
+ @BeforeClass
+ protected void setupFactory() throws IOException {
+ injector = createInjector();
+ parserFactory = injector.getInstance(ParseSax.Factory.class);
+ processor = injector.getInstance(RestAnnotationProcessor.class);
+ }
+
+ protected String identity = "identity";
+ protected String credential = "credential";
+
+ /**
+ * @see org.jclouds.providers.Providers#withId
+ */
+ protected ProviderMetadata createProviderMetadata() {
+ return null;
+ }
+
+ /**
+ * @see org.jclouds.apis.Apis#withId
+ */
+ protected ApiMetadata createApiMetadata() {
+ return null;
+ }
+
+ protected Injector createInjector() {
+ ProviderMetadata pm = createProviderMetadata();
+
+ ContextBuilder builder = pm != null ? ContextBuilder.newBuilder(pm) : ContextBuilder.newBuilder(ApiMetadata.class
+ .cast(checkNotNull(createApiMetadata(),
+ "either createApiMetadata or createProviderMetadata must be overridden")));
+
+ return builder.credentials(identity, credential)
+ .modules(ImmutableSet.of(new MockModule(), new NullLoggingModule(), createModule()))
+ .overrides(setupProperties()).buildInjector();
+ }
+
+ /**
+ * override this to supply context-specific parameters during tests.
+ */
+ protected Properties setupProperties() {
+ return new Properties();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/core/src/test/java/org/jclouds/rest/internal/BaseRestClientExpectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/BaseRestClientExpectTest.java b/core/src/test/java/org/jclouds/rest/internal/BaseRestClientExpectTest.java
deleted file mode 100644
index cf89bc0..0000000
--- a/core/src/test/java/org/jclouds/rest/internal/BaseRestClientExpectTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.internal;
-
-
-/**
- * Please use {@link BaseRestApiExpectTest}
- */
-public abstract class BaseRestClientExpectTest<S> extends BaseRestApiExpectTest<S> {
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/BaseAWSEC2ApiTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/BaseAWSEC2ApiTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/BaseAWSEC2ApiTest.java
index 30ac6f4..caf6e48 100644
--- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/BaseAWSEC2ApiTest.java
+++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/BaseAWSEC2ApiTest.java
@@ -38,7 +38,7 @@ import org.jclouds.location.config.LocationModule;
import org.jclouds.location.suppliers.RegionIdToURISupplier;
import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseAsyncApiTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.util.Suppliers2;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -53,7 +53,7 @@ import com.google.inject.Module;
import com.google.inject.Provides;
@Test(groups = "unit")
-public abstract class BaseAWSEC2ApiTest<T> extends BaseAsyncApiTest<T> {
+public abstract class BaseAWSEC2ApiTest<T> extends BaseRestAnnotationProcessingTest<T> {
@ConfiguresHttpApi
protected static class StubAWSEC2HttpApiModule extends AWSEC2HttpApiModule {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/providers/aws-s3/src/test/java/org/jclouds/aws/s3/internal/BaseAWSS3ClientExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/internal/BaseAWSS3ClientExpectTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/internal/BaseAWSS3ClientExpectTest.java
index 9613b86..ce0b1a5 100644
--- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/internal/BaseAWSS3ClientExpectTest.java
+++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/internal/BaseAWSS3ClientExpectTest.java
@@ -22,7 +22,7 @@ import org.jclouds.aws.s3.config.AWSS3HttpApiModule;
import org.jclouds.date.TimeStamp;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import com.google.common.base.Supplier;
import com.google.inject.Module;
@@ -30,7 +30,7 @@ import com.google.inject.Module;
/**
* Base class for writing Expect tests for AWS-S3
*/
-public class BaseAWSS3ClientExpectTest extends BaseRestClientExpectTest<AWSS3Client> {
+public class BaseAWSS3ClientExpectTest extends BaseRestApiExpectTest<AWSS3Client> {
protected static final String CONSTANT_DATE = "2009-11-08T15:54:08.897Z";
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientTest.java
index 34f0c5c..c738e45 100644
--- a/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientTest.java
+++ b/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientTest.java
@@ -44,7 +44,7 @@ import org.jclouds.http.functions.ParseSax;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.ReturnTrueIf2xx;
import org.jclouds.http.options.GetOptions;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.testng.annotations.Test;
@@ -54,7 +54,7 @@ import com.google.common.collect.ImmutableMultimap;
import com.google.common.reflect.Invokable;
@Test(groups = "unit", testName = "AzureBlobClientTest")
-public class AzureBlobClientTest extends BaseAsyncClientTest<AzureBlobClient> {
+public class AzureBlobClientTest extends BaseRestAnnotationProcessingTest<AzureBlobClient> {
public void testListContainers() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(AzureBlobClient.class, "listContainers", ListOptions[].class);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java
index faec9bb..8fc1030 100644
--- a/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java
+++ b/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java
@@ -26,13 +26,13 @@ import org.jclouds.azureblob.domain.AzureBlob;
import org.jclouds.http.HttpRequest;
import org.jclouds.io.Payload;
import org.jclouds.io.Payloads;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
@Test(groups = "unit", testName = "BindAzureBlobMetadataToRequestTest")
-public class BindAzureBlobMetadataToRequestTest extends BaseAsyncClientTest<AzureBlobClient> {
+public class BindAzureBlobMetadataToRequestTest extends BaseRestAnnotationProcessingTest<AzureBlobClient> {
@Test
public void testPassWithMinimumDetailsAndPayload64MB() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java
index 024611c..586e361 100644
--- a/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java
+++ b/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java
@@ -30,7 +30,7 @@ import org.jclouds.blobstore.domain.Blob.Factory;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -43,7 +43,7 @@ import com.google.inject.Module;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "AzureBlobRequestSignerTest")
-public class AzureBlobRequestSignerTest extends BaseAsyncClientTest<AzureBlobClient> {
+public class AzureBlobRequestSignerTest extends BaseRestAnnotationProcessingTest<AzureBlobClient> {
public AzureBlobRequestSignerTest() {
// this is base64 decoded in the signer;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSApiTest.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSApiTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSApiTest.java
index 2feb7ac..0419594 100644
--- a/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSApiTest.java
+++ b/providers/glesys/src/test/java/org/jclouds/glesys/GleSYSApiTest.java
@@ -21,7 +21,7 @@ import java.util.concurrent.ExecutionException;
import org.jclouds.http.HttpRequest;
import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.internal.BaseAsyncApiTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -31,7 +31,7 @@ import org.testng.annotations.Test;
// NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "GleSYSApiTest")
-public class GleSYSApiTest extends BaseAsyncApiTest<GleSYSApi> {
+public class GleSYSApiTest extends BaseRestAnnotationProcessingTest<GleSYSApi> {
private GleSYSApi syncApi;
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java
index 4a90875..ebe5f0b 100644
--- a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java
+++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java
@@ -25,21 +25,21 @@ import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
import org.jclouds.http.HttpRequest;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.testng.annotations.Test;
import com.google.common.base.Supplier;
import com.google.inject.Module;
@Test(groups = "unit")
-public abstract class BaseGoGridApiTest<T> extends BaseAsyncClientTest<T> {
+public abstract class BaseGoGridApiTest<T> extends BaseRestAnnotationProcessingTest<T> {
@Override
protected void checkFilters(HttpRequest request) {
assertEquals(request.getFilters().size(), 1);
assertEquals(request.getFilters().get(0).getClass(), SharedKeyLiteAuthentication.class);
}
- @ConfiguresHttpApi
+ @ConfiguresHttpApi
protected static final class TestGoGridHttpApiModule extends GoGridHttpApiModule {
@Override
protected void configure() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java
index 4b6fd2d..db529bd 100644
--- a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java
+++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java
@@ -20,18 +20,18 @@ import org.jclouds.date.TimeStamp;
import org.jclouds.gogrid.GoGridApi;
import org.jclouds.gogrid.config.GoGridHttpApiModule;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import com.google.common.base.Supplier;
import com.google.inject.Module;
-public class BaseGoGridHttpApiExpectTest extends BaseRestClientExpectTest<GoGridApi> {
+public class BaseGoGridHttpApiExpectTest extends BaseRestApiExpectTest<GoGridApi> {
public BaseGoGridHttpApiExpectTest() {
provider = "gogrid";
}
- @ConfiguresHttpApi
+ @ConfiguresHttpApi
protected static final class TestGoGridHttpApiModule extends GoGridHttpApiModule {
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/99e217b7/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/internal/BaseHPCloudObjectStorageBlobStoreExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/internal/BaseHPCloudObjectStorageBlobStoreExpectTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/internal/BaseHPCloudObjectStorageBlobStoreExpectTest.java
index 73ce6da..18181f8 100644
--- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/internal/BaseHPCloudObjectStorageBlobStoreExpectTest.java
+++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/internal/BaseHPCloudObjectStorageBlobStoreExpectTest.java
@@ -23,14 +23,14 @@ import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageProviderMetadata;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
import org.testng.annotations.Test;
import com.google.common.base.Function;
import com.google.inject.Module;
@Test(groups = "unit", testName = "HPCloudObjectStorageExpectTest")
-public class BaseHPCloudObjectStorageBlobStoreExpectTest extends BaseRestClientExpectTest<BlobStore> {
+public class BaseHPCloudObjectStorageBlobStoreExpectTest extends BaseRestApiExpectTest<BlobStore> {
protected HttpRequest keystoneAuthWithUsernameAndPassword;
[48/52] [abbrv] git commit: Moving checkstyle-plugin config to
profiles
Posted by an...@apache.org.
Moving checkstyle-plugin config to profiles
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/f9257969
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/f9257969
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/f9257969
Branch: refs/heads/use-agentproxy-008
Commit: f9257969058a7b38259fb3cc366f0d2519f6cf0a
Parents: 013e6da
Author: Andrew Phillips <an...@apache.org>
Authored: Sun Oct 5 14:41:23 2014 -0500
Committer: Andrew Phillips <an...@apache.org>
Committed: Mon Oct 6 18:14:14 2014 -0400
----------------------------------------------------------------------
project/pom.xml | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/f9257969/project/pom.xml
----------------------------------------------------------------------
diff --git a/project/pom.xml b/project/pom.xml
index 0372aaa..52cbfed 100644
--- a/project/pom.xml
+++ b/project/pom.xml
@@ -708,14 +708,7 @@
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.13</version>
- <configuration>
- <!-- configLocation configured via profiles -->
- <violationSeverity>warning</violationSeverity>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- <failOnViolation>true</failOnViolation>
- <failsOnError>true</failsOnError>
- <violationSeverity>warning</violationSeverity>
- </configuration>
+ <!-- configuration and dependencies set via profiles -->
</plugin>
<plugin>
<groupId>org.gaul</groupId>
@@ -1074,6 +1067,7 @@
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>../resources/checkstyle.xml</configLocation>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
<violationSeverity>warning</violationSeverity>
@@ -1115,6 +1109,7 @@
<configuration>
<!-- jclouds-resources has the checkstyle config in the classpath -->
<configLocation>resources/checkstyle.xml</configLocation>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
<!-- fails on itself as it uses the author tag in a module definition -->
[26/52] [abbrv] git commit: JCLOUDS-40 Remove AsyncBlobStore
Posted by an...@apache.org.
JCLOUDS-40 Remove AsyncBlobStore
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/a4e3c1a2
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/a4e3c1a2
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/a4e3c1a2
Branch: refs/heads/use-agentproxy-008
Commit: a4e3c1a2f8305d94143c67e26372db3bf24c6206
Parents: 56a2a8b
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 11:40:48 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 13:17:54 2014 -0700
----------------------------------------------------------------------
.../src/main/clojure/org/jclouds/blobstore2.clj | 11 +-
.../org/jclouds/blobstore/AsyncBlobStore.java | 173 -----------
.../java/org/jclouds/blobstore/BlobStore.java | 4 -
.../org/jclouds/blobstore/BlobStoreContext.java | 10 -
.../internal/BlobStoreContextImpl.java | 12 +-
.../internal/SubmissionAsyncBlobStore.java | 293 -------------------
.../internal/BaseBlobIntegrationTest.java | 42 +--
7 files changed, 20 insertions(+), 525 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a4e3c1a2/blobstore/src/main/clojure/org/jclouds/blobstore2.clj
----------------------------------------------------------------------
diff --git a/blobstore/src/main/clojure/org/jclouds/blobstore2.clj b/blobstore/src/main/clojure/org/jclouds/blobstore2.clj
index 98d51cb..bb06e5f 100644
--- a/blobstore/src/main/clojure/org/jclouds/blobstore2.clj
+++ b/blobstore/src/main/clojure/org/jclouds/blobstore2.clj
@@ -44,7 +44,7 @@ See http://code.google.com/p/jclouds for details."
java.util.Properties
[org.jclouds ContextBuilder]
[org.jclouds.blobstore
- AsyncBlobStore domain.BlobBuilder BlobStore BlobStoreContext
+ domain.BlobBuilder BlobStore BlobStoreContext
domain.BlobMetadata domain.StorageMetadata domain.PageSet
domain.Blob domain.internal.BlobBuilderImpl options.PutOptions
options.PutOptions$Builder
@@ -86,8 +86,6 @@ See http://code.google.com/p/jclouds for details."
(defn blobstore
"Create a logged in context.
-Options for communication style
- :sync and :async.
Options can also be specified for extension modules
:log4j :enterprise :ning :apachehc :bouncycastle :joda :gae"
[^String provider ^String provider-identity ^String provider-credential
@@ -102,9 +100,7 @@ Options can also be specified for extension modules
(overrides (reduce #(do (.put ^Properties %1 (name (first %2)) (second %2)) %1)
(Properties.) (dissoc opts :extensions)))
(buildView BlobStoreContext))]
- (if (some #(= :async %) options)
- (.getAsyncBlobStore context)
- (.getBlobStore context)))))
+ (.getBlobStore context))))
(defn blobstore-context
"Returns a blobstore context from a blobstore."
@@ -117,8 +113,7 @@ Options can also be specified for extension modules
(defn blobstore?
[object]
- (or (instance? BlobStore object)
- (instance? AsyncBlobStore object)))
+ (instance? BlobStore object))
(defn blobstore-context?
[object]
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a4e3c1a2/blobstore/src/main/java/org/jclouds/blobstore/AsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/AsyncBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/AsyncBlobStore.java
deleted file mode 100644
index a121455..0000000
--- a/blobstore/src/main/java/org/jclouds/blobstore/AsyncBlobStore.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.blobstore;
-
-import java.util.Set;
-
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobBuilder;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.blobstore.options.GetOptions;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.options.PutOptions;
-import org.jclouds.domain.Location;
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.inject.ImplementedBy;
-
-/**
- * Provides hooks needed to run a blob store asynchronously
- *
- * @see BlobStore
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported. Please use {@link org.jclouds.blobstore.BlobStore}
- */
-@Deprecated
-@ImplementedBy(SubmissionAsyncBlobStore.class)
-public interface AsyncBlobStore {
- /**
- * @see BlobStore#getContext
- */
- BlobStoreContext getContext();
-
- /**
- * @see BlobStore#blobBuilder
- */
- BlobBuilder blobBuilder(String name);
-
- /**
- * @see BlobStore#listAssignableLocations
- */
- ListenableFuture<Set<? extends Location>> listAssignableLocations();
-
- /**
- * @see BlobStore#list
- */
- ListenableFuture<PageSet<? extends StorageMetadata>> list();
-
- /**
- * @see BlobStore#containerExists
- */
- ListenableFuture<Boolean> containerExists(String container);
-
- /**
- * @see BlobStore#createContainerInLocation(Location, String)
- */
- ListenableFuture<Boolean> createContainerInLocation(@Nullable Location location, String container);
-
- /**
- * @see BlobStore#createContainerInLocation(Location,String,CreateContainerOptions)
- */
- ListenableFuture<Boolean> createContainerInLocation(@Nullable Location location, String container,
- CreateContainerOptions options);
-
- /**
- * @see BlobStore#list(String)
- */
- ListenableFuture<PageSet<? extends StorageMetadata>> list(String container);
-
- /**
- * @see BlobStore#list(String, ListContainerOptions)
- */
- ListenableFuture<PageSet<? extends StorageMetadata>> list(String container, ListContainerOptions options);
-
- /**
- * @see BlobStore#clearContainer(String)
- */
- ListenableFuture<Void> clearContainer(String container);
-
- /**
- * @see BlobStore#clearContainer(String, ListContainerOptions)
- */
- ListenableFuture<Void> clearContainer(String container, ListContainerOptions options);
-
- /**
- * @see BlobStore#deleteContainer
- */
- ListenableFuture<Void> deleteContainer(String container);
-
- /**
- * @see BlobStore#deleteContainerIfEmpty
- */
- ListenableFuture<Boolean> deleteContainerIfEmpty(String container);
-
- /**
- * @see BlobStore#directoryExists
- */
- ListenableFuture<Boolean> directoryExists(String container, String directory);
-
- /**
- * @see BlobStore#createDirectory
- */
- ListenableFuture<Void> createDirectory(String container, String directory);
-
- /**
- * @see BlobStore#deleteDirectory
- */
- ListenableFuture<Void> deleteDirectory(String containerName, String name);
-
- /**
- * @see BlobStore#blobExists
- */
- ListenableFuture<Boolean> blobExists(String container, String name);
-
- /**
- * @see BlobStore#putBlob(String,Blob)
- */
- ListenableFuture<String> putBlob(String container, Blob blob);
-
- /**
- * @see BlobStore#putBlob(String,Blob,PutOptions)
- */
- ListenableFuture<String> putBlob(String container, Blob blob, PutOptions options);
-
- /**
- * @see BlobStore#blobMetadata
- */
- ListenableFuture<BlobMetadata> blobMetadata(String container, String key);
-
- /**
- * @see BlobStore#getBlob(String, String)
- */
- ListenableFuture<Blob> getBlob(String container, String key);
-
- /**
- * @see BlobStore#getBlob(String, String, GetOptions)
- */
- ListenableFuture<Blob> getBlob(String container, String key, GetOptions options);
-
- /**
- * @see BlobStore#removeBlob
- */
- ListenableFuture<Void> removeBlob(String container, String key);
-
- /**
- * @see BlobStore#countBlobs(String)
- */
- ListenableFuture<Long> countBlobs(String container);
-
- /**
- * @see BlobStore#countBlobs(String,ListContainerOptions)
- */
- ListenableFuture<Long> countBlobs(String container, ListContainerOptions options);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a4e3c1a2/blobstore/src/main/java/org/jclouds/blobstore/BlobStore.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/BlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/BlobStore.java
index 88db39a..5dde0cd 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/BlobStore.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/BlobStore.java
@@ -32,10 +32,6 @@ import org.jclouds.javax.annotation.Nullable;
/**
* Synchronous access to a BlobStore such as Amazon S3
- *
- * @see AsyncBlobStore
- *
- * @see BlobStoreContextFactory
*/
public interface BlobStore {
/**
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a4e3c1a2/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java b/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java
index 8d66d10..1a569dd 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java
@@ -39,16 +39,6 @@ public interface BlobStoreContext extends Closeable, View {
BlobRequestSigner getSigner();
/**
- * @return a portable asynchronous interface for the BlobStore, which returns
- * {@code Future}s for each call.
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no
- * longer supported. Please use
- * {@link #getBlobStore()}
- */
- @Deprecated
- AsyncBlobStore getAsyncBlobStore();
-
- /**
* @return a portable interface for the BlobStore.
*/
BlobStore getBlobStore();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a4e3c1a2/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java b/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java
index 6d0ea01..6aea926 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java
@@ -22,7 +22,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.Context;
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.BlobStoreContext;
@@ -36,7 +35,6 @@ import com.google.common.reflect.TypeToken;
@Singleton
public class BlobStoreContextImpl extends BaseView implements BlobStoreContext {
- private final AsyncBlobStore ablobStore;
private final BlobStore blobStore;
private final ConsistencyModel consistencyModel;
private final Utils utils;
@@ -44,12 +42,9 @@ public class BlobStoreContextImpl extends BaseView implements BlobStoreContext {
@Inject
public BlobStoreContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
- Utils utils, ConsistencyModel consistencyModel,
- AsyncBlobStore ablobStore, BlobStore blobStore,
- BlobRequestSigner blobRequestSigner) {
+ Utils utils, ConsistencyModel consistencyModel, BlobStore blobStore, BlobRequestSigner blobRequestSigner) {
super(backend, backendType);
this.consistencyModel = checkNotNull(consistencyModel, "consistencyModel");
- this.ablobStore = checkNotNull(ablobStore, "ablobStore");
this.blobStore = checkNotNull(blobStore, "blobStore");
this.utils = checkNotNull(utils, "utils");
this.blobRequestSigner = checkNotNull(blobRequestSigner, "blobRequestSigner");
@@ -66,11 +61,6 @@ public class BlobStoreContextImpl extends BaseView implements BlobStoreContext {
}
@Override
- public AsyncBlobStore getAsyncBlobStore() {
- return ablobStore;
- }
-
- @Override
public Utils utils() {
return utils;
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a4e3c1a2/blobstore/src/main/java/org/jclouds/blobstore/internal/SubmissionAsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/internal/SubmissionAsyncBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/internal/SubmissionAsyncBlobStore.java
deleted file mode 100644
index b141008..0000000
--- a/blobstore/src/main/java/org/jclouds/blobstore/internal/SubmissionAsyncBlobStore.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.blobstore.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.Constants.PROPERTY_USER_THREADS;
-
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.blobstore.AsyncBlobStore;
-import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobBuilder;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.blobstore.options.GetOptions;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.options.PutOptions;
-import org.jclouds.domain.Location;
-
-import com.google.common.collect.ForwardingObject;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * Adapter that allows you to reuse an existing {@link BlobStore} to implement
- * the deprecated {@link AsyncBlobStore} interface.
- *
- * @deprecated will be removed in jclouds 2.0, as async interfaces are no longer
- * supported. Please use {@link BlobStore}
- */
-@Deprecated
-public class SubmissionAsyncBlobStore extends ForwardingObject implements AsyncBlobStore {
- private final BlobStore blobstore;
- private final ListeningExecutorService executor;
-
- @Inject
- public SubmissionAsyncBlobStore(BlobStore blobstore, @Named(PROPERTY_USER_THREADS) ListeningExecutorService executor) {
- this.blobstore = checkNotNull(blobstore, "blobstore");
- this.executor = checkNotNull(executor, "executor");
- }
-
- @Override
- protected BlobStore delegate() {
- return blobstore;
- }
-
- @Override
- public BlobStoreContext getContext() {
- return delegate().getContext();
- }
-
- @Override
- public BlobBuilder blobBuilder(String name) {
- return delegate().blobBuilder(name);
- }
-
- @Override
- public ListenableFuture<Set<? extends Location>> listAssignableLocations() {
- return executor.submit(new Callable<Set<? extends Location>>() {
- public Set<? extends Location> call() {
- return delegate().listAssignableLocations();
- }
- });
- }
-
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list() {
- return executor.submit(new Callable<PageSet<? extends StorageMetadata>>() {
- public PageSet<? extends StorageMetadata> call() {
- return delegate().list();
- }
- });
- }
-
- @Override
- public ListenableFuture<Boolean> containerExists(final String container) {
- return executor.submit(new Callable<Boolean>() {
- public Boolean call() {
- return delegate().containerExists(container);
- }
- });
- }
-
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(final Location location, final String container) {
- return executor.submit(new Callable<Boolean>() {
- public Boolean call() {
- return delegate().createContainerInLocation(location, container);
- }
- });
- }
-
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(final Location location, final String container,
- final CreateContainerOptions options) {
- return executor.submit(new Callable<Boolean>() {
- public Boolean call() {
- return delegate().createContainerInLocation(location, container, options);
- }
- });
- }
-
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list(final String container) {
- return executor.submit(new Callable<PageSet<? extends StorageMetadata>>() {
- public PageSet<? extends StorageMetadata> call() {
- return delegate().list(container);
- }
- });
- }
-
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list(final String container,
- final ListContainerOptions options) {
- return executor.submit(new Callable<PageSet<? extends StorageMetadata>>() {
- public PageSet<? extends StorageMetadata> call() {
- return delegate().list(container, options);
- }
- });
- }
-
- @Override
- public ListenableFuture<Void> clearContainer(final String container) {
- return executor.submit(new Callable<Void>() {
- public Void call() {
- delegate().clearContainer(container);
- return null;
- }
- });
- }
-
- @Override
- public ListenableFuture<Void> clearContainer(final String container, final ListContainerOptions options) {
- return executor.submit(new Callable<Void>() {
- public Void call() {
- delegate().clearContainer(container, options);
- return null;
- }
- });
- }
-
- @Override
- public ListenableFuture<Void> deleteContainer(final String container) {
- return executor.submit(new Callable<Void>() {
- public Void call() {
- delegate().deleteContainer(container);
- return null;
- }
- });
- }
-
- @Override
- public ListenableFuture<Boolean> deleteContainerIfEmpty(final String container) {
- return executor.submit(new Callable<Boolean>() {
- public Boolean call() {
- return delegate().deleteContainerIfEmpty(container);
- }
- });
- }
-
- @Override
- public ListenableFuture<Boolean> directoryExists(final String container, final String directory) {
- return executor.submit(new Callable<Boolean>() {
- public Boolean call() {
- return delegate().directoryExists(container, directory);
- }
- });
- }
-
- @Override
- public ListenableFuture<Void> createDirectory(final String container, final String directory) {
- return executor.submit(new Callable<Void>() {
- public Void call() {
- delegate().createDirectory(container, directory);
- return null;
- }
- });
- }
-
- @Override
- public ListenableFuture<Void> deleteDirectory(final String containerName, final String name) {
- return executor.submit(new Callable<Void>() {
- public Void call() {
- delegate().deleteDirectory(containerName, name);
- return null;
- }
- });
- }
-
- @Override
- public ListenableFuture<Boolean> blobExists(final String container, final String name) {
- return executor.submit(new Callable<Boolean>() {
- public Boolean call() {
- return delegate().blobExists(container, name);
- }
- });
- }
-
- @Override
- public ListenableFuture<String> putBlob(final String container, final Blob blob) {
- return executor.submit(new Callable<String>() {
- public String call() {
- return delegate().putBlob(container, blob);
- }
- });
- }
-
- @Override
- public ListenableFuture<String> putBlob(final String container, final Blob blob, final PutOptions options) {
- return executor.submit(new Callable<String>() {
- public String call() {
- return delegate().putBlob(container, blob, options);
- }
- });
- }
-
- @Override
- public ListenableFuture<BlobMetadata> blobMetadata(final String container, final String key) {
- return executor.submit(new Callable<BlobMetadata>() {
- public BlobMetadata call() {
- return delegate().blobMetadata(container, key);
- }
- });
- }
-
- @Override
- public ListenableFuture<Blob> getBlob(final String container, final String key) {
- return executor.submit(new Callable<Blob>() {
- public Blob call() {
- return delegate().getBlob(container, key);
- }
- });
- }
-
- @Override
- public ListenableFuture<Blob> getBlob(final String container, final String key, final GetOptions options) {
- return executor.submit(new Callable<Blob>() {
- public Blob call() {
- return delegate().getBlob(container, key, options);
- }
- });
- }
-
- @Override
- public ListenableFuture<Void> removeBlob(final String container, final String key) {
- return executor.submit(new Callable<Void>() {
- public Void call() {
- delegate().removeBlob(container, key);
- return null;
- }
- });
- }
-
- @Override
- public ListenableFuture<Long> countBlobs(final String container) {
- return executor.submit(new Callable<Long>() {
- public Long call() {
- return delegate().countBlobs(container);
- }
- });
- }
-
- @Override
- public ListenableFuture<Long> countBlobs(final String container, final ListContainerOptions options) {
- return executor.submit(new Callable<Long>() {
- public Long call() {
- return delegate().countBlobs(container, options);
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a4e3c1a2/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java
----------------------------------------------------------------------
diff --git a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java
index eb55098..dca61a1 100644
--- a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java
+++ b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java
@@ -24,6 +24,7 @@ import static org.jclouds.blobstore.options.GetOptions.Builder.ifModifiedSince;
import static org.jclouds.blobstore.options.GetOptions.Builder.ifUnmodifiedSince;
import static org.jclouds.blobstore.options.GetOptions.Builder.range;
import static org.jclouds.concurrent.FutureIterables.awaitCompletion;
+import static org.jclouds.io.ByteStreams2.hashAndClose;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
@@ -55,7 +56,6 @@ import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.crypto.Crypto;
import org.jclouds.encryption.internal.JCECrypto;
import org.jclouds.http.HttpResponseException;
-import org.jclouds.io.ByteStreams2;
import org.jclouds.io.Payload;
import org.jclouds.io.Payloads;
import org.jclouds.io.payloads.ByteSourcePayload;
@@ -67,7 +67,6 @@ import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.google.common.base.Charsets;
-import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
@@ -76,7 +75,6 @@ import com.google.common.collect.Maps;
import com.google.common.hash.HashCode;
import com.google.common.io.ByteSource;
import com.google.common.io.Files;
-import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.Uninterruptibles;
@@ -93,10 +91,6 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
return oneHundredOneConstitutions;
}
- public static long getOneHundredOneConstitutionsLength() throws IOException {
- return oneHundredOneConstitutions.size();
- }
-
/**
* Attempt to capture the issue detailed in
* http://groups.google.com/group/jclouds/browse_thread/thread/4a7c8d58530b287f
@@ -108,7 +102,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
createTestInput(32 * 1024).copyTo(Files.asByteSink(payloadFile));
final Payload testPayload = Payloads.newFilePayload(payloadFile);
- final HashCode md5 = ByteStreams2.hashAndClose(testPayload.openStream(), md5());
+ final HashCode md5 = hashAndClose(testPayload.openStream(), md5());
testPayload.getContentMetadata().setContentType("image/png");
final AtomicInteger blobCount = new AtomicInteger();
@@ -127,7 +121,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
assertConsistencyAwareBlobExists(container, name);
blob = view.getBlobStore().getBlob(container, name);
- assertEquals(ByteStreams2.hashAndClose(blob.getPayload().openStream(), md5()), md5,
+ assertEquals(hashAndClose(blob.getPayload().openStream(), md5()), md5,
String.format("md5 didn't match on %s/%s", container, name));
view.getBlobStore().removeBlob(container, name);
@@ -158,23 +152,19 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
uploadByteSource(container, name, expectedContentDisposition, supplier);
Map<Integer, ListenableFuture<?>> responses = Maps.newHashMap();
for (int i = 0; i < 10; i++) {
-
- responses.put(i, Futures.transform(view.getAsyncBlobStore().getBlob(container, name),
- new Function<Blob, Void>() {
-
- @Override
- public Void apply(Blob from) {
- try {
- validateMetadata(from.getMetadata(), container, name);
- assertEquals(ByteStreams2.hashAndClose(from.getPayload().openStream(), md5()), supplier.hash(md5()));
- checkContentDisposition(from, expectedContentDisposition);
- } catch (IOException e) {
- Throwables.propagate(e);
- }
- return null;
- }
-
- }, this.exec));
+ responses.put(i, this.exec.submit(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ try {
+ Blob blob = view.getBlobStore().getBlob(container, name);
+ validateMetadata(blob.getMetadata(), container, name);
+ assertEquals(hashAndClose(blob.getPayload().openStream(), md5()), supplier.hash(md5()));
+ checkContentDisposition(blob, expectedContentDisposition);
+ } catch (IOException e) {
+ Throwables.propagate(e);
+ }
+ return null;
+ }
+ }));
}
Map<Integer, Exception> exceptions = awaitCompletion(responses, exec, 30000l, Logger.CONSOLE,
"get constitution");
[52/52] [abbrv] git commit: Updating jsch.agentproxy 0.0.7 -> 0.0.8
Posted by an...@apache.org.
Updating jsch.agentproxy 0.0.7 -> 0.0.8
New version uses net.java.dev.jna:jna 4.1.0. The old version uses 3.4.0,
which is only LGPL-licensed.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/5ee084af
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/5ee084af
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/5ee084af
Branch: refs/heads/use-agentproxy-008
Commit: 5ee084af1d97fe052f26edc80546837ab8d2d771
Parents: 53fc568
Author: Andrew Phillips <an...@apache.org>
Authored: Fri Sep 26 17:57:04 2014 -0700
Committer: Andrew Phillips <an...@apache.org>
Committed: Mon Oct 6 18:29:32 2014 -0400
----------------------------------------------------------------------
drivers/jsch/pom.xml | 26 ++------------------------
drivers/sshj/pom.xml | 26 ++------------------------
2 files changed, 4 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/5ee084af/drivers/jsch/pom.xml
----------------------------------------------------------------------
diff --git a/drivers/jsch/pom.xml b/drivers/jsch/pom.xml
index 078a9bc..22b2dbc 100644
--- a/drivers/jsch/pom.xml
+++ b/drivers/jsch/pom.xml
@@ -89,34 +89,12 @@
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.jsch</artifactId>
- <version>0.0.7</version>
+ <version>0.0.8</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.connector-factory</artifactId>
- <version>0.0.7</version>
- <exclusions>
- <!-- provided versions are LGPL-only -->
- <exclusion>
- <groupId>net.java.dev.jna</groupId>
- <artifactId>jna</artifactId>
- </exclusion>
- <exclusion>
- <groupId>net.java.dev.jna</groupId>
- <artifactId>platform</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- dual-licensed under LGPL and ASL 2 -->
- <dependency>
- <groupId>net.java.dev.jna</groupId>
- <artifactId>jna</artifactId>
- <version>4.0.0</version>
- </dependency>
- <dependency>
- <groupId>net.java.dev.jna</groupId>
- <artifactId>jna-platform</artifactId>
- <version>4.0.0</version>
+ <version>0.0.8</version>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/5ee084af/drivers/sshj/pom.xml
----------------------------------------------------------------------
diff --git a/drivers/sshj/pom.xml b/drivers/sshj/pom.xml
index be6efc8..4bbfbbf 100644
--- a/drivers/sshj/pom.xml
+++ b/drivers/sshj/pom.xml
@@ -107,34 +107,12 @@
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.sshj</artifactId>
- <version>0.0.7</version>
+ <version>0.0.8</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.connector-factory</artifactId>
- <version>0.0.7</version>
- <exclusions>
- <!-- provided versions are LGPL-only -->
- <exclusion>
- <groupId>net.java.dev.jna</groupId>
- <artifactId>jna</artifactId>
- </exclusion>
- <exclusion>
- <groupId>net.java.dev.jna</groupId>
- <artifactId>platform</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- dual-licensed under LGPL and ASL 2 -->
- <dependency>
- <groupId>net.java.dev.jna</groupId>
- <artifactId>jna</artifactId>
- <version>4.0.0</version>
- </dependency>
- <dependency>
- <groupId>net.java.dev.jna</groupId>
- <artifactId>jna-platform</artifactId>
- <version>4.0.0</version>
+ <version>0.0.8</version>
</dependency>
</dependencies>
[37/52] [abbrv] git commit: JCLOUDS-49 clear remaining async stuff
from openstack
Posted by an...@apache.org.
JCLOUDS-49 clear remaining async stuff from openstack
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/360e8b8d
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/360e8b8d
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/360e8b8d
Branch: refs/heads/use-agentproxy-008
Commit: 360e8b8d6ac7247367cd60572b970f2c341b5562
Parents: e42cc80
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 17:37:06 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 22:32:20 2014 -0700
----------------------------------------------------------------------
.../v2_0/features/ExtensionAsyncApi.java | 72 --------------------
.../internal/OpenStackAuthClientTest.java | 14 ++--
2 files changed, 6 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/360e8b8d/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/features/ExtensionAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/features/ExtensionAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/features/ExtensionAsyncApi.java
deleted file mode 100644
index 215fad3..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/features/ExtensionAsyncApi.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.v2_0.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.v2_0.domain.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Extensions via their REST API.
- * <p/>
- *
- * @see ExtensionApi
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
- * />
- */
-@RequestFilters(AuthenticateRequest.class)
-public interface ExtensionAsyncApi {
-
- /**
- * @see ExtensionApi#list
- */
- @Named("extension:list")
- @GET
- @SelectJson("extensions")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/extensions")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<? extends Extension>> list();
-
- /**
- * @see ExtensionApi#get
- */
- @Named("extension:get")
- @GET
- @SelectJson("extension")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/extensions/{alias}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Extension> get(@PathParam("alias") String id);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/360e8b8d/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java
----------------------------------------------------------------------
diff --git a/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java b/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java
index 5829fa8..fedd4d6 100644
--- a/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java
+++ b/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java
@@ -16,17 +16,16 @@
*/
package org.jclouds.openstack.internal;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.jclouds.reflect.Reflection2.method;
import java.io.IOException;
-import org.jclouds.apis.ApiMetadata;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders;
-import org.jclouds.rest.AnonymousRestApiMetadata;
+import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.testng.annotations.Test;
@@ -41,7 +40,7 @@ public class OpenStackAuthClientTest extends BaseRestAnnotationProcessingTest<Op
Invokable<?, ?> method = method(OpenStackAuthClient.class, "authenticate", String.class, String.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
- assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
+ assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1 HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: */*\nHost: localhost:8080\nX-Auth-Key: bar\nX-Auth-User: foo\n");
assertPayloadEquals(httpRequest, null, null, false);
@@ -55,7 +54,7 @@ public class OpenStackAuthClientTest extends BaseRestAnnotationProcessingTest<Op
Invokable<?, ?> method = method(OpenStackAuthClient.class, "authenticateStorage", String.class, String.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
- assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
+ assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1 HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: */*\nHost: localhost:8080\nX-Storage-Pass: bar\nX-Storage-User: foo\n");
assertPayloadEquals(httpRequest, null, null, false);
@@ -66,9 +65,8 @@ public class OpenStackAuthClientTest extends BaseRestAnnotationProcessingTest<Op
}
@Override
- public ApiMetadata createApiMetadata() {
- return AnonymousRestApiMetadata.forClientMappedToAsyncClient(IntegrationTestClient.class, IntegrationTestAsyncClient.class).toBuilder().defaultEndpoint(
- "http://localhost:8080").version("1.0").build();
+ public ProviderMetadata createProviderMetadata() {
+ return forApiOnEndpoint(IntegrationTestClient.class, "http://localhost:8080");
}
@Override
[42/52] [abbrv] git commit: JCLOUDS-152 remove RestContext and its
dependencies.
Posted by an...@apache.org.
JCLOUDS-152 remove RestContext and its dependencies.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/c3497536
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/c3497536
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/c3497536
Branch: refs/heads/use-agentproxy-008
Commit: c349753624e247e9875589e869c8a2e92152f5c7
Parents: 7bab2dd
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 17:59:25 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 22:32:55 2014 -0700
----------------------------------------------------------------------
.../main/java/org/jclouds/ContextBuilder.java | 45 +--
.../java/org/jclouds/apis/ApiPredicates.java | 30 --
...xtWithWildcardExtendsExplicitAndRawType.java | 69 ----
.../providers/AnonymousProviderMetadata.java | 5 -
.../jclouds/rest/AnonymousRestApiMetadata.java | 73 ----
.../org/jclouds/rest/ConfiguresRestClient.java | 32 --
.../java/org/jclouds/rest/HttpAsyncClient.java | 88 -----
.../java/org/jclouds/rest/RestApiMetadata.java | 55 ---
.../AnnotatedSyncToAsyncHttpApiProvider.java | 56 ---
.../org/jclouds/rest/config/BinderUtils.java | 94 -----
.../rest/config/CallGetOnFuturesProvider.java | 57 ---
.../jclouds/rest/config/RestClientModule.java | 119 ------
.../rest/config/SyncToAsyncHttpApiProvider.java | 57 ---
.../config/SyncToAsyncHttpInvocationModule.java | 145 -------
.../rest/internal/BaseRestApiMetadata.java | 120 ------
...otentiallySyncToAsyncInvocationFunction.java | 72 ----
.../internal/InvokeSyncToAsyncHttpMethod.java | 273 --------------
.../java/org/jclouds/ContextBuilderTest.java | 16 +-
.../apis/JcloudsTestBlobStoreApiMetadata.java | 9 +-
.../apis/JcloudsTestComputeApiMetadata.java | 9 +-
...JcloudsTestYetAnotherComputeApiMetadata.java | 9 +-
...thWildcardExtendsExplicitAndRawTypeTest.java | 117 ------
...thWildcardExtendsExplicitAndRawTypeTest.java | 123 ------
.../java/org/jclouds/http/BaseJettyTest.java | 6 +-
.../http/IntegrationTestAsyncClient.java | 209 -----------
.../BackoffLimitedRetryHandlerTest.java | 4 +-
.../handlers/RedirectionRetryHandlerTest.java | 9 +-
...oviderMetadataContextAndCredentialsTest.java | 15 +-
...pdateProviderMetadataFromPropertiesTest.java | 9 +-
.../jclouds/rest/InputParamValidatorTest.java | 9 +-
.../rest/annotationparsing/ClosableApiTest.java | 8 +-
.../DelegateAnnotationExpectTest.java | 47 +--
.../JAXBResponseParserAnnotationExpectTest.java | 24 +-
.../ProvidesAnnotationExpectTest.java | 31 +-
.../config/MappedHttpInvocationModuleTest.java | 114 ------
.../rest/internal/BaseAsyncClientTest.java | 25 --
.../rest/internal/BaseRestApiExpectTest.java | 2 -
.../rest/internal/BaseRestApiMetadataTest.java | 46 ---
.../internal/InvokeMappedHttpMethodTest.java | 171 ---------
.../internal/RestAnnotationProcessorTest.java | 373 +++++--------------
40 files changed, 178 insertions(+), 2597 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/ContextBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/ContextBuilder.java b/core/src/main/java/org/jclouds/ContextBuilder.java
index 8e98b64..020d728 100644
--- a/core/src/main/java/org/jclouds/ContextBuilder.java
+++ b/core/src/main/java/org/jclouds/ContextBuilder.java
@@ -18,12 +18,10 @@ package org.jclouds;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.and;
import static com.google.common.base.Predicates.containsPattern;
import static com.google.common.base.Predicates.instanceOf;
import static com.google.common.base.Predicates.not;
import static com.google.common.base.Predicates.notNull;
-import static com.google.common.base.Predicates.or;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.Iterables.addAll;
import static com.google.common.collect.Iterables.any;
@@ -43,6 +41,7 @@ import static org.jclouds.Constants.PROPERTY_IDENTITY;
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
import static org.jclouds.Constants.PROPERTY_PROVIDER;
import static org.jclouds.reflect.Reflection2.typeToken;
+import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
import static org.jclouds.util.Throwables2.propagateAuthorizationOrOriginalException;
import java.io.Closeable;
@@ -60,7 +59,6 @@ import org.jclouds.concurrent.config.ExecutorServiceModule;
import org.jclouds.config.BindApiContextWithWildcardExtendsExplicitAndRawType;
import org.jclouds.config.BindNameToContext;
import org.jclouds.config.BindPropertiesToExpandedValues;
-import org.jclouds.config.BindRestContextWithWildcardExtendsExplicitAndRawType;
import org.jclouds.domain.Credentials;
import org.jclouds.events.config.ConfiguresEventBus;
import org.jclouds.events.config.EventBusModule;
@@ -74,16 +72,15 @@ import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.Providers;
import org.jclouds.providers.config.BindProviderMetadataContextAndCredentials;
import org.jclouds.providers.internal.UpdateProviderMetadataFromProperties;
+import org.jclouds.reflect.Invocation;
import org.jclouds.rest.ConfiguresCredentialStore;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.HttpApiMetadata;
-import org.jclouds.rest.RestApiMetadata;
+import org.jclouds.rest.HttpClient;
import org.jclouds.rest.config.CredentialStoreModule;
import org.jclouds.rest.config.HttpApiModule;
-import org.jclouds.rest.config.SyncToAsyncHttpInvocationModule;
-import org.jclouds.rest.config.RestClientModule;
import org.jclouds.rest.config.RestModule;
+import org.jclouds.rest.internal.InvokeHttpMethod;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
@@ -100,6 +97,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.reflect.TypeToken;
import com.google.common.util.concurrent.ExecutionList;
+import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
@@ -427,13 +425,6 @@ public class ContextBuilder {
} catch (IllegalArgumentException ignored) {
}
- } else if (apiMetadata instanceof RestApiMetadata) {
- try {
- modules.add(new BindRestContextWithWildcardExtendsExplicitAndRawType(RestApiMetadata.class
- .cast(apiMetadata)));
- } catch (IllegalArgumentException ignored) {
-
- }
}
}
@@ -455,7 +446,7 @@ public class ContextBuilder {
});
if (restModuleSpecifiedByUser)
- defaultModules = filter(defaultModules, and(not(configuresApi), not(configuresRest)));
+ defaultModules = filter(defaultModules, not(configuresApi));
return defaultModules;
}
@@ -493,7 +484,7 @@ public class ContextBuilder {
}
}
private static boolean apiModulePresent(List<Module> modules) {
- return any(modules, or(configuresApi, configuresRest));
+ return any(modules, configuresApi);
}
private static Predicate<Module> configuresApi = new Predicate<Module>() {
@@ -503,25 +494,22 @@ public class ContextBuilder {
};
- private static Predicate<Module> configuresRest = new Predicate<Module>() {
- public boolean apply(Module input) {
- return input.getClass().isAnnotationPresent(ConfiguresRestClient.class);
- }
-
- };
-
@SuppressWarnings({ "unchecked", "rawtypes" })
static void addClientModule(ApiMetadata apiMetadata, List<Module> modules) {
// TODO: move this up
if (apiMetadata instanceof HttpApiMetadata) {
HttpApiMetadata api = HttpApiMetadata.class.cast(apiMetadata);
modules.add(new HttpApiModule(api.getApi()));
- } else if (apiMetadata instanceof RestApiMetadata) {
- RestApiMetadata rest = RestApiMetadata.class.cast(apiMetadata);
- modules.add(new RestClientModule(typeToken(rest.getApi()), typeToken(rest.getAsyncApi())));
} else {
modules.add(new RestModule());
- modules.add(new SyncToAsyncHttpInvocationModule());
+ // Minimally bind HttpClient so that Utils works.
+ modules.add(new AbstractModule() {
+ @Override public void configure() {
+ bind(new TypeLiteral<Function<Invocation, Object>>() {
+ }).to(InvokeHttpMethod.class);
+ bindHttpApi(binder(), HttpClient.class);
+ }
+ });
}
}
@@ -570,12 +558,13 @@ public class ContextBuilder {
)) {
modules.add(new CredentialStoreModule());
}
+
}
/**
* Builds the base context for this api. Note that this may be of type {@link Closer}, if nothing
* else was configured via {@link ApiMetadata#getContext()}. Typically, the type returned is
- * {@link RestContext}
+ * {@link ApiContext}
*
* @see ApiMetadata#getContext()
* @see #build(TypeToken)
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/apis/ApiPredicates.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/apis/ApiPredicates.java b/core/src/main/java/org/jclouds/apis/ApiPredicates.java
index f87ce58..f75fe3a 100644
--- a/core/src/main/java/org/jclouds/apis/ApiPredicates.java
+++ b/core/src/main/java/org/jclouds/apis/ApiPredicates.java
@@ -20,7 +20,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.emptyToNull;
import org.jclouds.View;
-import org.jclouds.rest.RestApiMetadata;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
@@ -70,35 +69,6 @@ public class ApiPredicates {
}
/**
- * Returns all apis with the given type.
- *
- * @param type
- * the type of the api to return
- *
- * @return the apis with the given type
- */
- public static Predicate<RestApiMetadata> apiAssignableFrom(final TypeToken<?> type) {
- checkNotNull(type, "type must be defined");
- return new Predicate<RestApiMetadata>() {
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean apply(RestApiMetadata apiMetadata) {
- return type.isAssignableFrom(apiMetadata.getApi());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return "contextAssignableFrom(" + type + ")";
- }
- };
- }
-
- /**
* Returns all apis who's contexts are assignable from the parameter
*
* @param type
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/config/BindRestContextWithWildcardExtendsExplicitAndRawType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/config/BindRestContextWithWildcardExtendsExplicitAndRawType.java b/core/src/main/java/org/jclouds/config/BindRestContextWithWildcardExtendsExplicitAndRawType.java
deleted file mode 100644
index 0b8b7da..0000000
--- a/core/src/main/java/org/jclouds/config/BindRestContextWithWildcardExtendsExplicitAndRawType.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.config;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import org.jclouds.rest.RestApiMetadata;
-import org.jclouds.rest.RestContext;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
-import org.jclouds.rest.internal.RestContextImpl;
-
-import com.google.common.reflect.TypeToken;
-import com.google.inject.AbstractModule;
-import com.google.inject.TypeLiteral;
-import com.google.inject.util.Types;
-
-/**
- * Allows you to lookup the {@link RestApiMetadata#getContext()} as {@link RestContext}, {@code RestContext<Client, AsyncClient>}, and {@code
- *
- * @deprecated please use {@link BindApiContextWithWildcardExtendsExplicitAndRawType} as
- * async interface will be removed in jclouds 1.7.
- */
-@Deprecated
-public class BindRestContextWithWildcardExtendsExplicitAndRawType extends AbstractModule {
- private final RestApiMetadata restApiMetadata;
-
- public BindRestContextWithWildcardExtendsExplicitAndRawType(RestApiMetadata restApiMetadata)
- throws IllegalArgumentException {
- this.restApiMetadata = checkNotNull(restApiMetadata, "restApiMetadata");
- checkArgument(restApiMetadata.getContext().getRawType().equals(RestContext.class),
- "this does not work as %s raw type is not RestContext", restApiMetadata.getContext());
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void configure() {
- TypeToken<?> concreteType = BaseRestApiMetadata.contextToken(typeToken(restApiMetadata.getApi()),
- typeToken(restApiMetadata.getAsyncApi()));
- // bind explicit type
- bind(TypeLiteral.get(concreteType.getType())).to(
- TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class,
- restApiMetadata.getApi(), restApiMetadata.getAsyncApi()))));
- // bind potentially wildcard type
- if (!concreteType.equals(restApiMetadata.getContext())) {
- bind(TypeLiteral.get(restApiMetadata.getContext().getType())).to(
- TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class,
- restApiMetadata.getApi(), restApiMetadata.getAsyncApi()))));
- }
- // bind w/o types
- bind(TypeLiteral.get(RestContext.class)).to(
- TypeLiteral.class.cast(TypeLiteral.get(Types.newParameterizedType(RestContextImpl.class,
- restApiMetadata.getApi(), restApiMetadata.getAsyncApi()))));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/providers/AnonymousProviderMetadata.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/providers/AnonymousProviderMetadata.java b/core/src/main/java/org/jclouds/providers/AnonymousProviderMetadata.java
index d413158..2208376 100644
--- a/core/src/main/java/org/jclouds/providers/AnonymousProviderMetadata.java
+++ b/core/src/main/java/org/jclouds/providers/AnonymousProviderMetadata.java
@@ -21,7 +21,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
import org.jclouds.rest.AnonymousHttpApiMetadata;
-import org.jclouds.rest.AnonymousRestApiMetadata;
/**
* Useful in creating arbitrary clients.
@@ -32,10 +31,6 @@ public class AnonymousProviderMetadata extends BaseProviderMetadata {
return forApiWithEndpoint(AnonymousHttpApiMetadata.forApi(api), endpoint);
}
- public static ProviderMetadata forClientMappedToAsyncClientOnEndpoint(Class<?> client, Class<?> asyncClient,
- String endpoint) {
- return forApiWithEndpoint(AnonymousRestApiMetadata.forClientMappedToAsyncClient(client, asyncClient), endpoint);
- }
public static ProviderMetadata forApiWithEndpoint(ApiMetadata md, String endpoint) {
checkNotNull(md, "api");
checkNotNull(endpoint, "endpoint (%s)", md.getEndpointName());
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/AnonymousRestApiMetadata.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/AnonymousRestApiMetadata.java b/core/src/main/java/org/jclouds/rest/AnonymousRestApiMetadata.java
deleted file mode 100644
index 64d89c1..0000000
--- a/core/src/main/java/org/jclouds/rest/AnonymousRestApiMetadata.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 java.net.URI;
-
-import org.jclouds.rest.internal.BaseRestApiMetadata;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Useful in creating arbitrary clients.
- *
- * @deprecated please use {@link AnonymousHttpApiMetadata} as
- * async interface will be removed in jclouds 1.7.
- */
-@Beta
-@Deprecated
-public class AnonymousRestApiMetadata extends BaseRestApiMetadata {
-
- public static AnonymousRestApiMetadata forClientMappedToAsyncClient(Class<?> client, Class<?> asyncClient) {
- return new AnonymousRestApiMetadata(client, asyncClient);
- }
-
- @Override
- public Builder toBuilder() {
- return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this);
- }
-
- public AnonymousRestApiMetadata(Class<?> client, Class<?> asyncClient) {
- super(new Builder(client, asyncClient));
- }
-
- protected AnonymousRestApiMetadata(Builder builder) {
- super(builder);
- }
-
- public static final class Builder extends BaseRestApiMetadata.Builder<Builder> {
-
- public Builder(Class<?> client, Class<?> asyncClient) {
- super(client, asyncClient);
- id(client.getSimpleName())
- .identityName("unused")
- .defaultIdentity("foo")
- .version("1")
- .documentation(URI.create("http://jclouds.org/documentation"));
- }
-
- @Override
- public AnonymousRestApiMetadata build() {
- return new AnonymousRestApiMetadata(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/ConfiguresRestClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/ConfiguresRestClient.java b/core/src/main/java/org/jclouds/rest/ConfiguresRestClient.java
deleted file mode 100644
index f60c8be..0000000
--- a/core/src/main/java/org/jclouds/rest/ConfiguresRestClient.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * designates the module configures a Client to a cloud.
- */
-@Retention(RUNTIME)
-@Target(TYPE)
-public @interface ConfiguresRestClient {
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/HttpAsyncClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/HttpAsyncClient.java b/core/src/main/java/org/jclouds/rest/HttpAsyncClient.java
deleted file mode 100644
index 8d519d7..0000000
--- a/core/src/main/java/org/jclouds/rest/HttpAsyncClient.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 java.io.InputStream;
-import java.net.URI;
-
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseETagHeader;
-import org.jclouds.io.Payload;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.ResponseParser;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Simple rest client
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported.
- */
-@Deprecated
-public interface HttpAsyncClient {
- /**
- * @see HttpClient#put
- */
- @PUT
- @ResponseParser(ParseETagHeader.class)
- ListenableFuture<String> put(@EndpointParam URI location, Payload payload);
-
- /**
- * @see HttpClient#post
- */
- @POST
- @ResponseParser(ParseETagHeader.class)
- ListenableFuture<String> post(@EndpointParam URI location, Payload payload);
-
- /**
- * @see HttpClient#exists
- */
- @HEAD
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> exists(@EndpointParam URI location);
-
- /**
- * @see HttpClient#get
- */
- @GET
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<InputStream> get(@EndpointParam URI location);
-
- /**
- * @see HttpClient#invoke
- */
- ListenableFuture<HttpResponse> invoke(HttpRequest request);
-
- /**
- * @see HttpClient#delete
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> delete(@EndpointParam URI location);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/RestApiMetadata.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/RestApiMetadata.java b/core/src/main/java/org/jclouds/rest/RestApiMetadata.java
deleted file mode 100644
index 1c5dead..0000000
--- a/core/src/main/java/org/jclouds/rest/RestApiMetadata.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 org.jclouds.apis.ApiMetadata;
-
-import com.google.common.annotations.Beta;
-
-/**
- *
- * @since 1.5
- *
- * @deprecated please use {@link HttpApiMetadata} as
- * async interface will be removed in jclouds 1.7.
- */
-@Deprecated
-@Beta
-public interface RestApiMetadata extends ApiMetadata {
-
- public interface Builder<T extends Builder<T>> extends ApiMetadata.Builder<T> {
-
- /**
- * @see ApiMetadata#getApi()
- * @see ApiMetadata#getAsyncApi()
- */
- T javaApi(Class<?> api, Class<?> asyncApi);
- }
-
- /**
- *
- * @return the type of the api which blocks on all requests
- */
- Class<?> getApi();
-
- /**
- *
- * @return the type of the api, which is the same as {@link #getApi}, except
- * all methods return {@link ListenableFuture}
- */
- Class<?> getAsyncApi();
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/config/AnnotatedSyncToAsyncHttpApiProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/config/AnnotatedSyncToAsyncHttpApiProvider.java b/core/src/main/java/org/jclouds/rest/config/AnnotatedSyncToAsyncHttpApiProvider.java
deleted file mode 100644
index 6d5d7ac..0000000
--- a/core/src/main/java/org/jclouds/rest/config/AnnotatedSyncToAsyncHttpApiProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.config;
-
-import java.lang.reflect.Proxy;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.reflect.Invocation;
-import org.jclouds.rest.internal.DelegatesToPotentiallySyncToAsyncInvocationFunction;
-
-import com.google.common.base.Function;
-import com.google.inject.Provider;
-import com.google.inject.TypeLiteral;
-
-/**
- *
- * @deprecated please use {@link DelegatesToInvocationFunction} as async
- * interface will be removed in jclouds 1.7.
- */
-@Deprecated
-@Singleton
-public class AnnotatedSyncToAsyncHttpApiProvider<A> implements Provider<A> {
- private final Class<? super A> annotatedApiType;
- private final DelegatesToPotentiallySyncToAsyncInvocationFunction<A, Function<Invocation, Object>> httpInvoker;
-
- @Inject
- private AnnotatedSyncToAsyncHttpApiProvider(
- DelegatesToPotentiallySyncToAsyncInvocationFunction<A, Function<Invocation, Object>> httpInvoker,
- TypeLiteral<A> annotatedApiType) {
- this.httpInvoker = httpInvoker;
- this.annotatedApiType = annotatedApiType.getRawType();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public A get() {
- return (A) Proxy.newProxyInstance(annotatedApiType.getClassLoader(), new Class<?>[] { annotatedApiType },
- httpInvoker);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/config/BinderUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/config/BinderUtils.java b/core/src/main/java/org/jclouds/rest/config/BinderUtils.java
index 0d3c7d8..6e439a0 100644
--- a/core/src/main/java/org/jclouds/rest/config/BinderUtils.java
+++ b/core/src/main/java/org/jclouds/rest/config/BinderUtils.java
@@ -48,100 +48,6 @@ public class BinderUtils {
binder.bind(annotated).toProvider(TypeLiteral.class.cast(TypeLiteral.get(token.getType())));
}
- /**
- * adds an explicit binding for {@code async} by parsing its annotations. Then, adds an explicit binding for an
- * interface which synchronously blocks on similar calls to an {@code async} type.
- *
- * @param <S>
- * sync interface that blocks
- * @param <A>
- * async type where all methods have same args as {@code sync}, but returns {@link ListenableFuture}
- * @param binder
- * guice binder
- * @param sync
- * type interface that blocks
- * @param async
- * type type that returns {@link ListenableFuture}
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no
- * longer supported.
- */
- @Deprecated
- public static <S, A> void bindSyncToAsyncHttpApi(Binder binder, Class<S> sync, Class<A> async) {
- bindClass(binder, sync);
- bindClass(binder, async);
- bindAnnotatedSyncToAsyncHttpApiProvider(binder, async);
- bindHttpApiProvider(binder, sync, async);
- }
-
- /**
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no
- * longer supported.
- */
- @Deprecated
- @SuppressWarnings({ "unchecked", "serial" })
- private static <T> void bindAnnotatedSyncToAsyncHttpApiProvider(Binder binder, Class<T> annotated) {
- TypeToken<AnnotatedSyncToAsyncHttpApiProvider<T>> token = new TypeToken<AnnotatedSyncToAsyncHttpApiProvider<T>>() {
- }.where(new TypeParameter<T>() {
- }, annotated);
- binder.bind(annotated).toProvider(TypeLiteral.class.cast(TypeLiteral.get(token.getType())));
- }
-
- /**
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no
- * longer supported.
- */
- @Deprecated
- @SuppressWarnings({ "unchecked", "serial" })
- private static <S, A> void bindHttpApiProvider(Binder binder, Class<S> sync, Class<A> async) {
- TypeToken<SyncToAsyncHttpApiProvider<S, A>> token = new TypeToken<SyncToAsyncHttpApiProvider<S, A>>() {
- }.where(new TypeParameter<S>() {
- }, sync).where(new TypeParameter<A>() {
- }, async);
- binder.bind(sync).toProvider(TypeLiteral.class.cast(TypeLiteral.get(token.getType())));
- }
-
- /**
- * adds an explicit binding for an interface which synchronously blocks on
- * similar calls to an {@code async} type.
- *
- * @param <S>
- * sync interface that blocks
- * @param <A>
- * async type where all methods have same args as {@code sync}, but
- * returns {@link ListenableFuture}
- * @param binder
- * guice binder
- * @param sync
- * type interface that blocks
- * @param async
- * type type that returns {@link ListenableFuture}
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no
- * longer supported.
- */
- @Deprecated
- public static <S, A> void bindSyncToAsyncApi(Binder binder, Class<S> sync, Class<A> async) {
- bindClass(binder, sync);
- bindClass(binder, async);
- bindCallGetOnFutures(binder, sync, async);
- }
-
- /**
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no
- * longer supported.
- */
- @Deprecated
- @SuppressWarnings({ "unchecked", "serial" })
- private static <S, A> void bindCallGetOnFutures(Binder binder, Class<S> sync, Class<A> async) {
- TypeToken<CallGetOnFuturesProvider<S, A>> token = new TypeToken<CallGetOnFuturesProvider<S, A>>() {
- }.where(new TypeParameter<S>() {
- }, sync).where(new TypeParameter<A>() {
- }, async);
- binder.bind(sync).toProvider(TypeLiteral.class.cast(TypeLiteral.get(token.getType())));
- }
-
@SuppressWarnings({ "unchecked", "serial" })
private static <K> void bindClass(Binder binder, Class<K> sync) {
binder.bind(TypeLiteral.class.cast(TypeLiteral.get(new TypeToken<Class<K>>() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/config/CallGetOnFuturesProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/config/CallGetOnFuturesProvider.java b/core/src/main/java/org/jclouds/rest/config/CallGetOnFuturesProvider.java
deleted file mode 100644
index ee82528..0000000
--- a/core/src/main/java/org/jclouds/rest/config/CallGetOnFuturesProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.config;
-
-
-import java.lang.reflect.Proxy;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.rest.internal.DelegatesToPotentiallySyncToAsyncInvocationFunction;
-import org.jclouds.rest.internal.InvokeAndCallGetOnFutures;
-
-import com.google.common.cache.Cache;
-import com.google.common.reflect.Invokable;
-import com.google.inject.Provider;
-
-/**
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer supported.
- */
-@Deprecated
-@Singleton
-public class CallGetOnFuturesProvider<S, A> implements Provider<S> {
-
- private final Class<? super S> apiType;
- private final DelegatesToPotentiallySyncToAsyncInvocationFunction<S, InvokeAndCallGetOnFutures<A>> syncInvoker;
-
- @Inject
- private CallGetOnFuturesProvider(Cache<Invokable<?, ?>, Invokable<?, ?>> invokables,
- DelegatesToPotentiallySyncToAsyncInvocationFunction<S, InvokeAndCallGetOnFutures<A>> syncInvoker, Class<S> apiType,
- Class<A> asyncApiType) {
- this.syncInvoker = syncInvoker;
- this.apiType = apiType;
- SyncToAsyncHttpInvocationModule.putInvokables(apiType, asyncApiType, invokables);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- @Singleton
- public S get() {
- return (S) Proxy.newProxyInstance(apiType.getClassLoader(), new Class<?>[] { apiType }, syncInvoker);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/config/RestClientModule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/config/RestClientModule.java b/core/src/main/java/org/jclouds/rest/config/RestClientModule.java
deleted file mode 100644
index 9dfddc1..0000000
--- a/core/src/main/java/org/jclouds/rest/config/RestClientModule.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.config;
-
-import static org.jclouds.reflect.Types2.checkBound;
-import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi;
-
-import java.util.Map;
-
-import org.jclouds.rest.ConfiguresRestClient;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.reflect.TypeToken;
-
-/**
- *
- *
- * @deprecated will be removed in jclouds 1.7; use {@link HttpApiModule}
- */
-@Deprecated
-@ConfiguresRestClient
-public class RestClientModule<S, A> extends RestModule {
- protected final TypeToken<S> syncClientType;
- protected final TypeToken<A> asyncClientType;
-
- private final SyncToAsyncHttpInvocationModule invocationModule;
-
- /**
- * Note that this ctor requires that you instantiate w/resolved generic params. For example, via
- * a subclass of a bound type, or natural instantiation w/resolved type params.
- */
- protected RestClientModule(Map<Class<?>, Class<?>> sync2Async) {
- this.invocationModule = new SyncToAsyncHttpInvocationModule(sync2Async);
- this.syncClientType = checkBound(new TypeToken<S>(getClass()) {
- private static final long serialVersionUID = 1L;
- });
- this.asyncClientType = checkBound(new TypeToken<A>(getClass()) {
- private static final long serialVersionUID = 1L;
- });
- }
-
- /**
- * @see #RestClientModule(Map)
- */
- protected RestClientModule() {
- this(ImmutableMap.<Class<?>, Class<?>> of());
- }
-
- /**
- * @see #RestClientModule(TypeToken, TypeToken, Map)
- */
- public RestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType) {
- this(syncClientType, asyncClientType, ImmutableMap.<Class<?>, Class<?>> of());
- }
-
- /**
- * only necessary when type params are not resolvable at runtime.
- */
- public RestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType, Map<Class<?>, Class<?>> sync2Async) {
- this.invocationModule = new SyncToAsyncHttpInvocationModule(sync2Async);
- this.syncClientType = checkBound(syncClientType);
- this.asyncClientType = checkBound(asyncClientType);
- }
-
- @Override
- protected void configure() {
- super.configure();
- install(invocationModule);
- bindSyncToAsyncHttpApi(binder(), syncClientType.getRawType(), asyncClientType.getRawType());
- bindErrorHandlers();
- bindRetryHandlers();
- }
-
- /**
- * overrides this to change the default retry handlers for the http engine
- *
- * ex.
- *
- * <pre>
- * bind(HttpRetryHandler.class).annotatedWith(Redirection.class).to(AWSRedirectionRetryHandler.class);
- * bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(AWSClientErrorRetryHandler.class);
- * </pre>
- *
- */
- protected void bindRetryHandlers() {
- }
-
- /**
- * overrides this to change the default error handlers for the http engine
- *
- * ex.
- *
- * <pre>
- * bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseAWSErrorFromXmlContent.class);
- * bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseAWSErrorFromXmlContent.class);
- * bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseAWSErrorFromXmlContent.class);
- * </pre>
- *
- *
- */
- protected void bindErrorHandlers() {
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/config/SyncToAsyncHttpApiProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/config/SyncToAsyncHttpApiProvider.java b/core/src/main/java/org/jclouds/rest/config/SyncToAsyncHttpApiProvider.java
deleted file mode 100644
index 4f492e7..0000000
--- a/core/src/main/java/org/jclouds/rest/config/SyncToAsyncHttpApiProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.config;
-
-
-import java.lang.reflect.Proxy;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.reflect.Invocation;
-import org.jclouds.rest.internal.DelegatesToPotentiallySyncToAsyncInvocationFunction;
-
-import com.google.common.base.Function;
-import com.google.common.cache.Cache;
-import com.google.common.reflect.Invokable;
-import com.google.inject.Provider;
-
-/**
- *
- * @deprecated will be removed in jclouds 1.7; use {@link AnnotatedHttpApiProvider}
- */
-@Deprecated
-@Singleton
-public class SyncToAsyncHttpApiProvider<S, A> implements Provider<S> {
- private final Class<? super S> apiType;
- private final DelegatesToPotentiallySyncToAsyncInvocationFunction<S, Function<Invocation, Object>> httpInvoker;
-
- @Inject
- private SyncToAsyncHttpApiProvider(Cache<Invokable<?, ?>, Invokable<?, ?>> invokables,
- DelegatesToPotentiallySyncToAsyncInvocationFunction<S, Function<Invocation, Object>> httpInvoker, Class<S> apiType, Class<A> asyncApiType) {
- this.httpInvoker = httpInvoker;
- this.apiType = apiType;
- SyncToAsyncHttpInvocationModule.putInvokables(apiType, asyncApiType, invokables);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- @Singleton
- public S get() {
- return (S) Proxy.newProxyInstance(apiType.getClassLoader(), new Class<?>[] { apiType }, httpInvoker);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/config/SyncToAsyncHttpInvocationModule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/config/SyncToAsyncHttpInvocationModule.java b/core/src/main/java/org/jclouds/rest/config/SyncToAsyncHttpInvocationModule.java
deleted file mode 100644
index 3ccb15b..0000000
--- a/core/src/main/java/org/jclouds/rest/config/SyncToAsyncHttpInvocationModule.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.config;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.toArray;
-import static com.google.common.collect.Iterables.transform;
-import static org.jclouds.reflect.Reflection2.method;
-import static org.jclouds.reflect.Reflection2.methods;
-
-import java.io.Closeable;
-import java.util.Map;
-
-import javax.inject.Singleton;
-
-import org.jclouds.reflect.Invocation;
-import org.jclouds.rest.HttpAsyncClient;
-import org.jclouds.rest.HttpClient;
-import org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.reflect.Invokable;
-import com.google.common.reflect.Parameter;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.TypeLiteral;
-
-/**
- * supports sync-async mapping
- *
- * @deprecated will be removed in jclouds 1.7; use {@link HttpApiModule}
- */
-@Deprecated
-public class SyncToAsyncHttpInvocationModule extends AbstractModule {
- protected final Map<Class<?>, Class<?>> sync2Async;
-
- public SyncToAsyncHttpInvocationModule() {
- this(ImmutableMap.<Class<?>, Class<?>> of());
- }
-
- public SyncToAsyncHttpInvocationModule(Map<Class<?>, Class<?>> sync2Async) {
- this.sync2Async = sync2Async;
- }
-
- @Override
- protected void configure() {
- bind(new TypeLiteral<Map<Class<?>, Class<?>>>() {
- }).toInstance(sync2Async);
- bind(new TypeLiteral<Function<Invocation, Object>>() {
- }).to(InvokeSyncToAsyncHttpMethod.class);
- BinderUtils.bindSyncToAsyncHttpApi(binder(), HttpClient.class, HttpAsyncClient.class);
- }
-
- /**
- * seeds well-known invokables.
- */
- @Provides
- @Singleton
- protected Cache<Invokable<?, ?>, Invokable<?, ?>> seedKnownSync2AsyncInvokables() {
- return seedKnownSync2AsyncInvokables(sync2Async);
- }
-
- /**
- * function view of above
- *
- * @see InvokeAndCallGetOnFutures
- * @see InvokeSyncToAsyncHttpMethod
- */
- @Provides
- @Singleton
- protected Function<Invocation, Invocation> sync2async(final Cache<Invokable<?, ?>, Invokable<?, ?>> cache) {
- return new Function<Invocation, Invocation>() {
- public Invocation apply(Invocation in) {
- return Invocation.create(
- checkNotNull(cache.getIfPresent(in.getInvokable()), "invokable %s not in %s", in.getInvokable(),
- cache), in.getArgs());
- }
- };
- }
-
- @VisibleForTesting
- static Cache<Invokable<?, ?>, Invokable<?, ?>> seedKnownSync2AsyncInvokables(Map<Class<?>, Class<?>> sync2Async) {
- Cache<Invokable<?, ?>, Invokable<?, ?>> sync2AsyncBuilder = CacheBuilder.newBuilder().build();
- putInvokables(HttpClient.class, HttpAsyncClient.class, sync2AsyncBuilder);
- for (Map.Entry<Class<?>, Class<?>> entry : sync2Async.entrySet()) {
- putInvokables(entry.getKey(), entry.getValue(), sync2AsyncBuilder);
- }
- return sync2AsyncBuilder;
- }
-
- // accessible for ClientProvider
- public static void putInvokables(Class<?> sync, Class<?> async, Cache<Invokable<?, ?>, Invokable<?, ?>> cache) {
- for (Invokable<?, ?> invoked : methods(sync)) {
- Invokable<?, ?> delegatedMethod = method(async, invoked.getName(), getParameterTypes(invoked));
- checkArgument(delegatedMethod.getExceptionTypes().equals(invoked.getExceptionTypes())
- || isCloseable(delegatedMethod), "invoked %s has different typed exceptions than target %s", invoked,
- delegatedMethod);
- cache.put(invoked, delegatedMethod);
- }
- }
-
- /**
- * In JDK7 Closeable.close is declared in AutoCloseable, which throws
- * Exception vs IOException, so we have to be more lenient about exception
- * type declarations.
- *
- * <h4>note</h4>
- *
- * This will be refactored out when we delete Async code in jclouds 1.7.
- */
- private static boolean isCloseable(Invokable<?, ?> delegatedMethod) {
- return "close".equals(delegatedMethod.getName())
- && Closeable.class.isAssignableFrom(delegatedMethod.getDeclaringClass());
- }
-
- /**
- * for portability with {@link Class#getMethod(String, Class...)}
- */
- private static Class<?>[] getParameterTypes(Invokable<?, ?> in) {
- return toArray(transform(checkNotNull(in, "invokable").getParameters(), new Function<Parameter, Class<?>>() {
- public Class<?> apply(Parameter input) {
- return input.getType().getRawType();
- }
- }), Class.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/internal/BaseRestApiMetadata.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/internal/BaseRestApiMetadata.java b/core/src/main/java/org/jclouds/rest/internal/BaseRestApiMetadata.java
deleted file mode 100644
index f2a6c48..0000000
--- a/core/src/main/java/org/jclouds/rest/internal/BaseRestApiMetadata.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import java.util.Properties;
-
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.apis.internal.BaseApiMetadata;
-import org.jclouds.rest.RestApiMetadata;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.reflect.TypeParameter;
-import com.google.common.reflect.TypeToken;
-
-/**
- * Useful in creating rest apis.
- *
- * @deprecated please use {@link BaseHttpApiMetadata} as
- * async interface will be removed in jclouds 1.7.
- */
-@Beta
-@Deprecated
-public abstract class BaseRestApiMetadata extends BaseApiMetadata implements RestApiMetadata {
-
- protected final Class<?> api;
- protected final Class<?> asyncApi;
-
- protected BaseRestApiMetadata(Builder<?> builder) {
- super(builder);
- this.api = checkNotNull(builder.api, "api");
- this.asyncApi = checkNotNull(builder.asyncApi, "asyncApi");
- }
-
- public static Properties defaultProperties() {
- Properties props = BaseApiMetadata.defaultProperties();
- return props;
- }
-
- public static <S, A> TypeToken<org.jclouds.rest.RestContext<S, A>> contextToken(TypeToken<S> apiToken, TypeToken<A> asyncApiToken) {
- return new TypeToken<org.jclouds.rest.RestContext<S, A>>() {
- private static final long serialVersionUID = 1L;
- }.where(new TypeParameter<S>() {
- }, apiToken).where(new TypeParameter<A>() {
- }, asyncApiToken);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends BaseApiMetadata.Builder<T> implements RestApiMetadata.Builder<T> {
- protected Class<?> api;
- protected Class<?> asyncApi;
-
- protected Builder(Class<?> api, Class<?> asyncApi) {
- checkNotNull(api, "api");
- checkNotNull(asyncApi, "asyncApi");
- javaApi(api, asyncApi)
- .name(String.format("%s->%s", api.getSimpleName(), asyncApi.getSimpleName()))
- .context(contextToken(typeToken(api), typeToken(asyncApi)))
- .defaultProperties(BaseRestApiMetadata.defaultProperties());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public T javaApi(Class<?> api, Class<?> asyncApi) {
- this.api = checkNotNull(api, "api");
- this.asyncApi = checkNotNull(asyncApi, "asyncApi");
- return self();
- }
-
- @Override
- public T fromApiMetadata(ApiMetadata in) {
- if (in instanceof RestApiMetadata) {
- RestApiMetadata rest = RestApiMetadata.class.cast(in);
- javaApi(rest.getApi(), rest.getAsyncApi());
- }
- super.fromApiMetadata(in);
- return self();
- }
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Class<?> getApi() {
- return api;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Class<?> getAsyncApi() {
- return asyncApi;
- }
-
- @Override
- protected ToStringHelper string() {
- return super.string().add("api", getApi()).add("asyncApi", getAsyncApi());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/internal/DelegatesToPotentiallySyncToAsyncInvocationFunction.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/internal/DelegatesToPotentiallySyncToAsyncInvocationFunction.java b/core/src/main/java/org/jclouds/rest/internal/DelegatesToPotentiallySyncToAsyncInvocationFunction.java
deleted file mode 100644
index cccdc61..0000000
--- a/core/src/main/java/org/jclouds/rest/internal/DelegatesToPotentiallySyncToAsyncInvocationFunction.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.reflect.Invocation;
-import org.jclouds.reflect.InvocationSuccess;
-import org.jclouds.rest.config.SetCaller;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.util.Types;
-
-/**
- * @param <S>
- * The enclosing type of the interface that a dynamic proxy like this
- * implements
- * @param <F>
- * The function that implements this dynamic proxy
- *
- * @deprecated please use {@link DelegatesToInvocationFunction} as
- * async interface will be removed in jclouds 1.7.
- */
-@Deprecated
-@Beta
-public final class DelegatesToPotentiallySyncToAsyncInvocationFunction<S, F extends Function<Invocation, Object>> extends
- DelegatesToInvocationFunction<S, F> {
- private final Map<Class<?>, Class<?>> syncToAsync;
-
- @Inject
- DelegatesToPotentiallySyncToAsyncInvocationFunction(Injector injector, SetCaller setCaller, Class<S> ownerType,
- Function<InvocationSuccess, Optional<Object>> optionalConverter, F methodInvoker,
- Map<Class<?>, Class<?>> syncToAsync) {
- super(injector, setCaller, ownerType, optionalConverter, methodInvoker);
- this.syncToAsync = checkNotNull(syncToAsync, "syncToAsync");
- }
-
- protected Key<?> methodInvokerFor(Class<?> returnType) {
- if (methodInvoker.getClass().getTypeParameters().length == 2) {
- if (syncToAsync.containsValue(returnType))
- return Key.get(Types.newParameterizedType(methodInvoker.getClass(), returnType, returnType));
- return Key.get(Types.newParameterizedType(
- methodInvoker.getClass(),
- returnType,
- checkNotNull(syncToAsync.get(returnType), "need async type of %s for %s", returnType,
- methodInvoker.getClass())));
- }
- return super.methodInvokerFor(returnType);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/main/java/org/jclouds/rest/internal/InvokeSyncToAsyncHttpMethod.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/internal/InvokeSyncToAsyncHttpMethod.java b/core/src/main/java/org/jclouds/rest/internal/InvokeSyncToAsyncHttpMethod.java
deleted file mode 100644
index 1aa5b68..0000000
--- a/core/src/main/java/org/jclouds/rest/internal/InvokeSyncToAsyncHttpMethod.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.internal;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.transform;
-import static com.google.common.util.concurrent.Futures.withFallback;
-import static java.util.concurrent.TimeUnit.NANOSECONDS;
-import static org.jclouds.Constants.PROPERTY_USER_THREADS;
-
-import java.util.concurrent.Callable;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpCommandExecutorService;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.logging.Logger;
-import org.jclouds.reflect.Invocation;
-import org.jclouds.rest.InvocationContext;
-import org.jclouds.rest.config.InvocationConfig;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.reflect.Invokable;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.TimeLimiter;
-
-/**
- * @deprecated will be replaced in jclouds 1.7 with {@link InvokeHttpMethod}, as async interfaces are no longer supported.
- */
-@Deprecated
-public class InvokeSyncToAsyncHttpMethod implements Function<Invocation, Object> {
-
- @Resource
- private Logger logger = Logger.NULL;
-
- private final Function<Invocation, Invocation> sync2async;
- private final Function<Invocation, HttpRequest> annotationProcessor;
- private final HttpCommandExecutorService http;
- private final ListeningExecutorService userExecutor;
- private final TimeLimiter timeLimiter;
- private final Function<HttpRequest, Function<HttpResponse, ?>> transformerForRequest;
- private final InvocationConfig config;
-
- @Inject
- @VisibleForTesting
- InvokeSyncToAsyncHttpMethod(Function<Invocation, Invocation> sync2async, Function<Invocation, HttpRequest> annotationProcessor,
- HttpCommandExecutorService http, Function<HttpRequest, Function<HttpResponse, ?>> transformerForRequest,
- TimeLimiter timeLimiter, InvocationConfig config,
- @Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
- this.sync2async = sync2async;
- this.annotationProcessor = annotationProcessor;
- this.http = http;
- this.userExecutor = userExecutor;
- this.timeLimiter = timeLimiter;
- this.transformerForRequest = transformerForRequest;
- this.config = config;
- }
-
- @Override
- public Object apply(Invocation in) {
- if (isFuture(in.getInvokable())) {
- return submit(in);
- }
- Invocation async = toAsync(in);
- Optional<Long> timeoutNanos = config.getTimeoutNanos(async);
- if (timeoutNanos.isPresent()) {
- return invokeWithTimeout(async, timeoutNanos.get());
- }
- return invoke(async);
- }
-
- /**
- * submits the {@linkplain HttpCommand} associated with {@code invocation},
- * {@link #getTransformer(String, HttpCommand) parses its response}, and
- * applies a {@link #getFallback(String, Invocation, HttpCommand) fallback}
- * if a {@code Throwable} is encountered. Parsing and Fallback occur on the
- * {@code userExecutor} thread.
- */
- public ListenableFuture<?> submit(Invocation invocation) {
- String commandName = config.getCommandName(invocation);
- HttpCommand command = toCommand(commandName, invocation);
- Function<HttpResponse, ?> transformer = getTransformer(commandName, command);
- org.jclouds.Fallback<?> fallback = getFallback(commandName, invocation, command);
-
- logger.debug(">> submitting %s", commandName);
- return withFallback(transform(http.submit(command), transformer, userExecutor), fallback);
- }
-
- /**
- * invokes the {@linkplain HttpCommand} associated with {@code invocation},
- * {@link #getTransformer(String, HttpCommand) parses its response}, and
- * applies a {@link #getFallback(String, Invocation, HttpCommand) fallback}
- * if a {@code Throwable} is encountered.
- */
- public Object invoke(Invocation invocation) {
- String commandName = config.getCommandName(invocation);
- HttpCommand command = toCommand(commandName, invocation);
- Function<HttpResponse, ?> transformer = getTransformer(commandName, command);
- org.jclouds.Fallback<?> fallback = getFallback(commandName, invocation, command);
-
- logger.debug(">> invoking %s", commandName);
- try {
- return transformer.apply(http.invoke(command));
- } catch (Throwable t) {
- try {
- return fallback.createOrPropagate(t);
- } catch (Exception e) {
- throw propagate(e);
- }
- }
- }
-
- /**
- * calls {@link #invoke(Invocation)}, timing out after the specified time
- * limit. If the target method call finished before the limit is reached, the
- * return value or exception is propagated to the caller exactly as-is. If,
- * on the other hand, the time limit is reached, we attempt to abort the call
- * to the target, and throw an {@link UncheckedTimeoutException} to the
- * caller.
- *
- * @param invocation
- * the Invocation to invoke via {@link #invoke(Invocation)}
- * @param limitNanos
- * with timeoutUnit, the maximum length of time to wait in
- * nanoseconds
- * @throws InterruptedException
- * if our thread is interrupted during execution
- * @throws UncheckedTimeoutException
- * if the time limit is reached
- * @see TimeLimiter#callWithTimeout(Callable, long, TimeUnit, boolean)
- */
- public Object invokeWithTimeout(final Invocation invocation, final long limitNanos) {
- String commandName = config.getCommandName(invocation);
- HttpCommand command = toCommand(commandName, invocation);
- org.jclouds.Fallback<?> fallback = getFallback(commandName, invocation, command);
-
- logger.debug(">> blocking on %s for %s", invocation, limitNanos);
- try {
- return timeLimiter
- .callWithTimeout(new InvokeAndTransform(commandName, command), limitNanos, NANOSECONDS, true);
- } catch (Throwable t) {
- try {
- return fallback.createOrPropagate(t);
- } catch (Exception e) {
- throw propagate(e);
- }
- }
- }
-
- private org.jclouds.Fallback<?> getFallback(String commandName, Invocation invocation, HttpCommand command) {
- HttpRequest request = command.getCurrentRequest();
- org.jclouds.Fallback<?> fallback = config.getFallback(invocation);
- if (fallback instanceof InvocationContext)
- InvocationContext.class.cast(fallback).setContext(request);
- logger.trace("<< exceptions from %s are parsed by %s", commandName, fallback.getClass().getSimpleName());
- return fallback;
- }
-
- @VisibleForTesting
- final class InvokeAndTransform implements Callable<Object> {
- private final String commandName;
- private final HttpCommand command;
- private final Function<HttpResponse, ?> transformer;
-
- InvokeAndTransform(String commandName, HttpCommand command) {
- this.commandName = commandName;
- this.command = command;
- this.transformer = getTransformer(commandName, command);
- }
-
- @Override
- public Object call() throws Exception {
- return transformer.apply(http.invoke(command));
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(commandName, command, transformer);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null || getClass() != obj.getClass())
- return false;
- InvokeAndTransform that = InvokeAndTransform.class.cast(obj);
- return equal(this.commandName, that.commandName) && equal(this.command, that.command)
- && equal(this.transformer, that.transformer);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("commandName", commandName).add("command", command)
- .add("transformer", transformer).toString();
- }
- }
-
- /**
- * looks up the corresponding {@code Invocation} that returns a
- * {@code Future}. Only Invokables that return {@code Futures} are annotated
- * in a way that can be parsed into an {@linkplain HttpRequest}.
- */
- private Invocation toAsync(Invocation in) {
- Invocation async = sync2async.apply(in);
- checkState(isFuture(async.getInvokable()), "not a future: %s", async);
- return async;
- }
-
- private HttpCommand toCommand(String commandName, Invocation invocation) {
- logger.trace(">> converting %s", commandName);
- HttpRequest request = annotationProcessor.apply(invocation);
- logger.trace("<< converted %s to %s", commandName, request.getRequestLine());
- return new HttpCommand(request);
- }
-
- private Function<HttpResponse, ?> getTransformer(String commandName, HttpCommand command) {
- HttpRequest request = command.getCurrentRequest();
- Function<HttpResponse, ?> transformer = transformerForRequest.apply(request);
- logger.trace("<< response from %s is parsed by %s", commandName, transformer.getClass().getSimpleName());
- return transformer;
- }
-
- private boolean isFuture(Invokable<?, ?> in) {
- return in.getReturnType().getRawType().equals(ListenableFuture.class);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- InvokeSyncToAsyncHttpMethod that = InvokeSyncToAsyncHttpMethod.class.cast(o);
- return equal(this.annotationProcessor, that.annotationProcessor);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(annotationProcessor);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper("").omitNullValues().add("annotationParser", annotationProcessor).toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/ContextBuilderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/ContextBuilderTest.java b/core/src/test/java/org/jclouds/ContextBuilderTest.java
index 9faa6a1..ac59433 100644
--- a/core/src/test/java/org/jclouds/ContextBuilderTest.java
+++ b/core/src/test/java/org/jclouds/ContextBuilderTest.java
@@ -17,6 +17,7 @@
package org.jclouds;
import static com.google.common.base.Suppliers.ofInstance;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.testng.Assert.assertEquals;
import java.net.URI;
@@ -28,7 +29,6 @@ import java.util.Set;
import org.jclouds.concurrent.config.ExecutorServiceModule;
import org.jclouds.domain.Credentials;
import org.jclouds.events.config.EventBusModule;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
import org.jclouds.http.config.ConfiguresHttpCommandExecutorService;
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
@@ -36,9 +36,7 @@ import org.jclouds.location.Provider;
import org.jclouds.logging.config.LoggingModule;
import org.jclouds.logging.config.NullLoggingModule;
import org.jclouds.logging.jdk.config.JDKLoggingModule;
-import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.annotations.ApiVersion;
import org.jclouds.rest.config.CredentialStoreModule;
import org.testng.annotations.Test;
@@ -47,7 +45,6 @@ import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.inject.AbstractModule;
-import com.google.inject.Binder;
import com.google.inject.Key;
import com.google.inject.Module;
import com.google.inject.TypeLiteral;
@@ -65,8 +62,7 @@ public class ContextBuilderTest {
}
private ContextBuilder testContextBuilder() {
- return ContextBuilder.newBuilder(AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
- IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost"));
+ return ContextBuilder.newBuilder(forApiOnEndpoint(IntegrationTestClient.class, "http://localhost"));
}
@Test
@@ -198,14 +194,6 @@ public class ContextBuilderTest {
assertEquals(modules.remove(0), httpModule);
}
- @ConfiguresRestClient
- static class ConfiguresClientModule implements Module {
-
- public void configure(Binder arg0) {
- }
-
- }
-
@Test
public void testAddBothWhenDefault() {
List<Module> modules = Lists.newArrayList();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/apis/JcloudsTestBlobStoreApiMetadata.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/apis/JcloudsTestBlobStoreApiMetadata.java b/core/src/test/java/org/jclouds/apis/JcloudsTestBlobStoreApiMetadata.java
index 39e3a9d..6cb7127 100644
--- a/core/src/test/java/org/jclouds/apis/JcloudsTestBlobStoreApiMetadata.java
+++ b/core/src/test/java/org/jclouds/apis/JcloudsTestBlobStoreApiMetadata.java
@@ -18,14 +18,13 @@ package org.jclouds.apis;
import java.net.URI;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
/**
* Implementation of @ link org.jclouds.types.ApiMetadata} for testing.
*/
-public class JcloudsTestBlobStoreApiMetadata extends BaseRestApiMetadata {
+public class JcloudsTestBlobStoreApiMetadata extends BaseHttpApiMetadata {
public static Builder builder() {
return new Builder();
@@ -44,10 +43,10 @@ public class JcloudsTestBlobStoreApiMetadata extends BaseRestApiMetadata {
super(builder);
}
- public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
+ public static class Builder extends BaseHttpApiMetadata.Builder<IntegrationTestClient, Builder> {
protected Builder() {
- super(IntegrationTestClient.class, IntegrationTestAsyncClient.class);
+ super(IntegrationTestClient.class);
id("test-blobstore-api")
.view(Storage.class)
.name("Test Blobstore Api")
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/apis/JcloudsTestComputeApiMetadata.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/apis/JcloudsTestComputeApiMetadata.java b/core/src/test/java/org/jclouds/apis/JcloudsTestComputeApiMetadata.java
index 084f1a5..66f080c 100644
--- a/core/src/test/java/org/jclouds/apis/JcloudsTestComputeApiMetadata.java
+++ b/core/src/test/java/org/jclouds/apis/JcloudsTestComputeApiMetadata.java
@@ -18,14 +18,13 @@ package org.jclouds.apis;
import java.net.URI;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
/**
* Implementation of @ link org.jclouds.types.ApiMetadata} for testing.
*/
-public class JcloudsTestComputeApiMetadata extends BaseRestApiMetadata {
+public class JcloudsTestComputeApiMetadata extends BaseHttpApiMetadata {
public static Builder builder() {
return new Builder();
@@ -44,10 +43,10 @@ public class JcloudsTestComputeApiMetadata extends BaseRestApiMetadata {
super(builder);
}
- public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
+ public static class Builder extends BaseHttpApiMetadata.Builder<IntegrationTestClient, Builder> {
protected Builder() {
- super(IntegrationTestClient.class, IntegrationTestAsyncClient.class);
+ super(IntegrationTestClient.class);
id("test-compute-api")
.view(Compute.class)
.name("Test Compute Api")
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/apis/JcloudsTestYetAnotherComputeApiMetadata.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/apis/JcloudsTestYetAnotherComputeApiMetadata.java b/core/src/test/java/org/jclouds/apis/JcloudsTestYetAnotherComputeApiMetadata.java
index 60cc431..12988d2 100644
--- a/core/src/test/java/org/jclouds/apis/JcloudsTestYetAnotherComputeApiMetadata.java
+++ b/core/src/test/java/org/jclouds/apis/JcloudsTestYetAnotherComputeApiMetadata.java
@@ -18,14 +18,13 @@ package org.jclouds.apis;
import java.net.URI;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
/**
* Implementation of @ link org.jclouds.types.ApiMetadata} for testing.
*/
-public class JcloudsTestYetAnotherComputeApiMetadata extends BaseRestApiMetadata {
+public class JcloudsTestYetAnotherComputeApiMetadata extends BaseHttpApiMetadata {
public static Builder builder() {
return new Builder();
@@ -44,10 +43,10 @@ public class JcloudsTestYetAnotherComputeApiMetadata extends BaseRestApiMetadata
super(builder);
}
- public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
+ public static class Builder extends BaseHttpApiMetadata.Builder<IntegrationTestClient, Builder> {
protected Builder() {
- super(IntegrationTestClient.class, IntegrationTestAsyncClient.class);
+ super(IntegrationTestClient.class);
id("test-yet-another-compute-api")
.view(Compute.class)
.name("Test Yet Another Compute Api")
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3497536/core/src/test/java/org/jclouds/config/BindApiContextWithWildcardExtendsExplicitAndRawTypeTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/config/BindApiContextWithWildcardExtendsExplicitAndRawTypeTest.java b/core/src/test/java/org/jclouds/config/BindApiContextWithWildcardExtendsExplicitAndRawTypeTest.java
deleted file mode 100644
index 8997081..0000000
--- a/core/src/test/java/org/jclouds/config/BindApiContextWithWildcardExtendsExplicitAndRawTypeTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.config;
-
-import static com.google.common.base.Suppliers.ofInstance;
-import static org.easymock.EasyMock.createMock;
-import static org.testng.Assert.assertEquals;
-
-import javax.inject.Inject;
-
-import org.jclouds.Context;
-import org.jclouds.domain.Credentials;
-import org.jclouds.http.IntegrationTestAsyncClient;
-import org.jclouds.http.IntegrationTestClient;
-import org.jclouds.providers.AnonymousProviderMetadata;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.providers.config.BindProviderMetadataContextAndCredentials;
-import org.jclouds.rest.ApiContext;
-import org.jclouds.rest.HttpApiMetadata;
-import org.jclouds.rest.Utils;
-import org.jclouds.rest.internal.BaseRestApiTest.MockModule;
-import org.testng.annotations.Test;
-
-import com.google.common.reflect.TypeToken;
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-@Test(groups = "unit", testName = "BindApiContextWithWildcardExtendsExplicitAndRawTypeTest")
-public class BindApiContextWithWildcardExtendsExplicitAndRawTypeTest {
-
- @SuppressWarnings("rawtypes")
- private static class ExpectedBindings {
-
- private final ApiContext raw;
- private final ApiContext<IntegrationTestClient> explicit;
-
- @Inject
- public ExpectedBindings(ApiContext raw, ApiContext<IntegrationTestClient> explicit) {
- this.raw = raw;
- this.explicit = explicit;
- }
-
- }
-
- @Test
- public void testRawAndExplicit() {
- ProviderMetadata md = AnonymousProviderMetadata.forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");
-
- ExpectedBindings bindings = injectorFor(md).getInstance(ExpectedBindings.class);
- assertEquals(bindings.raw, bindings.explicit);
- }
-
- private Injector injectorFor(ProviderMetadata md) {
- return Guice.createInjector(new BindNameToContext("test"), new BindProviderMetadataContextAndCredentials(md,
- ofInstance(new Credentials("user", "pass"))), new BindApiContextWithWildcardExtendsExplicitAndRawType(
- HttpApiMetadata.class.cast(md.getApiMetadata())),
-
- // stuff needed for ApiContextImpl
- new MockModule(), new AbstractModule() {
-
- @Override
- protected void configure() {
- bind(Utils.class).toInstance(createMock(Utils.class));
- bind(IntegrationTestClient.class).toInstance(createMock(IntegrationTestClient.class));
- bind(IntegrationTestAsyncClient.class).toInstance(createMock(IntegrationTestAsyncClient.class));
- }
- });
- }
-
- @SuppressWarnings("rawtypes")
- private static class ExpectedBindingsWithWildCardExtends {
-
- private final ApiContext raw;
- private final ApiContext<IntegrationTestClient> explicit;
- private final ApiContext<? extends IntegrationTestClient> wildcardExtends;
-
- @Inject
- public ExpectedBindingsWithWildCardExtends(ApiContext raw, ApiContext<IntegrationTestClient> explicit,
- ApiContext<? extends IntegrationTestClient> wildcardExtends) {
- this.raw = raw;
- this.explicit = explicit;
- this.wildcardExtends = wildcardExtends;
- }
-
- }
-
- @Test
- public void testRawExplicitAndWildCardExtends() {
- ProviderMetadata md = AnonymousProviderMetadata.forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");
-
- TypeToken<? extends Context> wildCardExtendsType = new TypeToken<ApiContext<? extends IntegrationTestClient>>() {
- private static final long serialVersionUID = 1L;
- };
-
- md = md.toBuilder().apiMetadata(md.getApiMetadata().toBuilder().context(wildCardExtendsType).build()).build();
-
- ExpectedBindingsWithWildCardExtends bindings = injectorFor(md).getInstance(
- ExpectedBindingsWithWildCardExtends.class);
- assertEquals(bindings.raw, bindings.explicit);
- assertEquals(bindings.explicit, bindings.wildcardExtends);
- }
-}
[12/52] [abbrv] git commit: JCLOUDS-40 missing azure-common reference
from azureblob.
Posted by an...@apache.org.
JCLOUDS-40 missing azure-common reference from azureblob.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/c13220dc
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/c13220dc
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/c13220dc
Branch: refs/heads/use-agentproxy-008
Commit: c13220dc93bc87844ac0f2618dccfbe7ab4a8704
Parents: 4c95a57
Author: Adrian Cole <ac...@twitter.com>
Authored: Fri Oct 3 22:43:32 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Fri Oct 3 23:13:46 2014 -0700
----------------------------------------------------------------------
providers/azureblob/pom.xml | 6 ------
.../filters/SharedKeyLiteAuthenticationTest.java | 15 ++-------------
2 files changed, 2 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c13220dc/providers/azureblob/pom.xml
----------------------------------------------------------------------
diff --git a/providers/azureblob/pom.xml b/providers/azureblob/pom.xml
index bbeef91..52f155c 100644
--- a/providers/azureblob/pom.xml
+++ b/providers/azureblob/pom.xml
@@ -44,12 +44,6 @@
<dependencies>
<dependency>
- <groupId>org.apache.jclouds.common</groupId>
- <artifactId>azure-common</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- </dependency>
- <dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-blobstore</artifactId>
<version>${project.version}</version>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c13220dc/providers/azureblob/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java b/providers/azureblob/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java
index 5bea836..68ebaeb 100644
--- a/providers/azureblob/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java
+++ b/providers/azureblob/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java
@@ -16,7 +16,6 @@
*/
package org.jclouds.azure.storage.filters;
-import static org.jclouds.reflect.Reflection2.typeToken;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
@@ -25,12 +24,8 @@ import java.net.URI;
import javax.ws.rs.HttpMethod;
import org.jclouds.ContextBuilder;
-import org.jclouds.azure.storage.config.AzureStorageRestClientModule;
import org.jclouds.http.HttpRequest;
-import org.jclouds.http.IntegrationTestAsyncClient;
-import org.jclouds.http.IntegrationTestClient;
import org.jclouds.logging.config.NullLoggingModule;
-import org.jclouds.rest.AnonymousRestApiMetadata;
import org.jclouds.rest.internal.BaseRestApiTest.MockModule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -126,16 +121,10 @@ public class SharedKeyLiteAuthenticationTest {
@BeforeClass
protected void createFilter() throws IOException {
injector = ContextBuilder
- .newBuilder(
- AnonymousRestApiMetadata
- .forClientMappedToAsyncClient(IntegrationTestClient.class, IntegrationTestAsyncClient.class)
- .toBuilder().build())
+ .newBuilder("azureblob")
.endpoint("https://${jclouds.identity}.blob.core.windows.net")
.credentials(ACCOUNT, "credential")
- .modules(
- ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule(),
- new AzureStorageRestClientModule<IntegrationTestClient, IntegrationTestAsyncClient>(
- typeToken(IntegrationTestClient.class), typeToken(IntegrationTestAsyncClient.class))))
+ .modules(ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule()))
.buildInjector();
filter = injector.getInstance(SharedKeyLiteAuthentication.class);
}
[08/52] [abbrv] git commit: JCLOUDS-40 unasync atmos.
Posted by an...@apache.org.
JCLOUDS-40 unasync atmos.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/9b71a9dc
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/9b71a9dc
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/9b71a9dc
Branch: refs/heads/use-agentproxy-008
Commit: 9b71a9dcb8f5361cdcfb671f6bacbe757ec6dfc8
Parents: 9df0cd2
Author: Adrian Cole <ac...@twitter.com>
Authored: Fri Oct 3 21:38:57 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Fri Oct 3 22:06:12 2014 -0700
----------------------------------------------------------------------
apis/atmos/pom.xml | 1 -
.../org/jclouds/atmos/AtmosApiMetadata.java | 26 +-
.../org/jclouds/atmos/AtmosAsyncClient.java | 230 -------------
.../java/org/jclouds/atmos/AtmosClient.java | 165 +++++++--
.../atmos/blobstore/AtmosAsyncBlobStore.java | 289 ----------------
.../atmos/blobstore/AtmosBlobRequestSigner.java | 8 +-
.../config/AtmosBlobStoreContextModule.java | 7 +-
.../atmos/config/AtmosHttpApiModule.java | 96 ++++++
.../atmos/config/AtmosRestClientModule.java | 97 ------
.../org/jclouds/atmos/AtmosAsyncClientTest.java | 333 -------------------
.../org/jclouds/atmos/AtmosClientLiveTest.java | 2 +-
.../java/org/jclouds/atmos/AtmosClientTest.java | 330 ++++++++++++++++++
.../blobstore/AtmosBlobRequestSignerTest.java | 14 +-
.../jclouds/atmos/filters/SignRequestTest.java | 10 +-
.../atmos/internal/StubAtmosAsyncClient.java | 246 --------------
15 files changed, 587 insertions(+), 1267 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/pom.xml
----------------------------------------------------------------------
diff --git a/apis/atmos/pom.xml b/apis/atmos/pom.xml
index f6830e5..57ee14e 100644
--- a/apis/atmos/pom.xml
+++ b/apis/atmos/pom.xml
@@ -91,7 +91,6 @@
</goals>
<configuration>
<systemPropertyVariables>
- <test.initializer>${test.initializer}</test.initializer>
<jclouds.blobstore.httpstream.url>${jclouds.blobstore.httpstream.url}</jclouds.blobstore.httpstream.url>
<jclouds.blobstore.httpstream.md5>${jclouds.blobstore.httpstream.md5}</jclouds.blobstore.httpstream.md5>
<test.atmos.endpoint>${test.atmos.endpoint}</test.atmos.endpoint>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java
index 874f6e1..109ef1f 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
package org.jclouds.atmos;
+
import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX;
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
import static org.jclouds.reflect.Reflection2.typeToken;
@@ -23,27 +24,15 @@ import java.net.URI;
import java.util.Properties;
import org.jclouds.atmos.blobstore.config.AtmosBlobStoreContextModule;
-import org.jclouds.atmos.config.AtmosRestClientModule;
+import org.jclouds.atmos.config.AtmosHttpApiModule;
import org.jclouds.blobstore.BlobStoreContext;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
import org.jclouds.rest.internal.BaseRestApiMetadata;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
-/**
- * Implementation of {@link ApiMetadata} for EMC Atmos API
- */
-public class AtmosApiMetadata extends BaseRestApiMetadata {
-
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AtmosClient.class)} as
- * {@link AtmosAsyncClient} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<AtmosClient, AtmosAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<AtmosClient, AtmosAsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
+public class AtmosApiMetadata extends BaseHttpApiMetadata {
private static Builder builder() {
return new Builder();
@@ -69,10 +58,9 @@ public class AtmosApiMetadata extends BaseRestApiMetadata {
return properties;
}
- public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
- @SuppressWarnings("deprecation")
+ public static class Builder extends BaseHttpApiMetadata.Builder<AtmosClient, Builder> {
protected Builder() {
- super(AtmosClient.class, AtmosAsyncClient.class);
+ super(AtmosClient.class);
id("atmos")
.name("EMC's Atmos API")
.identityName("Subtenant ID (UID)")
@@ -82,7 +70,7 @@ public class AtmosApiMetadata extends BaseRestApiMetadata {
.defaultEndpoint("https://accesspoint.atmosonline.com")
.defaultProperties(AtmosApiMetadata.defaultProperties())
.view(typeToken(BlobStoreContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(AtmosRestClientModule.class, AtmosBlobStoreContextModule.class));
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(AtmosHttpApiModule.class, AtmosBlobStoreContextModule.class));
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java
deleted file mode 100644
index 5334487..0000000
--- a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.atmos;
-
-import static com.google.common.net.HttpHeaders.EXPECT;
-
-import java.io.Closeable;
-import java.net.URI;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.atmos.binders.BindMetadataToHeaders;
-import org.jclouds.atmos.domain.AtmosObject;
-import org.jclouds.atmos.domain.BoundedSet;
-import org.jclouds.atmos.domain.DirectoryEntry;
-import org.jclouds.atmos.domain.SystemMetadata;
-import org.jclouds.atmos.domain.UserMetadata;
-import org.jclouds.atmos.fallbacks.TrueOn404FalseOnPathNotEmpty;
-import org.jclouds.atmos.filters.SignRequest;
-import org.jclouds.atmos.functions.AtmosObjectName;
-import org.jclouds.atmos.functions.ParseDirectoryListFromContentAndHeaders;
-import org.jclouds.atmos.functions.ParseNullableURIFromListOrLocationHeaderIf20x;
-import org.jclouds.atmos.functions.ParseObjectFromHeadersAndHttpContent;
-import org.jclouds.atmos.functions.ParseSystemMetadataFromHeaders;
-import org.jclouds.atmos.functions.ParseUserMetadataFromHeaders;
-import org.jclouds.atmos.functions.ReturnTrueIfGroupACLIsOtherRead;
-import org.jclouds.atmos.options.ListOptions;
-import org.jclouds.atmos.options.PutOptions;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyAlreadyExists;
-import org.jclouds.blobstore.BlobStoreFallbacks.ThrowContainerNotFoundOn404;
-import org.jclouds.blobstore.BlobStoreFallbacks.ThrowKeyNotFoundOn404;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.ParamParser;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.inject.Provides;
-
-/**
- * Provides asynchronous access to EMC Atmos Online Storage resources via their REST API.
- * <p/>
- *
- * @see AtmosClient
- * @see <a href="https://community.emc.com/community/labs/atmos_online" />
- *
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AtmosClient.class)} as
- * {@link AtmosAsyncClient} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-@RequestFilters(SignRequest.class)
-@Path("/rest/namespace")
-public interface AtmosAsyncClient extends Closeable {
- /**
- * Creates a default implementation of AtmosObject
- */
- @Provides
- AtmosObject newObject();
-
- /**
- * @see AtmosClient#listDirectories
- */
- @Named("ListDirectory")
- @GET
- @Path("/")
- @ResponseParser(ParseDirectoryListFromContentAndHeaders.class)
- @Consumes(MediaType.TEXT_XML)
- ListenableFuture<BoundedSet<? extends DirectoryEntry>> listDirectories(ListOptions... options);
-
- /**
- * @see AtmosClient#listDirectory
- */
- @Named("ListDirectory")
- @GET
- @Path("/{directoryName}/")
- @ResponseParser(ParseDirectoryListFromContentAndHeaders.class)
- @Fallback(ThrowContainerNotFoundOn404.class)
- @Consumes(MediaType.TEXT_XML)
- ListenableFuture<BoundedSet<? extends DirectoryEntry>> listDirectory(
- @PathParam("directoryName") String directoryName, ListOptions... options);
-
- /**
- * @see AtmosClient#createDirectory
- */
- @Named("CreateDirectory")
- @POST
- @Path("/{directoryName}/")
- @Fallback(NullOnKeyAlreadyExists.class)
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
- @Consumes(MediaType.WILDCARD)
- ListenableFuture<URI> createDirectory(@PathParam("directoryName") String directoryName, PutOptions... options);
-
- /**
- * @see AtmosClient#createFile
- */
- @Nullable
- @Named("CreateObject")
- @POST
- @Path("/{parent}/{name}")
- @Headers(keys = EXPECT, values = "100-continue")
- @ResponseParser(ParseNullableURIFromListOrLocationHeaderIf20x.class)
- @Consumes(MediaType.WILDCARD)
- ListenableFuture<URI> createFile(
- @PathParam("parent") String parent,
- @PathParam("name") @ParamParser(AtmosObjectName.class) @BinderParam(BindMetadataToHeaders.class) AtmosObject object,
- PutOptions... options);
-
- /**
- * @see AtmosClient#updateFile
- */
- @Named("UpdateObject")
- @PUT
- @Path("/{parent}/{name}")
- @Headers(keys = EXPECT, values = "100-continue")
- @Fallback(ThrowKeyNotFoundOn404.class)
- @Consumes(MediaType.WILDCARD)
- ListenableFuture<Void> updateFile(
- @PathParam("parent") String parent,
- @PathParam("name") @ParamParser(AtmosObjectName.class) @BinderParam(BindMetadataToHeaders.class) AtmosObject object,
- PutOptions... options);
-
- /**
- * @see AtmosClient#readFile
- */
- @Named("ReadObject")
- @GET
- @ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
- @Fallback(NullOnNotFoundOr404.class)
- @Path("/{path}")
- @Consumes(MediaType.WILDCARD)
- ListenableFuture<AtmosObject> readFile(@PathParam("path") String path, GetOptions... options);
-
- /**
- * @see AtmosClient#headFile
- */
- @Named("GetObjectMetadata")
- @HEAD
- @ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
- @Fallback(NullOnNotFoundOr404.class)
- @Path("/{path}")
- @Consumes(MediaType.WILDCARD)
- ListenableFuture<AtmosObject> headFile(@PathParam("path") String path);
-
- /**
- * @see AtmosClient#getSystemMetadata
- */
- @Named("GetSystemMetadata")
- @HEAD
- @ResponseParser(ParseSystemMetadataFromHeaders.class)
- @Fallback(NullOnNotFoundOr404.class)
- // currently throws 403 errors @QueryParams(keys = "metadata/system")
- @Path("/{path}")
- @Consumes(MediaType.WILDCARD)
- ListenableFuture<SystemMetadata> getSystemMetadata(@PathParam("path") String path);
-
- /**
- * @see AtmosClient#getUserMetadata
- */
- @Named("GetUserMetadata")
- @HEAD
- @ResponseParser(ParseUserMetadataFromHeaders.class)
- @Fallback(NullOnNotFoundOr404.class)
- @Path("/{path}")
- @QueryParams(keys = "metadata/user")
- @Consumes(MediaType.WILDCARD)
- ListenableFuture<UserMetadata> getUserMetadata(@PathParam("path") String path);
-
- /**
- * @see AtmosClient#deletePath
- */
- @Named("DeleteObject")
- @DELETE
- @Fallback(TrueOn404FalseOnPathNotEmpty.class)
- @Path("/{path}")
- @Consumes(MediaType.WILDCARD)
- ListenableFuture<Boolean> deletePath(@PathParam("path") String path);
-
- /**
- * @see AtmosClient#pathExists
- */
- @Named("GetObjectMetadata")
- @HEAD
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/{path}")
- @Consumes(MediaType.WILDCARD)
- ListenableFuture<Boolean> pathExists(@PathParam("path") String path);
-
- /**
- * @see AtmosClient#isPublic
- */
- @Named("GetObjectMetadata")
- @HEAD
- @ResponseParser(ReturnTrueIfGroupACLIsOtherRead.class)
- @Path("/{path}")
- @Consumes(MediaType.WILDCARD)
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> isPublic(@PathParam("path") String path);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/main/java/org/jclouds/atmos/AtmosClient.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosClient.java b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosClient.java
index 38168e2..9d5a5ce 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosClient.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosClient.java
@@ -16,57 +16,162 @@
*/
package org.jclouds.atmos;
+import static com.google.common.net.HttpHeaders.EXPECT;
+import static org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import static org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyAlreadyExists;
+import static org.jclouds.blobstore.BlobStoreFallbacks.ThrowContainerNotFoundOn404;
+import static org.jclouds.blobstore.BlobStoreFallbacks.ThrowKeyNotFoundOn404;
+
import java.io.Closeable;
import java.net.URI;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.atmos.binders.BindMetadataToHeaders;
import org.jclouds.atmos.domain.AtmosObject;
import org.jclouds.atmos.domain.BoundedSet;
import org.jclouds.atmos.domain.DirectoryEntry;
import org.jclouds.atmos.domain.SystemMetadata;
import org.jclouds.atmos.domain.UserMetadata;
+import org.jclouds.atmos.fallbacks.TrueOn404FalseOnPathNotEmpty;
+import org.jclouds.atmos.filters.SignRequest;
+import org.jclouds.atmos.functions.AtmosObjectName;
+import org.jclouds.atmos.functions.ParseDirectoryListFromContentAndHeaders;
+import org.jclouds.atmos.functions.ParseNullableURIFromListOrLocationHeaderIf20x;
+import org.jclouds.atmos.functions.ParseObjectFromHeadersAndHttpContent;
+import org.jclouds.atmos.functions.ParseSystemMetadataFromHeaders;
+import org.jclouds.atmos.functions.ParseUserMetadataFromHeaders;
+import org.jclouds.atmos.functions.ReturnTrueIfGroupACLIsOtherRead;
import org.jclouds.atmos.options.ListOptions;
import org.jclouds.atmos.options.PutOptions;
import org.jclouds.http.options.GetOptions;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.ParamParser;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
import com.google.inject.Provides;
-/**
- * Provides access to EMC Atmos Online Storage resources via their REST API.
- * <p/>
- *
- * @see AtmosAsyncClient
- * @see <a href="https://community.emc.com/community/labs/atmos_online" />
- */
+/** Provides access to EMC Atmos Online Storage resources via their REST API. */
+@RequestFilters(SignRequest.class)
+@Path("/rest/namespace")
public interface AtmosClient extends Closeable {
- /**
- * Creates a default implementation of AtmosObject
- */
+
@Provides
AtmosObject newObject();
+ @Named("ListDirectory")
+ @GET
+ @Path("/")
+ @ResponseParser(ParseDirectoryListFromContentAndHeaders.class)
+ @Consumes(MediaType.TEXT_XML)
BoundedSet<? extends DirectoryEntry> listDirectories(ListOptions... options);
- BoundedSet<? extends DirectoryEntry> listDirectory(String directoryName, ListOptions... options);
-
- URI createDirectory(String directoryName, PutOptions... options);
+ @Named("ListDirectory")
+ @GET
+ @Path("/{directoryName}/")
+ @ResponseParser(ParseDirectoryListFromContentAndHeaders.class)
+ @Fallback(ThrowContainerNotFoundOn404.class)
+ @Consumes(MediaType.TEXT_XML)
+ BoundedSet<? extends DirectoryEntry> listDirectory(
+ @PathParam("directoryName") String directoryName, ListOptions... options);
+
+ @Named("CreateDirectory")
+ @POST
+ @Path("/{directoryName}/")
+ @Fallback(NullOnKeyAlreadyExists.class)
+ @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @Consumes(MediaType.WILDCARD)
+ URI createDirectory(@PathParam("directoryName") String directoryName, PutOptions... options);
@Nullable
- URI createFile(String parent, AtmosObject object, PutOptions... options);
-
- void updateFile(String parent, AtmosObject object, PutOptions... options);
-
- AtmosObject readFile(String path, GetOptions... options);
-
- AtmosObject headFile(String path);
-
- SystemMetadata getSystemMetadata(String path);
-
- UserMetadata getUserMetadata(String path);
-
- void deletePath(String path);
-
- boolean pathExists(String path);
-
- boolean isPublic(String path);
+ @Named("CreateObject")
+ @POST
+ @Path("/{parent}/{name}")
+ @Headers(keys = EXPECT, values = "100-continue")
+ @ResponseParser(ParseNullableURIFromListOrLocationHeaderIf20x.class)
+ @Consumes(MediaType.WILDCARD)
+ URI createFile(@PathParam("parent") String parent, @PathParam("name") @ParamParser(AtmosObjectName.class)
+ @BinderParam(BindMetadataToHeaders.class) AtmosObject object, PutOptions... options);
+
+ @Named("UpdateObject")
+ @PUT
+ @Path("/{parent}/{name}")
+ @Headers(keys = EXPECT, values = "100-continue")
+ @Fallback(ThrowKeyNotFoundOn404.class)
+ @Consumes(MediaType.WILDCARD)
+ void updateFile(@PathParam("parent") String parent, @PathParam("name") @ParamParser(AtmosObjectName.class)
+ @BinderParam(BindMetadataToHeaders.class) AtmosObject object, PutOptions... options);
+
+ @Named("ReadObject")
+ @GET
+ @ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Path("/{path}")
+ @Consumes(MediaType.WILDCARD)
+ AtmosObject readFile(@PathParam("path") String path, GetOptions... options);
+
+ @Named("GetObjectMetadata")
+ @HEAD
+ @ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Path("/{path}")
+ @Consumes(MediaType.WILDCARD)
+ AtmosObject headFile(@PathParam("path") String path);
+
+ @Named("GetSystemMetadata")
+ @HEAD
+ @ResponseParser(ParseSystemMetadataFromHeaders.class)
+ @Fallback(NullOnNotFoundOr404.class)
+ // currently throws 403 errors @QueryParams(keys = "metadata/system")
+ @Path("/{path}")
+ @Consumes(MediaType.WILDCARD)
+ SystemMetadata getSystemMetadata(@PathParam("path") String path);
+
+ @Named("GetUserMetadata")
+ @HEAD
+ @ResponseParser(ParseUserMetadataFromHeaders.class)
+ @Fallback(NullOnNotFoundOr404.class)
+ @Path("/{path}")
+ @QueryParams(keys = "metadata/user")
+ @Consumes(MediaType.WILDCARD)
+ UserMetadata getUserMetadata(@PathParam("path") String path);
+
+ @Named("DeleteObject")
+ @DELETE
+ @Fallback(TrueOn404FalseOnPathNotEmpty.class)
+ @Path("/{path}")
+ @Consumes(MediaType.WILDCARD)
+ boolean deletePath(@PathParam("path") String path);
+
+ @Named("GetObjectMetadata")
+ @HEAD
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Path("/{path}")
+ @Consumes(MediaType.WILDCARD)
+ boolean pathExists(@PathParam("path") String path);
+
+ @Named("GetObjectMetadata")
+ @HEAD
+ @ResponseParser(ReturnTrueIfGroupACLIsOtherRead.class)
+ @Path("/{path}")
+ @Consumes(MediaType.WILDCARD)
+ @Fallback(FalseOnNotFoundOr404.class)
+ boolean isPublic(@PathParam("path") String path);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosAsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosAsyncBlobStore.java b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosAsyncBlobStore.java
deleted file mode 100644
index 3beec33..0000000
--- a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosAsyncBlobStore.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.atmos.blobstore;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.util.concurrent.Futures.transform;
-import static org.jclouds.atmos.options.PutOptions.Builder.publicRead;
-
-import java.net.URI;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.atmos.AtmosAsyncClient;
-import org.jclouds.atmos.AtmosClient;
-import org.jclouds.atmos.blobstore.functions.BlobStoreListOptionsToListOptions;
-import org.jclouds.atmos.blobstore.functions.BlobToObject;
-import org.jclouds.atmos.blobstore.functions.DirectoryEntryListToResourceMetadataList;
-import org.jclouds.atmos.blobstore.functions.ObjectToBlob;
-import org.jclouds.atmos.blobstore.functions.ObjectToBlobMetadata;
-import org.jclouds.atmos.domain.AtmosObject;
-import org.jclouds.atmos.domain.BoundedSet;
-import org.jclouds.atmos.domain.DirectoryEntry;
-import org.jclouds.atmos.options.ListOptions;
-import org.jclouds.atmos.util.AtmosUtils;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
-import org.jclouds.blobstore.internal.BaseAsyncBlobStore;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.blobstore.options.PutOptions;
-import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.collect.Memoized;
-import org.jclouds.crypto.Crypto;
-import org.jclouds.domain.Location;
-import org.jclouds.http.options.GetOptions;
-
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Supplier;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported. Please use {@link AtmosBlobStore}
- */
-@Deprecated
-@Singleton
-public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
- private final AtmosAsyncClient async;
- private final AtmosClient sync;
- private final ObjectToBlob object2Blob;
- private final ObjectToBlobMetadata object2BlobMd;
- private final BlobToObject blob2Object;
- private final BlobStoreListOptionsToListOptions container2ContainerListOptions;
- private final DirectoryEntryListToResourceMetadataList container2ResourceList;
- private final Crypto crypto;
- private final BlobToHttpGetOptions blob2ObjectGetOptions;
- private final Provider<FetchBlobMetadata> fetchBlobMetadataProvider;
- private final LoadingCache<String, Boolean> isPublic;
-
- @Inject
- AtmosAsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, Supplier<Location> defaultLocation,
- @Memoized Supplier<Set<? extends Location>> locations, AtmosAsyncClient async, AtmosClient sync,
- ObjectToBlob object2Blob, ObjectToBlobMetadata object2BlobMd, BlobToObject blob2Object,
- BlobStoreListOptionsToListOptions container2ContainerListOptions,
- DirectoryEntryListToResourceMetadataList container2ResourceList, Crypto crypto,
- BlobToHttpGetOptions blob2ObjectGetOptions, Provider<FetchBlobMetadata> fetchBlobMetadataProvider,
- LoadingCache<String, Boolean> isPublic) {
- super(context, blobUtils, userExecutor, defaultLocation, locations);
- this.blob2ObjectGetOptions = checkNotNull(blob2ObjectGetOptions, "blob2ObjectGetOptions");
- this.sync = checkNotNull(sync, "sync");
- this.async = checkNotNull(async, "async");
- this.container2ContainerListOptions = checkNotNull(container2ContainerListOptions,
- "container2ContainerListOptions");
- this.container2ResourceList = checkNotNull(container2ResourceList, "container2ResourceList");
- this.object2Blob = checkNotNull(object2Blob, "object2Blob");
- this.blob2Object = checkNotNull(blob2Object, "blob2Object");
- this.object2BlobMd = checkNotNull(object2BlobMd, "object2BlobMd");
- this.crypto = checkNotNull(crypto, "crypto");
- this.fetchBlobMetadataProvider = checkNotNull(fetchBlobMetadataProvider, "fetchBlobMetadataProvider");
- this.isPublic = checkNotNull(isPublic, "isPublic");
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#headFile}
- */
- @Override
- public ListenableFuture<BlobMetadata> blobMetadata(String container, String key) {
- return transform(async.headFile(container + "/" + key), new Function<AtmosObject, BlobMetadata>() {
- @Override
- public BlobMetadata apply(AtmosObject from) {
- return object2BlobMd.apply(from);
- }
- }, userExecutor);
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#createDirectory}
- * <p/>
- * Note location is ignored
- */
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, String container) {
- return transform(async.createDirectory(container), new Function<URI, Boolean>() {
- public Boolean apply(URI from) {
- return from != null;
- }
- }, userExecutor);
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#createDirectory}
- */
- @Override
- public ListenableFuture<Void> createDirectory(String container, String directory) {
- return transform(async.createDirectory(container + "/" + directory), new Function<URI, Void>() {
- public Void apply(URI from) {
- return null; // no etag
- }
- }, userExecutor);
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#deletePath} followed by
- * {@link AtmosAsyncClient#pathExists} until it is true.
- */
- protected boolean deleteAndVerifyContainerGone(final String container) {
- sync.deletePath(container + "/");
- return !sync.pathExists(container + "/");
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#pathExists}
- */
- @Override
- public ListenableFuture<Boolean> containerExists(String container) {
- return async.pathExists(container + "/");
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#pathExists}
- */
- @Override
- public ListenableFuture<Boolean> directoryExists(String container, String directory) {
- return async.pathExists(container + "/" + directory + "/");
- }
-
- /**
- * This implementation invokes {@link #removeBlob}
- */
- @Override
- public ListenableFuture<Void> deleteDirectory(String containerName, String directory) {
- return removeBlob(containerName, directory + "/");
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#pathExists}
- *
- * @param container
- * container
- * @param key
- * file name
- */
- @Override
- public ListenableFuture<Boolean> blobExists(String container, String key) {
- return async.pathExists(container + "/" + key);
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#readFile}
- */
- @Override
- public ListenableFuture<Blob> getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions options) {
- GetOptions httpOptions = blob2ObjectGetOptions.apply(options);
- ListenableFuture<AtmosObject> returnVal = async.readFile(container + "/" + key, httpOptions);
- return transform(returnVal, object2Blob, userExecutor);
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#listDirectories}
- */
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list() {
- return transform(async.listDirectories(), container2ResourceList, userExecutor);
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#listDirectory}
- */
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list(String container,
- org.jclouds.blobstore.options.ListContainerOptions options) {
- container = AtmosUtils.adjustContainerIfDirOptionPresent(container, options);
- ListOptions nativeOptions = container2ContainerListOptions.apply(options);
- ListenableFuture<BoundedSet<? extends DirectoryEntry>> returnVal = async.listDirectory(container, nativeOptions);
- ListenableFuture<PageSet<? extends StorageMetadata>> list = transform(returnVal, container2ResourceList,
- userExecutor);
- return options.isDetailed() ? transform(list,
- fetchBlobMetadataProvider.get().setContainerName(container)) : list;
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#createFile}
- * <p/>
- * Since there is no etag support in atmos, we just return the path.
- */
- @Override
- public ListenableFuture<String> putBlob(final String container, final Blob blob) {
- final org.jclouds.atmos.options.PutOptions options = new org.jclouds.atmos.options.PutOptions();
- try {
- if (isPublic.getUnchecked(container + "/"))
- options.publicRead();
- } catch (CacheLoader.InvalidCacheLoadException e) {
- // nulls not permitted
- }
- return userExecutor.submit(new Callable<String>() {
-
- @Override
- public String call() throws Exception {
- return AtmosUtils.putBlob(sync, crypto, blob2Object, container, blob, options);
- }
-
- @Override
- public String toString() {
- return "putBlob(" + container + "," + blob.getMetadata().getName() + ")";
- }
- });
-
- }
-
- /**
- * This implementation invokes {@link AtmosAsyncClient#deletePath}
- */
- @Override
- public ListenableFuture<Void> removeBlob(String container, String key) {
- return Futures.transform(async.deletePath(container + "/" + key), Functions.constant((Void) null),
- userExecutor);
- }
-
- @Override
- public ListenableFuture<String> putBlob(String container, Blob blob, PutOptions options) {
- // TODO implement options
- return putBlob(container, blob);
- }
-
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, String container,
- CreateContainerOptions options) {
- if (options.isPublicRead())
- return transform(async.createDirectory(container, publicRead()), new Function<URI, Boolean>() {
-
- public Boolean apply(URI from) {
- return from != null;
- }
-
- }, userExecutor);
- return createContainerInLocation(location, container);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSigner.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSigner.java b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSigner.java
index c3e8172..8563222 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSigner.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSigner.java
@@ -23,7 +23,7 @@ import static org.jclouds.reflect.Reflection2.method;
import javax.inject.Inject;
import javax.inject.Singleton;
-import org.jclouds.atmos.AtmosAsyncClient;
+import org.jclouds.atmos.AtmosClient;
import org.jclouds.atmos.blobstore.functions.BlobToObject;
import org.jclouds.atmos.domain.AtmosObject;
import org.jclouds.atmos.options.PutOptions;
@@ -54,9 +54,9 @@ public class AtmosBlobRequestSigner implements BlobRequestSigner {
this.processor = checkNotNull(processor, "processor");
this.blobToObject = checkNotNull(blobToObject, "blobToObject");
this.blob2ObjectGetOptions = checkNotNull(blob2ObjectGetOptions, "blob2ObjectGetOptions");
- this.getMethod = method(AtmosAsyncClient.class, "readFile", String.class, GetOptions[].class);
- this.deleteMethod = method(AtmosAsyncClient.class, "deletePath", String.class);
- this.createMethod = method(AtmosAsyncClient.class, "createFile", String.class, AtmosObject.class, PutOptions[].class);
+ this.getMethod = method(AtmosClient.class, "readFile", String.class, GetOptions[].class);
+ this.deleteMethod = method(AtmosClient.class, "deletePath", String.class);
+ this.createMethod = method(AtmosClient.class, "createFile", String.class, AtmosObject.class, PutOptions[].class);
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
index 8cf13d3..a562ed6 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
@@ -21,13 +21,13 @@ import java.util.concurrent.TimeUnit;
import javax.inject.Singleton;
import org.jclouds.atmos.AtmosClient;
-import org.jclouds.atmos.blobstore.AtmosAsyncBlobStore;
import org.jclouds.atmos.blobstore.AtmosBlobRequestSigner;
import org.jclouds.atmos.blobstore.AtmosBlobStore;
import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
+import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
@@ -36,15 +36,12 @@ import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Scopes;
-/**
- * Configures the {@link AtmosBlobStoreContext}; requires {@link AtmosAsyncBlobStore} bound.
- */
public class AtmosBlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
- bind(AsyncBlobStore.class).to(AtmosAsyncBlobStore.class).in(Scopes.SINGLETON);
+ bind(AsyncBlobStore.class).to(SubmissionAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(AtmosBlobStore.class).in(Scopes.SINGLETON);
bind(BlobRequestSigner.class).to(AtmosBlobRequestSigner.class);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosHttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosHttpApiModule.java b/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosHttpApiModule.java
new file mode 100644
index 0000000..af21f9b
--- /dev/null
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosHttpApiModule.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.atmos.config;
+
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+
+import javax.inject.Named;
+
+import org.jclouds.Constants;
+import org.jclouds.atmos.AtmosClient;
+import org.jclouds.atmos.handlers.AtmosClientErrorRetryHandler;
+import org.jclouds.atmos.handlers.AtmosServerErrorRetryHandler;
+import org.jclouds.atmos.handlers.ParseAtmosErrorFromXmlContent;
+import org.jclouds.date.DateService;
+import org.jclouds.date.TimeStamp;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpRetryHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.config.HttpApiModule;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.inject.Provides;
+
+/**
+ * Configures the EMC Atmos Online Storage authentication service connection, including logging and
+ * http transport.
+ */
+@ConfiguresHttpApi
+public class AtmosHttpApiModule extends HttpApiModule<AtmosClient> {
+
+ @Override
+ protected void configure() {
+ install(new AtmosParserModule());
+ install(new AtmosObjectModule());
+ super.configure();
+ }
+
+ @Provides
+ @TimeStamp
+ protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
+ return cache.get();
+ }
+
+ /**
+ * borrowing concurrency code to ensure that caching takes place properly
+ */
+ @Provides
+ @TimeStamp
+ Supplier<String> provideTimeStampCache(@Named(Constants.PROPERTY_SESSION_INTERVAL) long seconds,
+ final DateService dateService) {
+ return Suppliers.memoizeWithExpiration(new Supplier<String>() {
+ public String get() {
+ return dateService.rfc822DateFormat();
+ }
+ }, seconds, TimeUnit.SECONDS);
+ }
+
+ @Provides
+ @TimeStamp
+ protected Long provideShareableUrlTimeout() {
+ return new Date().getTime() + TimeUnit.HOURS.toMillis(1);
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseAtmosErrorFromXmlContent.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseAtmosErrorFromXmlContent.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseAtmosErrorFromXmlContent.class);
+ }
+
+ @Override
+ protected void bindRetryHandlers() {
+ bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(AtmosClientErrorRetryHandler.class);
+ bind(HttpRetryHandler.class).annotatedWith(ServerError.class).to(AtmosServerErrorRetryHandler.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosRestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosRestClientModule.java b/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosRestClientModule.java
deleted file mode 100644
index c118450..0000000
--- a/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosRestClientModule.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.atmos.config;
-
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Named;
-
-import org.jclouds.Constants;
-import org.jclouds.atmos.AtmosAsyncClient;
-import org.jclouds.atmos.AtmosClient;
-import org.jclouds.atmos.handlers.AtmosClientErrorRetryHandler;
-import org.jclouds.atmos.handlers.AtmosServerErrorRetryHandler;
-import org.jclouds.atmos.handlers.ParseAtmosErrorFromXmlContent;
-import org.jclouds.date.DateService;
-import org.jclouds.date.TimeStamp;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpRetryHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.inject.Provides;
-
-/**
- * Configures the EMC Atmos Online Storage authentication service connection, including logging and
- * http transport.
- */
-@ConfiguresRestClient
-public class AtmosRestClientModule extends RestClientModule<AtmosClient, AtmosAsyncClient> {
-
- @Override
- protected void configure() {
- install(new AtmosParserModule());
- install(new AtmosObjectModule());
- super.configure();
- }
-
- @Provides
- @TimeStamp
- protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
- return cache.get();
- }
-
- /**
- * borrowing concurrency code to ensure that caching takes place properly
- */
- @Provides
- @TimeStamp
- Supplier<String> provideTimeStampCache(@Named(Constants.PROPERTY_SESSION_INTERVAL) long seconds,
- final DateService dateService) {
- return Suppliers.memoizeWithExpiration(new Supplier<String>() {
- public String get() {
- return dateService.rfc822DateFormat();
- }
- }, seconds, TimeUnit.SECONDS);
- }
-
- @Provides
- @TimeStamp
- protected Long provideShareableUrlTimeout() {
- return new Date().getTime() + TimeUnit.HOURS.toMillis(1);
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseAtmosErrorFromXmlContent.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseAtmosErrorFromXmlContent.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseAtmosErrorFromXmlContent.class);
- }
-
- @Override
- protected void bindRetryHandlers() {
- bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(AtmosClientErrorRetryHandler.class);
- bind(HttpRetryHandler.class).annotatedWith(ServerError.class).to(AtmosServerErrorRetryHandler.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java
deleted file mode 100644
index 7dc2297..0000000
--- a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.atmos;
-
-import static org.jclouds.reflect.Reflection2.method;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.atmos.blobstore.functions.BlobToObject;
-import org.jclouds.atmos.config.AtmosRestClientModule;
-import org.jclouds.atmos.domain.AtmosObject;
-import org.jclouds.atmos.fallbacks.TrueOn404FalseOnPathNotEmpty;
-import org.jclouds.atmos.filters.SignRequest;
-import org.jclouds.atmos.functions.ParseDirectoryListFromContentAndHeaders;
-import org.jclouds.atmos.functions.ParseNullableURIFromListOrLocationHeaderIf20x;
-import org.jclouds.atmos.functions.ParseObjectFromHeadersAndHttpContent;
-import org.jclouds.atmos.functions.ParseSystemMetadataFromHeaders;
-import org.jclouds.atmos.functions.ReturnTrueIfGroupACLIsOtherRead;
-import org.jclouds.atmos.options.ListOptions;
-import org.jclouds.atmos.options.PutOptions;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyAlreadyExists;
-import org.jclouds.blobstore.BlobStoreFallbacks.ThrowContainerNotFoundOn404;
-import org.jclouds.blobstore.BlobStoreFallbacks.ThrowKeyNotFoundOn404;
-import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest;
-import org.jclouds.date.TimeStamp;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.functions.ParseURIFromListOrLocationHeaderIf20x;
-import org.jclouds.http.functions.ReleasePayloadAndReturn;
-import org.jclouds.http.functions.ReturnTrueIf2xx;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.net.HttpHeaders;
-import com.google.common.reflect.Invokable;
-import com.google.inject.Module;
-/**
- * Tests behavior of {@code AtmosAsyncClient}
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
-@Test(groups = "unit", testName = "AtmosAsyncClientTest")
-public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient> {
-
- private BlobToObject blobToObject;
-
- public void testListDirectories() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "listDirectories", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/ HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testListDirectory() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "listDirectory", String.class, ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("directory"));
-
- assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/directory/ HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, ThrowContainerNotFoundOn404.class);
-
- checkFilters(request);
- }
-
- public void testListDirectoriesOptions() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "listDirectories", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(new ListOptions().limit(1).token("asda")));
-
- assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/ HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\nx-emc-limit: 1\nx-emc-token: asda\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testListDirectoryOptions() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "listDirectory", String.class, ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("directory", new ListOptions().limit(1).token("asda")));
-
- assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/directory/ HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\nx-emc-limit: 1\nx-emc-token: asda\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, ThrowContainerNotFoundOn404.class);
-
- checkFilters(request);
- }
-
- public void testCreateDirectory() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "createDirectory", String.class, PutOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir"));
-
- assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/ HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
- assertPayloadEquals(request, "", "application/octet-stream", false);
-
- assertResponseParserClassEquals(method, request, ParseURIFromListOrLocationHeaderIf20x.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnKeyAlreadyExists.class);
-
- checkFilters(request);
- }
-
- public void testCreateDirectoryOptions() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "createDirectory", String.class, PutOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", PutOptions.Builder.publicRead()));
-
- assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/ HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT
- + ": */*\nx-emc-groupacl: other=READ\nx-emc-useracl: root=FULL_CONTROL\n");
- assertPayloadEquals(request, "", "application/octet-stream", false);
-
- assertResponseParserClassEquals(method, request, ParseURIFromListOrLocationHeaderIf20x.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnKeyAlreadyExists.class);
-
- checkFilters(request);
- }
-
- public void testCreateFile() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "createFile", String.class, AtmosObject.class,
- PutOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
- .apply(BindBlobToMultipartFormTest.TEST_BLOB)));
-
- assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\nExpect: 100-continue\n");
- assertPayloadEquals(request, "hello", "text/plain", false);
-
- assertResponseParserClassEquals(method, request, ParseNullableURIFromListOrLocationHeaderIf20x.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testCreateFileOptions() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "createFile", String.class, AtmosObject.class,
- PutOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
- .apply(BindBlobToMultipartFormTest.TEST_BLOB), PutOptions.Builder.publicRead()));
-
- assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT
- + ": */*\nExpect: 100-continue\nx-emc-groupacl: other=READ\nx-emc-useracl: root=FULL_CONTROL\n");
- assertPayloadEquals(request, "hello", "text/plain", false);
-
- assertResponseParserClassEquals(method, request, ParseNullableURIFromListOrLocationHeaderIf20x.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testUpdateFile() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "updateFile", String.class, AtmosObject.class,
- PutOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
- .apply(BindBlobToMultipartFormTest.TEST_BLOB)));
-
- assertRequestLineEquals(request, "PUT https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\nExpect: 100-continue\n");
- assertPayloadEquals(request, "hello", "text/plain", false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, ThrowKeyNotFoundOn404.class);
-
- checkFilters(request);
- }
-
- public void testUpdateFileOptions() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "updateFile", String.class, AtmosObject.class,
- PutOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
- .apply(BindBlobToMultipartFormTest.TEST_BLOB), PutOptions.Builder.publicRead()));
-
- assertRequestLineEquals(request, "PUT https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT
- + ": */*\nExpect: 100-continue\nx-emc-groupacl: other=READ\nx-emc-useracl: root=FULL_CONTROL\n");
- assertPayloadEquals(request, "hello", "text/plain", false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, ThrowKeyNotFoundOn404.class);
-
- checkFilters(request);
- }
-
- public void testReadFile() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "readFile", String.class, GetOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
-
- assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseObjectFromHeadersAndHttpContent.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testGetSystemMetadata() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "getSystemMetadata", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
-
- assertRequestLineEquals(request, "HEAD https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSystemMetadataFromHeaders.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testDeletePath() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "deletePath", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
-
- assertRequestLineEquals(request, "DELETE https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, TrueOn404FalseOnPathNotEmpty.class);
-
- checkFilters(request);
- }
-
- public void testIsPublic() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "isPublic", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
-
- assertRequestLineEquals(request, "HEAD https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
- assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIfGroupACLIsOtherRead.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testNewObject() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AtmosAsyncClient.class, "newObject");
- assertEquals(method.getReturnType().getRawType(), AtmosObject.class);
- }
-
- @Override
- protected void checkFilters(HttpRequest request) {
- assertEquals(request.getFilters().size(), 1);
- assertEquals(request.getFilters().get(0).getClass(), SignRequest.class);
- }
-
- @BeforeClass
- @Override
- protected void setupFactory() throws IOException {
- super.setupFactory();
- blobToObject = injector.getInstance(BlobToObject.class);
- }
-
- @Override
- protected Module createModule() {
- return new TestAtmosRestClientModule();
- }
-
- @ConfiguresRestClient
- private static final class TestAtmosRestClientModule extends AtmosRestClientModule {
- @Override
- protected void configure() {
- super.configure();
- }
-
- @Override
- protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
- return "Thu, 05 Jun 2008 16:38:19 GMT";
- }
- }
-
- protected String provider = "atmos";
-
- @Override
- public ApiMetadata createApiMetadata() {
- return new AtmosApiMetadata();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientLiveTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientLiveTest.java
index 9f57ddb..0ba9a37 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientLiveTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientLiveTest.java
@@ -63,7 +63,7 @@ public class AtmosClientLiveTest extends BaseBlobStoreIntegrationTest {
}
public AtmosClient getApi() {
- return view.unwrap(AtmosApiMetadata.CONTEXT_TOKEN).getApi();
+ return view.unwrapApi(AtmosClient.class);
}
private static final class HeadMatches implements Runnable {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientTest.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientTest.java
new file mode 100644
index 0000000..7fa5d4f
--- /dev/null
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientTest.java
@@ -0,0 +1,330 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.atmos;
+
+import static org.jclouds.reflect.Reflection2.method;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.atmos.blobstore.functions.BlobToObject;
+import org.jclouds.atmos.config.AtmosHttpApiModule;
+import org.jclouds.atmos.domain.AtmosObject;
+import org.jclouds.atmos.fallbacks.TrueOn404FalseOnPathNotEmpty;
+import org.jclouds.atmos.filters.SignRequest;
+import org.jclouds.atmos.functions.ParseDirectoryListFromContentAndHeaders;
+import org.jclouds.atmos.functions.ParseNullableURIFromListOrLocationHeaderIf20x;
+import org.jclouds.atmos.functions.ParseObjectFromHeadersAndHttpContent;
+import org.jclouds.atmos.functions.ParseSystemMetadataFromHeaders;
+import org.jclouds.atmos.functions.ReturnTrueIfGroupACLIsOtherRead;
+import org.jclouds.atmos.options.ListOptions;
+import org.jclouds.atmos.options.PutOptions;
+import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyAlreadyExists;
+import org.jclouds.blobstore.BlobStoreFallbacks.ThrowContainerNotFoundOn404;
+import org.jclouds.blobstore.BlobStoreFallbacks.ThrowKeyNotFoundOn404;
+import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest;
+import org.jclouds.date.TimeStamp;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.functions.ParseURIFromListOrLocationHeaderIf20x;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.http.functions.ReturnTrueIf2xx;
+import org.jclouds.http.options.GetOptions;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableList;
+import com.google.common.net.HttpHeaders;
+import com.google.common.reflect.Invokable;
+import com.google.inject.Module;
+
+@Test(groups = "unit", testName = "AtmosClientTest")
+public class AtmosClientTest extends BaseAsyncClientTest<AtmosClient> {
+
+ private BlobToObject blobToObject;
+
+ public void testListDirectories() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "listDirectories", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/ HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testListDirectory() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "listDirectory", String.class, ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("directory"));
+
+ assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/directory/ HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, ThrowContainerNotFoundOn404.class);
+
+ checkFilters(request);
+ }
+
+ public void testListDirectoriesOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "listDirectories", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(new ListOptions().limit(1).token("asda")));
+
+ assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/ HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\nx-emc-limit: 1\nx-emc-token: asda\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testListDirectoryOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "listDirectory", String.class, ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("directory", new ListOptions().limit(1).token("asda")));
+
+ assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/directory/ HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\nx-emc-limit: 1\nx-emc-token: asda\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, ThrowContainerNotFoundOn404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCreateDirectory() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "createDirectory", String.class, PutOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir"));
+
+ assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/ HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
+ assertPayloadEquals(request, "", "application/octet-stream", false);
+
+ assertResponseParserClassEquals(method, request, ParseURIFromListOrLocationHeaderIf20x.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnKeyAlreadyExists.class);
+
+ checkFilters(request);
+ }
+
+ public void testCreateDirectoryOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "createDirectory", String.class, PutOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", PutOptions.Builder.publicRead()));
+
+ assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/ HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT
+ + ": */*\nx-emc-groupacl: other=READ\nx-emc-useracl: root=FULL_CONTROL\n");
+ assertPayloadEquals(request, "", "application/octet-stream", false);
+
+ assertResponseParserClassEquals(method, request, ParseURIFromListOrLocationHeaderIf20x.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnKeyAlreadyExists.class);
+
+ checkFilters(request);
+ }
+
+ public void testCreateFile() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "createFile", String.class, AtmosObject.class,
+ PutOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
+ .apply(BindBlobToMultipartFormTest.TEST_BLOB)));
+
+ assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\nExpect: 100-continue\n");
+ assertPayloadEquals(request, "hello", "text/plain", false);
+
+ assertResponseParserClassEquals(method, request, ParseNullableURIFromListOrLocationHeaderIf20x.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testCreateFileOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "createFile", String.class, AtmosObject.class,
+ PutOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
+ .apply(BindBlobToMultipartFormTest.TEST_BLOB), PutOptions.Builder.publicRead()));
+
+ assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT
+ + ": */*\nExpect: 100-continue\nx-emc-groupacl: other=READ\nx-emc-useracl: root=FULL_CONTROL\n");
+ assertPayloadEquals(request, "hello", "text/plain", false);
+
+ assertResponseParserClassEquals(method, request, ParseNullableURIFromListOrLocationHeaderIf20x.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUpdateFile() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "updateFile", String.class, AtmosObject.class,
+ PutOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
+ .apply(BindBlobToMultipartFormTest.TEST_BLOB)));
+
+ assertRequestLineEquals(request, "PUT https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\nExpect: 100-continue\n");
+ assertPayloadEquals(request, "hello", "text/plain", false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, ThrowKeyNotFoundOn404.class);
+
+ checkFilters(request);
+ }
+
+ public void testUpdateFileOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "updateFile", String.class, AtmosObject.class,
+ PutOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
+ .apply(BindBlobToMultipartFormTest.TEST_BLOB), PutOptions.Builder.publicRead()));
+
+ assertRequestLineEquals(request, "PUT https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT
+ + ": */*\nExpect: 100-continue\nx-emc-groupacl: other=READ\nx-emc-useracl: root=FULL_CONTROL\n");
+ assertPayloadEquals(request, "hello", "text/plain", false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, ThrowKeyNotFoundOn404.class);
+
+ checkFilters(request);
+ }
+
+ public void testReadFile() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "readFile", String.class, GetOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
+
+ assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseObjectFromHeadersAndHttpContent.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetSystemMetadata() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "getSystemMetadata", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
+
+ assertRequestLineEquals(request, "HEAD https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSystemMetadataFromHeaders.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testDeletePath() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "deletePath", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
+
+ assertRequestLineEquals(request, "DELETE https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, TrueOn404FalseOnPathNotEmpty.class);
+
+ checkFilters(request);
+ }
+
+ public void testIsPublic() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "isPublic", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
+
+ assertRequestLineEquals(request, "HEAD https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIfGroupACLIsOtherRead.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testNewObject() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AtmosClient.class, "newObject");
+ assertEquals(method.getReturnType().getRawType(), AtmosObject.class);
+ }
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ assertEquals(request.getFilters().get(0).getClass(), SignRequest.class);
+ }
+
+ @BeforeClass
+ @Override
+ protected void setupFactory() throws IOException {
+ super.setupFactory();
+ blobToObject = injector.getInstance(BlobToObject.class);
+ }
+
+ @Override
+ protected Module createModule() {
+ return new TestAtmosHttpApiModule();
+ }
+
+ @ConfiguresHttpApi
+ private static final class TestAtmosHttpApiModule extends AtmosHttpApiModule {
+ @Override
+ protected void configure() {
+ super.configure();
+ }
+
+ @Override
+ protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
+ return "Thu, 05 Jun 2008 16:38:19 GMT";
+ }
+ }
+
+ protected String provider = "atmos";
+
+ @Override
+ public ApiMetadata createApiMetadata() {
+ return new AtmosApiMetadata();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java
index 97f8862..39720ab 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java
@@ -23,15 +23,15 @@ import java.util.Date;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.atmos.AtmosApiMetadata;
-import org.jclouds.atmos.AtmosAsyncClient;
-import org.jclouds.atmos.config.AtmosRestClientModule;
+import org.jclouds.atmos.AtmosClient;
+import org.jclouds.atmos.config.AtmosHttpApiModule;
import org.jclouds.atmos.filters.SignRequest;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.Blob.Factory;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -45,7 +45,7 @@ import com.google.inject.Module;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "AtmosBlobRequestSignerTest")
-public class AtmosBlobRequestSignerTest extends BaseAsyncClientTest<AtmosAsyncClient> {
+public class AtmosBlobRequestSignerTest extends BaseAsyncClientTest<AtmosClient> {
public AtmosBlobRequestSignerTest() {
// this is base64 decoded in the signer;
@@ -126,11 +126,11 @@ public class AtmosBlobRequestSignerTest extends BaseAsyncClientTest<AtmosAsyncCl
@Override
protected Module createModule() {
- return new TestAtmosRestClientModule();
+ return new TestAtmosHttpApiModule();
}
- @ConfiguresRestClient
- private static final class TestAtmosRestClientModule extends AtmosRestClientModule {
+ @ConfiguresHttpApi
+ private static final class TestAtmosHttpApiModule extends AtmosHttpApiModule {
@Override
protected void configure() {
super.configure();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/test/java/org/jclouds/atmos/filters/SignRequestTest.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/filters/SignRequestTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/filters/SignRequestTest.java
index a5418c6..7993bbc 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/filters/SignRequestTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/filters/SignRequestTest.java
@@ -25,12 +25,12 @@ import java.security.NoSuchAlgorithmException;
import javax.ws.rs.core.MediaType;
import org.jclouds.ContextBuilder;
-import org.jclouds.atmos.config.AtmosRestClientModule;
+import org.jclouds.atmos.config.AtmosHttpApiModule;
import org.jclouds.atmos.reference.AtmosHeaders;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
import org.jclouds.logging.config.NullLoggingModule;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.internal.BaseRestApiTest.MockModule;
import org.jclouds.util.Strings2;
import org.testng.annotations.BeforeClass;
@@ -93,15 +93,15 @@ public class SignRequestTest {
.newBuilder("atmos")
.credentials(UID, KEY)
.modules(
- ImmutableSet.<Module> of(new MockModule(), new TestAtmosRestClientModule(), new NullLoggingModule()))
+ ImmutableSet.<Module> of(new MockModule(), new TestAtmosHttpApiModule(), new NullLoggingModule()))
.buildInjector();
filter = injector.getInstance(SignRequest.class);
}
- @ConfiguresRestClient
- private static final class TestAtmosRestClientModule extends AtmosRestClientModule {
+ @ConfiguresHttpApi
+ private static final class TestAtmosHttpApiModule extends AtmosHttpApiModule {
@Override
protected void configure() {
[04/52] [abbrv] git commit: JCLOUDS-150 add SubmissionAsyncBlobStore;
unasync s3 and aws-s3
Posted by an...@apache.org.
JCLOUDS-150 add SubmissionAsyncBlobStore; unasync s3 and aws-s3
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/b6497556
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/b6497556
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/b6497556
Branch: refs/heads/use-agentproxy-008
Commit: b6497556f69d07d87280bd8c38b79da384f79e04
Parents: 80d51f4
Author: Adrian Cole <ac...@twitter.com>
Authored: Fri Oct 3 13:14:00 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Fri Oct 3 13:18:29 2014 -0700
----------------------------------------------------------------------
.../main/java/org/jclouds/s3/S3ApiMetadata.java | 40 +-
.../main/java/org/jclouds/s3/S3AsyncClient.java | 363 --------------
.../src/main/java/org/jclouds/s3/S3Client.java | 356 +++++++++-----
.../jclouds/s3/blobstore/S3AsyncBlobStore.java | 273 -----------
.../s3/blobstore/S3BlobRequestSigner.java | 4 +-
.../s3/blobstore/S3BlobStoreContext.java | 3 -
.../config/S3BlobStoreContextModule.java | 11 +-
.../internal/S3BlobStoreContextImpl.java | 7 -
.../org/jclouds/s3/config/S3HttpApiModule.java | 211 ++++++++
.../jclouds/s3/config/S3RestClientModule.java | 214 --------
.../jclouds/s3/domain/AccessControlList.java | 3 -
.../org/jclouds/s3/domain/BucketLogging.java | 2 -
.../jclouds/s3/domain/CannedAccessPolicy.java | 3 -
.../org/jclouds/s3/domain/CanonicalUser.java | 5 +-
.../jclouds/s3/domain/ListBucketResponse.java | 2 -
.../s3/domain/MutableObjectMetadata.java | 14 +-
.../org/jclouds/s3/domain/ObjectMetadata.java | 4 -
.../main/java/org/jclouds/s3/domain/Payer.java | 3 -
.../java/org/jclouds/s3/domain/S3Object.java | 5 +-
.../org/jclouds/s3/domain/package-info.java | 1 -
.../s3/filters/RequestAuthorizeSignature.java | 4 -
.../org/jclouds/s3/filters/package-info.java | 1 -
.../ParseObjectMetadataFromHeaders.java | 12 +-
.../jclouds/s3/options/CopyObjectOptions.java | 6 -
.../jclouds/s3/options/ListBucketOptions.java | 6 +-
.../jclouds/s3/options/PutBucketOptions.java | 6 +-
.../jclouds/s3/options/PutObjectOptions.java | 6 +-
.../org/jclouds/s3/options/package-info.java | 2 -
.../main/java/org/jclouds/s3/package-info.java | 2 -
.../org/jclouds/s3/reference/S3Headers.java | 8 +-
.../s3/xml/AccessControlListHandler.java | 2 -
.../jclouds/s3/xml/BucketLoggingHandler.java | 2 -
.../org/jclouds/s3/xml/CopyObjectHandler.java | 2 -
.../jclouds/s3/xml/ListAllMyBucketsHandler.java | 4 -
.../org/jclouds/s3/xml/ListBucketHandler.java | 4 -
.../s3/xml/LocationConstraintHandler.java | 4 -
.../java/org/jclouds/s3/xml/PayerHandler.java | 2 -
.../java/org/jclouds/s3/S3AsyncClientTest.java | 490 -------------------
.../java/org/jclouds/s3/S3ClientLiveTest.java | 8 +-
.../test/java/org/jclouds/s3/S3ClientTest.java | 490 +++++++++++++++++++
.../BindAsHostPrefixIfConfiguredNoPathTest.java | 8 +-
.../BindAsHostPrefixIfConfiguredTest.java | 8 +-
.../BindNoBucketLoggingToXmlPayloadTest.java | 6 +-
.../BindS3ObjectMetadataToRequestTest.java | 6 +-
.../s3/blobstore/S3BlobSignerExpectTest.java | 11 +-
.../filters/RequestAuthorizeSignatureTest.java | 16 +-
...rizeSignatureWithSessionCredentialsTest.java | 13 +-
.../s3/internal/BaseS3AsyncClientTest.java | 62 ---
.../s3/internal/BaseS3ClientExpectTest.java | 11 +-
.../jclouds/s3/internal/BaseS3ClientTest.java | 62 +++
.../jclouds/s3/internal/StubS3AsyncClient.java | 343 -------------
.../jclouds/s3/services/BucketsLiveTest.java | 63 +--
.../internal/SubmissionAsyncBlobStore.java | 293 +++++++++++
.../org/jclouds/aws/s3/AWSS3ApiMetadata.java | 22 +-
.../org/jclouds/aws/s3/AWSS3AsyncClient.java | 135 -----
.../java/org/jclouds/aws/s3/AWSS3Client.java | 88 +++-
.../aws/s3/blobstore/AWSS3AsyncBlobStore.java | 139 ------
.../s3/blobstore/AWSS3BlobRequestSigner.java | 6 +-
.../aws/s3/blobstore/AWSS3BlobStore.java | 4 +-
.../aws/s3/blobstore/AWSS3BlobStoreContext.java | 3 -
.../config/AWSS3BlobStoreContextModule.java | 3 -
.../internal/AWSS3BlobStoreContextImpl.java | 7 -
.../strategy/AsyncMultipartUploadStrategy.java | 3 -
.../s3/blobstore/strategy/MultipartUpload.java | 3 -
.../strategy/MultipartUploadStrategy.java | 3 -
.../ParallelMultipartUploadStrategy.java | 31 +-
.../aws/s3/config/AWSS3HttpApiModule.java | 69 +++
.../aws/s3/config/AWSS3RestClientModule.java | 78 ---
.../org/jclouds/aws/s3/domain/DeleteResult.java | 12 +-
.../filters/AWSRequestAuthorizeSignature.java | 8 +-
.../jclouds/aws/s3/filters/package-info.java | 5 +-
.../functions/ETagFromHttpResponseViaRegex.java | 3 -
.../UploadIdFromHttpResponseViaRegex.java | 5 -
.../jclouds/aws/s3/xml/DeleteResultHandler.java | 7 +-
.../jclouds/aws/s3/xml/ErrorEntryHandler.java | 9 +-
.../jclouds/aws/s3/AWSS3AsyncClientTest.java | 308 ------------
.../org/jclouds/aws/s3/AWSS3ClientLiveTest.java | 4 +-
.../org/jclouds/aws/s3/AWSS3ClientTest.java | 307 ++++++++++++
...indIterableAsPayloadToDeleteRequestTest.java | 11 +-
.../BindObjectMetadataToRequestTest.java | 6 +-
.../s3/blobstore/AWSS3BlobSignerExpectTest.java | 10 +-
.../s3/internal/BaseAWSS3ClientExpectTest.java | 10 +-
.../aws/s3/xml/DeleteResultHandlerTest.java | 8 +-
83 files changed, 1930 insertions(+), 2864 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java b/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java
index 5e6fd0b..2923c15 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java
@@ -29,14 +29,14 @@ import java.net.URI;
import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
import org.jclouds.rest.internal.BaseRestApiMetadata;
import org.jclouds.s3.blobstore.S3BlobStoreContext;
import org.jclouds.s3.blobstore.config.S3BlobStoreContextModule;
-import org.jclouds.s3.config.S3RestClientModule;
+import org.jclouds.s3.config.S3HttpApiModule;
import org.jclouds.s3.reference.S3Headers;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
/**
@@ -44,9 +44,8 @@ import com.google.inject.Module;
*
* <h3>note</h3>
* <p/>
- * This class allows overriding of types {@code S}(client) and {@code A}
- * (asyncClient), so that children can add additional methods not declared here,
- * such as new features from AWS.
+ * This class allows overriding of types {@code A}(api), so that children can
+ * add additional methods not declared here, such as new features from AWS.
* <p/>
*
* As this is a popular api, we also allow overrides for type {@code C}
@@ -54,19 +53,10 @@ import com.google.inject.Module;
* not present in the base api. For example, you could make a subtype for
* context, that exposes admin operations.
*/
-public class S3ApiMetadata extends BaseRestApiMetadata {
-
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildClient(S3Client.class)} as
- * {@link S3AsyncClient} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<? extends S3Client, ? extends S3AsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<? extends S3Client, ? extends S3AsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
+public class S3ApiMetadata extends BaseHttpApiMetadata {
@Override
- public Builder<?> toBuilder() {
+ public Builder<?, ?> toBuilder() {
return new ConcreteBuilder().fromApiMetadata(this);
}
@@ -74,7 +64,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
this(new ConcreteBuilder());
}
- protected S3ApiMetadata(Builder<?> builder) {
+ protected S3ApiMetadata(Builder<?, ?> builder) {
super(builder);
}
@@ -90,14 +80,15 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
return properties;
}
- public abstract static class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
- @SuppressWarnings("deprecation")
+ public abstract static class Builder<A extends S3Client, T extends Builder<A, T>> extends
+ BaseHttpApiMetadata.Builder<A, T> {
+
protected Builder() {
- this(S3Client.class, S3AsyncClient.class);
+ this(Class.class.cast(S3Client.class));
}
- protected Builder(Class<?> syncClient, Class<?> asyncClient) {
- super(syncClient, asyncClient);
+ protected Builder(Class<A> syncClient) {
+ super(syncClient);
id("s3")
.name("Amazon Simple Storage Service (S3) API")
.identityName("Access Key ID")
@@ -106,9 +97,8 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
.documentation(URI.create("http://docs.amazonwebservices.com/AmazonS3/latest/API"))
.version("2006-03-01")
.defaultProperties(S3ApiMetadata.defaultProperties())
- .context(CONTEXT_TOKEN)
.view(typeToken(S3BlobStoreContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(S3RestClientModule.class, S3BlobStoreContextModule.class));
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(S3HttpApiModule.class, S3BlobStoreContextModule.class));
}
@Override
@@ -117,7 +107,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
}
}
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ private static class ConcreteBuilder extends Builder<S3Client, ConcreteBuilder> {
@Override
protected ConcreteBuilder self() {
return this;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java b/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java
deleted file mode 100644
index f119461..0000000
--- a/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.s3;
-
-import static com.google.common.net.HttpHeaders.EXPECT;
-import static org.jclouds.blobstore.attr.BlobScopes.CONTAINER;
-
-import java.io.Closeable;
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnContainerNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnKeyNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.ThrowContainerNotFoundOn404;
-import org.jclouds.blobstore.BlobStoreFallbacks.ThrowKeyNotFoundOn404;
-import org.jclouds.blobstore.attr.BlobScope;
-import org.jclouds.http.functions.ParseETagHeader;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.ParamParser;
-import org.jclouds.rest.annotations.ParamValidators;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.VirtualHost;
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.s3.S3Fallbacks.TrueOn404OrNotFoundFalseOnIllegalState;
-import org.jclouds.s3.binders.BindACLToXMLPayload;
-import org.jclouds.s3.binders.BindAsHostPrefixIfConfigured;
-import org.jclouds.s3.binders.BindBucketLoggingToXmlPayload;
-import org.jclouds.s3.binders.BindNoBucketLoggingToXmlPayload;
-import org.jclouds.s3.binders.BindPayerToXmlPayload;
-import org.jclouds.s3.binders.BindS3ObjectMetadataToRequest;
-import org.jclouds.s3.domain.AccessControlList;
-import org.jclouds.s3.domain.BucketLogging;
-import org.jclouds.s3.domain.BucketMetadata;
-import org.jclouds.s3.domain.ListBucketResponse;
-import org.jclouds.s3.domain.ObjectMetadata;
-import org.jclouds.s3.domain.Payer;
-import org.jclouds.s3.domain.S3Object;
-import org.jclouds.s3.fallbacks.FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists;
-import org.jclouds.s3.filters.RequestAuthorizeSignature;
-import org.jclouds.s3.functions.AssignCorrectHostnameForBucket;
-import org.jclouds.s3.functions.BindRegionToXmlPayload;
-import org.jclouds.s3.functions.DefaultEndpointThenInvalidateRegion;
-import org.jclouds.s3.functions.ObjectKey;
-import org.jclouds.s3.functions.ParseObjectFromHeadersAndHttpContent;
-import org.jclouds.s3.functions.ParseObjectMetadataFromHeaders;
-import org.jclouds.s3.options.CopyObjectOptions;
-import org.jclouds.s3.options.ListBucketOptions;
-import org.jclouds.s3.options.PutBucketOptions;
-import org.jclouds.s3.options.PutObjectOptions;
-import org.jclouds.s3.predicates.validators.BucketNameValidator;
-import org.jclouds.s3.xml.AccessControlListHandler;
-import org.jclouds.s3.xml.BucketLoggingHandler;
-import org.jclouds.s3.xml.CopyObjectHandler;
-import org.jclouds.s3.xml.ListAllMyBucketsHandler;
-import org.jclouds.s3.xml.ListBucketHandler;
-import org.jclouds.s3.xml.LocationConstraintHandler;
-import org.jclouds.s3.xml.PayerHandler;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.inject.Provides;
-
-/**
- * Provides asynchronous access to S3 via their REST API.
- * <p/>
- * All commands return a ListenableFuture of the result from S3. Any exceptions incurred during
- * processing will be backend in an {@link ExecutionException} as documented in
- * {@link ListenableFuture#get()}.
- *
- * @see AWSS3Client
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAPI.html" />
- * @deprecated please use
- * {@code org.jclouds.ContextBuilder#buildApi(S3Client.class)}
- * as {@link S3AsyncClient} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-@RequestFilters(RequestAuthorizeSignature.class)
-@BlobScope(CONTAINER)
-public interface S3AsyncClient extends Closeable {
- String VERSION = "2006-03-01";
-
- /**
- * Creates a default implementation of S3Object
- */
- @Provides
- S3Object newS3Object();
-
- /**
- * @see S3Client#getObject
- */
- @Named("GetObject")
- @GET
- @Path("/{key}")
- @Fallback(NullOnKeyNotFound.class)
- @ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
- ListenableFuture<S3Object> getObject(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @PathParam("key") String key, GetOptions... options);
-
- /**
- * @see S3Client#headObject
- */
- @Named("GetObject")
- @HEAD
- @Path("/{key}")
- @Fallback(NullOnKeyNotFound.class)
- @ResponseParser(ParseObjectMetadataFromHeaders.class)
- ListenableFuture<ObjectMetadata> headObject(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @PathParam("key") String key);
-
- /**
- * @see S3Client#objectExists
- */
- @Named("GetObject")
- @HEAD
- @Path("/{key}")
- @Fallback(FalseOnKeyNotFound.class)
- ListenableFuture<Boolean> objectExists(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @PathParam("key") String key);
-
- /**
- * @see S3Client#deleteObject
- */
- @Named("DeleteObject")
- @DELETE
- @Path("/{key}")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> deleteObject(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @PathParam("key") String key);
-
- /**
- * @see S3Client#putObject
- */
- @Named("PutObject")
- @PUT
- @Path("/{key}")
- @Headers(keys = EXPECT, values = "100-continue")
- @ResponseParser(ParseETagHeader.class)
- ListenableFuture<String> putObject(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @PathParam("key") @ParamParser(ObjectKey.class) @BinderParam(BindS3ObjectMetadataToRequest.class) S3Object object,
- PutObjectOptions... options);
-
- /**
- * @see S3Client#putBucketInRegion
- */
- @Named("CreateBucket")
- @PUT
- @Path("/")
- @Endpoint(Bucket.class)
- @Fallback(FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.class)
- ListenableFuture<Boolean> putBucketInRegion(
- @BinderParam(BindRegionToXmlPayload.class) @Nullable String region,
- @Bucket @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- PutBucketOptions... options);
-
- /**
- * @see S3Client#deleteBucketIfEmpty
- */
- @Named("DeleteBucket")
- @DELETE
- @Path("/")
- @Fallback(TrueOn404OrNotFoundFalseOnIllegalState.class)
- ListenableFuture<Boolean> deleteBucketIfEmpty(
- @Bucket @EndpointParam(parser = DefaultEndpointThenInvalidateRegion.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName);
-
- /**
- * @see S3Client#bucketExists
- */
- @Named("BucketExists")
- @HEAD
- @Path("/")
- @Fallback(FalseOnContainerNotFound.class)
- ListenableFuture<Boolean> bucketExists(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName);
-
-
- /**
- * @see S3Client#getBucketLocation
- */
- @Named("GetBucketLocation")
- @GET
- @QueryParams(keys = "location")
- @Path("/")
- @Endpoint(Bucket.class)
- @XMLResponseParser(LocationConstraintHandler.class)
- ListenableFuture<String> getBucketLocation(
- @Bucket @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName);
-
- /**
- * @see S3Client#getBucketPayer
- */
- @Named("GetBucketRequestPayment")
- @GET
- @QueryParams(keys = "requestPayment")
- @Path("/")
- @XMLResponseParser(PayerHandler.class)
- ListenableFuture<Payer> getBucketPayer(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName);
-
- /**
- * @see S3Client#setBucketPayer
- */
- @Named("PutBucketRequestPayment")
- @PUT
- @QueryParams(keys = "requestPayment")
- @Path("/")
- ListenableFuture<Void> setBucketPayer(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @BinderParam(BindPayerToXmlPayload.class) Payer payer);
-
- /**
- * @see S3Client#listBucket
- */
- @Named("ListBucket")
- @GET
- @Path("/")
- @XMLResponseParser(ListBucketHandler.class)
- ListenableFuture<ListBucketResponse> listBucket(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- ListBucketOptions... options);
-
- /**
- * @see S3Client#listOwnedBuckets
- */
- @Named("ListAllMyBuckets")
- @GET
- @XMLResponseParser(ListAllMyBucketsHandler.class)
- @Path("/")
- @VirtualHost
- ListenableFuture<? extends Set<BucketMetadata>> listOwnedBuckets();
-
- /**
- * @see S3Client#copyObject
- */
- @Named("PutObject")
- @PUT
- @Path("/{destinationObject}")
- @Headers(keys = "x-amz-copy-source", values = "/{sourceBucket}/{sourceObject}")
- @XMLResponseParser(CopyObjectHandler.class)
- ListenableFuture<ObjectMetadata> copyObject(
- @PathParam("sourceBucket") String sourceBucket,
- @PathParam("sourceObject") String sourceObject,
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String destinationBucket,
- @PathParam("destinationObject") String destinationObject, CopyObjectOptions... options);
-
- /**
- * @see S3Client#getBucketACL
- */
- @Named("GetBucketAcl")
- @GET
- @QueryParams(keys = "acl")
- @XMLResponseParser(AccessControlListHandler.class)
- @Fallback(ThrowContainerNotFoundOn404.class)
- @Path("/")
- ListenableFuture<AccessControlList> getBucketACL(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName);
-
- /**
- * @see S3Client#putBucketACL
- */
- @Named("PutBucketAcl")
- @PUT
- @Path("/")
- @QueryParams(keys = "acl")
- ListenableFuture<Boolean> putBucketACL(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @BinderParam(BindACLToXMLPayload.class) AccessControlList acl);
-
- /**
- * @see S3Client#getObjectACL
- */
- @Named("GetObjectAcl")
- @GET
- @QueryParams(keys = "acl")
- @Path("/{key}")
- @XMLResponseParser(AccessControlListHandler.class)
- @Fallback(ThrowKeyNotFoundOn404.class)
- ListenableFuture<AccessControlList> getObjectACL(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @PathParam("key") String key);
-
- /**
- * @see S3Client#putObjectACL
- */
- @Named("PutObjectAcl")
- @PUT
- @QueryParams(keys = "acl")
- @Path("/{key}")
- ListenableFuture<Boolean> putObjectACL(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @PathParam("key") String key, @BinderParam(BindACLToXMLPayload.class) AccessControlList acl);
-
- /**
- * @see S3Client#getBucketLogging
- */
- @Named("GetBucketLogging")
- @GET
- @QueryParams(keys = "logging")
- @XMLResponseParser(BucketLoggingHandler.class)
- @Fallback(ThrowContainerNotFoundOn404.class)
- @Path("/")
- ListenableFuture<BucketLogging> getBucketLogging(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName);
-
- /**
- * @see S3Client#enableBucketLogging
- */
- @Named("PutBucketLogging")
- @PUT
- @Path("/")
- @QueryParams(keys = "logging")
- ListenableFuture<Void> enableBucketLogging(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @BinderParam(BindBucketLoggingToXmlPayload.class) BucketLogging logging);
-
- /**
- * @see S3Client#putBucketLogging
- */
- @Named("PutBucketLogging")
- @PUT
- @Path("/")
- @QueryParams(keys = "logging")
- @Produces(MediaType.TEXT_XML)
- ListenableFuture<Void> disableBucketLogging(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindNoBucketLoggingToXmlPayload.class) @ParamValidators(BucketNameValidator.class) String bucketName);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/S3Client.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/S3Client.java b/apis/s3/src/main/java/org/jclouds/s3/S3Client.java
index 34ae0f0..ba11992 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/S3Client.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/S3Client.java
@@ -16,11 +16,51 @@
*/
package org.jclouds.s3;
+import static com.google.common.net.HttpHeaders.EXPECT;
+import static org.jclouds.blobstore.attr.BlobScopes.CONTAINER;
+import static org.jclouds.s3.S3Fallbacks.TrueOn404OrNotFoundFalseOnIllegalState;
+
import java.io.Closeable;
import java.util.Set;
+import javax.inject.Named;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnContainerNotFound;
+import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnKeyNotFound;
+import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyNotFound;
+import org.jclouds.blobstore.BlobStoreFallbacks.ThrowContainerNotFoundOn404;
+import org.jclouds.blobstore.BlobStoreFallbacks.ThrowKeyNotFoundOn404;
+import org.jclouds.blobstore.attr.BlobScope;
+import org.jclouds.http.functions.ParseETagHeader;
import org.jclouds.http.options.GetOptions;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.ParamParser;
+import org.jclouds.rest.annotations.ParamValidators;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.VirtualHost;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.s3.binders.BindACLToXMLPayload;
+import org.jclouds.s3.binders.BindAsHostPrefixIfConfigured;
+import org.jclouds.s3.binders.BindBucketLoggingToXmlPayload;
+import org.jclouds.s3.binders.BindNoBucketLoggingToXmlPayload;
+import org.jclouds.s3.binders.BindPayerToXmlPayload;
+import org.jclouds.s3.binders.BindS3ObjectMetadataToRequest;
import org.jclouds.s3.domain.AccessControlList;
import org.jclouds.s3.domain.BucketLogging;
import org.jclouds.s3.domain.BucketMetadata;
@@ -28,22 +68,34 @@ import org.jclouds.s3.domain.ListBucketResponse;
import org.jclouds.s3.domain.ObjectMetadata;
import org.jclouds.s3.domain.Payer;
import org.jclouds.s3.domain.S3Object;
+import org.jclouds.s3.fallbacks.FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists;
+import org.jclouds.s3.filters.RequestAuthorizeSignature;
+import org.jclouds.s3.functions.AssignCorrectHostnameForBucket;
+import org.jclouds.s3.functions.BindRegionToXmlPayload;
+import org.jclouds.s3.functions.DefaultEndpointThenInvalidateRegion;
+import org.jclouds.s3.functions.ObjectKey;
+import org.jclouds.s3.functions.ParseObjectFromHeadersAndHttpContent;
+import org.jclouds.s3.functions.ParseObjectMetadataFromHeaders;
import org.jclouds.s3.options.CopyObjectOptions;
import org.jclouds.s3.options.ListBucketOptions;
import org.jclouds.s3.options.PutBucketOptions;
import org.jclouds.s3.options.PutObjectOptions;
+import org.jclouds.s3.predicates.validators.BucketNameValidator;
+import org.jclouds.s3.xml.AccessControlListHandler;
+import org.jclouds.s3.xml.BucketLoggingHandler;
+import org.jclouds.s3.xml.CopyObjectHandler;
+import org.jclouds.s3.xml.ListAllMyBucketsHandler;
+import org.jclouds.s3.xml.ListBucketHandler;
+import org.jclouds.s3.xml.LocationConstraintHandler;
+import org.jclouds.s3.xml.PayerHandler;
import com.google.inject.Provides;
/**
* Provides access to S3 via their REST API.
- * <p/>
- * All commands return a Future of the result from S3. Any exceptions incurred during
- * processing will be backend in an {@link ExecutionException} as documented in
- * {@link Future#get()}.
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAPI.html" />
*/
+@RequestFilters(RequestAuthorizeSignature.class)
+@BlobScope(CONTAINER)
public interface S3Client extends Closeable {
/**
@@ -60,14 +112,14 @@ public interface S3Client extends Closeable {
* anonymous user, you can request the object without an authorization header.
*
* <p />
- * This command allows you to specify {@link GetObjectOptions} to control delivery of content.
+ * This command allows you to specify {@link GetOptions} to control delivery of content.
*
* <h2>Note</h2>
* If you specify any of the below options, you will receive partial content:
* <ul>
- * <li>{@link GetObjectOptions#range}</li>
- * <li>{@link GetObjectOptions#startAt}</li>
- * <li>{@link GetObjectOptions#tail}</li>
+ * <li>{@link GetOptions#range}</li>
+ * <li>{@link GetOptions#startAt}</li>
+ * <li>{@link GetOptions#tail}</li>
* </ul>
*
* @param bucketName
@@ -75,20 +127,23 @@ public interface S3Client extends Closeable {
* @param key
* unique key in the s3Bucket identifying the object
* @return Future reference to a fully populated S3Object including data stored in S3
- * or {@link S3Object#NOT_FOUND} if not present.
+ * or null if not present.
*
* @throws org.jclouds.http.HttpResponseException
* if the conditions requested set were not satisfied by the object on the server.
- * @see #getObject(String, String)
- * @see GetObjectOptions
*/
- S3Object getObject(String bucketName, String key, GetOptions... options);
+ @Named("GetObject")
+ @GET
+ @Path("/{key}")
+ @Fallback(NullOnKeyNotFound.class)
+ @ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
+ S3Object getObject(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @PathParam("key") String key, GetOptions... options);
/**
* Retrieves the {@link org.jclouds.s3.domain.internal.BucketListObjectMetadata metadata} of
- * the object associated with the key or
- * {@link org.jclouds.s3.domain.internal.BucketListObjectMetadata#NOT_FOUND} if not
- * available.
+ * the object associated with the key or null if not available.
*
* <p/>
* The HEAD operation is used to retrieve information about a specific object or object size,
@@ -96,21 +151,26 @@ public interface S3Client extends Closeable {
* object metadata, and don't want to waste bandwidth on the object data.
*
*
- * @param bucketName
- * namespace of the metadata you are retrieving
- * @param key
- * unique key in the s3Bucket identifying the object
- * @return metadata associated with the key or
- * {@link org.jclouds.s3.domain.internal.BucketListObjectMetadata#NOT_FOUND} if not
- * present;
- * @see #getObject(String, String)
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTObjectHEAD.html"
- * />
+ * @param bucketName namespace of the metadata you are retrieving
+ * @param key unique key in the s3Bucket identifying the object
+ * @return metadata associated with the key or null if not present.
*/
- ObjectMetadata headObject(String bucketName, String key);
+ @Named("GetObject")
+ @HEAD
+ @Path("/{key}")
+ @Fallback(NullOnKeyNotFound.class)
+ @ResponseParser(ParseObjectMetadataFromHeaders.class)
+ ObjectMetadata headObject(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @PathParam("key") String key);
- boolean objectExists(String bucketName, String key);
+ @Named("GetObject")
+ @HEAD
+ @Path("/{key}")
+ @Fallback(FalseOnKeyNotFound.class)
+ boolean objectExists(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @PathParam("key") String key);
/**
* Removes the object and metadata associated with the key.
@@ -125,10 +185,14 @@ public interface S3Client extends Closeable {
* unique key in the s3Bucket identifying the object
* @throws org.jclouds.http.HttpResponseException
* if the bucket is not available
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?
- * RESTObjectDELETE.html" />
*/
- void deleteObject(String bucketName, String key);
+ @Named("DeleteObject")
+ @DELETE
+ @Path("/{key}")
+ @Fallback(VoidOnNotFoundOr404.class)
+ void deleteObject(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @PathParam("key") String key);
/**
* Store data by creating or overwriting an object.
@@ -149,11 +213,16 @@ public interface S3Client extends Closeable {
* @throws org.jclouds.http.HttpResponseException
* if the conditions requested set are not satisfied by the object on the server.
* @see org.jclouds.s3.domain.CannedAccessPolicy#PRIVATE
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTObjectPUT.html"
- * />
*/
- String putObject(String bucketName, S3Object object, PutObjectOptions... options);
+ @Named("PutObject")
+ @PUT
+ @Path("/{key}")
+ @Headers(keys = EXPECT, values = "100-continue")
+ @ResponseParser(ParseETagHeader.class)
+ String putObject(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @PathParam("key") @ParamParser(ObjectKey.class) @BinderParam(BindS3ObjectMetadataToRequest.class)
+ S3Object object, PutObjectOptions... options);
/**
* Create and name your own bucket in which to store your objects.
@@ -171,12 +240,15 @@ public interface S3Client extends Closeable {
* @return true, if the bucket was created or false, if the container was already present
*
* @see PutBucketOptions
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTBucketPUT.html"
- * />
- *
*/
- boolean putBucketInRegion(@Nullable String region, @Bucket String bucketName, PutBucketOptions... options);
+ @Named("CreateBucket")
+ @PUT
+ @Path("/")
+ @Endpoint(Bucket.class)
+ @Fallback(FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.class)
+ boolean putBucketInRegion(@BinderParam(BindRegionToXmlPayload.class) @Nullable String region,
+ @Bucket @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class)
+ String bucketName, PutBucketOptions... options);
/**
* Deletes the bucket, if it is empty.
@@ -187,20 +259,26 @@ public interface S3Client extends Closeable {
* Only the owner of a bucket can delete it, regardless of the bucket's access control policy.
*
*
- * @param bucketName
- * what to delete
+ * @param bucketName what to delete
* @return false, if the bucket was not empty and therefore not deleted
- * @see org.jclouds.s3.commands.DeleteBucket
- * @see <a href=
- * "http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTBucketDELETE.html"
- * />
*/
- boolean deleteBucketIfEmpty(String bucketName);
+ @Named("DeleteBucket")
+ @DELETE
+ @Path("/")
+ @Fallback(TrueOn404OrNotFoundFalseOnIllegalState.class)
+ boolean deleteBucketIfEmpty(@Bucket @EndpointParam(parser = DefaultEndpointThenInvalidateRegion.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName);
+
/**
* Issues a HEAD command to determine if the bucket exists or not.
*/
- boolean bucketExists(String bucketName);
+ @Named("BucketExists")
+ @HEAD
+ @Path("/")
+ @Fallback(FalseOnContainerNotFound.class)
+ boolean bucketExists(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName);
/**
* Retrieve a {@code S3Bucket} listing. A GET request operation using a bucket URI lists
@@ -210,53 +288,60 @@ public interface S3Client extends Closeable {
* To list the keys of a bucket, you must have READ access to the bucket.
* <p/>
*
- * @param bucketName
- * namespace of the objects you wish to list
- * @return Future reference to a fully populated S3Bucket including metadata of the
- * S3Objects it contains or {@link BoundedList<ObjectMetadata>#NOT_FOUND} if not present.
+ * @param bucketName namespace of the objects you wish to list
+ * @return potentially empty or partial list of the bucket.
* @see ListBucketOptions
- *
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTBucketGET.html"
- * />
*/
- ListBucketResponse listBucket(String bucketName, ListBucketOptions... options);
+ @Named("ListBucket")
+ @GET
+ @Path("/")
+ @XMLResponseParser(ListBucketHandler.class)
+ ListBucketResponse listBucket(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ ListBucketOptions... options);
/**
* Returns a list of all of the buckets owned by the authenticated sender of the request.
*
* @return list of all of the buckets owned by the authenticated sender of the request.
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTServiceGET.html"
- * />
- *
*/
+ @Named("ListAllMyBuckets")
+ @GET
+ @XMLResponseParser(ListAllMyBucketsHandler.class)
+ @Path("/")
+ @VirtualHost
Set<BucketMetadata> listOwnedBuckets();
+
/**
* Copies one object to another bucket, retaining UserMetadata from the source. The destination
* will have a private acl. The copy operation creates a copy of an object that is already stored
* in Amazon S3.
* <p/>
* When copying an object, you can preserve all metadata (default) or
- * {@link CopyObjectOptions#overrideMetadataWith(com.google.common.collect.Multimap) specify new
+ * {@link CopyObjectOptions#overrideMetadataWith(java.util.Map)} specify new
* metadata}. However, the ACL is not preserved and is set to private for the user making the
* request. To override the default ACL setting,
* {@link CopyObjectOptions#overrideAcl(org.jclouds.s3.domain.CannedAccessPolicy) specify a
* new ACL} when generating a copy request.
*
* @return metadata populated with lastModified and eTag of the new object
- * @see org.jclouds.s3.commands.CopyObject
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTObjectCOPY.html"
- * />
* @throws org.jclouds.http.HttpResponseException
* if the conditions requested set are not satisfied by the object on the server.
* @see CopyObjectOptions
* @see org.jclouds.s3.domain.CannedAccessPolicy
*/
- ObjectMetadata copyObject(String sourceBucket, String sourceObject, String destinationBucket,
- String destinationObject, CopyObjectOptions... options);
+ @Named("PutObject")
+ @PUT
+ @Path("/{destinationObject}")
+ @Headers(keys = "x-amz-copy-source", values = "/{sourceBucket}/{sourceObject}")
+ @XMLResponseParser(CopyObjectHandler.class)
+ ObjectMetadata copyObject(@PathParam("sourceBucket") String sourceBucket,
+ @PathParam("sourceObject") String sourceObject,
+ @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String destinationBucket,
+ @PathParam("destinationObject") String destinationObject, CopyObjectOptions... options);
+
/**
*
@@ -266,10 +351,16 @@ public interface S3Client extends Closeable {
* To list a bucket's ACL, you must have READ_ACP access to the item.
*
* @return access permissions of the bucket
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html"/>
*/
- AccessControlList getBucketACL(String bucketName);
+ @Named("GetBucketAcl")
+ @GET
+ @QueryParams(keys = "acl")
+ @XMLResponseParser(AccessControlListHandler.class)
+ @Fallback(ThrowContainerNotFoundOn404.class)
+ @Path("/")
+ AccessControlList getBucketACL(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName);
+
/**
* Update a bucket's Access Control List settings.
@@ -285,10 +376,14 @@ public interface S3Client extends Closeable {
* the ACL to apply to the bucket. This acl object <strong>must</strong include a valid
* owner identifier string in {@link AccessControlList#getOwner()}.
* @return true if the bucket's Access Control List was updated successfully.
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html"/>
*/
- boolean putBucketACL(String bucketName, AccessControlList acl);
+ @Named("PutBucketAcl")
+ @PUT
+ @Path("/")
+ @QueryParams(keys = "acl")
+ boolean putBucketACL(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @BinderParam(BindACLToXMLPayload.class) AccessControlList acl);
/**
* A GET request operation directed at an object or bucket URI with the "acl" parameter retrieves
@@ -297,10 +392,16 @@ public interface S3Client extends Closeable {
* To list a object's ACL, you must have READ_ACP access to the item.
*
* @return access permissions of the object
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html"/>
*/
- AccessControlList getObjectACL(String bucketName, String key);
+ @Named("GetObjectAcl")
+ @GET
+ @QueryParams(keys = "acl")
+ @Path("/{key}")
+ @XMLResponseParser(AccessControlListHandler.class)
+ @Fallback(ThrowKeyNotFoundOn404.class)
+ AccessControlList getObjectACL(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @PathParam("key") String key);
/**
* Update an object's Access Control List settings.
@@ -310,18 +411,23 @@ public interface S3Client extends Closeable {
* <p />
* To set a bucket or object's ACL, you must have WRITE_ACP or FULL_CONTROL access to the item.
*
- * @param bucket
+ * @param bucketName
* the bucket containing the object to be updated
- * @param objectKey
+ * @param key
* the key of the object whose Access Control List settings will be updated.
* @param acl
* the ACL to apply to the object. This acl object <strong>must</strong include a valid
* owner identifier string in {@link AccessControlList#getOwner()}.
* @return true if the object's Access Control List was updated successfully.
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html"/>
*/
- boolean putObjectACL(String bucketName, String key, AccessControlList acl);
+ @Named("PutObjectAcl")
+ @PUT
+ @QueryParams(keys = "acl")
+ @Path("/{key}")
+ boolean putObjectACL(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @PathParam("key") String key, @BinderParam(BindACLToXMLPayload.class) AccessControlList acl);
+
/**
* A GET location request operation using a bucket URI lists the location constraint of the
@@ -329,16 +435,20 @@ public interface S3Client extends Closeable {
* <p/>
* To view the location constraint of a bucket, you must be the bucket owner.
*
- * @param bucket
+ * @param bucketName
* the bucket you wish to know where exists
*
* @return location of the bucket
- *
- * @see <a href=
- * "http://docs.amazonwebservices.com/AmazonS3/latest/index.html?RESTBucketLocationGET.html"
- * />
*/
- String getBucketLocation(String bucketName);
+ @Named("GetBucketLocation")
+ @GET
+ @QueryParams(keys = "location")
+ @Path("/")
+ @Endpoint(Bucket.class)
+ @XMLResponseParser(LocationConstraintHandler.class)
+ String getBucketLocation(@Bucket @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(
+ BucketNameValidator.class) String bucketName);
+
/**
* A GET request operation on a requestPayment resource returns the request payment configuration
@@ -349,14 +459,17 @@ public interface S3Client extends Closeable {
* @param bucketName
* the bucket you wish to know the payer status
*
- * @return {@link Payer.REQUESTER} for a Requester Pays bucket, and {@link Payer.BUCKET_OWNER},
+ * @return {@link Payer#REQUESTER} for a Requester Pays bucket, and {@link Payer#BUCKET_OWNER},
* for a normal bucket.
- *
- * @see <a href=
- * "http://docs.amazonwebservices.com/AmazonS3/latest/index.html?RESTrequestPaymentGET.html"
- * />
*/
- Payer getBucketPayer(String bucketName);
+ @Named("GetBucketRequestPayment")
+ @GET
+ @QueryParams(keys = "requestPayment")
+ @Path("/")
+ @XMLResponseParser(PayerHandler.class)
+ Payer getBucketPayer(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName);
+
/**
* The PUT request operation with a requestPayment URI configures an existing bucket to be
@@ -371,14 +484,19 @@ public interface S3Client extends Closeable {
* the bucket you wish to know the payer status
*
* @param payer
- * {@link Payer.REQUESTER} for a Requester Pays bucket, and {@link Payer.BUCKET_OWNER},
+ * {@link Payer#REQUESTER} for a Requester Pays bucket, and {@link Payer#BUCKET_OWNER},
* for a normal bucket.
- *
- * @see <a href=
- * "http://docs.amazonwebservices.com/AmazonS3/latest/index.html?RESTrequestPaymentPUT.html"
- * />
*/
- void setBucketPayer(String bucketName, Payer payer);
+ @Named("PutBucketRequestPayment")
+ @PUT
+ @QueryParams(keys = "requestPayment")
+ @Path("/")
+ void setBucketPayer(
+ @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @BinderParam(BindPayerToXmlPayload.class) Payer payer);
+
+
/**
* Inspects the logging status for a bucket.
@@ -387,11 +505,16 @@ public interface S3Client extends Closeable {
* @param bucketName
* the bucket you wish to know the logging status
* @return bucketLogging configuration or null, if not configured
- *
- * @see <a href= "http://docs.amazonwebservices.com/AmazonS3/latest/index.html?ServerLogs.html"
- * />
*/
- BucketLogging getBucketLogging(String bucketName);
+ @Named("GetBucketLogging")
+ @GET
+ @QueryParams(keys = "logging")
+ @XMLResponseParser(BucketLoggingHandler.class)
+ @Fallback(ThrowContainerNotFoundOn404.class)
+ @Path("/")
+ BucketLogging getBucketLogging(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName);
+
/**
* Enables logging for a bucket.
@@ -400,19 +523,26 @@ public interface S3Client extends Closeable {
* the bucket you wish to enable logging for
* @param logging
* configuration including destination, prefix, and access rules
- * @see <a href= "http://docs.amazonwebservices.com/AmazonS3/latest/index.html?ServerLogs.html"
- * />
*/
- void enableBucketLogging(String bucketName, BucketLogging logging);
+ @Named("PutBucketLogging")
+ @PUT
+ @Path("/")
+ @QueryParams(keys = "logging")
+ void enableBucketLogging(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @BinderParam(BindBucketLoggingToXmlPayload.class) BucketLogging logging);
/**
* Disables logging for a bucket.
*
* @param bucketName
* the bucket you wish to disable logging for
- *
- * @see <a href= "http://docs.amazonwebservices.com/AmazonS3/latest/index.html?ServerLogs.html"
- * />
*/
- void disableBucketLogging(String bucketName);
+ @Named("PutBucketLogging")
+ @PUT
+ @Path("/")
+ @QueryParams(keys = "logging")
+ @Produces(MediaType.TEXT_XML)
+ void disableBucketLogging(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindNoBucketLoggingToXmlPayload.class) @ParamValidators(BucketNameValidator.class) String bucketName);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3AsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3AsyncBlobStore.java b/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3AsyncBlobStore.java
deleted file mode 100644
index 3725d0a..0000000
--- a/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3AsyncBlobStore.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.s3.blobstore;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.util.concurrent.Futures.transform;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
-import org.jclouds.blobstore.internal.BaseAsyncBlobStore;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.options.PutOptions;
-import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.s3.S3AsyncClient;
-import org.jclouds.s3.S3Client;
-import org.jclouds.s3.blobstore.functions.BlobToObject;
-import org.jclouds.s3.blobstore.functions.BucketToResourceList;
-import org.jclouds.s3.blobstore.functions.ContainerToBucketListOptions;
-import org.jclouds.s3.blobstore.functions.ObjectToBlob;
-import org.jclouds.s3.blobstore.functions.ObjectToBlobMetadata;
-import org.jclouds.s3.domain.AccessControlList;
-import org.jclouds.s3.domain.AccessControlList.GroupGranteeURI;
-import org.jclouds.s3.domain.AccessControlList.Permission;
-import org.jclouds.s3.domain.BucketMetadata;
-import org.jclouds.s3.domain.CannedAccessPolicy;
-import org.jclouds.s3.domain.ListBucketResponse;
-import org.jclouds.s3.domain.ObjectMetadata;
-import org.jclouds.s3.options.ListBucketOptions;
-import org.jclouds.s3.options.PutBucketOptions;
-import org.jclouds.s3.options.PutObjectOptions;
-import org.jclouds.s3.util.S3Utils;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported. Please use {@link S3BlobStore}
- */
-@Deprecated
-@Singleton
-public class S3AsyncBlobStore extends BaseAsyncBlobStore {
-
- private final S3AsyncClient async;
- private final S3Client sync;
- private final Function<Set<BucketMetadata>, PageSet<? extends StorageMetadata>> convertBucketsToStorageMetadata;
- private final ContainerToBucketListOptions container2BucketListOptions;
- private final BlobToHttpGetOptions blob2ObjectGetOptions;
- private final BucketToResourceList bucket2ResourceList;
- private final ObjectToBlob object2Blob;
- private final BlobToObject blob2Object;
- private final ObjectToBlobMetadata object2BlobMd;
- private final Provider<FetchBlobMetadata> fetchBlobMetadataProvider;
- private final LoadingCache<String, AccessControlList> bucketAcls;
-
- @Inject
- protected S3AsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, Supplier<Location> defaultLocation,
- @Memoized Supplier<Set<? extends Location>> locations, S3AsyncClient async, S3Client sync,
- Function<Set<BucketMetadata>, PageSet<? extends StorageMetadata>> convertBucketsToStorageMetadata,
- ContainerToBucketListOptions container2BucketListOptions, BucketToResourceList bucket2ResourceList,
- ObjectToBlob object2Blob, BlobToHttpGetOptions blob2ObjectGetOptions, BlobToObject blob2Object,
- ObjectToBlobMetadata object2BlobMd, Provider<FetchBlobMetadata> fetchBlobMetadataProvider,
- LoadingCache<String, AccessControlList> bucketAcls) {
- super(context, blobUtils, userExecutor, defaultLocation, locations);
- this.blob2ObjectGetOptions = checkNotNull(blob2ObjectGetOptions, "blob2ObjectGetOptions");
- this.async = checkNotNull(async, "async");
- this.sync = checkNotNull(sync, "sync");
- this.convertBucketsToStorageMetadata = checkNotNull(convertBucketsToStorageMetadata, "convertBucketsToStorageMetadata");
- this.container2BucketListOptions = checkNotNull(container2BucketListOptions, "container2BucketListOptions");
- this.bucket2ResourceList = checkNotNull(bucket2ResourceList, "bucket2ResourceList");
- this.object2Blob = checkNotNull(object2Blob, "object2Blob");
- this.blob2Object = checkNotNull(blob2Object, "blob2Object");
- this.object2BlobMd = checkNotNull(object2BlobMd, "object2BlobMd");
- this.fetchBlobMetadataProvider = checkNotNull(fetchBlobMetadataProvider, "fetchBlobMetadataProvider");
- this.bucketAcls = checkNotNull(bucketAcls, "bucketAcls");
- }
-
- /**
- * This implementation invokes {@link S3AsyncClient#listOwnedBuckets}
- */
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list() {
- return transform(async.listOwnedBuckets(),
- new Function<Set<BucketMetadata>, org.jclouds.blobstore.domain.PageSet<? extends StorageMetadata>>() {
- public org.jclouds.blobstore.domain.PageSet<? extends StorageMetadata> apply(Set<BucketMetadata> from) {
- return convertBucketsToStorageMetadata.apply(from);
- }
- }, userExecutor);
- }
-
- /**
- * This implementation invokes {@link S3AsyncClient#bucketExists}
- *
- * @param container
- * bucket name
- */
- @Override
- public ListenableFuture<Boolean> containerExists(String container) {
- return async.bucketExists(container);
- }
-
- /**
- * This implementation invokes {@link S3AsyncClient#putBucketInRegion}
- *
- * @param location
- * corresponds to Region
- * @param container
- * bucket name
- */
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, String container) {
- return createContainerInLocation(location, container, CreateContainerOptions.NONE);
- }
-
- /**
- * This implementation invokes {@link S3AsyncClient#listBucket}
- *
- * @param container
- * bucket name
- */
- @Override
- // TODO get rid of transform, as it serializes async results when the executor is single-threaded.
- public ListenableFuture<PageSet<? extends StorageMetadata>> list(String container, ListContainerOptions options) {
- ListBucketOptions httpOptions = container2BucketListOptions.apply(options);
- ListenableFuture<ListBucketResponse> returnVal = async.listBucket(container, httpOptions);
- ListenableFuture<PageSet<? extends StorageMetadata>> list = transform(returnVal, bucket2ResourceList,
- userExecutor);
- return (options.isDetailed()) ? transform(list,
- fetchBlobMetadataProvider.get().setContainerName(container), userExecutor) : list;
- }
-
- /**
- * This implementation invokes {@link S3Utils#deleteAndVerifyContainerGone}
- */
- protected boolean deleteAndVerifyContainerGone(final String container) {
- return S3Utils.deleteAndVerifyContainerGone(sync, container);
- }
-
- /**
- * This implementation invokes {@link S3AsyncClient#objectExists}
- *
- * @param container
- * bucket name
- * @param key
- * object key
- */
- @Override
- public ListenableFuture<Boolean> blobExists(String container, String key) {
- return async.objectExists(container, key);
- }
-
- /**
- * This implementation invokes {@link S3AsyncClient#headObject}
- *
- * @param container
- * bucket name
- * @param key
- * object key
- */
- @Override
- public ListenableFuture<BlobMetadata> blobMetadata(String container, String key) {
- return transform(async.headObject(container, key), new Function<ObjectMetadata, BlobMetadata>() {
-
- @Override
- public BlobMetadata apply(ObjectMetadata from) {
- return object2BlobMd.apply(from);
- }
-
- }, userExecutor);
- }
-
- /**
- * This implementation invokes {@link S3AsyncClient#getObject}
- *
- * @param container
- * bucket name
- * @param key
- * object key
- */
- @Override
- public ListenableFuture<Blob> getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions options) {
- GetOptions httpOptions = blob2ObjectGetOptions.apply(options);
- return transform(async.getObject(container, key, httpOptions), object2Blob, userExecutor);
- }
-
- /**
- * This implementation invokes {@link S3AsyncClient#putObject}
- *
- * @param container
- * bucket name
- * @param blob
- * object
- */
- @Override
- public ListenableFuture<String> putBlob(String container, Blob blob) {
- return putBlob(container, blob, PutOptions.NONE);
- }
-
- @Override
- public ListenableFuture<String> putBlob(String container, Blob blob, PutOptions overrides) {
- // TODO: Make use of options overrides
- PutObjectOptions options = new PutObjectOptions();
- try {
- AccessControlList acl = bucketAcls.getUnchecked(container);
- if (acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ))
- options.withAcl(CannedAccessPolicy.PUBLIC_READ);
- } catch (CacheLoader.InvalidCacheLoadException e) {
- // nulls not permitted from cache loader
- }
- return async.putObject(container, blob2Object.apply(blob), options);
- }
-
- /**
- * This implementation invokes {@link S3AsyncClient#deleteObject}
- *
- * @param container
- * bucket name
- * @param key
- * object key
- */
- @Override
- public ListenableFuture<Void> removeBlob(String container, String key) {
- return async.deleteObject(container, key);
- }
-
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, String container,
- CreateContainerOptions options) {
- PutBucketOptions putBucketOptions = new PutBucketOptions();
- if (options.isPublicRead())
- putBucketOptions.withBucketAcl(CannedAccessPolicy.PUBLIC_READ);
- location = location != null ? location : defaultLocation.get();
- return async.putBucketInRegion(location.getId(), container, putBucketOptions);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobRequestSigner.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobRequestSigner.java b/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobRequestSigner.java
index 2ba56f4..a335754 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobRequestSigner.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobRequestSigner.java
@@ -30,7 +30,7 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.http.options.GetOptions;
import org.jclouds.reflect.Invocation;
import org.jclouds.rest.internal.RestAnnotationProcessor;
-import org.jclouds.s3.S3AsyncClient;
+import org.jclouds.s3.S3Client;
import org.jclouds.s3.blobstore.functions.BlobToObject;
import org.jclouds.s3.domain.S3Object;
import org.jclouds.s3.options.PutObjectOptions;
@@ -39,7 +39,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.reflect.Invokable;
@Singleton
-public class S3BlobRequestSigner<T extends S3AsyncClient> implements BlobRequestSigner {
+public class S3BlobRequestSigner<T extends S3Client> implements BlobRequestSigner {
protected final RestAnnotationProcessor processor;
protected final BlobToObject blobToObject;
protected final BlobToHttpGetOptions blob2HttpGetOptions;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobStoreContext.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobStoreContext.java b/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobStoreContext.java
index d4bcd4f..9f32ce8 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobStoreContext.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/blobstore/S3BlobStoreContext.java
@@ -26,7 +26,4 @@ public interface S3BlobStoreContext extends BlobStoreContext {
@Override
S3BlobStore getBlobStore();
-
- @Override
- S3AsyncBlobStore getAsyncBlobStore();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/blobstore/config/S3BlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/blobstore/config/S3BlobStoreContextModule.java b/apis/s3/src/main/java/org/jclouds/s3/blobstore/config/S3BlobStoreContextModule.java
index 3b42159..525f9bd 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/blobstore/config/S3BlobStoreContextModule.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/blobstore/config/S3BlobStoreContextModule.java
@@ -26,9 +26,9 @@ import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
+import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
import org.jclouds.domain.Location;
-import org.jclouds.s3.S3AsyncClient;
-import org.jclouds.s3.blobstore.S3AsyncBlobStore;
+import org.jclouds.s3.S3Client;
import org.jclouds.s3.blobstore.S3BlobRequestSigner;
import org.jclouds.s3.blobstore.S3BlobStore;
import org.jclouds.s3.blobstore.functions.LocationFromBucketName;
@@ -42,15 +42,12 @@ import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
-/**
- * Configures the {@link S3BlobStoreContext}; requires {@link S3AsyncBlobStore} bound.
- */
public class S3BlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
- bind(AsyncBlobStore.class).to(S3AsyncBlobStore.class).in(SINGLETON);
+ bind(AsyncBlobStore.class).to(SubmissionAsyncBlobStore.class).in(SINGLETON);
bind(BlobStore.class).to(S3BlobStore.class).in(SINGLETON);
bind(new TypeLiteral<Function<String, Location>>() {
}).to(LocationFromBucketName.class);
@@ -58,7 +55,7 @@ public class S3BlobStoreContextModule extends AbstractModule {
}
protected void bindRequestSigner() {
- bind(BlobRequestSigner.class).to(new TypeLiteral<S3BlobRequestSigner<S3AsyncClient>>() {
+ bind(BlobRequestSigner.class).to(new TypeLiteral<S3BlobRequestSigner<S3Client>>() {
});
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/blobstore/internal/S3BlobStoreContextImpl.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/blobstore/internal/S3BlobStoreContextImpl.java b/apis/s3/src/main/java/org/jclouds/s3/blobstore/internal/S3BlobStoreContextImpl.java
index 79bc913..a2aaf9a 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/blobstore/internal/S3BlobStoreContextImpl.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/blobstore/internal/S3BlobStoreContextImpl.java
@@ -27,7 +27,6 @@ import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.internal.BlobStoreContextImpl;
import org.jclouds.location.Provider;
import org.jclouds.rest.Utils;
-import org.jclouds.s3.blobstore.S3AsyncBlobStore;
import org.jclouds.s3.blobstore.S3BlobStore;
import org.jclouds.s3.blobstore.S3BlobStoreContext;
@@ -49,10 +48,4 @@ public class S3BlobStoreContextImpl extends BlobStoreContextImpl implements S3Bl
public S3BlobStore getBlobStore() {
return S3BlobStore.class.cast(super.getBlobStore());
}
-
- @Override
- public S3AsyncBlobStore getAsyncBlobStore() {
- return S3AsyncBlobStore.class.cast(super.getAsyncBlobStore());
- }
-
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/config/S3HttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/config/S3HttpApiModule.java b/apis/s3/src/main/java/org/jclouds/s3/config/S3HttpApiModule.java
new file mode 100644
index 0000000..3841865
--- /dev/null
+++ b/apis/s3/src/main/java/org/jclouds/s3/config/S3HttpApiModule.java
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.s3.config;
+
+import java.net.URI;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.Constants;
+import org.jclouds.aws.config.AWSHttpApiModule;
+import org.jclouds.aws.handlers.AWSClientErrorRetryHandler;
+import org.jclouds.aws.handlers.AWSServerErrorRetryHandler;
+import org.jclouds.blobstore.ContainerNotFoundException;
+import org.jclouds.blobstore.domain.PageSet;
+import org.jclouds.blobstore.domain.StorageMetadata;
+import org.jclouds.date.DateService;
+import org.jclouds.date.TimeStamp;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpRetryHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.location.Region;
+import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.RequestSigner;
+import org.jclouds.s3.Bucket;
+import org.jclouds.s3.S3Client;
+import org.jclouds.s3.blobstore.functions.BucketsToStorageMetadata;
+import org.jclouds.s3.domain.BucketMetadata;
+import org.jclouds.s3.filters.RequestAuthorizeSignature;
+import org.jclouds.s3.functions.GetRegionForBucket;
+import org.jclouds.s3.handlers.ParseS3ErrorFromXmlContent;
+import org.jclouds.s3.handlers.S3RedirectionRetryHandler;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.Iterables;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Configures the S3 connection, including logging and http transport.
+ */
+@ConfiguresHttpApi
+public class S3HttpApiModule<S extends S3Client> extends AWSHttpApiModule<S> {
+
+ @SuppressWarnings("unchecked")
+ public S3HttpApiModule() {
+ this(Class.class.cast(S3Client.class));
+ }
+
+ protected S3HttpApiModule(Class<S> syncClientType) {
+ super(syncClientType);
+ }
+
+ @Provides
+ @Bucket
+ @Singleton
+ protected CacheLoader<String, Optional<String>> bucketToRegion(@Region Supplier<Set<String>> regionSupplier,
+ final S3Client client) {
+ Set<String> regions = regionSupplier.get();
+ if (regions.isEmpty()) {
+ return new CacheLoader<String, Optional<String>>() {
+
+ @Override
+ public Optional<String> load(String bucket) {
+ return Optional.absent();
+ }
+
+ @Override
+ public String toString() {
+ return "noRegions()";
+ }
+ };
+ } else if (regions.size() == 1) {
+ final String onlyRegion = Iterables.getOnlyElement(regions);
+ return new CacheLoader<String, Optional<String>>() {
+ Optional<String> onlyRegionOption = Optional.of(onlyRegion);
+
+ @Override
+ public Optional<String> load(String bucket) {
+ return onlyRegionOption;
+ }
+
+ @Override
+ public String toString() {
+ return "onlyRegion(" + onlyRegion + ")";
+ }
+ };
+ } else {
+ return new CacheLoader<String, Optional<String>>() {
+ @Override
+ public Optional<String> load(String bucket) {
+ try {
+ return Optional.fromNullable(client.getBucketLocation(bucket));
+ } catch (ContainerNotFoundException e) {
+ return Optional.absent();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "bucketToRegion()";
+ }
+ };
+ }
+ }
+
+ @Provides
+ @Bucket
+ @Singleton
+ protected LoadingCache<String, Optional<String>> bucketToRegion(@Bucket CacheLoader<String, Optional<String>> loader) {
+ return CacheBuilder.newBuilder().build(loader);
+ }
+
+ @Provides
+ @Bucket
+ @Singleton
+ protected Supplier<String> defaultRegionForBucket(@Region Supplier<String> defaultRegion) {
+ return defaultRegion;
+ }
+
+ @Provides
+ @Singleton
+ @Bucket
+ protected Supplier<URI> provideBucketURI(@Bucket Supplier<String> defaultRegion,
+ RegionToEndpointOrProviderIfNull regionToEndpoint) {
+ return Suppliers.compose(regionToEndpoint, defaultRegion);
+ }
+
+ @Override
+ protected void configure() {
+ super.configure();
+ install(new S3ObjectModule());
+ install(new S3ParserModule());
+ bindRequestSigner();
+ bind(new TypeLiteral<Function<String, Optional<String>>>() {
+ }).annotatedWith(Bucket.class).to(GetRegionForBucket.class);
+ bind(new TypeLiteral<Function<Set<BucketMetadata>, PageSet<? extends StorageMetadata>>>() {
+ }).to(BucketsToStorageMetadata.class);
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseS3ErrorFromXmlContent.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseS3ErrorFromXmlContent.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseS3ErrorFromXmlContent.class);
+ }
+
+ protected void bindRequestSigner() {
+ bind(RequestAuthorizeSignature.class).in(Scopes.SINGLETON);
+ }
+
+ @Provides
+ @Singleton
+ protected RequestSigner provideRequestSigner(RequestAuthorizeSignature in) {
+ return in;
+ }
+
+ @Override
+ protected void bindRetryHandlers() {
+ bind(HttpRetryHandler.class).annotatedWith(Redirection.class).to(S3RedirectionRetryHandler.class);
+ bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(AWSClientErrorRetryHandler.class);
+ bind(HttpRetryHandler.class).annotatedWith(ServerError.class).to(AWSServerErrorRetryHandler.class);
+ }
+
+ @Provides
+ @TimeStamp
+ protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
+ return cache.get();
+ }
+
+ /**
+ * borrowing concurrency code to ensure that caching takes place properly
+ */
+ @Provides
+ @TimeStamp
+ @Singleton
+ protected Supplier<String> provideTimeStampCache(@Named(Constants.PROPERTY_SESSION_INTERVAL) long seconds,
+ final DateService dateService) {
+ return Suppliers.memoizeWithExpiration(new Supplier<String>() {
+ public String get() {
+ return dateService.rfc822DateFormat();
+ }
+ }, seconds, TimeUnit.SECONDS);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/config/S3RestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/config/S3RestClientModule.java b/apis/s3/src/main/java/org/jclouds/s3/config/S3RestClientModule.java
deleted file mode 100644
index 23cf033..0000000
--- a/apis/s3/src/main/java/org/jclouds/s3/config/S3RestClientModule.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.s3.config;
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import java.net.URI;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.aws.config.AWSRestClientModule;
-import org.jclouds.aws.handlers.AWSClientErrorRetryHandler;
-import org.jclouds.aws.handlers.AWSServerErrorRetryHandler;
-import org.jclouds.blobstore.ContainerNotFoundException;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.date.DateService;
-import org.jclouds.date.TimeStamp;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpRetryHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.location.Region;
-import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.RequestSigner;
-import org.jclouds.s3.Bucket;
-import org.jclouds.s3.S3AsyncClient;
-import org.jclouds.s3.S3Client;
-import org.jclouds.s3.blobstore.functions.BucketsToStorageMetadata;
-import org.jclouds.s3.domain.BucketMetadata;
-import org.jclouds.s3.filters.RequestAuthorizeSignature;
-import org.jclouds.s3.functions.GetRegionForBucket;
-import org.jclouds.s3.handlers.ParseS3ErrorFromXmlContent;
-import org.jclouds.s3.handlers.S3RedirectionRetryHandler;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.Iterables;
-import com.google.common.reflect.TypeToken;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-import com.google.inject.TypeLiteral;
-
-/**
- * Configures the S3 connection, including logging and http transport.
- */
-@ConfiguresRestClient
-public class S3RestClientModule<S extends S3Client, A extends S3AsyncClient> extends AWSRestClientModule<S, A> {
-
- @SuppressWarnings("unchecked")
- public S3RestClientModule() {
- this(TypeToken.class.cast(typeToken(S3Client.class)), TypeToken.class.cast(typeToken(S3AsyncClient.class)));
- }
-
- protected S3RestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType) {
- super(syncClientType, asyncClientType);
- }
-
- @Provides
- @Bucket
- @Singleton
- protected CacheLoader<String, Optional<String>> bucketToRegion(@Region Supplier<Set<String>> regionSupplier,
- final S3Client client) {
- Set<String> regions = regionSupplier.get();
- if (regions.isEmpty()) {
- return new CacheLoader<String, Optional<String>>() {
-
- @Override
- public Optional<String> load(String bucket) {
- return Optional.absent();
- }
-
- @Override
- public String toString() {
- return "noRegions()";
- }
- };
- } else if (regions.size() == 1) {
- final String onlyRegion = Iterables.getOnlyElement(regions);
- return new CacheLoader<String, Optional<String>>() {
- Optional<String> onlyRegionOption = Optional.of(onlyRegion);
-
- @Override
- public Optional<String> load(String bucket) {
- return onlyRegionOption;
- }
-
- @Override
- public String toString() {
- return "onlyRegion(" + onlyRegion + ")";
- }
- };
- } else {
- return new CacheLoader<String, Optional<String>>() {
- @Override
- public Optional<String> load(String bucket) {
- try {
- return Optional.fromNullable(client.getBucketLocation(bucket));
- } catch (ContainerNotFoundException e) {
- return Optional.absent();
- }
- }
-
- @Override
- public String toString() {
- return "bucketToRegion()";
- }
- };
- }
- }
-
- @Provides
- @Bucket
- @Singleton
- protected LoadingCache<String, Optional<String>> bucketToRegion(@Bucket CacheLoader<String, Optional<String>> loader) {
- return CacheBuilder.newBuilder().build(loader);
- }
-
- @Provides
- @Bucket
- @Singleton
- protected Supplier<String> defaultRegionForBucket(@Region Supplier<String> defaultRegion) {
- return defaultRegion;
- }
-
- @Provides
- @Singleton
- @Bucket
- protected Supplier<URI> provideBucketURI(@Bucket Supplier<String> defaultRegion,
- RegionToEndpointOrProviderIfNull regionToEndpoint) {
- return Suppliers.compose(regionToEndpoint, defaultRegion);
- }
-
- @Override
- protected void configure() {
- super.configure();
- install(new S3ObjectModule());
- install(new S3ParserModule());
- bindRequestSigner();
- bind(new TypeLiteral<Function<String, Optional<String>>>() {
- }).annotatedWith(Bucket.class).to(GetRegionForBucket.class);
- bind(new TypeLiteral<Function<Set<BucketMetadata>, PageSet<? extends StorageMetadata>>>() {
- }).to(BucketsToStorageMetadata.class);
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseS3ErrorFromXmlContent.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseS3ErrorFromXmlContent.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseS3ErrorFromXmlContent.class);
- }
-
- protected void bindRequestSigner() {
- bind(RequestAuthorizeSignature.class).in(Scopes.SINGLETON);
- }
-
- @Provides
- @Singleton
- protected RequestSigner provideRequestSigner(RequestAuthorizeSignature in) {
- return in;
- }
-
- @Override
- protected void bindRetryHandlers() {
- bind(HttpRetryHandler.class).annotatedWith(Redirection.class).to(S3RedirectionRetryHandler.class);
- bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(AWSClientErrorRetryHandler.class);
- bind(HttpRetryHandler.class).annotatedWith(ServerError.class).to(AWSServerErrorRetryHandler.class);
- }
-
- @Provides
- @TimeStamp
- protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
- return cache.get();
- }
-
- /**
- * borrowing concurrency code to ensure that caching takes place properly
- */
- @Provides
- @TimeStamp
- @Singleton
- protected Supplier<String> provideTimeStampCache(@Named(Constants.PROPERTY_SESSION_INTERVAL) long seconds,
- final DateService dateService) {
- return Suppliers.memoizeWithExpiration(new Supplier<String>() {
- public String get() {
- return dateService.rfc822DateFormat();
- }
- }, seconds, TimeUnit.SECONDS);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/domain/AccessControlList.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/domain/AccessControlList.java b/apis/s3/src/main/java/org/jclouds/s3/domain/AccessControlList.java
index 0faaa38..7450f30 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/domain/AccessControlList.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/domain/AccessControlList.java
@@ -36,9 +36,6 @@ import com.google.common.collect.Sets;
* has been granted to a specific {@link Grantee}. If an payload tries to access or modify an item
* in S3, the operation will be denied unless the item has ACL settings that explicitly permit that
* payload to perform that action.
- *
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html"/>
*/
public class AccessControlList {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/main/java/org/jclouds/s3/domain/BucketLogging.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/domain/BucketLogging.java b/apis/s3/src/main/java/org/jclouds/s3/domain/BucketLogging.java
index 3d50a44..1470441 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/domain/BucketLogging.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/domain/BucketLogging.java
@@ -26,8 +26,6 @@ import com.google.common.collect.Sets;
/**
* Each Amazon S3 bucket has an associated XML sub-resource that you can read and write in order to
* inspect or change the logging status for that bucket.
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/index.html?ServerLogs.html"/>
*/
public class BucketLogging {
private final String targetBucket;
[05/52] [abbrv] git commit: Revert "Revert "Revert "Unhook modernizer
from verify phase"""
Posted by an...@apache.org.
Revert "Revert "Revert "Unhook modernizer from verify phase"""
This reverts commit 2c790c897e91404704a3b29f37517ba60e776e66. We
originally unhooked modernizer in a misguided attempt to address
Checkstyle configuration issues fixed by:
80d51f409aa36f1a5505214eb4ac6e1128213c92.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/1788ad7d
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/1788ad7d
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/1788ad7d
Branch: refs/heads/use-agentproxy-008
Commit: 1788ad7d5857d69506e802fcb55a2823bb7e73c0
Parents: b649755
Author: Andrew Gaul <ga...@apache.org>
Authored: Fri Oct 3 13:40:37 2014 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Fri Oct 3 13:46:13 2014 -0700
----------------------------------------------------------------------
project/pom.xml | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1788ad7d/project/pom.xml
----------------------------------------------------------------------
diff --git a/project/pom.xml b/project/pom.xml
index 9325981..4aba813 100644
--- a/project/pom.xml
+++ b/project/pom.xml
@@ -707,6 +707,15 @@
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<version>1.1.0</version>
+ <executions>
+ <execution>
+ <id>modernizer</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>modernizer</goal>
+ </goals>
+ </execution>
+ </executions>
<configuration>
<javaVersion>1.7</javaVersion>
<exclusionsFile>resources/modernizer_exclusions.txt</exclusionsFile>
[09/52] [abbrv] JCLOUDS-40 unasync azureblob;
plus fold otherwise unused azure-common into it.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureAsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureAsyncBlobStore.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureAsyncBlobStore.java
deleted file mode 100644
index a0bba9f..0000000
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureAsyncBlobStore.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azureblob.blobstore;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.util.concurrent.Futures.transform;
-import static org.jclouds.azure.storage.options.ListOptions.Builder.includeMetadata;
-
-import java.util.List;
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.azure.storage.domain.BoundedSet;
-import org.jclouds.azureblob.AzureBlobAsyncClient;
-import org.jclouds.azureblob.blobstore.functions.AzureBlobToBlob;
-import org.jclouds.azureblob.blobstore.functions.BlobPropertiesToBlobMetadata;
-import org.jclouds.azureblob.blobstore.functions.BlobToAzureBlob;
-import org.jclouds.azureblob.blobstore.functions.ContainerToResourceMetadata;
-import org.jclouds.azureblob.blobstore.functions.ListBlobsResponseToResourceList;
-import org.jclouds.azureblob.blobstore.functions.ListOptionsToListBlobsOptions;
-import org.jclouds.azureblob.blobstore.strategy.MultipartUploadStrategy;
-import org.jclouds.azureblob.domain.AzureBlob;
-import org.jclouds.azureblob.domain.BlobProperties;
-import org.jclouds.azureblob.domain.ContainerProperties;
-import org.jclouds.azureblob.domain.ListBlobBlocksResponse;
-import org.jclouds.azureblob.domain.ListBlobsResponse;
-import org.jclouds.azureblob.domain.PublicAccess;
-import org.jclouds.azureblob.options.ListBlobsOptions;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.domain.internal.PageSetImpl;
-import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
-import org.jclouds.blobstore.internal.BaseAsyncBlobStore;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.options.PutOptions;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-import org.jclouds.http.options.GetOptions;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import org.jclouds.io.Payload;
-
-/**
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported. Please use {@link AzureBlobStore}
- */
-@Deprecated
-@Singleton
-public class AzureAsyncBlobStore extends BaseAsyncBlobStore {
- private final AzureBlobAsyncClient async;
- private final ContainerToResourceMetadata container2ResourceMd;
- private final ListOptionsToListBlobsOptions blobStore2AzureContainerListOptions;
- private final ListBlobsResponseToResourceList azure2BlobStoreResourceList;
- private final AzureBlobToBlob azureBlob2Blob;
- private final BlobToAzureBlob blob2AzureBlob;
- private final BlobPropertiesToBlobMetadata blob2BlobMd;
- private final BlobToHttpGetOptions blob2ObjectGetOptions;
- private final Provider<MultipartUploadStrategy> multipartUploadStrategy;
-
-
- @Inject
- AzureAsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, Supplier<Location> defaultLocation,
- @Memoized Supplier<Set<? extends Location>> locations, AzureBlobAsyncClient async,
- ContainerToResourceMetadata container2ResourceMd,
- ListOptionsToListBlobsOptions blobStore2AzureContainerListOptions,
- ListBlobsResponseToResourceList azure2BlobStoreResourceList, AzureBlobToBlob azureBlob2Blob,
- BlobToAzureBlob blob2AzureBlob, BlobPropertiesToBlobMetadata blob2BlobMd,
- BlobToHttpGetOptions blob2ObjectGetOptions,
- Provider<MultipartUploadStrategy> multipartUploadStrategy) {
- super(context, blobUtils, userExecutor, defaultLocation, locations);
- this.async = checkNotNull(async, "async");
- this.container2ResourceMd = checkNotNull(container2ResourceMd, "container2ResourceMd");
- this.blobStore2AzureContainerListOptions = checkNotNull(blobStore2AzureContainerListOptions,
- "blobStore2AzureContainerListOptions");
- this.azure2BlobStoreResourceList = checkNotNull(azure2BlobStoreResourceList, "azure2BlobStoreResourceList");
- this.azureBlob2Blob = checkNotNull(azureBlob2Blob, "azureBlob2Blob");
- this.blob2AzureBlob = checkNotNull(blob2AzureBlob, "blob2AzureBlob");
- this.blob2BlobMd = checkNotNull(blob2BlobMd, "blob2BlobMd");
- this.blob2ObjectGetOptions = checkNotNull(blob2ObjectGetOptions, "blob2ObjectGetOptions");
- this.multipartUploadStrategy = checkNotNull(multipartUploadStrategy, "multipartUploadStrategy");
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#listContainers} with the
- * {@link org.jclouds.azure.storage.options.ListOptions#includeMetadata} option.
- */
- @Override
- public ListenableFuture<org.jclouds.blobstore.domain.PageSet<? extends StorageMetadata>> list() {
- return transform(
- async.listContainers(includeMetadata()),
- new Function<BoundedSet<ContainerProperties>, org.jclouds.blobstore.domain.PageSet<? extends StorageMetadata>>() {
- public org.jclouds.blobstore.domain.PageSet<? extends StorageMetadata> apply(
- BoundedSet<ContainerProperties> from) {
- return new PageSetImpl<StorageMetadata>(Iterables.transform(from, container2ResourceMd),
- from.getNextMarker());
- }
- }, userExecutor);
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#containerExists}
- *
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<Boolean> containerExists(String container) {
- return async.containerExists(container);
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#createContainer}
- *
- * @param location
- * ignored
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, String container) {
- return async.createContainer(container);
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#listBucket}
- *
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<PageSet<? extends StorageMetadata>> list(String container, ListContainerOptions options) {
- ListBlobsOptions azureOptions = blobStore2AzureContainerListOptions.apply(options);
- ListenableFuture<ListBlobsResponse> returnVal = async.listBlobs(container, azureOptions.includeMetadata());
- return transform(returnVal, azure2BlobStoreResourceList, userExecutor);
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#deleteContainer}
- *
- * @param container
- * container name
- */
- @Override
- public ListenableFuture<Void> deleteContainer(final String container) {
- return async.deleteContainer(container);
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#getBlob}
- *
- * @param container
- * container name
- * @param key
- * blob key
- */
- @Override
- public ListenableFuture<Blob> getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions options) {
- GetOptions azureOptions = blob2ObjectGetOptions.apply(options);
- ListenableFuture<AzureBlob> returnVal = async.getBlob(container, key, azureOptions);
- return transform(returnVal, azureBlob2Blob, userExecutor);
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#putBlob}
- *
- * @param container
- * container name
- * @param blob
- * blob
- */
- @Override
- public ListenableFuture<String> putBlob(String container, Blob blob) {
- return async.putBlob(container, blob2AzureBlob.apply(blob));
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#deleteObject}
- *
- * @param container
- * container name
- * @param key
- * blob key
- */
- @Override
- public ListenableFuture<Void> removeBlob(String container, String key) {
- return async.deleteBlob(container, key);
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#blobExists}
- *
- * @param container
- * bucket name
- * @param credential
- * object key
- */
- @Override
- public ListenableFuture<Boolean> blobExists(String container, String name) {
- return async.blobExists(container, name);
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#putBlock(String, String, String, Payload)}
- * @param container
- * @param name
- * @param blockId
- * @param object
- */
- public ListenableFuture<Void> putBlock(String container, String name, String blockId, Payload object) {
- return async.putBlock(container, name, blockId, object);
- }
-
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#putBlockList(String, String, java.util.List)}
- * @param container
- * @param name
- * @param blockIdList
- */
- public ListenableFuture<String> putBlockList(String container, String name, List<String> blockIdList) {
- return async.putBlockList(container, name, blockIdList);
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#getBlockList(String, String)}
- * @param container
- * @param name
- */
- public ListenableFuture<ListBlobBlocksResponse> getBlockList(String container, String name) {
- return async.getBlockList(container, name);
- }
-
- /**
- * This implementation invokes {@link AzureBlobAsyncClient#getBlobProperties}
- *
- * @param container
- * container name
- * @param key
- * blob key
- */
- @Override
- public ListenableFuture<BlobMetadata> blobMetadata(String container, String key) {
- return transform(async.getBlobProperties(container, key), new Function<BlobProperties, BlobMetadata>() {
- public BlobMetadata apply(BlobProperties from) {
- return blob2BlobMd.apply(from);
- }
- }, userExecutor);
- }
-
- @Override
- protected boolean deleteAndVerifyContainerGone(String container) {
- // Azure deleteContainer supports deleting empty containers so emulate
- // deleteIfEmpty by listing.
- if (!Futures.getUnchecked(list(container)).isEmpty()) {
- return false;
- }
- Futures.getUnchecked(async.deleteContainer(container));
- return true;
- }
-
- @Override
- public ListenableFuture<String> putBlob(String container, Blob blob, PutOptions options) {
- if (options.isMultipart()) {
- throw new UnsupportedOperationException("Multipart upload not supported in AzureAsyncBlobStore");
- }
- return putBlob(container, blob);
- }
-
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, String container,
- CreateContainerOptions options) {
- org.jclouds.azureblob.options.CreateContainerOptions createContainerOptions = new org.jclouds.azureblob.options.CreateContainerOptions();
- if (options.isPublicRead())
- createContainerOptions.withPublicAccess(PublicAccess.CONTAINER);
- return async.createContainer(container, createContainerOptions);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSigner.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSigner.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSigner.java
index 7415981..7a365ed 100644
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSigner.java
+++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSigner.java
@@ -23,7 +23,7 @@ import static org.jclouds.reflect.Reflection2.method;
import javax.inject.Inject;
import javax.inject.Singleton;
-import org.jclouds.azureblob.AzureBlobAsyncClient;
+import org.jclouds.azureblob.AzureBlobClient;
import org.jclouds.azureblob.blobstore.functions.BlobToAzureBlob;
import org.jclouds.azureblob.domain.AzureBlob;
import org.jclouds.blobstore.BlobRequestSigner;
@@ -53,9 +53,9 @@ public class AzureBlobRequestSigner implements BlobRequestSigner {
this.processor = checkNotNull(processor, "processor");
this.blobToBlob = checkNotNull(blobToBlob, "blobToBlob");
this.blob2HttpGetOptions = checkNotNull(blob2HttpGetOptions, "blob2HttpGetOptions");
- this.getMethod = method(AzureBlobAsyncClient.class, "getBlob", String.class, String.class, GetOptions[].class);
- this.deleteMethod = method(AzureBlobAsyncClient.class, "deleteBlob", String.class, String.class);
- this.createMethod = method(AzureBlobAsyncClient.class, "putBlob", String.class, AzureBlob.class);
+ this.getMethod = method(AzureBlobClient.class, "getBlob", String.class, String.class, GetOptions[].class);
+ this.deleteMethod = method(AzureBlobClient.class, "deleteBlob", String.class, String.class);
+ this.createMethod = method(AzureBlobClient.class, "putBlob", String.class, AzureBlob.class);
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
index dce2e58..aef156d 100644
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
+++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/config/AzureBlobStoreContextModule.java
@@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
import javax.inject.Singleton;
import org.jclouds.azureblob.AzureBlobClient;
-import org.jclouds.azureblob.blobstore.AzureAsyncBlobStore;
import org.jclouds.azureblob.blobstore.AzureBlobRequestSigner;
import org.jclouds.azureblob.blobstore.AzureBlobStore;
import org.jclouds.azureblob.domain.PublicAccess;
@@ -29,6 +28,7 @@ import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
+import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
@@ -37,15 +37,12 @@ import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Scopes;
-/**
- * Configures the {@link AzureBlobStoreContext}; requires {@link AzureAsyncBlobStore} bound.
- */
public class AzureBlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
- bind(AsyncBlobStore.class).to(AzureAsyncBlobStore.class).in(Scopes.SINGLETON);
+ bind(AsyncBlobStore.class).to(SubmissionAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(AzureBlobStore.class).in(Scopes.SINGLETON);
bind(BlobRequestSigner.class).to(AzureBlobRequestSigner.class);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azureblob/config/AzureBlobHttpApiModule.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/config/AzureBlobHttpApiModule.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/config/AzureBlobHttpApiModule.java
new file mode 100644
index 0000000..52a4195
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/config/AzureBlobHttpApiModule.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azureblob.config;
+
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.jclouds.json.config.GsonModule.DateAdapter;
+import static org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
+
+import java.util.concurrent.TimeUnit;
+
+import javax.inject.Named;
+
+import org.jclouds.azure.storage.handlers.AzureStorageClientErrorRetryHandler;
+import org.jclouds.azureblob.AzureBlobClient;
+import org.jclouds.azureblob.handlers.ParseAzureBlobErrorFromXmlContent;
+import org.jclouds.date.DateService;
+import org.jclouds.date.TimeStamp;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpRetryHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.config.HttpApiModule;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.inject.Provides;
+
+/**
+ * Configures the Azure Blob Service connection, including logging and http transport.
+ */
+@ConfiguresHttpApi
+public class AzureBlobHttpApiModule extends HttpApiModule<AzureBlobClient> {
+
+ @Override
+ protected void configure() {
+ install(new AzureBlobModule());
+ bind(DateAdapter.class).to(Iso8601DateAdapter.class);
+ super.configure();
+ }
+
+ @Provides
+ @TimeStamp
+ protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
+ return cache.get();
+ }
+
+ /**
+ * borrowing concurrency code to ensure that caching takes place properly
+ */
+ @Provides
+ @TimeStamp
+ protected Supplier<String> provideTimeStampCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
+ final DateService dateService) {
+ return Suppliers.memoizeWithExpiration(new Supplier<String>() {
+ public String get() {
+ return dateService.rfc822DateFormat();
+ }
+ }, seconds, TimeUnit.SECONDS);
+ }
+
+ @Override
+ protected void bindRetryHandlers() {
+ bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(AzureStorageClientErrorRetryHandler.class);
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseAzureBlobErrorFromXmlContent.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseAzureBlobErrorFromXmlContent.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseAzureBlobErrorFromXmlContent.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azureblob/config/AzureBlobRestClientModule.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/config/AzureBlobRestClientModule.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/config/AzureBlobRestClientModule.java
deleted file mode 100644
index 4b62ebf..0000000
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/config/AzureBlobRestClientModule.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azureblob.config;
-
-import org.jclouds.azure.storage.config.AzureStorageRestClientModule;
-import org.jclouds.azureblob.AzureBlobAsyncClient;
-import org.jclouds.azureblob.AzureBlobClient;
-import org.jclouds.azureblob.handlers.ParseAzureBlobErrorFromXmlContent;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.rest.ConfiguresRestClient;
-
-/**
- * Configures the Azure Blob Service connection, including logging and http transport.
- */
-@ConfiguresRestClient
-public class AzureBlobRestClientModule extends AzureStorageRestClientModule<AzureBlobClient, AzureBlobAsyncClient> {
-
- @Override
- protected void configure() {
- install(new AzureBlobModule());
- super.configure();
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseAzureBlobErrorFromXmlContent.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseAzureBlobErrorFromXmlContent.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseAzureBlobErrorFromXmlContent.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java b/providers/azureblob/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java
new file mode 100644
index 0000000..5bea836
--- /dev/null
+++ b/providers/azureblob/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.filters;
+
+import static org.jclouds.reflect.Reflection2.typeToken;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+
+import javax.ws.rs.HttpMethod;
+
+import org.jclouds.ContextBuilder;
+import org.jclouds.azure.storage.config.AzureStorageRestClientModule;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.IntegrationTestAsyncClient;
+import org.jclouds.http.IntegrationTestClient;
+import org.jclouds.logging.config.NullLoggingModule;
+import org.jclouds.rest.AnonymousRestApiMetadata;
+import org.jclouds.rest.internal.BaseRestApiTest.MockModule;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.net.HttpHeaders;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+
+@Test(groups = "unit")
+public class SharedKeyLiteAuthenticationTest {
+
+ private static final String ACCOUNT = "foo";
+ private Injector injector;
+ private SharedKeyLiteAuthentication filter;
+
+ @DataProvider(parallel = true)
+ public Object[][] dataProvider() {
+ return new Object[][] {
+ { HttpRequest.builder().method(HttpMethod.PUT).endpoint("http://" + ACCOUNT
+ + ".blob.core.windows.net/movies/MOV1.avi?comp=block&blockid=BlockId1&timeout=60").build() },
+ { HttpRequest.builder().method(HttpMethod.PUT).endpoint("http://" + ACCOUNT
+ + ".blob.core.windows.net/movies/MOV1.avi?comp=blocklist&timeout=120").build() },
+ { HttpRequest.builder().method(HttpMethod.GET).endpoint("http://" + ACCOUNT + ".blob.core.windows.net/movies/MOV1.avi").build() } };
+ }
+
+ /**
+ * NOTE this test is dependent on how frequently the timestamp updates. At
+ * the time of writing, this was once per second. If this timestamp update
+ * interval is increased, it could make this test appear to hang for a long
+ * time.
+ */
+ @Test(threadPoolSize = 3, dataProvider = "dataProvider", timeOut = 3000)
+ void testIdempotent(HttpRequest request) {
+ request = filter.filter(request);
+ String signature = request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION);
+ String date = request.getFirstHeaderOrNull(HttpHeaders.DATE);
+ int iterations = 1;
+ while (request.getFirstHeaderOrNull(HttpHeaders.DATE).equals(date)) {
+ date = request.getFirstHeaderOrNull(HttpHeaders.DATE);
+ iterations++;
+ assertEquals(signature, request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION));
+ request = filter.filter(request);
+ }
+ System.out.printf("%s: %d iterations before the timestamp updated %n", Thread.currentThread().getName(),
+ iterations);
+ }
+
+ @Test
+ void testAclQueryStringRoot() {
+ URI host = URI.create("http://" + ACCOUNT + ".blob.core.windows.net/?comp=list");
+ HttpRequest request = HttpRequest.builder().method(HttpMethod.GET).endpoint(host).build();
+ StringBuilder builder = new StringBuilder();
+ filter.appendUriPath(request, builder);
+ assertEquals(builder.toString(), "/?comp=list");
+ }
+
+ @Test
+ void testAclQueryStringResTypeNotSignificant() {
+ URI host = URI.create("http://" + ACCOUNT + ".blob.core.windows.net/mycontainer?restype=container");
+ HttpRequest request = HttpRequest.builder().method(HttpMethod.GET).endpoint(host).build();
+ StringBuilder builder = new StringBuilder();
+ filter.appendUriPath(request, builder);
+ assertEquals(builder.toString(), "/mycontainer");
+ }
+
+ @Test
+ void testAclQueryStringComp() {
+ URI host = URI.create("http://" + ACCOUNT + ".blob.core.windows.net/mycontainer?comp=list");
+ HttpRequest request = HttpRequest.builder().method(HttpMethod.GET).endpoint(host).build();
+ StringBuilder builder = new StringBuilder();
+ filter.appendUriPath(request, builder);
+ assertEquals(builder.toString(), "/mycontainer?comp=list");
+ }
+
+ @Test
+ void testAclQueryStringRelativeWithExtraJunk() {
+ URI host = URI.create("http://" + ACCOUNT
+ + ".blob.core.windows.net/mycontainer?comp=list&marker=marker&maxresults=1&prefix=prefix");
+ HttpRequest request = HttpRequest.builder().method(HttpMethod.GET).endpoint(host).build();
+ StringBuilder builder = new StringBuilder();
+ filter.appendUriPath(request, builder);
+ assertEquals(builder.toString(), "/mycontainer?comp=list");
+ }
+
+ /**
+ * before class, as we need to ensure that the filter is threadsafe.
+ *
+ * @throws IOException
+ *
+ */
+ @BeforeClass
+ protected void createFilter() throws IOException {
+ injector = ContextBuilder
+ .newBuilder(
+ AnonymousRestApiMetadata
+ .forClientMappedToAsyncClient(IntegrationTestClient.class, IntegrationTestAsyncClient.class)
+ .toBuilder().build())
+ .endpoint("https://${jclouds.identity}.blob.core.windows.net")
+ .credentials(ACCOUNT, "credential")
+ .modules(
+ ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule(),
+ new AzureStorageRestClientModule<IntegrationTestClient, IntegrationTestAsyncClient>(
+ typeToken(IntegrationTestClient.class), typeToken(IntegrationTestAsyncClient.class))))
+ .buildInjector();
+ filter = injector.getInstance(SharedKeyLiteAuthentication.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/test/java/org/jclouds/azure/storage/handlers/ParseAzureErrorFromXmlContentTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azure/storage/handlers/ParseAzureErrorFromXmlContentTest.java b/providers/azureblob/src/test/java/org/jclouds/azure/storage/handlers/ParseAzureErrorFromXmlContentTest.java
new file mode 100644
index 0000000..5cfbffe
--- /dev/null
+++ b/providers/azureblob/src/test/java/org/jclouds/azure/storage/handlers/ParseAzureErrorFromXmlContentTest.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.handlers;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reportMatcher;
+import static org.easymock.EasyMock.verify;
+
+import java.net.URI;
+
+import org.easymock.IArgumentMatcher;
+import org.jclouds.azure.storage.AzureStorageResponseException;
+import org.jclouds.azure.storage.filters.SharedKeyLiteAuthentication;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.testng.annotations.Test;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+
+@Test(groups = { "unit" })
+public class ParseAzureErrorFromXmlContentTest {
+
+ @Test
+ public void test411WithTextHtmlIllegalArgumentException() {
+ assertCodeMakes("PUT",
+ URI.create("https://jclouds.blob.core.windows.net/adriancole-azureblob-413790770?restype=container"), 411,
+ "Length Required", "text/html; charset=us-ascii", "<HTML><HEAD><TITLE>Length Required</TITLE>\r\n",
+ IllegalArgumentException.class);
+ }
+
+ @Test
+ public void test304WithNoContentIllegalArgumentException() {
+ assertCodeMakes("GET", URI.create("https://jclouds.blob.core.windows.net/adriancole-blobstore0/apples"), 411,
+ "HTTP/1.1 304 The condition specified using HTTP conditional header(s) is not met.", "application/unknown",
+ "", IllegalArgumentException.class);
+ }
+
+
+ @Test
+ public void test412WithTextHtmlHttpResponseException() {
+ assertCodeMakes(
+ "GET",
+ URI.create("https://jclouds.blob.core.windows.net/adriancole-blobstore2?restype=container&comp=list&prefix=apps/apps/apps/&include=metadata"),
+ 412,
+ "HTTP/1.1 412 The condition specified using HTTP conditional header(s) is not met.",
+ "application/xml",
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>ConditionNotMet</Code><Message>The condition specified using HTTP conditional header(s) is not met.\nRequestId:921efcad-84bc-4e0a-863d-24810d1096e1\nTime:2010-11-04T15:03:07.8694513Z</Message></Error>",
+ AzureStorageResponseException.class);
+ }
+
+ private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
+ String content, Class<? extends Exception> expected) {
+
+ ParseAzureStorageErrorFromXmlContent function = Guice.createInjector(new SaxParserModule(), new AbstractModule() {
+
+ @Override
+ protected void configure() {
+ bind(SharedKeyLiteAuthentication.class).toInstance(createMock(SharedKeyLiteAuthentication.class));
+ }
+
+ }).getInstance(ParseAzureStorageErrorFromXmlContent.class);
+
+ HttpCommand command = createMock(HttpCommand.class);
+ HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
+ HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
+ response.getPayload().getContentMetadata().setContentType(contentType);
+
+ expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
+ command.setException(classEq(expected));
+
+ replay(command);
+
+ function.handleError(command, response);
+
+ verify(command);
+ }
+
+ public static Exception classEq(final Class<? extends Exception> in) {
+ reportMatcher(new IArgumentMatcher() {
+
+ @Override
+ public void appendTo(StringBuffer buffer) {
+ buffer.append("classEq(");
+ buffer.append(in);
+ buffer.append(")");
+ }
+
+ @Override
+ public boolean matches(Object arg) {
+ return arg.getClass() == in;
+ }
+
+ });
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/test/java/org/jclouds/azure/storage/options/CreateOptionsTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azure/storage/options/CreateOptionsTest.java b/providers/azureblob/src/test/java/org/jclouds/azure/storage/options/CreateOptionsTest.java
new file mode 100644
index 0000000..b582783
--- /dev/null
+++ b/providers/azureblob/src/test/java/org/jclouds/azure/storage/options/CreateOptionsTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.options;
+
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.azure.storage.reference.AzureStorageHeaders;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMultimap;
+
+/**
+ * Tests behavior of {@code CreateOptions}
+ */
+@Test(groups = "unit")
+public class CreateOptionsTest {
+
+ public void testMetadata() {
+ CreateOptions options = new CreateOptions().withMetadata(ImmutableMultimap.of(
+ "test", "foo"));
+ assertEquals(ImmutableList.of("foo"), options.buildRequestHeaders().get(
+ AzureStorageHeaders.USER_METADATA_PREFIX + "test"));
+ }
+
+ public void testMetadataAlreadyPrefixed() {
+ CreateOptions options = new CreateOptions().withMetadata(ImmutableMultimap.of(
+ AzureStorageHeaders.USER_METADATA_PREFIX + "test", "foo"));
+ assertEquals(ImmutableList.of("foo"), options.buildRequestHeaders().get(
+ AzureStorageHeaders.USER_METADATA_PREFIX + "test"));
+ }
+
+ public void testMetadataStatic() {
+ CreateOptions options = CreateOptions.Builder.withMetadata(ImmutableMultimap.of(
+ "test", "foo"));
+ assertEquals(ImmutableList.of("foo"), options.buildRequestHeaders().get(
+ AzureStorageHeaders.USER_METADATA_PREFIX + "test"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/test/java/org/jclouds/azure/storage/options/ListOptionsTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azure/storage/options/ListOptionsTest.java b/providers/azureblob/src/test/java/org/jclouds/azure/storage/options/ListOptionsTest.java
new file mode 100644
index 0000000..67fc768
--- /dev/null
+++ b/providers/azureblob/src/test/java/org/jclouds/azure/storage/options/ListOptionsTest.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.options;
+
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Tests behavior of {@code ListOptions}
+ */
+@Test(groups = "unit")
+public class ListOptionsTest {
+ public void testIncludeMetadata() {
+ ListOptions options = new ListOptions().includeMetadata();
+ assertEquals(ImmutableList.of("metadata"), options.buildQueryParameters().get("include"));
+ }
+
+ public void testIncludeMetadataStatic() {
+ ListOptions options = ListOptions.Builder.includeMetadata();
+ assertEquals(ImmutableList.of("metadata"), options.buildQueryParameters().get("include"));
+ }
+
+ public void testPrefix() {
+ ListOptions options = new ListOptions().prefix("a");
+ assertEquals(ImmutableList.of("a"), options.buildQueryParameters().get("prefix"));
+ }
+
+ public void testMarker() {
+ ListOptions options = new ListOptions().marker("a");
+ assertEquals(ImmutableList.of("a"), options.buildQueryParameters().get("marker"));
+ }
+
+ public void testMaxResults() {
+ int limit = 1;
+ ListOptions options = new ListOptions().maxResults(limit);
+ assertEquals(ImmutableList.of("1"), options.buildQueryParameters().get("maxresults"));
+ }
+
+ public void testPrefixStatic() {
+ ListOptions options = ListOptions.Builder.prefix("a");
+ assertEquals(ImmutableList.of("a"), options.buildQueryParameters().get("prefix"));
+ }
+
+ public void testMarkerStatic() {
+ ListOptions options = ListOptions.Builder.marker("a");
+ assertEquals(ImmutableList.of("a"), options.buildQueryParameters().get("marker"));
+ }
+
+ public void testMaxResultsStatic() {
+ int limit = 1;
+ ListOptions options = ListOptions.Builder.maxResults(limit);
+ assertEquals(ImmutableList.of("1"), options.buildQueryParameters().get("maxresults"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/test/java/org/jclouds/azure/storage/xml/ErrorHandlerTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azure/storage/xml/ErrorHandlerTest.java b/providers/azureblob/src/test/java/org/jclouds/azure/storage/xml/ErrorHandlerTest.java
new file mode 100644
index 0000000..1698cd6
--- /dev/null
+++ b/providers/azureblob/src/test/java/org/jclouds/azure/storage/xml/ErrorHandlerTest.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+
+import org.jclouds.azure.storage.domain.AzureStorageError;
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.http.functions.ParseSax;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code ErrorHandler}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "ErrorHandlerTest")
+public class ErrorHandlerTest extends BaseHandlerTest {
+
+ ParseSax<AzureStorageError> createParser() {
+ ParseSax<AzureStorageError> parser = factory.create(injector
+ .getInstance(ErrorHandler.class));
+ return parser;
+ }
+
+ public void testApplyInputStream() {
+ InputStream is = getClass().getResourceAsStream("/test_error.xml");
+ ParseSax<AzureStorageError> parser = createParser();
+ AzureStorageError result = parser.parse(is);
+ assertEquals(result.getCode(), "AuthenticationFailed");
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobAsyncClientTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobAsyncClientTest.java
deleted file mode 100644
index 17a9cb8..0000000
--- a/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobAsyncClientTest.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azureblob;
-
-import static org.jclouds.azure.storage.options.ListOptions.Builder.maxResults;
-import static org.jclouds.azureblob.options.CreateContainerOptions.Builder.withPublicAccess;
-import static org.jclouds.reflect.Reflection2.method;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.jclouds.Fallbacks.TrueOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.azure.storage.filters.SharedKeyLiteAuthentication;
-import org.jclouds.azure.storage.options.ListOptions;
-import org.jclouds.azureblob.AzureBlobFallbacks.FalseIfContainerAlreadyExists;
-import org.jclouds.azureblob.domain.PublicAccess;
-import org.jclouds.azureblob.functions.ParseBlobFromHeadersAndHttpContent;
-import org.jclouds.azureblob.functions.ParseContainerPropertiesFromHeaders;
-import org.jclouds.azureblob.functions.ParsePublicAccessHeader;
-import org.jclouds.azureblob.options.CreateContainerOptions;
-import org.jclouds.azureblob.options.ListBlobsOptions;
-import org.jclouds.azureblob.xml.AccountNameEnumerationResultsHandler;
-import org.jclouds.azureblob.xml.ContainerNameEnumerationResultsHandler;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnContainerNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyNotFound;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.http.functions.ReleasePayloadAndReturn;
-import org.jclouds.http.functions.ReturnTrueIf2xx;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.reflect.Invokable;
-/**
- * Tests behavior of {@code AzureBlobAsyncClient}
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
-@Test(groups = "unit", testName = "AzureBlobAsyncClientTest")
-public class AzureBlobAsyncClientTest extends BaseAsyncClientTest<AzureBlobAsyncClient> {
-
- public void testListContainers() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "listContainers", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request, "GET https://identity.blob.core.windows.net/?comp=list HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, AccountNameEnumerationResultsHandler.class);
- assertFallbackClassEquals(method, null);
-
- }
-
- public void testListContainersOptions() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "listContainers", ListOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(maxResults(1).marker("marker").prefix("prefix")));
-
- assertRequestLineEquals(request,
- "GET https://identity.blob.core.windows.net/?comp=list&maxresults=1&marker=marker&prefix=prefix HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, AccountNameEnumerationResultsHandler.class);
- assertFallbackClassEquals(method, null);
- }
-
- public void testCreateContainer() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "createContainer", String.class,
- CreateContainerOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container"));
-
- assertRequestLineEquals(request,
- "PUT https://identity.blob.core.windows.net/container?restype=container HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseIfContainerAlreadyExists.class);
- }
-
- public void testDeleteContainer() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "deleteContainer", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container"));
-
- assertRequestLineEquals(request,
- "DELETE https://identity.blob.core.windows.net/container?restype=container HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
- }
-
- public void testCreateContainerOptions() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "createContainer", String.class,
- CreateContainerOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container", withPublicAccess(PublicAccess.BLOB)
- .withMetadata(ImmutableMultimap.of("foo", "bar"))));
-
- assertRequestLineEquals(request,
- "PUT https://identity.blob.core.windows.net/container?restype=container HTTP/1.1");
- assertNonPayloadHeadersEqual(request,
- "x-ms-blob-public-access: blob\n" +
- "x-ms-meta-foo: bar\n" +
- "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseIfContainerAlreadyExists.class);
- }
-
- public void testCreateRootContainer() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "createRootContainer", CreateContainerOptions[].class);
-
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request, "PUT https://identity.blob.core.windows.net/$root?restype=container HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseIfContainerAlreadyExists.class);
- }
-
- public void testDeleteRootContainer() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "deleteRootContainer");
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request, "DELETE https://identity.blob.core.windows.net/$root?restype=container HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, TrueOnNotFoundOr404.class);
- }
-
- public void testCreateRootContainerOptions() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "createRootContainer", CreateContainerOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withPublicAccess(PublicAccess.BLOB).withMetadata(
- ImmutableMultimap.of("foo", "bar"))));
-
- assertRequestLineEquals(request, "PUT https://identity.blob.core.windows.net/$root?restype=container HTTP/1.1");
- assertNonPayloadHeadersEqual(request,
- "x-ms-blob-public-access: blob\n" +
- "x-ms-meta-foo: bar\n" +
- "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, FalseIfContainerAlreadyExists.class);
- }
-
- public void testListBlobs() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "listBlobs", String.class, ListBlobsOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container"));
-
- assertRequestLineEquals(request,
- "GET https://identity.blob.core.windows.net/container?restype=container&comp=list HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, ContainerNameEnumerationResultsHandler.class);
- assertFallbackClassEquals(method, null);
- }
-
- public void testListRootBlobs() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "listBlobs", ListBlobsOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request,
- "GET https://identity.blob.core.windows.net/$root?restype=container&comp=list HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, ContainerNameEnumerationResultsHandler.class);
- assertFallbackClassEquals(method, null);
- }
-
- public void testContainerProperties() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "getContainerProperties", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container"));
-
- assertRequestLineEquals(request,
- "HEAD https://identity.blob.core.windows.net/container?restype=container HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseContainerPropertiesFromHeaders.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnContainerNotFound.class);
- }
-
- public void testGetPublicAccessForContainer() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "getPublicAccessForContainer", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container"));
-
- assertRequestLineEquals(request,
- "HEAD https://identity.blob.core.windows.net/container?restype=container&comp=acl HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParsePublicAccessHeader.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnContainerNotFound.class);
- }
-
- public void testSetResourceMetadata() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "setResourceMetadata", String.class, Map.class);
- GeneratedHttpRequest request = processor.createRequest(method,
- ImmutableList.<Object> of("container", ImmutableMap.of("key", "value")));
-
- assertRequestLineEquals(request,
- "PUT https://identity.blob.core.windows.net/container?restype=container&comp=metadata HTTP/1.1");
- assertNonPayloadHeadersEqual(request,
- "x-ms-meta-key: value\n" +
- "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
- }
-
- public void testGetBlob() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "getBlob", String.class, String.class, GetOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container", "blob"));
-
- assertRequestLineEquals(request, "GET https://identity.blob.core.windows.net/container/blob HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseBlobFromHeadersAndHttpContent.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, NullOnKeyNotFound.class);
- }
-
- public void testSetBlobMetadata() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(AzureBlobAsyncClient.class, "setBlobMetadata", String.class, String.class, Map.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container", "blob", ImmutableMap.of("key", "value")));
-
- assertRequestLineEquals(request,
- "PUT https://identity.blob.core.windows.net/container/blob?comp=metadata HTTP/1.1");
- assertNonPayloadHeadersEqual(request,
- "x-ms-meta-key: value\n" +
- "x-ms-version: 2012-02-12\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
- }
-
- @Override
- protected void checkFilters(HttpRequest request) {
- assertEquals(request.getFilters().size(), 1);
- assertEquals(request.getFilters().get(0).getClass(), SharedKeyLiteAuthentication.class);
- }
-
- @Override
- public AzureBlobProviderMetadata createProviderMetadata() {
- return new AzureBlobProviderMetadata();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientLiveTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientLiveTest.java
index 5966e7b..5ad73d1 100644
--- a/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientLiveTest.java
+++ b/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientLiveTest.java
@@ -30,7 +30,6 @@ import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Set;
-import com.google.common.io.BaseEncoding;
import org.jclouds.azure.storage.AzureStorageResponseException;
import org.jclouds.azure.storage.domain.BoundedSet;
import org.jclouds.azure.storage.options.ListOptions;
@@ -55,10 +54,8 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Iterables;
import com.google.common.hash.Hashing;
+import com.google.common.io.BaseEncoding;
-/**
- * Tests behavior of {@code AzureBlobClient}
- */
@Test(groups = "live", singleThreaded = true)
public class AzureBlobClientLiveTest extends BaseBlobStoreIntegrationTest {
public AzureBlobClientLiveTest() {
@@ -66,7 +63,7 @@ public class AzureBlobClientLiveTest extends BaseBlobStoreIntegrationTest {
}
public AzureBlobClient getApi() {
- return view.unwrap(AzureBlobApiMetadata.CONTEXT_TOKEN).getApi();
+ return view.unwrapApi(AzureBlobClient.class);
}
@Test
@@ -100,8 +97,8 @@ public class AzureBlobClientLiveTest extends BaseBlobStoreIntegrationTest {
long containerCount = response.size();
assertTrue(containerCount >= 1);
ListBlobsResponse list = getApi().listBlobs(privateContainer);
- assertEquals(list.getUrl(), URI.create(String.format("https://%s.blob.core.windows.net/%s", view.unwrap(
- AzureBlobApiMetadata.CONTEXT_TOKEN).getIdentity(), privateContainer)));
+ assertEquals(list.getUrl(), URI.create(String.format("https://%s.blob.core.windows.net/%s",
+ view.unwrap().getIdentity(), privateContainer)));
// TODO .. check to see the container actually exists
}
@@ -156,8 +153,8 @@ public class AzureBlobClientLiveTest extends BaseBlobStoreIntegrationTest {
}
}
ListBlobsResponse list = getApi().listBlobs();
- assertEquals(list.getUrl(), URI.create(String.format("https://%s.blob.core.windows.net/$root", view.unwrap(
- AzureBlobApiMetadata.CONTEXT_TOKEN).getIdentity())));
+ assertEquals(list.getUrl(), URI.create(String.format("https://%s.blob.core.windows.net/$root",
+ view.unwrap().getIdentity())));
}
@Test
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientTest.java
new file mode 100644
index 0000000..34f0c5c
--- /dev/null
+++ b/providers/azureblob/src/test/java/org/jclouds/azureblob/AzureBlobClientTest.java
@@ -0,0 +1,291 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azureblob;
+
+import static org.jclouds.azure.storage.options.ListOptions.Builder.maxResults;
+import static org.jclouds.azureblob.options.CreateContainerOptions.Builder.withPublicAccess;
+import static org.jclouds.reflect.Reflection2.method;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.jclouds.Fallbacks.TrueOnNotFoundOr404;
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.azure.storage.filters.SharedKeyLiteAuthentication;
+import org.jclouds.azure.storage.options.ListOptions;
+import org.jclouds.azureblob.AzureBlobFallbacks.FalseIfContainerAlreadyExists;
+import org.jclouds.azureblob.domain.PublicAccess;
+import org.jclouds.azureblob.functions.ParseBlobFromHeadersAndHttpContent;
+import org.jclouds.azureblob.functions.ParseContainerPropertiesFromHeaders;
+import org.jclouds.azureblob.functions.ParsePublicAccessHeader;
+import org.jclouds.azureblob.options.CreateContainerOptions;
+import org.jclouds.azureblob.options.ListBlobsOptions;
+import org.jclouds.azureblob.xml.AccountNameEnumerationResultsHandler;
+import org.jclouds.azureblob.xml.ContainerNameEnumerationResultsHandler;
+import org.jclouds.blobstore.BlobStoreFallbacks.NullOnContainerNotFound;
+import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyNotFound;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.http.functions.ReturnTrueIf2xx;
+import org.jclouds.http.options.GetOptions;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.reflect.Invokable;
+
+@Test(groups = "unit", testName = "AzureBlobClientTest")
+public class AzureBlobClientTest extends BaseAsyncClientTest<AzureBlobClient> {
+
+ public void testListContainers() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "listContainers", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "GET https://identity.blob.core.windows.net/?comp=list HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, AccountNameEnumerationResultsHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ }
+
+ public void testListContainersOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "listContainers", ListOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(maxResults(1).marker("marker").prefix("prefix")));
+
+ assertRequestLineEquals(request,
+ "GET https://identity.blob.core.windows.net/?comp=list&maxresults=1&marker=marker&prefix=prefix HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, AccountNameEnumerationResultsHandler.class);
+ assertFallbackClassEquals(method, null);
+ }
+
+ public void testCreateContainer() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "createContainer", String.class,
+ CreateContainerOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container"));
+
+ assertRequestLineEquals(request,
+ "PUT https://identity.blob.core.windows.net/container?restype=container HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseIfContainerAlreadyExists.class);
+ }
+
+ public void testDeleteContainer() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "deleteContainer", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container"));
+
+ assertRequestLineEquals(request,
+ "DELETE https://identity.blob.core.windows.net/container?restype=container HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
+ }
+
+ public void testCreateContainerOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "createContainer", String.class,
+ CreateContainerOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container", withPublicAccess(PublicAccess.BLOB)
+ .withMetadata(ImmutableMultimap.of("foo", "bar"))));
+
+ assertRequestLineEquals(request,
+ "PUT https://identity.blob.core.windows.net/container?restype=container HTTP/1.1");
+ assertNonPayloadHeadersEqual(request,
+ "x-ms-blob-public-access: blob\n" +
+ "x-ms-meta-foo: bar\n" +
+ "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseIfContainerAlreadyExists.class);
+ }
+
+ public void testCreateRootContainer() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "createRootContainer", CreateContainerOptions[].class);
+
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "PUT https://identity.blob.core.windows.net/$root?restype=container HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseIfContainerAlreadyExists.class);
+ }
+
+ public void testDeleteRootContainer() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "deleteRootContainer");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "DELETE https://identity.blob.core.windows.net/$root?restype=container HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, TrueOnNotFoundOr404.class);
+ }
+
+ public void testCreateRootContainerOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "createRootContainer", CreateContainerOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withPublicAccess(PublicAccess.BLOB).withMetadata(
+ ImmutableMultimap.of("foo", "bar"))));
+
+ assertRequestLineEquals(request, "PUT https://identity.blob.core.windows.net/$root?restype=container HTTP/1.1");
+ assertNonPayloadHeadersEqual(request,
+ "x-ms-blob-public-access: blob\n" +
+ "x-ms-meta-foo: bar\n" +
+ "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, FalseIfContainerAlreadyExists.class);
+ }
+
+ public void testListBlobs() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "listBlobs", String.class, ListBlobsOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container"));
+
+ assertRequestLineEquals(request,
+ "GET https://identity.blob.core.windows.net/container?restype=container&comp=list HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, ContainerNameEnumerationResultsHandler.class);
+ assertFallbackClassEquals(method, null);
+ }
+
+ public void testListRootBlobs() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "listBlobs", ListBlobsOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request,
+ "GET https://identity.blob.core.windows.net/$root?restype=container&comp=list HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, ContainerNameEnumerationResultsHandler.class);
+ assertFallbackClassEquals(method, null);
+ }
+
+ public void testContainerProperties() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "getContainerProperties", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container"));
+
+ assertRequestLineEquals(request,
+ "HEAD https://identity.blob.core.windows.net/container?restype=container HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseContainerPropertiesFromHeaders.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnContainerNotFound.class);
+ }
+
+ public void testGetPublicAccessForContainer() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "getPublicAccessForContainer", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container"));
+
+ assertRequestLineEquals(request,
+ "HEAD https://identity.blob.core.windows.net/container?restype=container&comp=acl HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParsePublicAccessHeader.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnContainerNotFound.class);
+ }
+
+ public void testSetResourceMetadata() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "setResourceMetadata", String.class, Map.class);
+ GeneratedHttpRequest request = processor.createRequest(method,
+ ImmutableList.<Object> of("container", ImmutableMap.of("key", "value")));
+
+ assertRequestLineEquals(request,
+ "PUT https://identity.blob.core.windows.net/container?restype=container&comp=metadata HTTP/1.1");
+ assertNonPayloadHeadersEqual(request,
+ "x-ms-meta-key: value\n" +
+ "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+ }
+
+ public void testGetBlob() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "getBlob", String.class, String.class, GetOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container", "blob"));
+
+ assertRequestLineEquals(request, "GET https://identity.blob.core.windows.net/container/blob HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseBlobFromHeadersAndHttpContent.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnKeyNotFound.class);
+ }
+
+ public void testSetBlobMetadata() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(AzureBlobClient.class, "setBlobMetadata", String.class, String.class, Map.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container", "blob", ImmutableMap.of("key", "value")));
+
+ assertRequestLineEquals(request,
+ "PUT https://identity.blob.core.windows.net/container/blob?comp=metadata HTTP/1.1");
+ assertNonPayloadHeadersEqual(request,
+ "x-ms-meta-key: value\n" +
+ "x-ms-version: 2012-02-12\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+ }
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ assertEquals(request.getFilters().get(0).getClass(), SharedKeyLiteAuthentication.class);
+ }
+
+ @Override
+ public AzureBlobProviderMetadata createProviderMetadata() {
+ return new AzureBlobProviderMetadata();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java
index a933805..faec9bb 100644
--- a/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java
+++ b/providers/azureblob/src/test/java/org/jclouds/azureblob/binders/BindAzureBlobMetadataToRequestTest.java
@@ -20,7 +20,7 @@ import static org.testng.Assert.assertEquals;
import java.io.File;
-import org.jclouds.azureblob.AzureBlobAsyncClient;
+import org.jclouds.azureblob.AzureBlobClient;
import org.jclouds.azureblob.AzureBlobProviderMetadata;
import org.jclouds.azureblob.domain.AzureBlob;
import org.jclouds.http.HttpRequest;
@@ -31,12 +31,8 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
-/**
- * Tests behavior of {@code BindAzureBlobMetadataToRequest}
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "BindAzureBlobMetadataToRequestTest")
-public class BindAzureBlobMetadataToRequestTest extends BaseAsyncClientTest<AzureBlobAsyncClient> {
+public class BindAzureBlobMetadataToRequestTest extends BaseAsyncClientTest<AzureBlobClient> {
@Test
public void testPassWithMinimumDetailsAndPayload64MB() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java
index b2ba5f2..024611c 100644
--- a/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java
+++ b/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSignerTest.java
@@ -21,15 +21,15 @@ import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.util.Date;
-import org.jclouds.azureblob.AzureBlobAsyncClient;
+import org.jclouds.azureblob.AzureBlobClient;
import org.jclouds.azureblob.AzureBlobProviderMetadata;
-import org.jclouds.azureblob.config.AzureBlobRestClientModule;
+import org.jclouds.azureblob.config.AzureBlobHttpApiModule;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.Blob.Factory;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -43,7 +43,7 @@ import com.google.inject.Module;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "AzureBlobRequestSignerTest")
-public class AzureBlobRequestSignerTest extends BaseAsyncClientTest<AzureBlobAsyncClient> {
+public class AzureBlobRequestSignerTest extends BaseAsyncClientTest<AzureBlobClient> {
public AzureBlobRequestSignerTest() {
// this is base64 decoded in the signer;
@@ -122,11 +122,11 @@ public class AzureBlobRequestSignerTest extends BaseAsyncClientTest<AzureBlobAsy
@Override
protected Module createModule() {
- return new TestAzureBlobRestClientModule();
+ return new TestAzureBlobHttpApiModule();
}
- @ConfiguresRestClient
- private static final class TestAzureBlobRestClientModule extends AzureBlobRestClientModule {
+ @ConfiguresHttpApi
+ private static final class TestAzureBlobHttpApiModule extends AzureBlobHttpApiModule {
@Override
protected void configure() {
super.configure();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/test/resources/test_error.xml
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/test/resources/test_error.xml b/providers/azureblob/src/test/resources/test_error.xml
new file mode 100644
index 0000000..6c12fac
--- /dev/null
+++ b/providers/azureblob/src/test/resources/test_error.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Error>
+ <Code>AuthenticationFailed</Code>
+ <Message>Server failed to authenticate the request. Make sure the value
+ of Authorization header is formed correctly including the signature.
+ RequestId:7859e884-e8b9-4ed0-aa62-ac6963b91bf6
+ Time:2009-09-02T23:32:36.7507749Z</Message>
+ <AuthenticationErrorDetail>The MAC signature found in the HTTP request
+ 'XEv0NqP+zePZxlrHmxy2F6MiyoRD8LIJt1f/Swgzn1U=' is not the same as any
+ computed signature. Server used following string to sign: 'GET
+
+
+ Wed, 02 Sep 2009 23:32:34 GMT
+ /jclouds/?comp=list'.</AuthenticationErrorDetail>
+</Error>
[40/52] [abbrv] git commit: JCLOUDS-40 one last Async reference in
Atmos.
Posted by an...@apache.org.
JCLOUDS-40 one last Async reference in Atmos.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/7bab2dd1
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/7bab2dd1
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/7bab2dd1
Branch: refs/heads/use-agentproxy-008
Commit: 7bab2dd17b00ade0c44f0993b9f273f8621cc69b
Parents: 9d77a06
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 18:13:57 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 22:32:45 2014 -0700
----------------------------------------------------------------------
apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7bab2dd1/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java
index 109ef1f..ab7757a 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java
@@ -27,7 +27,6 @@ import org.jclouds.atmos.blobstore.config.AtmosBlobStoreContextModule;
import org.jclouds.atmos.config.AtmosHttpApiModule;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.rest.internal.BaseHttpApiMetadata;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
@@ -52,7 +51,7 @@ public class AtmosApiMetadata extends BaseHttpApiMetadata {
}
public static Properties defaultProperties() {
- Properties properties = BaseRestApiMetadata.defaultProperties();
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
properties.setProperty(PROPERTY_REGIONS, "DEFAULT");
properties.setProperty(PROPERTY_USER_METADATA_PREFIX, "X-Object-Meta-");
return properties;
[06/52] [abbrv] git commit: JCLOUDS-742 Remove cloudonestorage
provider
Posted by an...@apache.org.
JCLOUDS-742 Remove cloudonestorage provider
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/9df0cd24
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/9df0cd24
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/9df0cd24
Branch: refs/heads/use-agentproxy-008
Commit: 9df0cd24c635b0fd41a3432414a1ae3f92de6e02
Parents: 1788ad7
Author: Andrew Gaul <ga...@apache.org>
Authored: Fri Oct 3 17:37:17 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Fri Oct 3 21:33:05 2014 -0700
----------------------------------------------------------------------
allblobstore/pom.xml | 5 -
providers/cloudonestorage/README.txt | 8 --
providers/cloudonestorage/pom.xml | 122 -------------------
.../CloudOneStorageProviderMetadata.java | 79 ------------
.../org.jclouds.providers.ProviderMetadata | 1 -
.../CloudOneStorageAsyncClientTest.java | 29 -----
.../CloudOneStorageClientLiveTest.java | 28 -----
.../CloudOneStorageProviderTest.java | 33 -----
.../CloudOneStorageBlobIntegrationLiveTest.java | 28 -----
.../CloudOneStorageBlobLiveTest.java | 28 -----
.../CloudOneStorageBlobSignerLiveTest.java | 28 -----
...dOneStorageContainerIntegrationLiveTest.java | 28 -----
.../CloudOneStorageContainerLiveTest.java | 28 -----
...oudOneStorageServiceIntegrationLiveTest.java | 36 ------
providers/pom.xml | 1 -
15 files changed, 482 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/allblobstore/pom.xml
----------------------------------------------------------------------
diff --git a/allblobstore/pom.xml b/allblobstore/pom.xml
index 6bc82cc..a1c5c3a 100644
--- a/allblobstore/pom.xml
+++ b/allblobstore/pom.xml
@@ -40,11 +40,6 @@
</dependency>
<dependency>
<groupId>org.apache.jclouds.provider</groupId>
- <artifactId>cloudonestorage</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.provider</groupId>
<artifactId>azureblob</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/README.txt
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/README.txt b/providers/cloudonestorage/README.txt
deleted file mode 100644
index b79f349..0000000
--- a/providers/cloudonestorage/README.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# The jclouds provider for Peer1's CloudOne Storage (http://www.peer1.com/hosting/cloudone-storage.php) service.
-#
-# Expects the jclouds atmos API to be present on your application's classpath.
-#
-# TODO: Implementation status.
-# TODO: Supported features.
-# TODO: Usage example.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/pom.xml
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/pom.xml b/providers/cloudonestorage/pom.xml
deleted file mode 100644
index 982da87..0000000
--- a/providers/cloudonestorage/pom.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-project</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../../project/pom.xml</relativePath>
- </parent>
- <groupId>org.apache.jclouds.provider</groupId>
- <artifactId>cloudonestorage</artifactId>
- <name>jclouds CloudOne Storage as a Service provider</name>
- <description>Atmos implementation targeted to Peer1 CloudOne Storage as a Service</description>
- <packaging>bundle</packaging>
-
- <properties>
- <test.cloudonestorage.endpoint>https://cloudonestorage.peer1.com</test.cloudonestorage.endpoint>
- <test.cloudonestorage.api-version>1.3.0</test.cloudonestorage.api-version>
- <test.cloudonestorage.build-version />
- <test.cloudonestorage.identity>FIXME_IDENTITY</test.cloudonestorage.identity>
- <test.cloudonestorage.credential>FIXME_CREDENTIAL</test.cloudonestorage.credential>
-
- <jclouds.osgi.export>org.jclouds.cloudonestorage*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>atmos</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>atmos</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-blobstore</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-log4j</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>live</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <threadCount>1</threadCount>
- <systemPropertyVariables>
- <test.cloudonestorage.endpoint>${test.cloudonestorage.endpoint}</test.cloudonestorage.endpoint>
- <test.cloudonestorage.api-version>${test.cloudonestorage.api-version}</test.cloudonestorage.api-version>
- <test.cloudonestorage.build-version>${test.cloudonestorage.build-version}</test.cloudonestorage.build-version>
- <test.cloudonestorage.identity>${test.cloudonestorage.identity}</test.cloudonestorage.identity>
- <test.cloudonestorage.credential>${test.cloudonestorage.credential}</test.cloudonestorage.credential>
- <jclouds.blobstore.httpstream.url>${jclouds.blobstore.httpstream.url}</jclouds.blobstore.httpstream.url>
- <jclouds.blobstore.httpstream.md5>${jclouds.blobstore.httpstream.md5}</jclouds.blobstore.httpstream.md5>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
-
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/src/main/java/org/jclouds/cloudonestorage/CloudOneStorageProviderMetadata.java
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/src/main/java/org/jclouds/cloudonestorage/CloudOneStorageProviderMetadata.java b/providers/cloudonestorage/src/main/java/org/jclouds/cloudonestorage/CloudOneStorageProviderMetadata.java
deleted file mode 100644
index 5755afa..0000000
--- a/providers/cloudonestorage/src/main/java/org/jclouds/cloudonestorage/CloudOneStorageProviderMetadata.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudonestorage;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.atmos.AtmosApiMetadata;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.providers.internal.BaseProviderMetadata;
-
-/**
- * Implementation of {@ link org.jclouds.types.ProviderMetadata} for PEER1's
- * CloudOne Storage provider.
- */
-public class CloudOneStorageProviderMetadata extends BaseProviderMetadata {
-
- public static Builder builder() {
- return new Builder();
- }
-
- @Override
- public Builder toBuilder() {
- return builder().fromProviderMetadata(this);
- }
-
- public CloudOneStorageProviderMetadata() {
- super(builder());
- }
-
- public CloudOneStorageProviderMetadata(Builder builder) {
- super(builder);
- }
-
- public static Properties defaultProperties() {
- Properties properties = new Properties();
- return properties;
- }
-
- public static class Builder extends BaseProviderMetadata.Builder {
-
- protected Builder() {
- id("cloudonestorage")
- .name("PEER1 CloudOne Storage")
- .apiMetadata(new AtmosApiMetadata())
- .homepage(URI.create("http://www.peer1.com/hosting/cloudone-storage.php"))
- .console(URI.create("https://mypeer1.com/"))
- .iso3166Codes("US-GA", "US-TX")
- .endpoint("https://cloudonestorage.peer1.com")
- .defaultProperties(CloudOneStorageProviderMetadata.defaultProperties());
- }
-
- @Override
- public CloudOneStorageProviderMetadata build() {
- return new CloudOneStorageProviderMetadata(this);
- }
-
- @Override
- public Builder fromProviderMetadata(
- ProviderMetadata in) {
- super.fromProviderMetadata(in);
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/providers/cloudonestorage/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
deleted file mode 100644
index 1e01a98..0000000
--- a/providers/cloudonestorage/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
+++ /dev/null
@@ -1 +0,0 @@
-org.jclouds.cloudonestorage.CloudOneStorageProviderMetadata
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageAsyncClientTest.java b/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageAsyncClientTest.java
deleted file mode 100644
index a9398b9..0000000
--- a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageAsyncClientTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudonestorage;
-
-import org.testng.annotations.Test;
-
-// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
-@Test(groups = "unit", testName = "CloudOneStorageAsyncClientTest")
-public class CloudOneStorageAsyncClientTest extends org.jclouds.atmos.AtmosAsyncClientTest {
-
- public CloudOneStorageAsyncClientTest() {
- this.provider = "cloudonestorage";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageClientLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageClientLiveTest.java b/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageClientLiveTest.java
deleted file mode 100644
index 23d69e2..0000000
--- a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageClientLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudonestorage;
-
-import org.jclouds.atmos.AtmosClientLiveTest;
-import org.testng.annotations.Test;
-
-/**
- * Tests behavior of {@code AtmosClient}
- */
-@Test(groups = "live", sequential = true, testName = "CloudOneStorageClientLiveTest")
-public class CloudOneStorageClientLiveTest extends AtmosClientLiveTest {
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageProviderTest.java
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageProviderTest.java b/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageProviderTest.java
deleted file mode 100644
index dc95103..0000000
--- a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/CloudOneStorageProviderTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudonestorage;
-
-import org.jclouds.atmos.AtmosApiMetadata;
-import org.jclouds.providers.internal.BaseProviderMetadataTest;
-import org.testng.annotations.Test;
-
-/**
- * The CloudOneStorageProviderTest tests the {@link CloudOneStorageProviderMetadata} class.
- */
-@Test(groups = "unit", testName = "CloudOneStorageProviderTest")
-public class CloudOneStorageProviderTest extends BaseProviderMetadataTest {
-
- public CloudOneStorageProviderTest() {
- super(new CloudOneStorageProviderMetadata(), new AtmosApiMetadata());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobIntegrationLiveTest.java b/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobIntegrationLiveTest.java
deleted file mode 100644
index 4dbdf47..0000000
--- a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobIntegrationLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudonestorage.blobstore.integration;
-
-import org.jclouds.atmos.blobstore.integration.AtmosIntegrationLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", testName = "CloudOneStorageBlobIntegrationLiveTest")
-public class CloudOneStorageBlobIntegrationLiveTest extends AtmosIntegrationLiveTest {
- public CloudOneStorageBlobIntegrationLiveTest() {
- provider = "cloudonestorage";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobLiveTest.java b/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobLiveTest.java
deleted file mode 100644
index ecb9592..0000000
--- a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudonestorage.blobstore.integration;
-
-import org.jclouds.atmos.blobstore.integration.AtmosLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", testName = "CloudOneStorageBlobLiveTest")
-public class CloudOneStorageBlobLiveTest extends AtmosLiveTest {
- public CloudOneStorageBlobLiveTest() {
- provider = "cloudonestorage";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobSignerLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobSignerLiveTest.java b/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobSignerLiveTest.java
deleted file mode 100644
index 0249e73..0000000
--- a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageBlobSignerLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudonestorage.blobstore.integration;
-
-import org.jclouds.atmos.blobstore.integration.AtmosBlobSignerLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", testName = "CloudOneStorageBlobSignerLiveTest")
-public class CloudOneStorageBlobSignerLiveTest extends AtmosBlobSignerLiveTest {
- public CloudOneStorageBlobSignerLiveTest() {
- provider = "cloudonestorage";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageContainerIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageContainerIntegrationLiveTest.java b/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageContainerIntegrationLiveTest.java
deleted file mode 100644
index 5adea57..0000000
--- a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageContainerIntegrationLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudonestorage.blobstore.integration;
-
-import org.jclouds.atmos.blobstore.integration.AtmosContainerIntegrationLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", testName = "CloudOneStorageContainerIntegrationLiveTest")
-public class CloudOneStorageContainerIntegrationLiveTest extends AtmosContainerIntegrationLiveTest {
- public CloudOneStorageContainerIntegrationLiveTest() {
- provider = "cloudonestorage";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageContainerLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageContainerLiveTest.java b/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageContainerLiveTest.java
deleted file mode 100644
index 200b117..0000000
--- a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageContainerLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudonestorage.blobstore.integration;
-
-import org.jclouds.atmos.blobstore.integration.AtmosContainerLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", testName = "CloudOneStorageContainerLiveTest")
-public class CloudOneStorageContainerLiveTest extends AtmosContainerLiveTest {
- public CloudOneStorageContainerLiveTest() {
- provider = "cloudonestorage";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageServiceIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageServiceIntegrationLiveTest.java b/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageServiceIntegrationLiveTest.java
deleted file mode 100644
index 8392a2d..0000000
--- a/providers/cloudonestorage/src/test/java/org/jclouds/cloudonestorage/blobstore/integration/CloudOneStorageServiceIntegrationLiveTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.cloudonestorage.blobstore.integration;
-
-import java.util.Set;
-
-import org.jclouds.atmos.blobstore.integration.AtmosServiceIntegrationLiveTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-@Test(groups = "live", testName = "CloudOneStorageServiceIntegrationLiveTest")
-public class CloudOneStorageServiceIntegrationLiveTest extends AtmosServiceIntegrationLiveTest {
- public CloudOneStorageServiceIntegrationLiveTest() {
- provider = "cloudonestorage";
- }
-
- @Override
- protected Set<String> getIso3166Codes() {
- return ImmutableSet.<String> of("US-GA", "US-TX");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9df0cd24/providers/pom.xml
----------------------------------------------------------------------
diff --git a/providers/pom.xml b/providers/pom.xml
index e7e6c0e..6cccf18 100644
--- a/providers/pom.xml
+++ b/providers/pom.xml
@@ -36,7 +36,6 @@
<module>aws-ec2</module>
<module>aws-sqs</module>
<module>aws-cloudwatch</module>
- <module>cloudonestorage</module>
<module>bluelock-vcloud-zone01</module>
<module>elastichosts-lon-p</module>
<module>elastichosts-sat-p</module>
[47/52] [abbrv] git commit: Overriding modernizer-plugin config in
jclouds-resources
Posted by an...@apache.org.
Overriding modernizer-plugin config in jclouds-resources
This fixes a self-dependency
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/013e6da8
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/013e6da8
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/013e6da8
Branch: refs/heads/use-agentproxy-008
Commit: 013e6da8453a9af3ec9648eccbd55ec356074883
Parents: b9525a0
Author: Andrew Phillips <an...@apache.org>
Authored: Sun Oct 5 16:28:57 2014 -0500
Committer: Andrew Phillips <an...@apache.org>
Committed: Mon Oct 6 18:14:13 2014 -0400
----------------------------------------------------------------------
resources/pom.xml | 12 ++++++++++++
1 file changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/013e6da8/resources/pom.xml
----------------------------------------------------------------------
diff --git a/resources/pom.xml b/resources/pom.xml
index 6404210..6282650 100644
--- a/resources/pom.xml
+++ b/resources/pom.xml
@@ -41,5 +41,17 @@
</includes>
</resource>
</resources>
+ <plugins>
+ <plugin>
+ <groupId>org.gaul</groupId>
+ <artifactId>modernizer-maven-plugin</artifactId>
+ <configuration>
+ <javaVersion>1.7</javaVersion>
+ <!-- ${project.basedir} required here as 1.1.0 of the modernizer plugin
+ can't find the exclusions file otherwise -->
+ <exclusionsFile>${project.basedir}/modernizer_exclusions.txt</exclusionsFile>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
</project>
[02/52] [abbrv] JCLOUDS-150 add SubmissionAsyncBlobStore;
unasync s3 and aws-s3
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/blobstore/S3BlobSignerExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/blobstore/S3BlobSignerExpectTest.java b/apis/s3/src/test/java/org/jclouds/s3/blobstore/S3BlobSignerExpectTest.java
index 1c138ae..ecc6e3f 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/blobstore/S3BlobSignerExpectTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/blobstore/S3BlobSignerExpectTest.java
@@ -19,10 +19,9 @@ package org.jclouds.s3.blobstore;
import org.jclouds.blobstore.internal.BaseBlobSignerExpectTest;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.s3.S3AsyncClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.s3.S3Client;
-import org.jclouds.s3.config.S3RestClientModule;
+import org.jclouds.s3.config.S3HttpApiModule;
import org.testng.SkipException;
import org.testng.annotations.Test;
@@ -106,11 +105,11 @@ public class S3BlobSignerExpectTest extends BaseBlobSignerExpectTest {
@Override
protected Module createModule() {
- return new TestS3RestClientModule();
+ return new TestS3HttpApiModule();
}
- @ConfiguresRestClient
- private static final class TestS3RestClientModule extends S3RestClientModule<S3Client, S3AsyncClient> {
+ @ConfiguresHttpApi
+ private static final class TestS3HttpApiModule extends S3HttpApiModule<S3Client> {
@Override
protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureTest.java b/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureTest.java
index 77cd173..48da148 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureTest.java
@@ -26,11 +26,11 @@ import java.util.Properties;
import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.s3.S3AsyncClient;
+import org.jclouds.s3.S3Client;
import org.jclouds.s3.domain.AccessControlList;
import org.jclouds.s3.domain.CannedAccessPolicy;
import org.jclouds.s3.domain.S3Object;
-import org.jclouds.s3.internal.BaseS3AsyncClientTest;
+import org.jclouds.s3.internal.BaseS3ClientTest;
import org.jclouds.s3.options.PutObjectOptions;
import org.jclouds.s3.reference.S3Headers;
import org.testng.annotations.DataProvider;
@@ -45,7 +45,7 @@ import com.google.common.net.HttpHeaders;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "RequestAuthorizeSignatureTest")
-public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest<S3AsyncClient> {
+public class RequestAuthorizeSignatureTest extends BaseS3ClientTest<S3Client> {
String bucketName = "bucket";
@DataProvider(parallel = true)
@@ -84,7 +84,7 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest<S3Async
@Test
void testAppendBucketNameHostHeader() throws SecurityException, NoSuchMethodException {
GeneratedHttpRequest request = processor.createRequest(
- method(S3AsyncClient.class, "getBucketLocation", String.class),
+ method(S3Client.class, "getBucketLocation", String.class),
ImmutableList.<Object> of("bucket"));
StringBuilder builder = new StringBuilder();
filter.appendBucketName(request, builder);
@@ -101,7 +101,7 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest<S3Async
private GeneratedHttpRequest putBucketAcl() throws NoSuchMethodException {
return processor.createRequest(
- method(S3AsyncClient.class, "putBucketACL", String.class, AccessControlList.class),
+ method(S3Client.class, "putBucketACL", String.class, AccessControlList.class),
ImmutableList.<Object> of("bucket",
AccessControlList.fromCannedAccessPolicy(CannedAccessPolicy.PRIVATE, "1234")));
}
@@ -117,7 +117,7 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest<S3Async
}
private GeneratedHttpRequest listOwnedBuckets() throws NoSuchMethodException {
- return processor.createRequest(method(S3AsyncClient.class, "listOwnedBuckets"),
+ return processor.createRequest(method(S3Client.class, "listOwnedBuckets"),
ImmutableList.of());
}
@@ -134,14 +134,14 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest<S3Async
private HttpRequest putObject() throws NoSuchMethodException {
S3Object object = blobToS3Object.apply(BindBlobToMultipartFormTest.TEST_BLOB);
object.getMetadata().getUserMetadata().put("Adrian", "foo");
- return processor.createRequest(method(S3AsyncClient.class, "putObject", String.class,
+ return processor.createRequest(method(S3Client.class, "putObject", String.class,
S3Object.class, PutObjectOptions[].class), ImmutableList.<Object> of("bucket", object));
}
@Test
void testAppendBucketNameInURIPath() throws SecurityException, NoSuchMethodException {
GeneratedHttpRequest request = processor.createRequest(
- method(S3AsyncClient.class, "getBucketLocation", String.class),
+ method(S3Client.class, "getBucketLocation", String.class),
ImmutableList.<Object> of(bucketName));
URI uri = request.getEndpoint();
assertEquals(uri.getHost(), "s3.amazonaws.com");
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureWithSessionCredentialsTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureWithSessionCredentialsTest.java b/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureWithSessionCredentialsTest.java
index 396664a..8ae2fc1 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureWithSessionCredentialsTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureWithSessionCredentialsTest.java
@@ -27,12 +27,11 @@ import org.jclouds.domain.Credentials;
import org.jclouds.http.HttpRequest;
import org.jclouds.logging.config.NullLoggingModule;
import org.jclouds.reflect.Invocation;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.internal.BaseRestApiTest.MockModule;
import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.s3.S3AsyncClient;
import org.jclouds.s3.S3Client;
-import org.jclouds.s3.config.S3RestClientModule;
+import org.jclouds.s3.config.S3HttpApiModule;
import org.testng.annotations.Test;
import com.google.common.base.Supplier;
@@ -50,11 +49,11 @@ public class RequestAuthorizeSignatureWithSessionCredentialsTest {
public static Injector injector(Credentials creds) {
return ContextBuilder.newBuilder("s3")
.credentialsSupplier(Suppliers.<Credentials> ofInstance(creds))
- .modules(ImmutableList.<Module> of(new MockModule(), new NullLoggingModule(), new TestS3RestClientModule())).buildInjector();
+ .modules(ImmutableList.<Module> of(new MockModule(), new NullLoggingModule(), new TestS3HttpApiModule())).buildInjector();
}
- @ConfiguresRestClient
- private static final class TestS3RestClientModule extends S3RestClientModule<S3Client, S3AsyncClient> {
+ @ConfiguresHttpApi
+ private static final class TestS3HttpApiModule extends S3HttpApiModule<S3Client> {
@Override
protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
@@ -72,7 +71,7 @@ public class RequestAuthorizeSignatureWithSessionCredentialsTest {
.sessionToken("AQoEXAMPLEH4aoAH0gNCAPyJxz4BlCFFxWNE1OPTgk5TthT")
.expiration(new SimpleDateFormatDateService().iso8601DateParse("2011-07-11T19:55:29.611Z")).build();
- Invocation invocation = Invocation.create(method(S3AsyncClient.class, "bucketExists", String.class),
+ Invocation invocation = Invocation.create(method(S3Client.class, "bucketExists", String.class),
ImmutableList.<Object> of("foo"));
HttpRequest bucketFooExists = GeneratedHttpRequest.builder().method("GET")
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3AsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3AsyncClientTest.java b/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3AsyncClientTest.java
deleted file mode 100644
index b1fca99..0000000
--- a/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3AsyncClientTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.s3.internal;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
-import org.jclouds.s3.S3ApiMetadata;
-import org.jclouds.s3.S3AsyncClient;
-import org.jclouds.s3.blobstore.functions.BlobToObject;
-import org.jclouds.s3.filters.RequestAuthorizeSignature;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit")
-public abstract class BaseS3AsyncClientTest<T extends S3AsyncClient> extends BaseAsyncClientTest<T> {
-
- protected BlobToObject blobToS3Object;
- protected RequestAuthorizeSignature filter;
-
- @Override
- protected void checkFilters(HttpRequest request) {
- assertEquals(request.getFilters().size(), 1);
- assertEquals(request.getFilters().get(0).getClass(), RequestAuthorizeSignature.class);
- }
-
-
- @BeforeClass
- @Override
- protected void setupFactory() throws IOException {
- super.setupFactory();
- blobToS3Object = injector.getInstance(BlobToObject.class);
- filter = injector.getInstance(RequestAuthorizeSignature.class);
- }
-
- public BaseS3AsyncClientTest() {
- super();
- }
-
- @Override
- public S3ApiMetadata createApiMetadata() {
- return new S3ApiMetadata();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientExpectTest.java b/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientExpectTest.java
index 0ee36fe..260a242 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientExpectTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientExpectTest.java
@@ -17,12 +17,11 @@
package org.jclouds.s3.internal;
import org.jclouds.date.TimeStamp;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.internal.BaseRestClientExpectTest;
import org.jclouds.s3.S3ApiMetadata;
-import org.jclouds.s3.S3AsyncClient;
import org.jclouds.s3.S3Client;
-import org.jclouds.s3.config.S3RestClientModule;
+import org.jclouds.s3.config.S3HttpApiModule;
import com.google.common.base.Supplier;
import com.google.inject.Module;
@@ -31,8 +30,8 @@ public abstract class BaseS3ClientExpectTest extends BaseRestClientExpectTest<S3
protected static final String CONSTANT_DATE = "2009-11-08T15:54:08.897Z";
- @ConfiguresRestClient
- private static final class TestS3RestClientModule extends S3RestClientModule<S3Client, S3AsyncClient> {
+ @ConfiguresHttpApi
+ private static final class TestS3HttpApiModule extends S3HttpApiModule<S3Client> {
@Override
protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
@@ -42,7 +41,7 @@ public abstract class BaseS3ClientExpectTest extends BaseRestClientExpectTest<S3
@Override
protected Module createModule() {
- return new TestS3RestClientModule();
+ return new TestS3HttpApiModule();
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientTest.java b/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientTest.java
new file mode 100644
index 0000000..2b418ae
--- /dev/null
+++ b/apis/s3/src/test/java/org/jclouds/s3/internal/BaseS3ClientTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.s3.internal;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.s3.S3ApiMetadata;
+import org.jclouds.s3.S3Client;
+import org.jclouds.s3.blobstore.functions.BlobToObject;
+import org.jclouds.s3.filters.RequestAuthorizeSignature;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit")
+public abstract class BaseS3ClientTest<T extends S3Client> extends BaseAsyncClientTest<T> {
+
+ protected BlobToObject blobToS3Object;
+ protected RequestAuthorizeSignature filter;
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ assertEquals(request.getFilters().get(0).getClass(), RequestAuthorizeSignature.class);
+ }
+
+
+ @BeforeClass
+ @Override
+ protected void setupFactory() throws IOException {
+ super.setupFactory();
+ blobToS3Object = injector.getInstance(BlobToObject.class);
+ filter = injector.getInstance(RequestAuthorizeSignature.class);
+ }
+
+ public BaseS3ClientTest() {
+ super();
+ }
+
+ @Override
+ public S3ApiMetadata createApiMetadata() {
+ return new S3ApiMetadata();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/internal/StubS3AsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/internal/StubS3AsyncClient.java b/apis/s3/src/test/java/org/jclouds/s3/internal/StubS3AsyncClient.java
deleted file mode 100644
index bbd79ff..0000000
--- a/apis/s3/src/test/java/org/jclouds/s3/internal/StubS3AsyncClient.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.s3.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
-import static com.google.common.util.concurrent.Futures.transform;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.aws.domain.Region;
-import org.jclouds.blobstore.AsyncBlobStore;
-import org.jclouds.blobstore.KeyNotFoundException;
-import org.jclouds.blobstore.LocalAsyncBlobStore;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.MutableBlobMetadata;
-import org.jclouds.blobstore.functions.HttpGetOptionsListToGetOptions;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.util.BlobStoreUtils;
-import org.jclouds.date.DateService;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.lifecycle.Closer;
-import org.jclouds.s3.S3AsyncClient;
-import org.jclouds.s3.blobstore.S3AsyncBlobStore;
-import org.jclouds.s3.blobstore.functions.BlobToObject;
-import org.jclouds.s3.blobstore.functions.BlobToObjectMetadata;
-import org.jclouds.s3.blobstore.functions.BucketToContainerListOptions;
-import org.jclouds.s3.blobstore.functions.ObjectToBlob;
-import org.jclouds.s3.blobstore.functions.ResourceToBucketList;
-import org.jclouds.s3.domain.AccessControlList;
-import org.jclouds.s3.domain.AccessControlList.CanonicalUserGrantee;
-import org.jclouds.s3.domain.AccessControlList.EmailAddressGrantee;
-import org.jclouds.s3.domain.AccessControlList.Grant;
-import org.jclouds.s3.domain.BucketLogging;
-import org.jclouds.s3.domain.BucketMetadata;
-import org.jclouds.s3.domain.CannedAccessPolicy;
-import org.jclouds.s3.domain.ListBucketResponse;
-import org.jclouds.s3.domain.ObjectMetadata;
-import org.jclouds.s3.domain.Payer;
-import org.jclouds.s3.domain.S3Object;
-import org.jclouds.s3.options.CopyObjectOptions;
-import org.jclouds.s3.options.ListBucketOptions;
-import org.jclouds.s3.options.PutBucketOptions;
-import org.jclouds.s3.options.PutObjectOptions;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * Implementation of {@link S3AsyncBlobStore} which keeps all data in a local Map object.
- */
-@Singleton
-public class StubS3AsyncClient implements S3AsyncClient {
- private final DateService dateService;
- private final HttpGetOptionsListToGetOptions httpGetOptionsConverter;
- private final AsyncBlobStore blobStore;
- private final S3Object.Factory objectProvider;
- private final Blob.Factory blobProvider;
- private final ObjectToBlob object2Blob;
- private final BlobToObject blob2Object;
- private final BlobToObjectMetadata blob2ObjectMetadata;
- private final BucketToContainerListOptions bucket2ContainerListOptions;
- private final ResourceToBucketList resource2BucketList;
- private final ConcurrentMap<String, ConcurrentMap<String, Blob>> containerToBlobs;
- private final ConcurrentMap<String, Location> containerToLocation;
- private final ListeningExecutorService userExecutor;
- private final Closer closer;
-
- @Inject
- private StubS3AsyncClient(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- LocalAsyncBlobStore blobStore, ConcurrentMap<String, ConcurrentMap<String, Blob>> containerToBlobs,
- ConcurrentMap<String, Location> containerToLocation, DateService dateService,
- S3Object.Factory objectProvider, Blob.Factory blobProvider,
- HttpGetOptionsListToGetOptions httpGetOptionsConverter, ObjectToBlob object2Blob, BlobToObject blob2Object,
- BlobToObjectMetadata blob2ObjectMetadata, BucketToContainerListOptions bucket2ContainerListOptions,
- ResourceToBucketList resource2BucketList, Closer closer) {
- this.userExecutor = userExecutor;
- this.containerToBlobs = containerToBlobs;
- this.containerToLocation = containerToLocation;
- this.blobStore = blobStore;
- this.objectProvider = objectProvider;
- this.blobProvider = blobProvider;
- this.dateService = dateService;
- this.httpGetOptionsConverter = httpGetOptionsConverter;
- this.object2Blob = checkNotNull(object2Blob, "object2Blob");
- this.blob2Object = checkNotNull(blob2Object, "blob2Object");
- this.blob2ObjectMetadata = checkNotNull(blob2ObjectMetadata, "blob2ObjectMetadata");
- this.bucket2ContainerListOptions = checkNotNull(bucket2ContainerListOptions, "bucket2ContainerListOptions");
- this.resource2BucketList = checkNotNull(resource2BucketList, "resource2BucketList");
- this.closer = checkNotNull(closer, "closer");
- }
-
- public static final String TEST_ACL_ID = "1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c";
- public static final String TEST_ACL_EMAIL = "james@misterm.org";
-
- /**
- * An S3 item's "ACL" may be a {@link CannedAccessPolicy} or an {@link AccessControlList}.
- */
- private static Map<String, Object> keyToAcl = new ConcurrentHashMap<String, Object>();
-
- public static final String DEFAULT_OWNER_ID = "abc123";
-
- @Override
- public ListenableFuture<Boolean> putBucketInRegion(@Nullable String region, String name,
- PutBucketOptions... optionsList) {
- region = region == null ? Region.US_STANDARD : region;
- final PutBucketOptions options = (optionsList.length == 0) ? new PutBucketOptions() : optionsList[0];
- keyToAcl.put(name, options.getAcl());
- return blobStore.createContainerInLocation(new LocationBuilder().scope(LocationScope.REGION).id(region)
- .description(region).build(), name);
- }
-
- public ListenableFuture<ListBucketResponse> listBucket(final String name, ListBucketOptions... optionsList) {
- ListContainerOptions options = bucket2ContainerListOptions.apply(optionsList);
- return transform(blobStore.list(name, options), resource2BucketList, userExecutor);
- }
-
- public ListenableFuture<ObjectMetadata> copyObject(final String sourceBucket, final String sourceObject,
- final String destinationBucket, final String destinationObject, CopyObjectOptions... nullableOptions) {
- final CopyObjectOptions options = (nullableOptions.length == 0) ? new CopyObjectOptions() : nullableOptions[0];
- ConcurrentMap<String, Blob> source = containerToBlobs.get(sourceBucket);
- ConcurrentMap<String, Blob> dest = containerToBlobs.get(destinationBucket);
- if (source.containsKey(sourceObject)) {
- Blob object = source.get(sourceObject);
- if (options.getIfMatch() != null) {
- if (!object.getMetadata().getETag().equals(options.getIfMatch()))
- return immediateFailedFuture(LocalAsyncBlobStore.returnResponseException(412));
- }
- if (options.getIfNoneMatch() != null) {
- if (object.getMetadata().getETag().equals(options.getIfNoneMatch()))
- return immediateFailedFuture(LocalAsyncBlobStore.returnResponseException(412));
- }
- if (options.getIfModifiedSince() != null) {
- Date modifiedSince = dateService.rfc822DateParse(options.getIfModifiedSince());
- if (modifiedSince.after(object.getMetadata().getLastModified()))
- return immediateFailedFuture(LocalAsyncBlobStore.returnResponseException(412));
-
- }
- if (options.getIfUnmodifiedSince() != null) {
- Date unmodifiedSince = dateService.rfc822DateParse(options.getIfUnmodifiedSince());
- if (unmodifiedSince.before(object.getMetadata().getLastModified()))
- return immediateFailedFuture(LocalAsyncBlobStore.returnResponseException(412));
- }
- Blob sourceS3 = source.get(sourceObject);
- MutableBlobMetadata newMd = BlobStoreUtils.copy(sourceS3.getMetadata(), destinationObject);
- if (options.getAcl() != null)
- keyToAcl.put(destinationBucket + "/" + destinationObject, options.getAcl());
-
- newMd.setLastModified(new Date());
- Blob newBlob = blobProvider.create(newMd);
- newBlob.setPayload(sourceS3.getPayload());
- dest.put(destinationObject, newBlob);
- return immediateFuture((ObjectMetadata) blob2ObjectMetadata.apply(BlobStoreUtils.copy(newMd)));
- }
- return immediateFailedFuture(new KeyNotFoundException(sourceBucket, sourceObject, sourceBucket + "/"
- + sourceObject));
- }
-
- public ListenableFuture<String> putObject(final String bucketName, final S3Object object,
- PutObjectOptions... nullableOptions) {
- final PutObjectOptions options = (nullableOptions.length == 0) ? new PutObjectOptions() : nullableOptions[0];
- if (options.getAcl() != null)
- keyToAcl.put(bucketName + "/" + object.getMetadata().getKey(), options.getAcl());
- return blobStore.putBlob(bucketName, object2Blob.apply(object));
- }
-
- protected AccessControlList getACLforS3Item(String bucketAndObjectKey) {
- AccessControlList acl = null;
- Object aclObj = keyToAcl.get(bucketAndObjectKey);
- if (aclObj instanceof AccessControlList) {
- acl = (AccessControlList) aclObj;
- } else if (aclObj instanceof CannedAccessPolicy) {
- acl = AccessControlList.fromCannedAccessPolicy((CannedAccessPolicy) aclObj, DEFAULT_OWNER_ID);
- } else if (aclObj == null) {
- // Default to private access policy
- acl = AccessControlList.fromCannedAccessPolicy(CannedAccessPolicy.PRIVATE, DEFAULT_OWNER_ID);
- }
- return acl;
- }
-
- public ListenableFuture<AccessControlList> getBucketACL(final String bucket) {
- return immediateFuture(getACLforS3Item(bucket));
- }
-
- public ListenableFuture<AccessControlList> getObjectACL(final String bucket, final String objectKey) {
- return immediateFuture(getACLforS3Item(bucket + "/" + objectKey));
- }
-
- /**
- * Replace any AmazonCustomerByEmail grantees with a somewhat-arbitrary canonical user grantee,
- * to match S3 which substitutes each email address grantee with that user's corresponding ID. In
- * short, although you can PUT email address grantees, these are actually subsequently returned
- * by S3 as canonical user grantees.
- *
- * @param acl
- * @return
- */
- protected AccessControlList sanitizeUploadedACL(AccessControlList acl) {
- // Replace any email address grantees with canonical user grantees, using
- // the acl's owner ID as the surrogate replacement.
- for (Grant grant : acl.getGrants()) {
- if (grant.getGrantee() instanceof EmailAddressGrantee) {
- EmailAddressGrantee emailGrantee = (EmailAddressGrantee) grant.getGrantee();
- String id = emailGrantee.getEmailAddress().equals(TEST_ACL_EMAIL) ? TEST_ACL_ID : acl.getOwner().getId();
- grant.setGrantee(new CanonicalUserGrantee(id, acl.getOwner().getDisplayName()));
- }
- }
- return acl;
- }
-
- public ListenableFuture<Boolean> putBucketACL(final String bucket, final AccessControlList acl) {
- keyToAcl.put(bucket, sanitizeUploadedACL(acl));
- return immediateFuture(true);
- }
-
- public ListenableFuture<Boolean> putObjectACL(final String bucket, final String objectKey,
- final AccessControlList acl) {
- keyToAcl.put(bucket + "/" + objectKey, sanitizeUploadedACL(acl));
- return immediateFuture(true);
- }
-
- public ListenableFuture<Boolean> bucketExists(final String bucketName) {
- return immediateFuture(containerToBlobs.containsKey(bucketName));
- }
-
- public ListenableFuture<Boolean> deleteBucketIfEmpty(String bucketName) {
- Boolean returnVal = true;
- if (containerToBlobs.containsKey(bucketName)) {
- if (containerToBlobs.get(bucketName).isEmpty())
- containerToBlobs.remove(bucketName);
- else
- returnVal = false;
- }
- return immediateFuture(returnVal);
- }
-
- public ListenableFuture<Void> deleteObject(String bucketName, String key) {
- return blobStore.removeBlob(bucketName, key);
- }
-
- public ListenableFuture<S3Object> getObject(final String bucketName, final String key, final GetOptions... options) {
- org.jclouds.blobstore.options.GetOptions getOptions = httpGetOptionsConverter.apply(options);
- return transform(blobStore.getBlob(bucketName, key, getOptions), blob2Object, userExecutor);
- }
-
- public ListenableFuture<ObjectMetadata> headObject(String bucketName, String key) {
- return transform(blobStore.blobMetadata(bucketName, key), new Function<BlobMetadata, ObjectMetadata>() {
- public ObjectMetadata apply(BlobMetadata from) {
- return blob2ObjectMetadata.apply(from);
- }
- }, userExecutor);
- }
-
- public ListenableFuture<? extends Set<BucketMetadata>> listOwnedBuckets() {
- return immediateFuture(Sets.newLinkedHashSet(Iterables.transform(containerToBlobs.keySet(),
- new Function<String, BucketMetadata>() {
- public BucketMetadata apply(String name) {
- return new BucketMetadata(name, null, null);
- }
-
- })));
- }
-
- public S3Object newS3Object() {
- return objectProvider.create(null);
- }
-
- @Override
- public ListenableFuture<String> getBucketLocation(String bucketName) {
- Location location = containerToLocation.get(bucketName);
- return immediateFuture(location.getId());
- }
-
- @Override
- public ListenableFuture<Payer> getBucketPayer(String bucketName) {
- return immediateFuture(Payer.BUCKET_OWNER);
- }
-
- @Override
- public ListenableFuture<Void> setBucketPayer(String bucketName, Payer payer) {
- return immediateFuture(null);
-
- }
-
- @Override
- public ListenableFuture<Void> disableBucketLogging(String bucketName) {
- return immediateFuture(null);
- }
-
- @Override
- public ListenableFuture<Void> enableBucketLogging(String bucketName, BucketLogging logging) {
- return immediateFuture(null);
- }
-
- @Override
- public ListenableFuture<BucketLogging> getBucketLogging(String bucketName) {
- return immediateFuture(null);
- }
-
- @Override
- public ListenableFuture<Boolean> objectExists(String bucketName, String key) {
- return immediateFuture(containerToBlobs.get(bucketName).containsKey(key));
- }
-
- @Override
- public void close() throws IOException {
- closer.close();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/apis/s3/src/test/java/org/jclouds/s3/services/BucketsLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/services/BucketsLiveTest.java b/apis/s3/src/test/java/org/jclouds/s3/services/BucketsLiveTest.java
index 558b055..bb9891f 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/services/BucketsLiveTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/services/BucketsLiveTest.java
@@ -16,6 +16,18 @@
*/
package org.jclouds.s3.services;
+import static org.jclouds.s3.S3ClientLiveTest.TEST_ACL_EMAIL;
+import static org.jclouds.s3.S3ClientLiveTest.TEST_ACL_ID;
+import static org.jclouds.s3.domain.AccessControlList.GroupGranteeURI.ALL_USERS;
+import static org.jclouds.s3.domain.AccessControlList.GroupGranteeURI.LOG_DELIVERY;
+import static org.jclouds.s3.domain.AccessControlList.Permission.FULL_CONTROL;
+import static org.jclouds.s3.domain.AccessControlList.Permission.READ;
+import static org.jclouds.s3.domain.AccessControlList.Permission.READ_ACP;
+import static org.jclouds.s3.domain.AccessControlList.Permission.WRITE;
+import static org.jclouds.s3.domain.AccessControlList.Permission.WRITE_ACP;
+import static org.jclouds.s3.domain.CannedAccessPolicy.PUBLIC_READ;
+import static org.jclouds.s3.domain.Payer.BUCKET_OWNER;
+import static org.jclouds.s3.domain.Payer.REQUESTER;
import static org.jclouds.s3.options.ListBucketOptions.Builder.afterMarker;
import static org.jclouds.s3.options.ListBucketOptions.Builder.delimiter;
import static org.jclouds.s3.options.ListBucketOptions.Builder.maxResults;
@@ -34,21 +46,15 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
-import org.jclouds.s3.S3ApiMetadata;
import org.jclouds.s3.S3Client;
import org.jclouds.s3.domain.AccessControlList;
import org.jclouds.s3.domain.AccessControlList.CanonicalUserGrantee;
import org.jclouds.s3.domain.AccessControlList.EmailAddressGrantee;
import org.jclouds.s3.domain.AccessControlList.Grant;
-import org.jclouds.s3.domain.AccessControlList.GroupGranteeURI;
-import org.jclouds.s3.domain.AccessControlList.Permission;
import org.jclouds.s3.domain.BucketLogging;
import org.jclouds.s3.domain.BucketMetadata;
-import org.jclouds.s3.domain.CannedAccessPolicy;
import org.jclouds.s3.domain.ListBucketResponse;
-import org.jclouds.s3.domain.Payer;
import org.jclouds.s3.domain.S3Object;
-import org.jclouds.s3.internal.StubS3AsyncClient;
import org.jclouds.util.Strings2;
import org.testng.annotations.Test;
@@ -58,13 +64,14 @@ import com.google.common.collect.Iterables;
@Test(groups = { "integration", "live" })
public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
+
public BucketsLiveTest() {
this.provider = "s3";
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
}
public S3Client getApi() {
- return view.unwrap(S3ApiMetadata.CONTEXT_TOKEN).getApi();
+ return view.unwrapApi(S3Client.class);
}
/**
@@ -94,7 +101,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
assertEquals(acl.getGrants().size(), 1);
assertNotNull(acl.getOwner());
String ownerId = acl.getOwner().getId();
- assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
+ assertTrue(acl.hasPermission(ownerId, FULL_CONTROL));
} finally {
returnContainer(bucketName);
}
@@ -109,7 +116,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
AccessControlList acl = getApi().getBucketACL(bucketName);
String ownerId = acl.getOwner().getId();
assertEquals(acl.getGrants().size(), 1);
- assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
+ assertTrue(acl.hasPermission(ownerId, FULL_CONTROL));
addGrantsToACL(acl);
assertEquals(acl.getGrants().size(), 4);
@@ -129,26 +136,26 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
assertEquals(acl.getGrants().size(), 4, acl.toString());
- assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL), acl.toString());
- assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ), acl.toString());
- assertTrue(acl.hasPermission(ownerId, Permission.WRITE_ACP), acl.toString());
+ assertTrue(acl.hasPermission(ownerId, FULL_CONTROL), acl.toString());
+ assertTrue(acl.hasPermission(ALL_USERS, READ), acl.toString());
+ assertTrue(acl.hasPermission(ownerId, WRITE_ACP), acl.toString());
// EmailAddressGrantee is replaced by a CanonicalUserGrantee, so we cannot test by email addr
- assertTrue(acl.hasPermission(StubS3AsyncClient.TEST_ACL_ID, Permission.READ_ACP), acl.toString());
+ assertTrue(acl.hasPermission(TEST_ACL_ID, READ_ACP), acl.toString());
}
private void addGrantsToACL(AccessControlList acl) {
String ownerId = acl.getOwner().getId();
- acl.addPermission(GroupGranteeURI.ALL_USERS, Permission.READ);
- acl.addPermission(new EmailAddressGrantee(StubS3AsyncClient.TEST_ACL_EMAIL), Permission.READ_ACP);
- acl.addPermission(new CanonicalUserGrantee(ownerId), Permission.WRITE_ACP);
+ acl.addPermission(ALL_USERS, READ);
+ acl.addPermission(new EmailAddressGrantee(TEST_ACL_EMAIL), READ_ACP);
+ acl.addPermission(new CanonicalUserGrantee(ownerId), WRITE_ACP);
}
public void testPublicReadAccessPolicy() throws Exception {
String bucketName = getScratchContainerName();
try {
- getApi().putBucketInRegion(null, bucketName, withBucketAcl(CannedAccessPolicy.PUBLIC_READ));
+ getApi().putBucketInRegion(null, bucketName, withBucketAcl(PUBLIC_READ));
AccessControlList acl = getApi().getBucketACL(bucketName);
- assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ), acl.toString());
+ assertTrue(acl.hasPermission(ALL_USERS, READ), acl.toString());
// TODO: I believe that the following should work based on the above acl assertion passing.
// However, it fails on 403
// URL url = new URL(String.format("http://%s.s3.amazonaws.com", bucketName));
@@ -173,23 +180,23 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
public void testBucketPayer() throws Exception {
final String bucketName = getContainerName();
try {
- assertEquals(Payer.BUCKET_OWNER, getApi().getBucketPayer(bucketName));
- getApi().setBucketPayer(bucketName, Payer.REQUESTER);
+ assertEquals(BUCKET_OWNER, getApi().getBucketPayer(bucketName));
+ getApi().setBucketPayer(bucketName, REQUESTER);
assertConsistencyAware(new Runnable() {
public void run() {
try {
- assertEquals(Payer.REQUESTER, getApi().getBucketPayer(bucketName));
+ assertEquals(REQUESTER, getApi().getBucketPayer(bucketName));
} catch (Exception e) {
Throwables.propagateIfPossible(e);
}
}
});
- getApi().setBucketPayer(bucketName, Payer.BUCKET_OWNER);
+ getApi().setBucketPayer(bucketName, BUCKET_OWNER);
assertConsistencyAware(new Runnable() {
public void run() {
try {
- assertEquals(Payer.BUCKET_OWNER, getApi().getBucketPayer(bucketName));
+ assertEquals(BUCKET_OWNER, getApi().getBucketPayer(bucketName));
} catch (Exception e) {
Throwables.propagateIfPossible(e);
}
@@ -208,8 +215,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
setupAclForBucketLoggingTarget(targetBucket);
final BucketLogging logging = new BucketLogging(targetBucket, "access_log-",
- ImmutableSet.<Grant> of(new Grant(new EmailAddressGrantee(StubS3AsyncClient.TEST_ACL_EMAIL),
- Permission.FULL_CONTROL)));
+ ImmutableSet.<Grant> of(new Grant(new EmailAddressGrantee(TEST_ACL_EMAIL), FULL_CONTROL)));
getApi().enableBucketLogging(bucketName, logging);
@@ -226,7 +232,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
}
// EmailAddressGrantee is replaced by a CanonicalUserGrantee, so we cannot test by
// email addr
- assertTrue(acl.hasPermission(StubS3AsyncClient.TEST_ACL_ID, Permission.FULL_CONTROL), acl.toString());
+ assertTrue(acl.hasPermission(TEST_ACL_ID, FULL_CONTROL), acl.toString());
assertEquals(logging.getTargetBucket(), newLogging.getTargetBucket());
assertEquals(logging.getTargetPrefix(), newLogging.getTargetPrefix());
} catch (Exception e) {
@@ -251,10 +257,9 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
}
private void setupAclForBucketLoggingTarget(final String targetBucket) {
- // http://docs.amazonwebservices.com/AmazonS3/latest/LoggingHowTo.html
AccessControlList acl = getApi().getBucketACL(targetBucket);
- acl.addPermission(GroupGranteeURI.LOG_DELIVERY, Permission.WRITE);
- acl.addPermission(GroupGranteeURI.LOG_DELIVERY, Permission.READ_ACP);
+ acl.addPermission(LOG_DELIVERY, WRITE);
+ acl.addPermission(LOG_DELIVERY, READ_ACP);
assertTrue(getApi().putBucketACL(targetBucket, acl));
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/blobstore/src/main/java/org/jclouds/blobstore/internal/SubmissionAsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/internal/SubmissionAsyncBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/internal/SubmissionAsyncBlobStore.java
new file mode 100644
index 0000000..b141008
--- /dev/null
+++ b/blobstore/src/main/java/org/jclouds/blobstore/internal/SubmissionAsyncBlobStore.java
@@ -0,0 +1,293 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.blobstore.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.Constants.PROPERTY_USER_THREADS;
+
+import java.util.Set;
+import java.util.concurrent.Callable;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.blobstore.AsyncBlobStore;
+import org.jclouds.blobstore.BlobStore;
+import org.jclouds.blobstore.BlobStoreContext;
+import org.jclouds.blobstore.domain.Blob;
+import org.jclouds.blobstore.domain.BlobBuilder;
+import org.jclouds.blobstore.domain.BlobMetadata;
+import org.jclouds.blobstore.domain.PageSet;
+import org.jclouds.blobstore.domain.StorageMetadata;
+import org.jclouds.blobstore.options.CreateContainerOptions;
+import org.jclouds.blobstore.options.GetOptions;
+import org.jclouds.blobstore.options.ListContainerOptions;
+import org.jclouds.blobstore.options.PutOptions;
+import org.jclouds.domain.Location;
+
+import com.google.common.collect.ForwardingObject;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+
+/**
+ * Adapter that allows you to reuse an existing {@link BlobStore} to implement
+ * the deprecated {@link AsyncBlobStore} interface.
+ *
+ * @deprecated will be removed in jclouds 2.0, as async interfaces are no longer
+ * supported. Please use {@link BlobStore}
+ */
+@Deprecated
+public class SubmissionAsyncBlobStore extends ForwardingObject implements AsyncBlobStore {
+ private final BlobStore blobstore;
+ private final ListeningExecutorService executor;
+
+ @Inject
+ public SubmissionAsyncBlobStore(BlobStore blobstore, @Named(PROPERTY_USER_THREADS) ListeningExecutorService executor) {
+ this.blobstore = checkNotNull(blobstore, "blobstore");
+ this.executor = checkNotNull(executor, "executor");
+ }
+
+ @Override
+ protected BlobStore delegate() {
+ return blobstore;
+ }
+
+ @Override
+ public BlobStoreContext getContext() {
+ return delegate().getContext();
+ }
+
+ @Override
+ public BlobBuilder blobBuilder(String name) {
+ return delegate().blobBuilder(name);
+ }
+
+ @Override
+ public ListenableFuture<Set<? extends Location>> listAssignableLocations() {
+ return executor.submit(new Callable<Set<? extends Location>>() {
+ public Set<? extends Location> call() {
+ return delegate().listAssignableLocations();
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<PageSet<? extends StorageMetadata>> list() {
+ return executor.submit(new Callable<PageSet<? extends StorageMetadata>>() {
+ public PageSet<? extends StorageMetadata> call() {
+ return delegate().list();
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Boolean> containerExists(final String container) {
+ return executor.submit(new Callable<Boolean>() {
+ public Boolean call() {
+ return delegate().containerExists(container);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Boolean> createContainerInLocation(final Location location, final String container) {
+ return executor.submit(new Callable<Boolean>() {
+ public Boolean call() {
+ return delegate().createContainerInLocation(location, container);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Boolean> createContainerInLocation(final Location location, final String container,
+ final CreateContainerOptions options) {
+ return executor.submit(new Callable<Boolean>() {
+ public Boolean call() {
+ return delegate().createContainerInLocation(location, container, options);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<PageSet<? extends StorageMetadata>> list(final String container) {
+ return executor.submit(new Callable<PageSet<? extends StorageMetadata>>() {
+ public PageSet<? extends StorageMetadata> call() {
+ return delegate().list(container);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<PageSet<? extends StorageMetadata>> list(final String container,
+ final ListContainerOptions options) {
+ return executor.submit(new Callable<PageSet<? extends StorageMetadata>>() {
+ public PageSet<? extends StorageMetadata> call() {
+ return delegate().list(container, options);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Void> clearContainer(final String container) {
+ return executor.submit(new Callable<Void>() {
+ public Void call() {
+ delegate().clearContainer(container);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Void> clearContainer(final String container, final ListContainerOptions options) {
+ return executor.submit(new Callable<Void>() {
+ public Void call() {
+ delegate().clearContainer(container, options);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Void> deleteContainer(final String container) {
+ return executor.submit(new Callable<Void>() {
+ public Void call() {
+ delegate().deleteContainer(container);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Boolean> deleteContainerIfEmpty(final String container) {
+ return executor.submit(new Callable<Boolean>() {
+ public Boolean call() {
+ return delegate().deleteContainerIfEmpty(container);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Boolean> directoryExists(final String container, final String directory) {
+ return executor.submit(new Callable<Boolean>() {
+ public Boolean call() {
+ return delegate().directoryExists(container, directory);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Void> createDirectory(final String container, final String directory) {
+ return executor.submit(new Callable<Void>() {
+ public Void call() {
+ delegate().createDirectory(container, directory);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Void> deleteDirectory(final String containerName, final String name) {
+ return executor.submit(new Callable<Void>() {
+ public Void call() {
+ delegate().deleteDirectory(containerName, name);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Boolean> blobExists(final String container, final String name) {
+ return executor.submit(new Callable<Boolean>() {
+ public Boolean call() {
+ return delegate().blobExists(container, name);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<String> putBlob(final String container, final Blob blob) {
+ return executor.submit(new Callable<String>() {
+ public String call() {
+ return delegate().putBlob(container, blob);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<String> putBlob(final String container, final Blob blob, final PutOptions options) {
+ return executor.submit(new Callable<String>() {
+ public String call() {
+ return delegate().putBlob(container, blob, options);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<BlobMetadata> blobMetadata(final String container, final String key) {
+ return executor.submit(new Callable<BlobMetadata>() {
+ public BlobMetadata call() {
+ return delegate().blobMetadata(container, key);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Blob> getBlob(final String container, final String key) {
+ return executor.submit(new Callable<Blob>() {
+ public Blob call() {
+ return delegate().getBlob(container, key);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Blob> getBlob(final String container, final String key, final GetOptions options) {
+ return executor.submit(new Callable<Blob>() {
+ public Blob call() {
+ return delegate().getBlob(container, key, options);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Void> removeBlob(final String container, final String key) {
+ return executor.submit(new Callable<Void>() {
+ public Void call() {
+ delegate().removeBlob(container, key);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Long> countBlobs(final String container) {
+ return executor.submit(new Callable<Long>() {
+ public Long call() {
+ return delegate().countBlobs(container);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<Long> countBlobs(final String container, final ListContainerOptions options) {
+ return executor.submit(new Callable<Long>() {
+ public Long call() {
+ return delegate().countBlobs(container, options);
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ApiMetadata.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ApiMetadata.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ApiMetadata.java
index 707b40a..ae91faf 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ApiMetadata.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ApiMetadata.java
@@ -23,26 +23,16 @@ import java.util.Properties;
import org.jclouds.aws.s3.blobstore.AWSS3BlobStoreContext;
import org.jclouds.aws.s3.blobstore.config.AWSS3BlobStoreContextModule;
-import org.jclouds.aws.s3.config.AWSS3RestClientModule;
+import org.jclouds.aws.s3.config.AWSS3HttpApiModule;
import org.jclouds.s3.S3ApiMetadata;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
/**
- * Implementation of {@link ApiMetadata} for the Amazon-specific S3 API
+ * Implementation of {@link S3ApiMetadata} for the Amazon-specific S3 API
*/
public class AWSS3ApiMetadata extends S3ApiMetadata {
-
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AWSS3Client.class)} as
- * {@link AWSS3AsyncClient} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<AWSS3Client, AWSS3AsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<AWSS3Client, AWSS3AsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
@Override
public Builder toBuilder() {
@@ -63,16 +53,14 @@ public class AWSS3ApiMetadata extends S3ApiMetadata {
return properties;
}
- public static class Builder extends S3ApiMetadata.Builder<Builder> {
- @SuppressWarnings("deprecation")
+ public static class Builder extends S3ApiMetadata.Builder<AWSS3Client, Builder> {
protected Builder() {
- super(AWSS3Client.class, AWSS3AsyncClient.class);
+ super(AWSS3Client.class);
id("aws-s3")
.name("Amazon-specific S3 API")
.defaultProperties(AWSS3ApiMetadata.defaultProperties())
- .context(CONTEXT_TOKEN)
.view(typeToken(AWSS3BlobStoreContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(AWSS3RestClientModule.class, AWSS3BlobStoreContextModule.class));
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(AWSS3HttpApiModule.class, AWSS3BlobStoreContextModule.class));
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3AsyncClient.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3AsyncClient.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3AsyncClient.java
deleted file mode 100644
index 366a845..0000000
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3AsyncClient.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.aws.s3;
-
-import static org.jclouds.blobstore.attr.BlobScopes.CONTAINER;
-
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.aws.s3.binders.BindIterableAsPayloadToDeleteRequest;
-import org.jclouds.aws.s3.binders.BindObjectMetadataToRequest;
-import org.jclouds.aws.s3.binders.BindPartIdsAndETagsToRequest;
-import org.jclouds.aws.s3.domain.DeleteResult;
-import org.jclouds.aws.s3.functions.ETagFromHttpResponseViaRegex;
-import org.jclouds.aws.s3.functions.ObjectMetadataKey;
-import org.jclouds.aws.s3.functions.UploadIdFromHttpResponseViaRegex;
-import org.jclouds.aws.s3.xml.DeleteResultHandler;
-import org.jclouds.blobstore.attr.BlobScope;
-import org.jclouds.http.functions.ParseETagHeader;
-import org.jclouds.io.Payload;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.ParamParser;
-import org.jclouds.rest.annotations.ParamValidators;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.s3.Bucket;
-import org.jclouds.s3.S3AsyncClient;
-import org.jclouds.s3.binders.BindAsHostPrefixIfConfigured;
-import org.jclouds.s3.domain.ObjectMetadata;
-import org.jclouds.s3.filters.RequestAuthorizeSignature;
-import org.jclouds.s3.functions.AssignCorrectHostnameForBucket;
-import org.jclouds.s3.options.PutObjectOptions;
-import org.jclouds.s3.predicates.validators.BucketNameValidator;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides access to amazon-specific S3 features
- *
- * @deprecated please use
- * {@code org.jclouds.ContextBuilder#buildApi(AWSS3Client.class)}
- * as {@link AWSS3AsyncClient} interface will be removed in jclouds 1.7.
- */
-@RequestFilters(RequestAuthorizeSignature.class)
-@BlobScope(CONTAINER)
-@Deprecated
-public interface AWSS3AsyncClient extends S3AsyncClient {
-
- /**
- * @see AWSS3Client#initiateMultipartUpload
- */
- @Named("PutObject")
- @POST
- @QueryParams(keys = "uploads")
- @Path("/{key}")
- @ResponseParser(UploadIdFromHttpResponseViaRegex.class)
- ListenableFuture<String> initiateMultipartUpload(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @PathParam("key") @ParamParser(ObjectMetadataKey.class) @BinderParam(BindObjectMetadataToRequest.class) ObjectMetadata objectMetadata,
- PutObjectOptions... options);
-
- /**
- * @see AWSS3Client#abortMultipartUpload
- */
- @Named("AbortMultipartUpload")
- @DELETE
- @Path("/{key}")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> abortMultipartUpload(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @PathParam("key") String key, @QueryParam("uploadId") String uploadId);
-
- /**
- * @see AWSS3Client#uploadPart
- */
- @Named("PutObject")
- @PUT
- @Path("/{key}")
- @ResponseParser(ParseETagHeader.class)
- ListenableFuture<String> uploadPart(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @PathParam("key") String key, @QueryParam("partNumber") int partNumber,
- @QueryParam("uploadId") String uploadId, Payload part);
-
- /**
- * @see AWSS3Client#completeMultipartUpload
- */
- @Named("PutObject")
- @POST
- @Path("/{key}")
- @ResponseParser(ETagFromHttpResponseViaRegex.class)
- ListenableFuture<String> completeMultipartUpload(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @PathParam("key") String key, @QueryParam("uploadId") String uploadId,
- @BinderParam(BindPartIdsAndETagsToRequest.class) Map<Integer, String> parts);
-
- /**
- * @see AWSS3Client#deleteObjects
- */
- @Named("DeleteObject")
- @POST
- @Path("/")
- @QueryParams(keys = "delete")
- @XMLResponseParser(DeleteResultHandler.class)
- ListenableFuture<DeleteResult> deleteObjects(
- @Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
- @BinderParam(BindIterableAsPayloadToDeleteRequest.class) Iterable<String> keys);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3Client.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3Client.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3Client.java
index 37f9b3b..7dccd70 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3Client.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3Client.java
@@ -16,18 +16,53 @@
*/
package org.jclouds.aws.s3;
+import static org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import static org.jclouds.blobstore.attr.BlobScopes.CONTAINER;
+
import java.util.Map;
+
+import javax.inject.Named;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+
+import org.jclouds.aws.s3.binders.BindIterableAsPayloadToDeleteRequest;
+import org.jclouds.aws.s3.binders.BindObjectMetadataToRequest;
+import org.jclouds.aws.s3.binders.BindPartIdsAndETagsToRequest;
import org.jclouds.aws.s3.domain.DeleteResult;
+import org.jclouds.aws.s3.functions.ETagFromHttpResponseViaRegex;
+import org.jclouds.aws.s3.functions.ObjectMetadataKey;
+import org.jclouds.aws.s3.functions.UploadIdFromHttpResponseViaRegex;
+import org.jclouds.aws.s3.xml.DeleteResultHandler;
+import org.jclouds.blobstore.attr.BlobScope;
+import org.jclouds.http.functions.ParseETagHeader;
import org.jclouds.io.Payload;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.ParamParser;
+import org.jclouds.rest.annotations.ParamValidators;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.s3.Bucket;
import org.jclouds.s3.S3Client;
+import org.jclouds.s3.binders.BindAsHostPrefixIfConfigured;
import org.jclouds.s3.domain.ObjectMetadata;
+import org.jclouds.s3.filters.RequestAuthorizeSignature;
+import org.jclouds.s3.functions.AssignCorrectHostnameForBucket;
import org.jclouds.s3.options.PutObjectOptions;
+import org.jclouds.s3.predicates.validators.BucketNameValidator;
/**
* Provides access to amazon-specific S3 features
- *
- * @see AWSS3AsyncClient
*/
+@RequestFilters(RequestAuthorizeSignature.class)
+@BlobScope(CONTAINER)
public interface AWSS3Client extends S3Client {
/**
@@ -48,8 +83,15 @@ public interface AWSS3Client extends S3Client {
* controls optional parameters such as canned ACL
* @return ID for the initiated multipart upload.
*/
- String initiateMultipartUpload(String bucketName, ObjectMetadata objectMetadata, PutObjectOptions... options);
-
+ @Named("PutObject")
+ @POST
+ @QueryParams(keys = "uploads")
+ @Path("/{key}")
+ @ResponseParser(UploadIdFromHttpResponseViaRegex.class)
+ String initiateMultipartUpload(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @PathParam("key") @ParamParser(ObjectMetadataKey.class) @BinderParam(BindObjectMetadataToRequest.class)
+ ObjectMetadata objectMetadata, PutObjectOptions... options);
/**
* This operation aborts a multipart upload. After a multipart upload is aborted, no additional
@@ -66,7 +108,13 @@ public interface AWSS3Client extends S3Client {
* @param uploadId
* id of the multipart upload in progress.
*/
- void abortMultipartUpload(String bucketName, String key, String uploadId);
+ @Named("AbortMultipartUpload")
+ @DELETE
+ @Path("/{key}")
+ @Fallback(VoidOnNotFoundOr404.class)
+ void abortMultipartUpload(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @PathParam("key") String key, @QueryParam("uploadId") String uploadId);
/**
* This operation uploads a part in a multipart upload. You must initiate a multipart upload (see
@@ -98,10 +146,15 @@ public interface AWSS3Client extends S3Client {
* @param part
* contains the data to create or overwrite
* @return ETag of the content uploaded
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadUploadPart.html"
- * />
*/
- String uploadPart(String bucketName, String key, int partNumber, String uploadId, Payload part);
+ @Named("PutObject")
+ @PUT
+ @Path("/{key}")
+ @ResponseParser(ParseETagHeader.class)
+ String uploadPart(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @PathParam("key") String key, @QueryParam("partNumber") int partNumber,
+ @QueryParam("uploadId") String uploadId, Payload part);
/**
*
@@ -135,7 +188,14 @@ public interface AWSS3Client extends S3Client {
* a map of part id to eTag from the {@link #uploadPart} command.
* @return ETag of the content uploaded
*/
- String completeMultipartUpload(String bucketName, String key, String uploadId, Map<Integer, String> parts);
+ @Named("PutObject")
+ @POST
+ @Path("/{key}")
+ @ResponseParser(ETagFromHttpResponseViaRegex.class)
+ String completeMultipartUpload(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @PathParam("key") String key, @QueryParam("uploadId") String uploadId,
+ @BinderParam(BindPartIdsAndETagsToRequest.class) Map<Integer, String> parts);
/**
* The Multi-Object Delete operation enables you to delete multiple objects from a bucket using a
@@ -151,11 +211,17 @@ public interface AWSS3Client extends S3Client {
* By default, the operation uses verbose mode in which the response includes the result of
* deletion of each key in your request.
*
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/API/multiobjectdeleteapi.html" />
* @param bucketName
* namespace of the objects you are deleting
* @param keys
* set of unique keys identifying objects
*/
- DeleteResult deleteObjects(String bucketName, Iterable<String> keys);
+ @Named("DeleteObject")
+ @POST
+ @Path("/")
+ @QueryParams(keys = "delete")
+ @XMLResponseParser(DeleteResultHandler.class)
+ DeleteResult deleteObjects(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam(
+ BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName,
+ @BinderParam(BindIterableAsPayloadToDeleteRequest.class) Iterable<String> keys);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3AsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3AsyncBlobStore.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3AsyncBlobStore.java
deleted file mode 100644
index 63e084d..0000000
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3AsyncBlobStore.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.aws.s3.blobstore;
-
-import static org.jclouds.s3.domain.ObjectMetadata.StorageClass.REDUCED_REDUNDANCY;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-
-import org.jclouds.Constants;
-import org.jclouds.aws.domain.Region;
-import org.jclouds.aws.s3.AWSS3ApiMetadata;
-import org.jclouds.aws.s3.AWSS3AsyncClient;
-import org.jclouds.aws.s3.AWSS3Client;
-import org.jclouds.aws.s3.blobstore.options.AWSS3PutObjectOptions;
-import org.jclouds.aws.s3.blobstore.options.AWSS3PutOptions;
-import org.jclouds.aws.s3.blobstore.strategy.AsyncMultipartUploadStrategy;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.blobstore.options.PutOptions;
-import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-import org.jclouds.s3.blobstore.S3AsyncBlobStore;
-import org.jclouds.s3.blobstore.functions.BlobToObject;
-import org.jclouds.s3.blobstore.functions.BucketToResourceList;
-import org.jclouds.s3.blobstore.functions.ContainerToBucketListOptions;
-import org.jclouds.s3.blobstore.functions.ObjectToBlob;
-import org.jclouds.s3.blobstore.functions.ObjectToBlobMetadata;
-import org.jclouds.s3.domain.AccessControlList;
-import org.jclouds.s3.domain.BucketMetadata;
-import org.jclouds.s3.domain.CannedAccessPolicy;
-import org.jclouds.s3.domain.ObjectMetadata;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported. Please use {@link AWSS3BlobStore}
- */
-@Deprecated
-public class AWSS3AsyncBlobStore extends S3AsyncBlobStore {
-
- private final Provider<AsyncMultipartUploadStrategy> multipartUploadStrategy;
- private final LoadingCache<String, AccessControlList> bucketAcls;
- private final BlobToObject blob2Object;
-
- @Inject
- public AWSS3AsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, Supplier<Location> defaultLocation,
- @Memoized Supplier<Set<? extends Location>> locations, AWSS3AsyncClient async, AWSS3Client sync,
- Function<Set<BucketMetadata>, PageSet<? extends StorageMetadata>> convertBucketsToStorageMetadata,
- ContainerToBucketListOptions container2BucketListOptions, BucketToResourceList bucket2ResourceList,
- ObjectToBlob object2Blob, BlobToHttpGetOptions blob2ObjectGetOptions, BlobToObject blob2Object,
- ObjectToBlobMetadata object2BlobMd, Provider<FetchBlobMetadata> fetchBlobMetadataProvider,
- LoadingCache<String, AccessControlList> bucketAcls,
- Provider<AsyncMultipartUploadStrategy> multipartUploadStrategy) {
- super(context, blobUtils, userExecutor, defaultLocation, locations, async, sync, convertBucketsToStorageMetadata,
- container2BucketListOptions, bucket2ResourceList, object2Blob, blob2ObjectGetOptions, blob2Object,
- object2BlobMd, fetchBlobMetadataProvider, bucketAcls);
- this.multipartUploadStrategy = multipartUploadStrategy;
- this.bucketAcls = bucketAcls;
- this.blob2Object = blob2Object;
- }
-
- @Override
- public ListenableFuture<String> putBlob(String container, Blob blob, PutOptions options) {
- if (options.isMultipart()) {
- // need to use a provider if the strategy object is stateful
- return multipartUploadStrategy.get().execute(container, blob, options);
- } else if (options instanceof AWSS3PutOptions &&
- ((AWSS3PutOptions) options).getStorageClass() == REDUCED_REDUNDANCY) {
- return putBlobWithReducedRedundancy(container, blob);
-
- } else {
- return super.putBlob(container, blob, options);
- }
- }
-
- private ListenableFuture<String> putBlobWithReducedRedundancy(String container, Blob blob) {
- AWSS3PutObjectOptions options = new AWSS3PutObjectOptions();
- try {
- AccessControlList acl = bucketAcls.getUnchecked(container);
- if (acl != null && acl.hasPermission(AccessControlList.GroupGranteeURI.ALL_USERS,
- AccessControlList.Permission.READ)) {
- options.withAcl(CannedAccessPolicy.PUBLIC_READ);
- }
- options.storageClass(ObjectMetadata.StorageClass.REDUCED_REDUNDANCY);
-
- } catch (CacheLoader.InvalidCacheLoadException e) {
- // nulls not permitted from cache loader
- }
- return getContext().unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getAsyncApi().putObject(container,
- blob2Object.apply(blob), options);
- }
-
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, String container,
- CreateContainerOptions options) {
- if ((location == null || location.getId().equals(Region.US_STANDARD)) &&
- Futures.getUnchecked(containerExists(container))) {
- // AWS-S3 returns the incorrect creation status when a container
- // already exists in the us-standard (or default) region. See
- // JCLOUDS-334 for details.
- // TODO: executing on the calling thread
- return Futures.immediateFuture(Boolean.FALSE);
- }
- return super.createContainerInLocation(location, container, options);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobRequestSigner.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobRequestSigner.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobRequestSigner.java
index 3c26fc6..b719bab 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobRequestSigner.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobRequestSigner.java
@@ -24,7 +24,7 @@ import java.net.URLEncoder;
import java.util.Date;
import java.util.concurrent.TimeUnit;
-import org.jclouds.aws.s3.AWSS3AsyncClient;
+import org.jclouds.aws.s3.AWSS3Client;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
import org.jclouds.date.DateService;
@@ -44,7 +44,7 @@ import com.google.common.net.HttpHeaders;
import com.google.inject.Inject;
import com.google.inject.Provider;
-public class AWSS3BlobRequestSigner extends S3BlobRequestSigner<AWSS3AsyncClient> {
+public class AWSS3BlobRequestSigner extends S3BlobRequestSigner<AWSS3Client> {
public static final String TEMPORARY_SIGNATURE_PARAM = "Signature";
private final RequestAuthorizeSignature authSigner;
@@ -54,7 +54,7 @@ public class AWSS3BlobRequestSigner extends S3BlobRequestSigner<AWSS3AsyncClient
@Inject
public AWSS3BlobRequestSigner(RestAnnotationProcessor processor, BlobToObject blobToObject,
- BlobToHttpGetOptions blob2HttpGetOptions, Class<AWSS3AsyncClient> interfaceClass,
+ BlobToHttpGetOptions blob2HttpGetOptions, Class<AWSS3Client> interfaceClass,
@org.jclouds.location.Provider Supplier<Credentials> credentials,
RequestAuthorizeSignature authSigner, @TimeStamp Provider<String> timeStampProvider,
DateService dateService) throws SecurityException, NoSuchMethodException {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobStore.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobStore.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobStore.java
index a6541d6..a9b8b1e 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobStore.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobStore.java
@@ -24,7 +24,6 @@ import javax.inject.Inject;
import javax.inject.Provider;
import org.jclouds.aws.domain.Region;
-import org.jclouds.aws.s3.AWSS3ApiMetadata;
import org.jclouds.aws.s3.AWSS3Client;
import org.jclouds.aws.s3.blobstore.options.AWSS3PutObjectOptions;
import org.jclouds.aws.s3.blobstore.options.AWSS3PutOptions;
@@ -110,8 +109,7 @@ public class AWSS3BlobStore extends S3BlobStore {
} catch (CacheLoader.InvalidCacheLoadException e) {
// nulls not permitted from cache loader
}
- return getContext().unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi().putObject(container, blob2Object.apply(blob),
- options);
+ return getContext().unwrapApi(AWSS3Client.class).putObject(container, blob2Object.apply(blob), options);
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobStoreContext.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobStoreContext.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobStoreContext.java
index 7bb0840..bbf834a 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobStoreContext.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/AWSS3BlobStoreContext.java
@@ -26,7 +26,4 @@ public interface AWSS3BlobStoreContext extends S3BlobStoreContext {
@Override
AWSS3BlobStore getBlobStore();
-
- @Override
- AWSS3AsyncBlobStore getAsyncBlobStore();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/config/AWSS3BlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/config/AWSS3BlobStoreContextModule.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/config/AWSS3BlobStoreContextModule.java
index 2b4f21c..bfd6716 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/config/AWSS3BlobStoreContextModule.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/config/AWSS3BlobStoreContextModule.java
@@ -16,7 +16,6 @@
*/
package org.jclouds.aws.s3.blobstore.config;
-import org.jclouds.aws.s3.blobstore.AWSS3AsyncBlobStore;
import org.jclouds.aws.s3.blobstore.AWSS3BlobRequestSigner;
import org.jclouds.aws.s3.blobstore.AWSS3BlobStore;
import org.jclouds.aws.s3.blobstore.strategy.AsyncMultipartUploadStrategy;
@@ -24,7 +23,6 @@ import org.jclouds.aws.s3.blobstore.strategy.MultipartUploadStrategy;
import org.jclouds.aws.s3.blobstore.strategy.internal.ParallelMultipartUploadStrategy;
import org.jclouds.aws.s3.blobstore.strategy.internal.SequentialMultipartUploadStrategy;
import org.jclouds.blobstore.BlobRequestSigner;
-import org.jclouds.s3.blobstore.S3AsyncBlobStore;
import org.jclouds.s3.blobstore.S3BlobStore;
import org.jclouds.s3.blobstore.config.S3BlobStoreContextModule;
@@ -35,7 +33,6 @@ public class AWSS3BlobStoreContextModule extends S3BlobStoreContextModule {
@Override
protected void configure() {
super.configure();
- bind(S3AsyncBlobStore.class).to(AWSS3AsyncBlobStore.class).in(Scopes.SINGLETON);
bind(S3BlobStore.class).to(AWSS3BlobStore.class).in(Scopes.SINGLETON);
bind(MultipartUploadStrategy.class).to(SequentialMultipartUploadStrategy.class);
bind(AsyncMultipartUploadStrategy.class).to(ParallelMultipartUploadStrategy.class);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/internal/AWSS3BlobStoreContextImpl.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/internal/AWSS3BlobStoreContextImpl.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/internal/AWSS3BlobStoreContextImpl.java
index cad9916..9455f01 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/internal/AWSS3BlobStoreContextImpl.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/internal/AWSS3BlobStoreContextImpl.java
@@ -20,7 +20,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.Context;
-import org.jclouds.aws.s3.blobstore.AWSS3AsyncBlobStore;
import org.jclouds.aws.s3.blobstore.AWSS3BlobStore;
import org.jclouds.aws.s3.blobstore.AWSS3BlobStoreContext;
import org.jclouds.blobstore.AsyncBlobStore;
@@ -49,10 +48,4 @@ public class AWSS3BlobStoreContextImpl extends S3BlobStoreContextImpl implements
public AWSS3BlobStore getBlobStore() {
return AWSS3BlobStore.class.cast(super.getBlobStore());
}
-
- @Override
- public AWSS3AsyncBlobStore getAsyncBlobStore() {
- return AWSS3AsyncBlobStore.class.cast(super.getAsyncBlobStore());
- }
-
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/AsyncMultipartUploadStrategy.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/AsyncMultipartUploadStrategy.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/AsyncMultipartUploadStrategy.java
index 1431b6d..3f638ae 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/AsyncMultipartUploadStrategy.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/AsyncMultipartUploadStrategy.java
@@ -23,9 +23,6 @@ import org.jclouds.blobstore.options.PutOptions;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.ImplementedBy;
-/**
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?qfacts.html">AWS Documentation</a>
- */
@ImplementedBy(ParallelMultipartUploadStrategy.class)
public interface AsyncMultipartUploadStrategy {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/MultipartUpload.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/MultipartUpload.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/MultipartUpload.java
index 622c60e..5342e67 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/MultipartUpload.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/MultipartUpload.java
@@ -16,9 +16,6 @@
*/
package org.jclouds.aws.s3.blobstore.strategy;
-/**
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?qfacts.html">AWS Documentation</a>
- */
public final class MultipartUpload {
/* Maximum number of parts per upload */
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b6497556/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/MultipartUploadStrategy.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/MultipartUploadStrategy.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/MultipartUploadStrategy.java
index e00580d..12b7ef3 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/MultipartUploadStrategy.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/MultipartUploadStrategy.java
@@ -21,9 +21,6 @@ import org.jclouds.blobstore.domain.Blob;
import com.google.inject.ImplementedBy;
-/**
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?qfacts.html">AWS Documentation</a>
- */
@ImplementedBy(SequentialMultipartUploadStrategy.class)
public interface MultipartUploadStrategy {
[44/52] [abbrv] JCLOUDS-153 remove IO Executor and usage of it.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/gae/src/test/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorServiceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/drivers/gae/src/test/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorServiceIntegrationTest.java b/drivers/gae/src/test/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorServiceIntegrationTest.java
deleted file mode 100644
index c3b63c0..0000000
--- a/drivers/gae/src/test/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorServiceIntegrationTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.gae;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import org.jclouds.concurrent.SingleThreaded;
-import org.jclouds.concurrent.config.ConfiguresExecutorService;
-import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
-import org.jclouds.http.BaseHttpCommandExecutorServiceIntegrationTest;
-import org.jclouds.http.HttpCommandExecutorService;
-import org.jclouds.http.config.ConfiguresHttpCommandExecutorService;
-import org.testng.SkipException;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
-import com.google.appengine.tools.development.testing.LocalURLFetchServiceTestConfig;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-/**
- *
- * Integration test for the URLFetchService
- */
-@Test
-public class AsyncGaeHttpCommandExecutorServiceIntegrationTest extends BaseHttpCommandExecutorServiceIntegrationTest {
-
- @BeforeMethod
- public void setupApiProxy() {
- LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig());
- helper.setUp();
- }
-
- @Override
- public void testPostAsInputStream() {
- throw new SkipException("streams aren't supported");
- }
-
- @Override
- public void testPostAsInputStreamDoesNotRetryOnFailure() throws Exception {
- throw new SkipException("streams aren't supported");
- }
-
- @Override
- public void testGetBigFile() {
- throw new SkipException("test data is too big for GAE");
- }
-
- @Override
- public void testUploadBigFile() throws IOException {
- throw new SkipException("test data is too big for GAE");
- }
-
- protected Module createConnectionModule() {
- setupApiProxy();
- return new AsyncGoogleAppEngineConfigurationModule();
- }
-
- @ConfiguresHttpCommandExecutorService
- @ConfiguresExecutorService
- @SingleThreaded
- public class AsyncGoogleAppEngineConfigurationModule extends GoogleAppEngineConfigurationModule {
-
- public AsyncGoogleAppEngineConfigurationModule() {
- super();
- }
-
- protected HttpCommandExecutorService providerHttpCommandExecutorService(Injector injector) {
- return injector.getInstance(AsyncGaeHttpCommandExecutorService.class);
- }
-
- }
-
- @Override
- protected void addOverrideProperties(Properties props) {
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/gae/src/test/java/org/jclouds/gae/GaeHttpCommandExecutorServiceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/drivers/gae/src/test/java/org/jclouds/gae/GaeHttpCommandExecutorServiceIntegrationTest.java b/drivers/gae/src/test/java/org/jclouds/gae/GaeHttpCommandExecutorServiceIntegrationTest.java
new file mode 100644
index 0000000..d7e30bf
--- /dev/null
+++ b/drivers/gae/src/test/java/org/jclouds/gae/GaeHttpCommandExecutorServiceIntegrationTest.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.gae;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.jclouds.concurrent.SingleThreaded;
+import org.jclouds.concurrent.config.ConfiguresExecutorService;
+import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
+import org.jclouds.http.BaseHttpCommandExecutorServiceIntegrationTest;
+import org.jclouds.http.HttpCommandExecutorService;
+import org.jclouds.http.config.ConfiguresHttpCommandExecutorService;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import com.google.appengine.tools.development.testing.LocalURLFetchServiceTestConfig;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+
+/**
+ *
+ * Integration test for the URLFetchService
+ */
+@Test
+public class GaeHttpCommandExecutorServiceIntegrationTest extends BaseHttpCommandExecutorServiceIntegrationTest {
+
+ @BeforeMethod
+ public void setupApiProxy() {
+ LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig());
+ helper.setUp();
+ }
+
+ @Override
+ public void testPostAsInputStream() {
+ throw new SkipException("streams aren't supported");
+ }
+
+ @Override
+ public void testPostAsInputStreamDoesNotRetryOnFailure() throws Exception {
+ throw new SkipException("streams aren't supported");
+ }
+
+ @Override
+ public void testGetBigFile() {
+ throw new SkipException("test data is too big for GAE");
+ }
+
+ @Override
+ public void testUploadBigFile() throws IOException {
+ throw new SkipException("test data is too big for GAE");
+ }
+
+ protected Module createConnectionModule() {
+ setupApiProxy();
+ return new AsyncGoogleAppEngineConfigurationModule();
+ }
+
+ @ConfiguresHttpCommandExecutorService
+ @ConfiguresExecutorService
+ @SingleThreaded
+ public class AsyncGoogleAppEngineConfigurationModule extends GoogleAppEngineConfigurationModule {
+
+ public AsyncGoogleAppEngineConfigurationModule() {
+ super();
+ }
+
+ protected HttpCommandExecutorService providerHttpCommandExecutorService(Injector injector) {
+ return injector.getInstance(GaeHttpCommandExecutorService.class);
+ }
+
+ }
+
+ @Override
+ protected void addOverrideProperties(Properties props) {
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/okhttp/src/main/java/org/jclouds/http/okhttp/OkHttpCommandExecutorService.java
----------------------------------------------------------------------
diff --git a/drivers/okhttp/src/main/java/org/jclouds/http/okhttp/OkHttpCommandExecutorService.java b/drivers/okhttp/src/main/java/org/jclouds/http/okhttp/OkHttpCommandExecutorService.java
index dadd623..edecc29 100644
--- a/drivers/okhttp/src/main/java/org/jclouds/http/okhttp/OkHttpCommandExecutorService.java
+++ b/drivers/okhttp/src/main/java/org/jclouds/http/okhttp/OkHttpCommandExecutorService.java
@@ -27,7 +27,6 @@ import javax.inject.Singleton;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
-import org.jclouds.Constants;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpUtils;
import org.jclouds.http.IOExceptionRetryHandler;
@@ -40,7 +39,6 @@ import org.jclouds.io.ContentMetadataCodec;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.net.HttpHeaders;
-import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.Inject;
import com.squareup.okhttp.OkHttpClient;
@@ -53,12 +51,11 @@ public class OkHttpCommandExecutorService extends JavaUrlHttpCommandExecutorServ
@Inject
public OkHttpCommandExecutorService(HttpUtils utils, ContentMetadataCodec contentMetadataCodec,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor,
DelegatingRetryHandler retryHandler, IOExceptionRetryHandler ioRetryHandler,
DelegatingErrorHandler errorHandler, HttpWire wire, @Named("untrusted") HostnameVerifier verifier,
@Named("untrusted") Supplier<SSLContext> untrustedSSLContextProvider, Function<URI, Proxy> proxyForURI)
throws SecurityException, NoSuchFieldException {
- super(utils, contentMetadataCodec, ioExecutor, retryHandler, ioRetryHandler, errorHandler, wire, verifier,
+ super(utils, contentMetadataCodec, retryHandler, ioRetryHandler, errorHandler, wire, verifier,
untrustedSSLContextProvider, proxyForURI);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java
----------------------------------------------------------------------
diff --git a/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java b/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java
index deb2106..f201416 100644
--- a/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java
+++ b/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java
@@ -17,7 +17,6 @@
package org.jclouds.http.okhttp;
import static com.google.common.io.Closeables.close;
-import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_CONTEXT;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
@@ -57,8 +56,6 @@ public class OkHttpCommandExecutorServiceTest extends BaseHttpCommandExecutorSer
protected void addOverrideProperties(final Properties props) {
props.setProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT, 50 + "");
props.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 0 + "");
- // IO workers not used in this executor
- props.setProperty(PROPERTY_IO_WORKER_THREADS, 0 + "");
props.setProperty(PROPERTY_USER_THREADS, 5 + "");
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
index bb25f2f..9694274 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
@@ -67,7 +67,7 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
@VisibleForTesting
static final int DEFAULT_MAX_PERCENT_RETRIES = 10;
- private final ListeningExecutorService ioExecutor;
+ private final ListeningExecutorService executor;
@Inject(optional = true)
@Named("jclouds.mpu.parallel.degree")
@@ -96,10 +96,10 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
@Inject
public ParallelMultipartUploadStrategy(AWSS3BlobStore blobstore, PayloadSlicer slicer,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor) {
+ @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService executor) {
this.blobstore = checkNotNull(blobstore, "blobstore");
this.slicer = checkNotNull(slicer, "slicer");
- this.ioExecutor = checkNotNull(ioExecutor, "ioExecutor");
+ this.executor = checkNotNull(executor, "executor");
}
protected void prepareUploadPart(final String container, final String key,
@@ -118,7 +118,7 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
final Payload chunkedPart = slicer.slice(payload, offset, size);
logger.debug(String.format("async uploading part %s of %s to container %s with uploadId %s", part, key, container, uploadId));
final long start = System.currentTimeMillis();
- final ListenableFuture<String> futureETag = ioExecutor.submit(new Callable<String>() {
+ final ListenableFuture<String> futureETag = executor.submit(new Callable<String>() {
@Override public String call() throws Exception {
return client.uploadPart(container, key, part, uploadId, chunkedPart);
}
@@ -148,13 +148,13 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
latch.countDown();
}
}
- }, ioExecutor);
+ }, executor);
futureParts.put(part, futureETag);
}
@Override
public ListenableFuture<String> execute(final String container, final Blob blob, final PutOptions options) {
- return ioExecutor.submit(new Callable<String>() {
+ return executor.submit(new Callable<String>() {
@Override
public String call() throws Exception {
String key = blob.getMetadata().getName();
@@ -242,7 +242,7 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
// recursively call this execute method again; instead mark as not multipart
// because it can all fit in one go.
final PutOptions nonMultipartOptions = PutOptions.Builder.multipart(false);
- ListenableFuture<String> futureETag = ioExecutor.submit(new Callable<String>() {
+ ListenableFuture<String> futureETag = executor.submit(new Callable<String>() {
@Override public String call() throws Exception {
return blobstore.putBlob(container, blob, nonMultipartOptions);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/strategy/internal/SequentialMultipartUploadStrategyMockTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/strategy/internal/SequentialMultipartUploadStrategyMockTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/strategy/internal/SequentialMultipartUploadStrategyMockTest.java
index d96c311..71ae0ea 100644
--- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/strategy/internal/SequentialMultipartUploadStrategyMockTest.java
+++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/blobstore/strategy/internal/SequentialMultipartUploadStrategyMockTest.java
@@ -127,8 +127,8 @@ public class SequentialMultipartUploadStrategyMockTest {
}
}
- private static final Set<Module> modules = ImmutableSet.<Module> of(new ExecutorServiceModule(newDirectExecutorService(),
- newDirectExecutorService()));
+ private static final Set<Module> modules = ImmutableSet.<Module>of(
+ new ExecutorServiceModule(newDirectExecutorService()));
static SequentialMultipartUploadStrategy mockSequentialMultipartUploadStrategy(String uri, int partSize) {
Properties overrides = new Properties();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/providers/dynect/src/main/java/org/jclouds/dynect/v3/config/DynECTHttpApiModule.java
----------------------------------------------------------------------
diff --git a/providers/dynect/src/main/java/org/jclouds/dynect/v3/config/DynECTHttpApiModule.java b/providers/dynect/src/main/java/org/jclouds/dynect/v3/config/DynECTHttpApiModule.java
index 1d96c7b..48bb9f8 100644
--- a/providers/dynect/src/main/java/org/jclouds/dynect/v3/config/DynECTHttpApiModule.java
+++ b/providers/dynect/src/main/java/org/jclouds/dynect/v3/config/DynECTHttpApiModule.java
@@ -30,7 +30,6 @@ import javax.inject.Singleton;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
-import org.jclouds.Constants;
import org.jclouds.concurrent.SingleThreaded;
import org.jclouds.dynect.v3.DynECTApi;
import org.jclouds.dynect.v3.features.SessionApi;
@@ -57,7 +56,6 @@ import org.jclouds.rest.config.HttpApiModule;
import com.google.common.base.Charsets;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
-import com.google.common.util.concurrent.ListeningExecutorService;
/**
* Configures the DynECT connection.
@@ -102,12 +100,11 @@ public class DynECTHttpApiModule extends HttpApiModule<DynECTApi> {
@Inject
private SillyRabbit200sAreForSuccess(HttpUtils utils, ContentMetadataCodec contentMetadataCodec,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor,
DelegatingRetryHandler retryHandler, IOExceptionRetryHandler ioRetryHandler,
DelegatingErrorHandler errorHandler, HttpWire wire, @Named("untrusted") HostnameVerifier verifier,
@Named("untrusted") Supplier<SSLContext> untrustedSSLContextProvider, Function<URI, Proxy> proxyForURI)
throws SecurityException, NoSuchFieldException {
- super(utils, contentMetadataCodec, ioExecutor, retryHandler, ioRetryHandler, errorHandler, wire, verifier,
+ super(utils, contentMetadataCodec, retryHandler, ioRetryHandler, errorHandler, wire, verifier,
untrustedSSLContextProvider, proxyForURI);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/providers/dynect/src/test/java/org/jclouds/dynect/v3/DynectApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/dynect/src/test/java/org/jclouds/dynect/v3/DynectApiMockTest.java b/providers/dynect/src/test/java/org/jclouds/dynect/v3/DynectApiMockTest.java
index 97c7611..c5bd5b3 100644
--- a/providers/dynect/src/test/java/org/jclouds/dynect/v3/DynectApiMockTest.java
+++ b/providers/dynect/src/test/java/org/jclouds/dynect/v3/DynectApiMockTest.java
@@ -39,7 +39,7 @@ import com.squareup.okhttp.mockwebserver.MockWebServer;
public class DynectApiMockTest {
private static final Set<Module> modules = ImmutableSet.<Module> of(
- new ExecutorServiceModule(newDirectExecutorService(), newDirectExecutorService()));
+ new ExecutorServiceModule(newDirectExecutorService()));
static DynECTApi mockDynectApi(String uri) {
Properties overrides = new Properties();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/internal/BaseHPCloudObjectStorageMockTest.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/internal/BaseHPCloudObjectStorageMockTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/internal/BaseHPCloudObjectStorageMockTest.java
index fa6105f..4074229 100644
--- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/internal/BaseHPCloudObjectStorageMockTest.java
+++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/internal/BaseHPCloudObjectStorageMockTest.java
@@ -46,7 +46,7 @@ public class BaseHPCloudObjectStorageMockTest {
.credentials("jclouds:joe", "letmein") //
.endpoint(uri) //
.overrides(overrides) //
- .modules(ImmutableSet.<Module> of(new ExecutorServiceModule(newDirectExecutorService(), newDirectExecutorService()))) //
+ .modules(ImmutableSet.<Module> of(new ExecutorServiceModule(newDirectExecutorService()))) //
.buildApi(HPCloudObjectStorageApi.class);
}
[10/52] [abbrv] JCLOUDS-40 unasync azureblob;
plus fold otherwise unused azure-common into it.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/AzureStorageResponseException.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/AzureStorageResponseException.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/AzureStorageResponseException.java
new file mode 100644
index 0000000..744de08
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/AzureStorageResponseException.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage;
+
+import org.jclouds.azure.storage.domain.AzureStorageError;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+
+/**
+ * Encapsulates an Error from Azure Storage Services.
+ *
+ * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/UsingRESTError.html" />
+ * @see AzureStorageError
+ * @see org.jclouds.aws.handlers.ParseAzureStorageErrorFromXmlContent
+ */
+public class AzureStorageResponseException extends HttpResponseException {
+
+ private AzureStorageError error = new AzureStorageError();
+
+ public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error) {
+ super(String.format("command %s failed with code %s, error: %s", command.toString(), response
+ .getStatusCode(), error.toString()), command, response);
+ this.setError(error);
+
+ }
+
+ public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error,
+ Throwable cause) {
+ super(String.format("command %1$s failed with error: %2$s", command.toString(), error
+ .toString()), command, response, cause);
+ this.setError(error);
+
+ }
+
+ public AzureStorageResponseException(String message, HttpCommand command, HttpResponse response,
+ AzureStorageError error) {
+ super(message, command, response);
+ this.setError(error);
+
+ }
+
+ public AzureStorageResponseException(String message, HttpCommand command, HttpResponse response,
+ AzureStorageError error, Throwable cause) {
+ super(message, command, response, cause);
+ this.setError(error);
+
+ }
+
+ public void setError(AzureStorageError error) {
+ this.error = error;
+ }
+
+ public AzureStorageError getError() {
+ return error;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/AzureStorageError.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/AzureStorageError.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/AzureStorageError.java
new file mode 100644
index 0000000..ec57979
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/AzureStorageError.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.domain;
+
+import java.util.Map;
+
+import com.google.common.collect.Maps;
+
+/**
+ * When an Azure Storage request is in error, the client receives an error response.
+ *
+ * @see <a href="http://msdn.microsoft.com/en-us/library/dd573365.aspx" />
+ */
+public class AzureStorageError {
+ private String code;
+ private String message;
+ private String requestId;
+ private Map<String, String> details = Maps.newHashMap();
+ private String stringSigned;
+ private String signature;
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("AzureError");
+ sb.append("{requestId='").append(requestId).append('\'');
+ if (code != null)
+ sb.append(", code='").append(code).append('\'');
+ if (message != null)
+ sb.append(", message='").append(message).append('\'');
+ if (stringSigned != null)
+ sb.append(", stringSigned='").append(stringSigned).append('\'');
+ if (getSignature() != null)
+ sb.append(", signature='").append(getSignature()).append('\'');
+ if (!details.isEmpty())
+ sb.append(", context='").append(details.toString()).append('\'').append('}');
+ return sb.toString();
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ /**
+ * If a request is consistently failing and you have verified that the request is properly
+ * formulated, you may use this value to report the error to Microsoft. In your report, include
+ * the value of x-ms-request-id, the approximate time that the request was made, the storage
+ * service against which the request was made, and the type of operation that the request
+ * attempted
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setStringSigned(String stringSigned) {
+ this.stringSigned = stringSigned;
+ }
+
+ /**
+ * @return what jclouds signed before sending the request.
+ */
+ public String getStringSigned() {
+ return stringSigned;
+ }
+
+ public void setDetails(Map<String, String> context) {
+ this.details = context;
+ }
+
+ /**
+ * @return additional details surrounding the error.
+ */
+ public Map<String, String> getDetails() {
+ return details;
+ }
+
+ public void setSignature(String signature) {
+ this.signature = signature;
+ }
+
+ public String getSignature() {
+ return signature;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/BoundedSet.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/BoundedSet.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/BoundedSet.java
new file mode 100644
index 0000000..8778ae6
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/BoundedSet.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.domain;
+
+import java.net.URI;
+import java.util.Set;
+
+public interface BoundedSet<T> extends Set<T> {
+ URI getUrl();
+
+ String getPrefix();
+
+ String getMarker();
+
+ int getMaxResults();
+
+ String getNextMarker();
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/internal/BoundedHashSet.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/internal/BoundedHashSet.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/internal/BoundedHashSet.java
new file mode 100644
index 0000000..b9767ec
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/domain/internal/BoundedHashSet.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.domain.internal;
+
+import java.net.URI;
+import java.util.HashSet;
+
+import org.jclouds.azure.storage.domain.BoundedSet;
+
+import com.google.common.collect.Iterables;
+
+public class BoundedHashSet<T> extends HashSet<T> implements BoundedSet<T> {
+
+ protected final URI url;
+ protected final String prefix;
+ protected final String marker;
+ protected final Integer maxResults;
+ protected final String nextMarker;
+
+ public BoundedHashSet(Iterable<T> contents, URI url, String prefix, String marker,
+ Integer maxResults, String nextMarker) {
+ Iterables.addAll(this, contents);
+ this.url = url;
+ this.prefix = prefix;
+ this.nextMarker = nextMarker;
+ this.maxResults = maxResults;
+ this.marker = marker;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+ public String getMarker() {
+ return marker;
+ }
+
+ public int getMaxResults() {
+ return maxResults;
+ }
+
+ public String getNextMarker() {
+ return nextMarker;
+ }
+
+ public URI getUrl() {
+ return url;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java
new file mode 100644
index 0000000..8e56390
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.filters;
+
+import static com.google.common.io.BaseEncoding.base64;
+import static com.google.common.io.ByteStreams.readBytes;
+import static org.jclouds.crypto.Macs.asByteProcessor;
+import static org.jclouds.util.Patterns.NEWLINE_PATTERN;
+import static org.jclouds.util.Strings2.toInputStream;
+
+import java.util.Collection;
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.jclouds.Constants;
+import org.jclouds.crypto.Crypto;
+import org.jclouds.date.TimeStamp;
+import org.jclouds.domain.Credentials;
+import org.jclouds.http.HttpException;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpRequestFilter;
+import org.jclouds.http.HttpUtils;
+import org.jclouds.http.internal.SignatureWire;
+import org.jclouds.logging.Logger;
+import org.jclouds.util.Strings2;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Strings;
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.Sets;
+import com.google.common.io.ByteProcessor;
+import com.google.common.net.HttpHeaders;
+
+/**
+ * Signs the Azure Storage request.
+ *
+ * @see <a href= "http://msdn.microsoft.com/en-us/library/dd179428.aspx" />
+ */
+@Singleton
+public class SharedKeyLiteAuthentication implements HttpRequestFilter {
+ private static final Collection<String> FIRST_HEADERS_TO_SIGN = ImmutableList.of(HttpHeaders.DATE);
+
+ private final SignatureWire signatureWire;
+ private final Supplier<Credentials> creds;
+ private final Provider<String> timeStampProvider;
+ private final Crypto crypto;
+ private final HttpUtils utils;
+
+ @Resource
+ @Named(Constants.LOGGER_SIGNATURE)
+ Logger signatureLog = Logger.NULL;
+
+ @Inject
+ public SharedKeyLiteAuthentication(SignatureWire signatureWire,
+ @org.jclouds.location.Provider Supplier<Credentials> creds, @TimeStamp Provider<String> timeStampProvider,
+ Crypto crypto, HttpUtils utils) {
+ this.crypto = crypto;
+ this.utils = utils;
+ this.signatureWire = signatureWire;
+ this.creds = creds;
+ this.timeStampProvider = timeStampProvider;
+ }
+
+ public HttpRequest filter(HttpRequest request) throws HttpException {
+ request = replaceDateHeader(request);
+ String signature = calculateSignature(createStringToSign(request));
+ request = replaceAuthorizationHeader(request, signature);
+ utils.logRequest(signatureLog, request, "<<");
+ return request;
+ }
+
+ HttpRequest replaceAuthorizationHeader(HttpRequest request, String signature) {
+ return request.toBuilder()
+ .replaceHeader(HttpHeaders.AUTHORIZATION, "SharedKeyLite " + creds.get().identity + ":" + signature)
+ .build();
+ }
+
+ HttpRequest replaceDateHeader(HttpRequest request) {
+ Builder<String, String> builder = ImmutableMap.builder();
+ String date = timeStampProvider.get();
+ builder.put(HttpHeaders.DATE, date);
+ request = request.toBuilder().replaceHeaders(Multimaps.forMap(builder.build())).build();
+ return request;
+ }
+
+ public String createStringToSign(HttpRequest request) {
+ utils.logRequest(signatureLog, request, ">>");
+ StringBuilder buffer = new StringBuilder();
+ // re-sign the request
+ appendMethod(request, buffer);
+ appendPayloadMetadata(request, buffer);
+ appendHttpHeaders(request, buffer);
+ appendCanonicalizedHeaders(request, buffer);
+ appendCanonicalizedResource(request, buffer);
+ if (signatureWire.enabled())
+ signatureWire.output(buffer.toString());
+ return buffer.toString();
+ }
+
+ private void appendPayloadMetadata(HttpRequest request, StringBuilder buffer) {
+ buffer.append(
+ HttpUtils.nullToEmpty(request.getPayload() == null ? null : request.getPayload().getContentMetadata()
+ .getContentMD5())).append("\n");
+ buffer.append(
+ Strings.nullToEmpty(request.getPayload() == null ? null : request.getPayload().getContentMetadata()
+ .getContentType())).append("\n");
+ }
+
+ private String calculateSignature(String toSign) throws HttpException {
+ String signature = signString(toSign);
+ if (signatureWire.enabled())
+ signatureWire.input(Strings2.toInputStream(signature));
+ return signature;
+ }
+
+ public String signString(String toSign) {
+ try {
+ ByteProcessor<byte[]> hmacSHA256 = asByteProcessor(crypto.hmacSHA256(base64().decode(creds.get().credential)));
+ return base64().encode(readBytes(toInputStream(toSign), hmacSHA256));
+ } catch (Exception e) {
+ throw new HttpException("error signing request", e);
+ }
+ }
+
+ private void appendMethod(HttpRequest request, StringBuilder toSign) {
+ toSign.append(request.getMethod()).append("\n");
+ }
+
+ private void appendCanonicalizedHeaders(HttpRequest request, StringBuilder toSign) {
+ // TreeSet == Sort the headers alphabetically.
+ Set<String> headers = Sets.newTreeSet(request.getHeaders().keySet());
+ for (String header : headers) {
+ if (header.startsWith("x-ms-")) {
+ toSign.append(header.toLowerCase()).append(":");
+ for (String value : request.getHeaders().get(header)) {
+ toSign.append(NEWLINE_PATTERN.matcher(value).replaceAll("")).append(",");
+ }
+ toSign.deleteCharAt(toSign.lastIndexOf(","));
+ toSign.append("\n");
+ }
+ }
+ }
+
+ private void appendHttpHeaders(HttpRequest request, StringBuilder toSign) {
+ for (String header : FIRST_HEADERS_TO_SIGN)
+ toSign.append(HttpUtils.nullToEmpty(request.getHeaders().get(header))).append("\n");
+ }
+
+ @VisibleForTesting
+ void appendCanonicalizedResource(HttpRequest request, StringBuilder toSign) {
+ // 1. Beginning with an empty string (""), append a forward slash (/), followed by the name of
+ // the identity that owns the resource being accessed.
+ toSign.append("/").append(creds.get().identity);
+ appendUriPath(request, toSign);
+ }
+
+ @VisibleForTesting
+ void appendUriPath(HttpRequest request, StringBuilder toSign) {
+ // 2. Append the resource's encoded URI path
+ toSign.append(request.getEndpoint().getRawPath());
+
+ // If the request URI addresses a component of the
+ // resource, append the appropriate query string. The query string should include the question
+ // mark and the comp parameter (for example, ?comp=metadata). No other parameters should be
+ // included on the query string.
+ if (request.getEndpoint().getQuery() != null) {
+ StringBuilder paramsToSign = new StringBuilder("?");
+
+ String[] params = request.getEndpoint().getQuery().split("&");
+ for (String param : params) {
+ String[] paramNameAndValue = param.split("=");
+
+ if ("comp".equals(paramNameAndValue[0])) {
+ paramsToSign.append(param);
+ }
+ }
+
+ if (paramsToSign.length() > 1) {
+ toSign.append(paramsToSign);
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/handlers/AzureStorageClientErrorRetryHandler.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/handlers/AzureStorageClientErrorRetryHandler.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/handlers/AzureStorageClientErrorRetryHandler.java
new file mode 100644
index 0000000..fadc772
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/handlers/AzureStorageClientErrorRetryHandler.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.handlers;
+
+import java.io.ByteArrayInputStream;
+
+import javax.annotation.Resource;
+import javax.inject.Named;
+
+import org.jclouds.Constants;
+import org.jclouds.azure.storage.domain.AzureStorageError;
+import org.jclouds.azure.storage.util.AzureStorageUtils;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpException;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpRetryHandler;
+import org.jclouds.http.HttpUtils;
+import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
+import org.jclouds.logging.Logger;
+
+import com.google.inject.Inject;
+
+/**
+ * Handles Retryable responses with error codes in the 4xx range
+ */
+public class AzureStorageClientErrorRetryHandler implements HttpRetryHandler {
+
+ @Inject(optional = true)
+ @Named(Constants.PROPERTY_MAX_RETRIES)
+ private int retryCountLimit = 5;
+
+ private final AzureStorageUtils utils;
+ private final BackoffLimitedRetryHandler backoffHandler;
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ @Inject
+ public AzureStorageClientErrorRetryHandler(BackoffLimitedRetryHandler backoffHandler,
+ AzureStorageUtils utils) {
+ this.backoffHandler = backoffHandler;
+ this.utils = utils;
+ }
+
+ public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
+ byte[] content = HttpUtils.closeClientButKeepContentStream(response);
+ command.incrementFailureCount();
+ if (!command.isReplayable()) {
+ logger.warn("Cannot retry after server error, command is not replayable: %1$s", command);
+ return false;
+ } else if (command.getFailureCount() > retryCountLimit) {
+ logger.warn(
+ "Cannot retry after server error, command has exceeded retry limit %1$d: %2$s",
+ retryCountLimit, command);
+ return false;
+ } else if (response.getStatusCode() == 409) {
+ // Content can be null in the case of HEAD requests
+ if (content != null) {
+ try {
+ AzureStorageError error = utils.parseAzureStorageErrorFromContent(command, response,
+ new ByteArrayInputStream(content));
+ if ("ContainerBeingDeleted".equals(error.getCode())) {
+ backoffHandler.imposeBackoffExponentialDelay(100L, 3, retryCountLimit, command
+ .getFailureCount(), command.toString());
+ return true;
+ }
+ } catch (HttpException e) {
+ logger.warn(e, "error parsing response: %s", new String(content));
+ }
+ }
+ }
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/handlers/ParseAzureStorageErrorFromXmlContent.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/handlers/ParseAzureStorageErrorFromXmlContent.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/handlers/ParseAzureStorageErrorFromXmlContent.java
new file mode 100644
index 0000000..ece8176
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/handlers/ParseAzureStorageErrorFromXmlContent.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.handlers;
+
+import static org.jclouds.http.HttpUtils.releasePayload;
+
+import java.io.IOException;
+import java.util.regex.Pattern;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+
+import org.jclouds.azure.storage.AzureStorageResponseException;
+import org.jclouds.azure.storage.domain.AzureStorageError;
+import org.jclouds.azure.storage.util.AzureStorageUtils;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.logging.Logger;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.jclouds.util.Strings2;
+
+/**
+ * This will parse and set an appropriate exception on the command object.
+ *
+ * @see AzureStorageError
+ */
+public class ParseAzureStorageErrorFromXmlContent implements HttpErrorHandler {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final AzureStorageUtils utils;
+
+ @Inject
+ public ParseAzureStorageErrorFromXmlContent(AzureStorageUtils utils) {
+ this.utils = utils;
+ }
+
+ public static final Pattern CONTAINER_PATH = Pattern.compile("^[/]?([^/]+)$");
+ public static final Pattern CONTAINER_KEY_PATH = Pattern.compile("^[/]?([^/]+)/(.*)$");
+
+ public void handleError(HttpCommand command, HttpResponse response) {
+ Exception exception = new HttpResponseException(command, response);
+ String message = null;
+ AzureStorageError error = null;
+ try {
+ if (response.getPayload() != null) {
+ String contentType = response.getPayload().getContentMetadata().getContentType();
+ if (contentType != null && (contentType.indexOf("xml") != -1 || contentType.indexOf("unknown") != -1)
+ && !Long.valueOf(0).equals(response.getPayload().getContentMetadata().getContentLength())) {
+ try {
+ error = utils.parseAzureStorageErrorFromContent(command, response, response.getPayload().getInput());
+ if (error != null) {
+ message = error.getMessage();
+ exception = new AzureStorageResponseException(command, response, error);
+ }
+ } catch (RuntimeException e) {
+ try {
+ message = Strings2.toStringAndClose(response.getPayload().openStream());
+ exception = new HttpResponseException(command, response, message);
+ } catch (IOException e1) {
+ }
+ }
+ } else {
+ try {
+ message = Strings2.toStringAndClose(response.getPayload().openStream());
+ exception = new HttpResponseException(command, response, message);
+ } catch (IOException e) {
+ }
+ }
+ }
+ message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
+ response.getStatusLine());
+ exception = refineException(command, response, exception, error, message);
+ } finally {
+ releasePayload(response);
+ command.setException(exception);
+ }
+ }
+
+ protected Exception refineException(HttpCommand command, HttpResponse response, Exception exception,
+ AzureStorageError error, String message) {
+ switch (response.getStatusCode()) {
+ case 401:
+ exception = new AuthorizationException(message, exception);
+ break;
+ case 404:
+ if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
+ exception = new ResourceNotFoundException(message, exception);
+ }
+ break;
+ case 411:
+ exception = new IllegalArgumentException(message);
+ break;
+ }
+ return exception;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/options/CreateOptions.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/options/CreateOptions.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/options/CreateOptions.java
new file mode 100644
index 0000000..20fd7f8
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/options/CreateOptions.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.options;
+
+import java.util.Map.Entry;
+
+import org.jclouds.azure.storage.reference.AzureStorageHeaders;
+import org.jclouds.http.options.BaseHttpRequestOptions;
+
+import com.google.common.collect.Multimap;
+
+/**
+ * Contains common options supported in the REST API for the Create operation. <h2>
+ * Usage</h2> The recommended way to instantiate a CreateOptions object is to statically import
+ * CreateOptions.* and invoke a static creation method followed by an instance mutator (if
+ * needed):
+ * <p/>
+ * <code>
+ * import static CreateOptions.Builder.*
+ * import org.jclouds.azure.storage.queue.AzureQueueClient;
+ * <p/>
+ * AzureQueueClient connection = // get connection
+ * Multimap<String,String> metadata = // ...
+ * boolean createdWithPublicAcl = connection.createQueue("containerName", withMetadata(metadata));
+ * <code> *
+ *
+ * @see <a href="http://msdn.microsoft.com/en-us/library/dd179466.aspx" />
+ */
+public class CreateOptions extends BaseHttpRequestOptions {
+ public static final CreateOptions NONE = new CreateOptions();
+
+ /**
+ * A name-value pair to associate with the container as metadata.
+ *
+ * Note that these are stored at the server under the prefix: x-ms-meta-
+ */
+ public CreateOptions withMetadata(Multimap<String, String> metadata) {
+ for (Entry<String, String> entry : metadata.entries()) {
+ if (entry.getKey().startsWith(AzureStorageHeaders.USER_METADATA_PREFIX))
+ headers.put(entry.getKey(), entry.getValue());
+ else
+ headers
+ .put(AzureStorageHeaders.USER_METADATA_PREFIX + entry.getKey(), entry
+ .getValue());
+ }
+ return this;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see CreateOptions#withMetadata(Multimap<String, String>)
+ */
+ public static CreateOptions withMetadata(Multimap<String, String> metadata) {
+ CreateOptions options = new CreateOptions();
+ return options.withMetadata(metadata);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/options/ListOptions.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/options/ListOptions.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/options/ListOptions.java
new file mode 100644
index 0000000..fba5f39
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/options/ListOptions.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.options;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
+import org.jclouds.http.options.BaseHttpRequestOptions;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Options used to control paginated results (aka list commands).
+ *
+ * @see <a href="http://msdn.microsoft.com/en-us/library/dd179466.aspx" />
+ */
+public class ListOptions extends BaseHttpRequestOptions {
+ public static final ListOptions NONE = new ListOptions();
+
+ /**
+ * Include this parameter to specify that the container's metadata be returned as part of the
+ * response body.
+ *
+ * Note that metadata requested with this parameter must be stored in accordance with the naming
+ * restrictions imposed by the 2009-09-19 version of the Blob service. Beginning with this
+ * version, all metadata names must adhere to the naming conventions for C# identifiers.
+ */
+ public ListOptions includeMetadata() {
+ this.queryParameters.replaceValues("include", ImmutableSet.of("metadata"));
+ return this;
+ }
+
+ public boolean getIncludeMetadata() {
+ return getFirstQueryOrNull("include").equals("metadata");
+ }
+
+ /**
+ * Filters the results to return only objects whose name begins with the specified prefix.
+ */
+ public ListOptions prefix(String prefix) {
+ this.queryParameters.put("prefix", checkNotNull(prefix, "prefix"));
+ return this;
+ }
+
+ public String getPrefix() {
+ return getFirstQueryOrNull("prefix");
+ }
+
+ /**
+ * A string value that identifies the portion of the list to be returned with the next list
+ * operation. The operation returns a marker value within the response body if the list returned
+ * was not complete. The marker value may then be used in a subsequent call to request the next
+ * set of list items.
+ * <p/>
+ * The marker value is opaque to the client.
+ */
+ public ListOptions marker(String marker) {
+ this.queryParameters.put("marker", checkNotNull(marker, "marker"));
+ return this;
+ }
+
+ public String getMarker() {
+ return getFirstQueryOrNull("marker");
+ }
+
+ /**
+ * Specifies the maximum number of containers to return. If maxresults is not specified, the
+ * server will return up to 5,000 items. If the parameter is set to a value greater than 5,000,
+ * the server will return a Bad Request (400) error
+ */
+ public ListOptions maxResults(int maxresults) {
+ checkState(maxresults >= 0, "maxresults must be >= 0");
+ checkState(maxresults <= 10000, "maxresults must be <= 5000");
+ queryParameters.put("maxresults", Integer.toString(maxresults));
+ return this;
+ }
+
+ public Integer getMaxResults() {
+ String maxresults = getFirstQueryOrNull("maxresults");
+ return (maxresults != null) ? Integer.valueOf(maxresults) : null;
+ }
+
+ public static class Builder {
+ /**
+ * @see ListOptions#includeMetadata()
+ */
+ public static ListOptions includeMetadata() {
+ ListOptions options = new ListOptions();
+ return options.includeMetadata();
+ }
+
+ /**
+ * @see ListOptions#prefix(String)
+ */
+ public static ListOptions prefix(String prefix) {
+ ListOptions options = new ListOptions();
+ return options.prefix(prefix);
+ }
+
+ /**
+ * @see ListOptions#marker(String)
+ */
+ public static ListOptions marker(String marker) {
+ ListOptions options = new ListOptions();
+ return options.marker(marker);
+ }
+
+ /**
+ * @see ListOptions#maxResults(long)
+ */
+ public static ListOptions maxResults(int maxKeys) {
+ ListOptions options = new ListOptions();
+ return options.maxResults(maxKeys);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/reference/AzureStorageHeaders.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/reference/AzureStorageHeaders.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/reference/AzureStorageHeaders.java
new file mode 100644
index 0000000..0c60e51
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/reference/AzureStorageHeaders.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.reference;
+
+/**
+ * Additional headers specified by Azure Storage REST API.
+ *
+ * @see <a href="http://msdn.microsoft.com/en-us/library/dd179357.aspx" />
+ */
+public final class AzureStorageHeaders {
+
+ public static final String USER_METADATA_PREFIX = "x-ms-meta-";
+ public static final String REQUEST_ID = "x-ms-request-id";
+ public static final String VERSION = "x-ms-version";
+
+ private AzureStorageHeaders() {
+ throw new AssertionError("intentionally unimplemented");
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/util/AzureStorageUtils.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/util/AzureStorageUtils.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/util/AzureStorageUtils.java
new file mode 100644
index 0000000..bf62ff82a
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/util/AzureStorageUtils.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.util;
+
+import java.io.InputStream;
+
+import javax.inject.Inject;
+import javax.inject.Provider;
+
+import org.jclouds.azure.storage.domain.AzureStorageError;
+import org.jclouds.azure.storage.filters.SharedKeyLiteAuthentication;
+import org.jclouds.azure.storage.reference.AzureStorageHeaders;
+import org.jclouds.azure.storage.xml.ErrorHandler;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpException;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.functions.ParseSax;
+
+/**
+ * Encryption, Hashing, and IO Utilities needed to sign and verify Azure Storage requests and
+ * responses.
+ */
+public class AzureStorageUtils {
+
+ @Inject
+ SharedKeyLiteAuthentication signer;
+
+ @Inject
+ ParseSax.Factory factory;
+
+ @Inject
+ Provider<ErrorHandler> errorHandlerProvider;
+
+ public AzureStorageError parseAzureStorageErrorFromContent(HttpCommand command,
+ HttpResponse response, InputStream content) throws HttpException {
+ AzureStorageError error = factory.create(errorHandlerProvider.get()).parse(content);
+ error.setRequestId(response.getFirstHeaderOrNull(AzureStorageHeaders.REQUEST_ID));
+ if ("AuthenticationFailed".equals(error.getCode())) {
+ error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
+ error.setSignature(signer.signString(error.getStringSigned()));
+ }
+ return error;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azure/storage/xml/ErrorHandler.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azure/storage/xml/ErrorHandler.java b/providers/azureblob/src/main/java/org/jclouds/azure/storage/xml/ErrorHandler.java
new file mode 100644
index 0000000..2467fe7
--- /dev/null
+++ b/providers/azureblob/src/main/java/org/jclouds/azure/storage/xml/ErrorHandler.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.azure.storage.xml;
+
+import org.jclouds.azure.storage.domain.AzureStorageError;
+import org.jclouds.http.functions.ParseSax;
+
+/**
+ * Parses the error from the Amazon S3 REST API.
+ *
+ * @see <a
+ * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?UsingRESTError.html"
+ * />
+ */
+public class ErrorHandler extends ParseSax.HandlerWithResult<AzureStorageError> {
+
+ private AzureStorageError error = new AzureStorageError();
+ private StringBuilder currentText = new StringBuilder();
+
+ public AzureStorageError getResult() {
+ return error;
+ }
+
+ public void endElement(String uri, String name, String qName) {
+
+ if (qName.equals("Code")) {
+ error.setCode(currentText.toString().trim());
+ } else if (qName.equals("Message")) {
+ error.setMessage(currentText.toString().trim());
+ } else if (!qName.equals("Error")) {
+ error.getDetails().put(qName, currentText.toString());
+ }
+ currentText.setLength(0);
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobApiMetadata.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobApiMetadata.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobApiMetadata.java
index 8c5744a..ade52bc 100644
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobApiMetadata.java
+++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobApiMetadata.java
@@ -23,28 +23,15 @@ import java.net.URI;
import java.util.Properties;
import org.jclouds.azureblob.blobstore.config.AzureBlobStoreContextModule;
-import org.jclouds.azureblob.config.AzureBlobRestClientModule;
+import org.jclouds.azureblob.config.AzureBlobHttpApiModule;
import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
-/**
- * Implementation of {@link ApiMetadata} for Microsoft Azure Blob Service API
- */
-public class AzureBlobApiMetadata extends BaseRestApiMetadata {
+public class AzureBlobApiMetadata extends BaseHttpApiMetadata {
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AzureBlobClient.class)} as
- * {@link AzureBlobAsyncClient} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<AzureBlobClient, AzureBlobAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<AzureBlobClient, AzureBlobAsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
-
private static Builder builder() {
return new Builder();
}
@@ -63,15 +50,14 @@ public class AzureBlobApiMetadata extends BaseRestApiMetadata {
}
public static Properties defaultProperties() {
- Properties properties = BaseRestApiMetadata.defaultProperties();
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
properties.setProperty(PROPERTY_USER_METADATA_PREFIX, "x-ms-meta-");
return properties;
}
- public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
- @SuppressWarnings("deprecation")
+ public static class Builder extends BaseHttpApiMetadata.Builder<AzureBlobClient, Builder> {
protected Builder() {
- super(AzureBlobClient.class, AzureBlobAsyncClient.class);
+ super(AzureBlobClient.class);
id("azureblob")
.name("Microsoft Azure Blob Service API")
.identityName("Account Name")
@@ -81,7 +67,7 @@ public class AzureBlobApiMetadata extends BaseRestApiMetadata {
.documentation(URI.create("http://msdn.microsoft.com/en-us/library/dd135733.aspx"))
.defaultProperties(AzureBlobApiMetadata.defaultProperties())
.view(typeToken(BlobStoreContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(AzureBlobRestClientModule.class, AzureBlobStoreContextModule.class));
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(AzureBlobHttpApiModule.class, AzureBlobStoreContextModule.class));
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobAsyncClient.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobAsyncClient.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobAsyncClient.java
deleted file mode 100644
index ea44e96..0000000
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobAsyncClient.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azureblob;
-
-import static com.google.common.net.HttpHeaders.EXPECT;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-
-import org.jclouds.Fallbacks.TrueOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.azure.storage.domain.BoundedSet;
-import org.jclouds.azure.storage.filters.SharedKeyLiteAuthentication;
-import org.jclouds.azure.storage.options.ListOptions;
-import org.jclouds.azure.storage.reference.AzureStorageHeaders;
-import org.jclouds.azureblob.AzureBlobFallbacks.FalseIfContainerAlreadyExists;
-import org.jclouds.azureblob.binders.BindAzureBlobMetadataToRequest;
-import org.jclouds.azureblob.binders.BindAzureBlocksToRequest;
-import org.jclouds.azureblob.domain.BlobProperties;
-import org.jclouds.azureblob.domain.ContainerProperties;
-import org.jclouds.azureblob.domain.ListBlobBlocksResponse;
-import org.jclouds.azureblob.domain.ListBlobsResponse;
-import org.jclouds.azureblob.domain.PublicAccess;
-import org.jclouds.azureblob.functions.BlobName;
-import org.jclouds.azureblob.functions.ParseBlobFromHeadersAndHttpContent;
-import org.jclouds.azureblob.functions.ParseBlobPropertiesFromHeaders;
-import org.jclouds.azureblob.functions.ParseContainerPropertiesFromHeaders;
-import org.jclouds.azureblob.functions.ParsePublicAccessHeader;
-import org.jclouds.azureblob.options.CreateContainerOptions;
-import org.jclouds.azureblob.options.ListBlobsOptions;
-import org.jclouds.azureblob.predicates.validators.BlockIdValidator;
-import org.jclouds.azureblob.predicates.validators.ContainerNameValidator;
-import org.jclouds.azureblob.xml.AccountNameEnumerationResultsHandler;
-import org.jclouds.azureblob.xml.BlobBlocksResultsHandler;
-import org.jclouds.azureblob.xml.ContainerNameEnumerationResultsHandler;
-import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnContainerNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnKeyNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnContainerNotFound;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyNotFound;
-import org.jclouds.blobstore.binders.BindMapToHeadersWithPrefix;
-import org.jclouds.http.functions.ParseETagHeader;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.io.Payload;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.ParamParser;
-import org.jclouds.rest.annotations.ParamValidators;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SkipEncoding;
-import org.jclouds.rest.annotations.XMLResponseParser;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.inject.Provides;
-
-/**
- * Provides asynchronous access to Azure Blob via their REST API.
- * <p/>
- * All commands return a ListenableFuture of the result from Azure Blob. Any exceptions incurred
- * during processing will be backend in an {@link ExecutionException} as documented in
- * {@link ListenableFuture#get()}.
- *
- * @see <a href="http://msdn.microsoft.com/en-us/library/dd135733.aspx" />
- * @see AzureBlobClient
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AzureBlobClient.class)} as
- * {@link AzureBlobAsyncClient} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-@RequestFilters(SharedKeyLiteAuthentication.class)
-@Headers(keys = AzureStorageHeaders.VERSION, values = "2012-02-12")
-@SkipEncoding({ '/', '$' })
-@Path("/")
-public interface AzureBlobAsyncClient {
- @Provides
- org.jclouds.azureblob.domain.AzureBlob newBlob();
-
- /**
- * @see AzureBlobClient#listContainers
- */
- @Named("ListContainers")
- @GET
- @XMLResponseParser(AccountNameEnumerationResultsHandler.class)
- @QueryParams(keys = "comp", values = "list")
- ListenableFuture<? extends BoundedSet<ContainerProperties>> listContainers(ListOptions... listOptions);
-
- /**
- * @see AzureBlobClient#createContainer
- */
- @Named("CreateContainer")
- @PUT
- @Path("{container}")
- @Fallback(FalseIfContainerAlreadyExists.class)
- @QueryParams(keys = "restype", values = "container")
- ListenableFuture<Boolean> createContainer(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- CreateContainerOptions... options);
-
- /**
- * @see AzureBlobClient#getPublicAccessForContainer
- */
- @Named("GetContainerACL")
- @HEAD
- @Path("{container}")
- @QueryParams(keys = { "restype", "comp" }, values = { "container", "acl" })
- @ResponseParser(ParsePublicAccessHeader.class)
- @Fallback(NullOnContainerNotFound.class)
- ListenableFuture<PublicAccess> getPublicAccessForContainer(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
-
- /**
- * @see AzureBlobClient#getContainerProperties
- */
- @Named("GetContainerProperties")
- @HEAD
- @Path("{container}")
- @QueryParams(keys = "restype", values = "container")
- @ResponseParser(ParseContainerPropertiesFromHeaders.class)
- @Fallback(NullOnContainerNotFound.class)
- ListenableFuture<ContainerProperties> getContainerProperties(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
-
- /**
- * @see AzureBlobClient#containerExists
- */
- @Named("GetContainerProperties")
- @HEAD
- @Path("{container}")
- @QueryParams(keys = "restype", values = "container")
- @Fallback(FalseOnContainerNotFound.class)
- ListenableFuture<Boolean> containerExists(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
-
- /**
- * @see AzureBlobClient#setResourceMetadata
- */
- @Named("SetContainerMetadata")
- @PUT
- @Path("{container}")
- @QueryParams(keys = { "restype", "comp" }, values = { "container", "metadata" })
- ListenableFuture<Void> setResourceMetadata(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- @BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> metadata);
-
- /**
- * @see AzureBlobClient#deleteContainer
- */
- @Named("DeleteContainer")
- @DELETE
- @Path("{container}")
- @Fallback(VoidOnNotFoundOr404.class)
- @QueryParams(keys = "restype", values = "container")
- ListenableFuture<Void> deleteContainer(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
-
- /**
- * @see AzureBlobClient#createRootContainer
- */
- @Named("CreateContainer")
- @PUT
- @Path("$root")
- @Fallback(FalseIfContainerAlreadyExists.class)
- @QueryParams(keys = "restype", values = "container")
- ListenableFuture<Boolean> createRootContainer(CreateContainerOptions... options);
-
- /**
- * @see AzureBlobClient#deleteRootContainer
- */
- @Named("DeleteContainer")
- @DELETE
- @Path("$root")
- @Fallback(TrueOnNotFoundOr404.class)
- @QueryParams(keys = "restype", values = "container")
- ListenableFuture<Void> deleteRootContainer();
-
- /**
- * @see AzureBlobClient#listBlobs(String, ListBlobsOptions[])
- */
- @Named("ListBlobs")
- @GET
- @XMLResponseParser(ContainerNameEnumerationResultsHandler.class)
- @Path("{container}")
- @QueryParams(keys = { "restype", "comp" }, values = { "container", "list" })
- ListenableFuture<ListBlobsResponse> listBlobs(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- ListBlobsOptions... options);
-
- /**
- * @see AzureBlobClient#listBlobs(ListBlobsOptions[])
- */
- @Named("ListBlobs")
- @GET
- @XMLResponseParser(ContainerNameEnumerationResultsHandler.class)
- @Path("$root")
- @QueryParams(keys = { "restype", "comp" }, values = { "container", "list" })
- ListenableFuture<ListBlobsResponse> listBlobs(ListBlobsOptions... options);
-
- /**
- * @see AzureBlobClient#putBlob
- */
- @Named("PutBlob")
- @PUT
- @Path("{container}/{name}")
- @Headers(keys = EXPECT, values = "100-continue")
- @ResponseParser(ParseETagHeader.class)
- ListenableFuture<String> putBlob(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- @PathParam("name") @ParamParser(BlobName.class) @BinderParam(BindAzureBlobMetadataToRequest.class) org.jclouds.azureblob.domain.AzureBlob object);
-
- /**
- * @see AzureBlobClient#getBlob
- */
- @Named("GetBlob")
- @GET
- @ResponseParser(ParseBlobFromHeadersAndHttpContent.class)
- @Fallback(NullOnKeyNotFound.class)
- @Path("{container}/{name}")
- ListenableFuture<org.jclouds.azureblob.domain.AzureBlob> getBlob(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- @PathParam("name") String name, GetOptions... options);
-
- /**
- * @see AzureBlobClient#getBlobProperties
- */
- @Named("GetBlobProperties")
- @HEAD
- @ResponseParser(ParseBlobPropertiesFromHeaders.class)
- @Fallback(NullOnKeyNotFound.class)
- @Path("{container}/{name}")
- ListenableFuture<BlobProperties> getBlobProperties(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- @PathParam("name") String name);
-
- /**
- * @see AzureBlobClient#blobExists
- *
- */
- @Named("GetBlobProperties")
- @HEAD
- @Fallback(FalseOnKeyNotFound.class)
- @Path("{container}/{name}")
- ListenableFuture<Boolean> blobExists(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- @PathParam("name") String name);
-
- /**
- * @see AzureBlobClient#setBlobMetadata
- */
- @Named("SetBlobMetadata")
- @PUT
- @Path("{container}/{name}")
- @QueryParams(keys = { "comp" }, values = { "metadata" })
- ListenableFuture<Void> setBlobMetadata(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- @PathParam("name") String name, @BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> metadata);
-
- /**
- * @see AzureBlobClient#deleteBlob
- */
- @Named("DeleteBlob")
- @DELETE
- @Fallback(VoidOnNotFoundOr404.class)
- @Path("{container}/{name}")
- ListenableFuture<Void> deleteBlob(
- @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- @PathParam("name") String name);
-
-
- /**
- * @see AzureBlobClient#putBlock
- */
- @Named("PutBlock")
- @PUT
- @Path("{container}/{name}")
- @QueryParams(keys = { "comp" }, values = { "block" })
- ListenableFuture<Void> putBlock(@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- @PathParam("name") String name,
- @QueryParam("blockid") @ParamValidators(BlockIdValidator.class) String blockId, Payload part);
-
-
- /**
- * @see AzureBlobClient#putBlockList
- */
- @Named("PutBlockList")
- @PUT
- @Path("{container}/{name}")
- @ResponseParser(ParseETagHeader.class)
- @QueryParams(keys = { "comp" }, values = { "blocklist" })
- ListenableFuture<String> putBlockList(@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- @PathParam("name") String name,
- @BinderParam(BindAzureBlocksToRequest.class) List<String> blockIdList);
-
- /**
- * @see AzureBlobClient#getBlockList
- */
- @Named("GetBlockList")
- @GET
- @Path("{container}/{name}")
- @XMLResponseParser(BlobBlocksResultsHandler.class)
- @QueryParams(keys = { "comp" }, values = { "blocklist" })
- ListenableFuture<ListBlobBlocksResponse> getBlockList(@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
- @PathParam("name") String name);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobClient.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobClient.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobClient.java
index 4d78ebb..790a0f4 100644
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobClient.java
+++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobClient.java
@@ -16,32 +16,75 @@
*/
package org.jclouds.azureblob;
+import static com.google.common.net.HttpHeaders.EXPECT;
+import static org.jclouds.Fallbacks.TrueOnNotFoundOr404;
+import static org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import static org.jclouds.azureblob.AzureBlobFallbacks.FalseIfContainerAlreadyExists;
+import static org.jclouds.blobstore.BlobStoreFallbacks.FalseOnContainerNotFound;
+import static org.jclouds.blobstore.BlobStoreFallbacks.FalseOnKeyNotFound;
+import static org.jclouds.blobstore.BlobStoreFallbacks.NullOnContainerNotFound;
+import static org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyNotFound;
+
+import java.io.Closeable;
import java.util.List;
import java.util.Map;
+
+import javax.inject.Named;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+
import org.jclouds.azure.storage.domain.BoundedSet;
+import org.jclouds.azure.storage.filters.SharedKeyLiteAuthentication;
import org.jclouds.azure.storage.options.ListOptions;
+import org.jclouds.azure.storage.reference.AzureStorageHeaders;
+import org.jclouds.azureblob.binders.BindAzureBlobMetadataToRequest;
+import org.jclouds.azureblob.binders.BindAzureBlocksToRequest;
import org.jclouds.azureblob.domain.AzureBlob;
import org.jclouds.azureblob.domain.BlobProperties;
import org.jclouds.azureblob.domain.ContainerProperties;
import org.jclouds.azureblob.domain.ListBlobBlocksResponse;
import org.jclouds.azureblob.domain.ListBlobsResponse;
import org.jclouds.azureblob.domain.PublicAccess;
+import org.jclouds.azureblob.functions.BlobName;
+import org.jclouds.azureblob.functions.ParseBlobFromHeadersAndHttpContent;
+import org.jclouds.azureblob.functions.ParseBlobPropertiesFromHeaders;
+import org.jclouds.azureblob.functions.ParseContainerPropertiesFromHeaders;
+import org.jclouds.azureblob.functions.ParsePublicAccessHeader;
import org.jclouds.azureblob.options.CreateContainerOptions;
import org.jclouds.azureblob.options.ListBlobsOptions;
+import org.jclouds.azureblob.predicates.validators.BlockIdValidator;
+import org.jclouds.azureblob.predicates.validators.ContainerNameValidator;
+import org.jclouds.azureblob.xml.AccountNameEnumerationResultsHandler;
+import org.jclouds.azureblob.xml.BlobBlocksResultsHandler;
+import org.jclouds.azureblob.xml.ContainerNameEnumerationResultsHandler;
+import org.jclouds.blobstore.binders.BindMapToHeadersWithPrefix;
+import org.jclouds.http.functions.ParseETagHeader;
import org.jclouds.http.options.GetOptions;
+import org.jclouds.io.Payload;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.ParamParser;
+import org.jclouds.rest.annotations.ParamValidators;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SkipEncoding;
+import org.jclouds.rest.annotations.XMLResponseParser;
import com.google.inject.Provides;
-import org.jclouds.io.Payload;
-/**
- * Provides access to Azure Blob via their REST API.
- * <p/>
- * All commands return a Future of the result from Azure Blob. Any exceptions incurred during
- * processing will be backend in an {@link ExecutionException} as documented in {@link Future#get()}.
- *
- * @see <a href="http://msdn.microsoft.com/en-us/library/dd135733.aspx" />
- */
-public interface AzureBlobClient {
+/** Provides access to Azure Blob via their REST API. */
+@RequestFilters(SharedKeyLiteAuthentication.class)
+@Headers(keys = AzureStorageHeaders.VERSION, values = "{jclouds.api-version}")
+@SkipEncoding({ '/', '$' })
+@Path("/")
+public interface AzureBlobClient extends Closeable {
@Provides
AzureBlob newBlob();
@@ -54,8 +97,13 @@ public interface AzureBlobClient {
* controls the number or type of results requested
* @see ListOptions
*/
+ @Named("ListContainers")
+ @GET
+ @XMLResponseParser(AccountNameEnumerationResultsHandler.class)
+ @QueryParams(keys = "comp", values = "list")
BoundedSet<ContainerProperties> listContainers(ListOptions... listOptions);
+
/**
* The Create Container operation creates a new container under the specified identity. If the
* container with the same name already exists, the operation fails.
@@ -68,18 +116,38 @@ public interface AzureBlobClient {
* @see CreateContainerOptions
*
*/
- boolean createContainer(String container, CreateContainerOptions... options);
+ @Named("CreateContainer")
+ @PUT
+ @Path("{container}")
+ @Fallback(FalseIfContainerAlreadyExists.class)
+ @QueryParams(keys = "restype", values = "container")
+ boolean createContainer(@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ CreateContainerOptions... options);
+
/**
* The Get Container Properties operation returns all user-defined metadata and system properties
* for the specified container. The data returned does not include the container's list of blobs.
*/
- ContainerProperties getContainerProperties(String container);
+ @Named("GetContainerProperties")
+ @HEAD
+ @Path("{container}")
+ @QueryParams(keys = "restype", values = "container")
+ @ResponseParser(ParseContainerPropertiesFromHeaders.class)
+ @Fallback(NullOnContainerNotFound.class)
+ ContainerProperties getContainerProperties(
+ @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
+
/**
* Issues a HEAD command to determine if the container exists or not.
*/
- boolean containerExists(String container);
+ @Named("GetContainerProperties")
+ @HEAD
+ @Path("{container}")
+ @QueryParams(keys = "restype", values = "container")
+ @Fallback(FalseOnContainerNotFound.class)
+ boolean containerExists(@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
/**
* The Set Container Metadata operation sets one or more user-defined name/value pairs for the
@@ -93,7 +161,14 @@ public interface AzureBlobClient {
* <p/>
* Calling Set Container Metadata updates the ETag for the container.
*/
- void setResourceMetadata(String container, Map<String, String> metadata);
+ @Named("SetContainerMetadata")
+ @PUT
+ @Path("{container}")
+ @QueryParams(keys = { "restype", "comp" }, values = { "container", "metadata" })
+ void setResourceMetadata(
+ @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ @BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> metadata);
+
/**
* The Delete Container operation marks the specified container for deletion. The container and
@@ -108,7 +183,12 @@ public interface AzureBlobClient {
* 404 (Not Found) while the container is being deleted.
*
*/
- void deleteContainer(String container);
+ @Named("DeleteContainer")
+ @DELETE
+ @Path("{container}")
+ @Fallback(VoidOnNotFoundOr404.class)
+ @QueryParams(keys = "restype", values = "container")
+ void deleteContainer(@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
/**
* The root container is a default container that may be inferred from a URL requesting a blob
@@ -121,15 +201,25 @@ public interface AzureBlobClient {
* @see CreateContainerOptions
*
*/
+ @Named("CreateContainer")
+ @PUT
+ @Path("$root")
+ @Fallback(FalseIfContainerAlreadyExists.class)
+ @QueryParams(keys = "restype", values = "container")
boolean createRootContainer(CreateContainerOptions... options);
/**
- *
- *
- * @param container
- * @return whether data in the container may be accessed publicly and the level of access
+ * Returns whether data in the container may be accessed publicly and the level of access
*/
- PublicAccess getPublicAccessForContainer(String container);
+ @Named("GetContainerACL")
+ @HEAD
+ @Path("{container}")
+ @QueryParams(keys = { "restype", "comp" }, values = { "container", "acl" })
+ @ResponseParser(ParsePublicAccessHeader.class)
+ @Fallback(NullOnContainerNotFound.class)
+ PublicAccess getPublicAccessForContainer(
+ @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container);
+
/**
* The Delete Container operation marks the specified container for deletion. The container and
@@ -142,9 +232,14 @@ public interface AzureBlobClient {
* operations, including operations on any blobs under the container, will fail with status code
* 404 (Not Found) while the container is being deleted.
*
- * @see deleteContainer(String)
- * @see createRootContainer(CreateContainerOptions)
+ * @see #deleteContainer(String)
+ * @see #createRootContainer(CreateContainerOptions...)
*/
+ @Named("DeleteContainer")
+ @DELETE
+ @Path("$root")
+ @Fallback(TrueOnNotFoundOr404.class)
+ @QueryParams(keys = "restype", values = "container")
void deleteRootContainer();
/**
@@ -182,8 +277,20 @@ public interface AzureBlobClient {
* <p/>
* Blobs are listed in alphabetical order in the response body.
*/
- ListBlobsResponse listBlobs(String container, ListBlobsOptions... options);
+ @Named("ListBlobs")
+ @GET
+ @XMLResponseParser(ContainerNameEnumerationResultsHandler.class)
+ @Path("{container}")
+ @QueryParams(keys = { "restype", "comp" }, values = { "container", "list" })
+ ListBlobsResponse listBlobs(@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ ListBlobsOptions... options);
+
+ @Named("ListBlobs")
+ @GET
+ @XMLResponseParser(ContainerNameEnumerationResultsHandler.class)
+ @Path("$root")
+ @QueryParams(keys = { "restype", "comp" }, values = { "container", "list" })
ListBlobsResponse listBlobs(ListBlobsOptions... options);
/**
@@ -201,57 +308,107 @@ public interface AzureBlobClient {
* (Request Payload Too Large). The Blob service also returns additional information about the
* error in the response, including the maximum blob size permitted in bytes.
*/
- String putBlob(String container, AzureBlob object);
+ @Named("PutBlob")
+ @PUT
+ @Path("{container}/{name}")
+ @Headers(keys = EXPECT, values = "100-continue")
+ @ResponseParser(ParseETagHeader.class)
+ String putBlob(@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ @PathParam("name") @ParamParser(BlobName.class) @BinderParam(BindAzureBlobMetadataToRequest.class)
+ AzureBlob object);
+
/**
* The Get Blob operation reads or downloads a blob from the system, including its metadata and
* properties.
*/
- AzureBlob getBlob(String container, String name, GetOptions... options);
+ @Named("GetBlob")
+ @GET
+ @ResponseParser(ParseBlobFromHeadersAndHttpContent.class)
+ @Fallback(NullOnKeyNotFound.class)
+ @Path("{container}/{name}")
+ AzureBlob getBlob(@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ @PathParam("name") String name, GetOptions... options);
/**
* The Put Block operation creates a block blob on Azure which can be later assembled into
* a single, large blob object with the Put Block List operation.
- *
- * @see <a href="http://msdn.microsoft.com/en-us/library/windowsazure/dd135726.aspx">Put Blob</a>
*/
- void putBlock(String container, String name, String blockId, Payload object);
+ @Named("PutBlock")
+ @PUT
+ @Path("{container}/{name}")
+ @QueryParams(keys = { "comp" }, values = { "block" })
+ void putBlock(@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ @PathParam("name") String name,
+ @QueryParam("blockid") @ParamValidators(BlockIdValidator.class) String blockId, Payload part);
/**
* The Put Block List assembles a list of blocks previously uploaded with Put Block into a single
* blob. Blocks are either already committed to a blob or uncommitted. The blocks ids passed here
* are searched for first in the uncommitted block list; then committed using the "latest" strategy.
- *
- * @see <a href="http://msdn.microsoft.com/en-us/library/windowsazure/dd179467.aspx">Put Block List</a>
*/
- String putBlockList(String container, String name, List<String> blockIdList);
+ @Named("PutBlockList")
+ @PUT
+ @Path("{container}/{name}")
+ @ResponseParser(ParseETagHeader.class)
+ @QueryParams(keys = { "comp" }, values = { "blocklist" })
+ String putBlockList(@PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ @PathParam("name") String name,
+ @BinderParam(BindAzureBlocksToRequest.class) List<String> blockIdList);
+
+ @Named("GetBlockList")
+ @GET
+ @Path("{container}/{name}")
+ @XMLResponseParser(BlobBlocksResultsHandler.class)
+ @QueryParams(keys = { "comp" }, values = { "blocklist" })
+ ListBlobBlocksResponse getBlockList(
+ @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ @PathParam("name") String name);
- /**
- * Get Block ID List for a blob
- *
- * @see <a href="http://msdn.microsoft.com/en-us/library/windowsazure/dd179400.aspx">Get Block List</a>
- */
- ListBlobBlocksResponse getBlockList(String container, String name);
/**
* The Get Blob Properties operation returns all user-defined metadata, standard HTTP properties,
* and system properties for the blob. It does not return the content of the blob.
*/
- BlobProperties getBlobProperties(String container, String name);
+ @Named("GetBlobProperties")
+ @HEAD
+ @ResponseParser(ParseBlobPropertiesFromHeaders.class)
+ @Fallback(NullOnKeyNotFound.class)
+ @Path("{container}/{name}")
+ BlobProperties getBlobProperties(
+ @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ @PathParam("name") String name);
- void setBlobMetadata(String container, String name, Map<String, String> metadata);
+
+ @Named("SetBlobMetadata")
+ @PUT
+ @Path("{container}/{name}")
+ @QueryParams(keys = { "comp" }, values = { "metadata" })
+ void setBlobMetadata(
+ @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ @PathParam("name") String name, @BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> metadata);
/**
* The Delete Blob operation marks the specified blob for deletion. The blob is later deleted
* during garbage collection.
*/
- void deleteBlob(String container, String name);
-
+ @Named("DeleteBlob")
+ @DELETE
+ @Fallback(VoidOnNotFoundOr404.class)
+ @Path("{container}/{name}")
+ void deleteBlob(
+ @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ @PathParam("name") String name);
/**
- * @throws ContainerNotFoundException
- * if the container is not present.
+ * @throws org.jclouds.blobstore.ContainerNotFoundException if the container is not present.
*/
- boolean blobExists(String container, String name);
+ @Named("GetBlobProperties")
+ @HEAD
+ @Fallback(FalseOnKeyNotFound.class)
+ @Path("{container}/{name}")
+ boolean blobExists(
+ @PathParam("container") @ParamValidators(ContainerNameValidator.class) String container,
+ @PathParam("name") String name);
}
[49/52] [abbrv] git commit: Overriding checkstyle-plugin config in
jclouds-resources
Posted by an...@apache.org.
Overriding checkstyle-plugin config in jclouds-resources
Otherwise, fails with a self-dependency
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/67a0498b
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/67a0498b
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/67a0498b
Branch: refs/heads/use-agentproxy-008
Commit: 67a0498b7ecf3df898982578fa1995d70f3546d1
Parents: f925796
Author: Andrew Phillips <an...@apache.org>
Authored: Sun Oct 5 15:02:22 2014 -0500
Committer: Andrew Phillips <an...@apache.org>
Committed: Mon Oct 6 18:14:15 2014 -0400
----------------------------------------------------------------------
project/pom.xml | 2 --
resources/pom.xml | 12 ++++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/67a0498b/project/pom.xml
----------------------------------------------------------------------
diff --git a/project/pom.xml b/project/pom.xml
index 52cbfed..c5e6693 100644
--- a/project/pom.xml
+++ b/project/pom.xml
@@ -1112,8 +1112,6 @@
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
- <!-- fails on itself as it uses the author tag in a module definition -->
- <resourceExcludes>checkstyle.xml</resourceExcludes>
<violationSeverity>warning</violationSeverity>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/67a0498b/resources/pom.xml
----------------------------------------------------------------------
diff --git a/resources/pom.xml b/resources/pom.xml
index 6282650..a133e0c 100644
--- a/resources/pom.xml
+++ b/resources/pom.xml
@@ -43,6 +43,18 @@
</resources>
<plugins>
<plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>checkstyle.xml</configLocation>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <failOnViolation>true</failOnViolation>
+ <failsOnError>true</failsOnError>
+ <!-- fails on itself as it uses the author tag in a module definition -->
+ <resourceExcludes>checkstyle.xml</resourceExcludes>
+ <violationSeverity>warning</violationSeverity>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<configuration>
[35/52] [abbrv] git commit: Rather than rely on or work around JRE
behavior based, lock S3ClientMockTest using OkHttp.
Posted by an...@apache.org.
Rather than rely on or work around JRE behavior based, lock S3ClientMockTest using OkHttp.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/044223ef
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/044223ef
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/044223ef
Branch: refs/heads/use-agentproxy-008
Commit: 044223efcbabeff90a5bb7197b6e8662d22115f7
Parents: 99e217b
Author: Adrian Cole <ad...@gmail.com>
Authored: Sat Oct 4 10:30:31 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 20:14:45 2014 -0700
----------------------------------------------------------------------
apis/s3/pom.xml | 6 ++++++
apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java | 9 ++-------
2 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/044223ef/apis/s3/pom.xml
----------------------------------------------------------------------
diff --git a/apis/s3/pom.xml b/apis/s3/pom.xml
index dfdbf9d..14ea076 100644
--- a/apis/s3/pom.xml
+++ b/apis/s3/pom.xml
@@ -81,6 +81,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-okhttp</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/044223ef/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java b/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
index 279de59..c9f67dc 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
@@ -31,6 +31,7 @@ import java.util.Set;
import org.jclouds.ContextBuilder;
import org.jclouds.concurrent.config.ExecutorServiceModule;
+import org.jclouds.http.okhttp.config.OkHttpCommandExecutorServiceModule;
import org.jclouds.s3.domain.S3Object;
import org.testng.annotations.Test;
@@ -44,13 +45,11 @@ import com.squareup.okhttp.mockwebserver.RecordedRequest;
@Test(singleThreaded = true)
public class S3ClientMockTest {
- private static final Set<Module> modules = ImmutableSet.<Module> of(
+ private static final Set<Module> modules = ImmutableSet.<Module> of(new OkHttpCommandExecutorServiceModule(),
new ExecutorServiceModule(newDirectExecutorService(), newDirectExecutorService()));
static S3Client getS3Client(URL server) {
Properties overrides = new Properties();
- // prevent expect-100 bug http://code.google.com/p/mockwebserver/issues/detail?id=6
- overrides.setProperty(PROPERTY_SO_TIMEOUT, "0");
overrides.setProperty(PROPERTY_MAX_RETRIES, "1");
return ContextBuilder.newBuilder("s3")
.credentials("accessKey", "secretKey")
@@ -63,8 +62,6 @@ public class S3ClientMockTest {
public void testZeroLengthPutHasContentLengthHeader() throws IOException, InterruptedException {
MockWebServer server = new MockWebServer();
server.enqueue(new MockResponse().addHeader(ETAG, "ABCDEF"));
- // hangs on Java 7 without this additional response ?!?
- server.enqueue(new MockResponse().addHeader(ETAG, "ABCDEF"));
server.play();
S3Client client = getS3Client(server.getUrl("/"));
@@ -77,7 +74,6 @@ public class S3ClientMockTest {
RecordedRequest request = server.takeRequest();
assertEquals(request.getRequestLine(), "PUT /bucket/object HTTP/1.1");
assertEquals(request.getHeaders(CONTENT_LENGTH), ImmutableList.of("0"));
- // will fail unless -Dsun.net.http.allowRestrictedHeaders=true is set
assertEquals(request.getHeaders(EXPECT), ImmutableList.of("100-continue"));
server.shutdown();
}
@@ -96,7 +92,6 @@ public class S3ClientMockTest {
RecordedRequest request = server.takeRequest();
assertEquals(request.getRequestLine(), "PUT /bucket/someDir/fileName HTTP/1.1");
- // will fail unless -Dsun.net.http.allowRestrictedHeaders=true is set
assertEquals(request.getHeaders(EXPECT), ImmutableList.of("100-continue"));
server.shutdown();
[14/52] [abbrv] JCLOUDS-296 unasync legacy swift provider.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyApi.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyApi.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyApi.java
new file mode 100644
index 0000000..6c71dfe
--- /dev/null
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyApi.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.swift.extensions;
+
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.swift.Storage;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.RequestFilters;
+
+/**
+ * Only purpose is to override the auth filter with one that works in keystone
+ */
+@RequestFilters(AuthenticateRequest.class)
+@Endpoint(Storage.class)
+public interface KeystoneTemporaryUrlKeyApi extends TemporaryUrlKeyApi {
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyAsyncApi.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyAsyncApi.java
deleted file mode 100644
index 57c69f3..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/KeystoneTemporaryUrlKeyAsyncApi.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.swift.extensions;
-
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.swift.Storage;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.RequestFilters;
-
-/**
- * Only purpose is to override the auth filter with one that works in keystone
- *
- * @see TemporaryUrlKeyApi
- */
-@RequestFilters(AuthenticateRequest.class)
-@Endpoint(Storage.class)
-public interface KeystoneTemporaryUrlKeyAsyncApi extends TemporaryUrlKeyAsyncApi {
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyApi.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyApi.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyApi.java
index ca20531..0a96960 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyApi.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyApi.java
@@ -16,17 +16,38 @@
*/
package org.jclouds.openstack.swift.extensions;
+import static org.jclouds.openstack.swift.reference.SwiftHeaders.ACCOUNT_TEMPORARY_URL_KEY;
+
+import java.io.Closeable;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import org.jclouds.openstack.filters.AuthenticateRequest;
+import org.jclouds.openstack.swift.Storage;
+import org.jclouds.openstack.swift.functions.ParseTemporaryUrlKeyFromHeaders;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+
+@RequestFilters(AuthenticateRequest.class)
+@Endpoint(Storage.class)
+public interface TemporaryUrlKeyApi extends Closeable {
-/**
- * @see <a href="http://docs.rackspace.com/files/api/v1/cf-devguide/content/Public_Access_to_Account-d1a4440.html" />
- */
-public interface TemporaryUrlKeyApi {
/**
* Retrieve the key used to generate Temporary object access URLs
*
* @return shared secret key or null
- * @see <a href="http://docs.rackspace.com/files/api/v1/cf-devguide/content/Set_Account_Metadata-d1a4460.html" />
*/
+ @Named("GetAccountMetadata")
+ @HEAD
+ @Path("/")
+ @Consumes
+ @ResponseParser(ParseTemporaryUrlKeyFromHeaders.class)
String getTemporaryUrlKey();
/**
@@ -36,9 +57,9 @@ public interface TemporaryUrlKeyApi {
* able to access your temporary URL. If you change it, the TempURL becomes invalid
* (within 60 seconds, which is the cache time for a key) and others will not be allowed
* to access it.
- *
- * @param temporaryUrlKey
- * @see <a href="http://docs.rackspace.com/files/api/v1/cf-devguide/content/Set_Account_Metadata-d1a4460.html" />
*/
- void setTemporaryUrlKey(String temporaryUrlKey);
+ @Named("UpdateAccountMetadata")
+ @POST
+ @Path("/")
+ void setTemporaryUrlKey(@HeaderParam(ACCOUNT_TEMPORARY_URL_KEY) String key);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyAsyncApi.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyAsyncApi.java
deleted file mode 100644
index ca92c12..0000000
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/extensions/TemporaryUrlKeyAsyncApi.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.swift.extensions;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import org.jclouds.openstack.filters.AuthenticateRequest;
-import org.jclouds.openstack.swift.Storage;
-import org.jclouds.openstack.swift.functions.ParseTemporaryUrlKeyFromHeaders;
-import org.jclouds.openstack.swift.reference.SwiftHeaders;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-/**
- * @see TemporaryUrlKeyApi
- * @see <a href="http://docs.openstack.org/trunk/openstack-object-storage/admin/content/swift-tempurl.html">docs</a>
- */
-@RequestFilters(AuthenticateRequest.class)
-@Endpoint(Storage.class)
-public interface TemporaryUrlKeyAsyncApi {
-
- /**
- * @see TemporaryUrlKeyApi#getTemporaryUrlKey
- */
- @Named("GetAccountMetadata")
- @HEAD
- @Path("/")
- @Consumes(MediaType.WILDCARD)
- @ResponseParser(ParseTemporaryUrlKeyFromHeaders.class)
- ListenableFuture<String> getTemporaryUrlKey();
-
- /**
- * @see TemporaryUrlKeyApi#setTemporaryUrlKey
- */
- @Named("UpdateAccountMetadata")
- @POST
- @Path("/")
- ListenableFuture<Void> setTemporaryUrlKey(@HeaderParam(SwiftHeaders.ACCOUNT_TEMPORARY_URL_KEY) String key);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java
index 796eb48..d021eb5 100644
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java
+++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientTest.java
@@ -34,7 +34,7 @@ import org.jclouds.openstack.reference.AuthHeaders;
import org.jclouds.openstack.swift.blobstore.SwiftBlobSigner;
import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule;
import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule;
-import org.jclouds.openstack.swift.config.SwiftRestClientModule;
+import org.jclouds.openstack.swift.config.SwiftHttpApiModule;
import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.testng.annotations.Test;
@@ -50,7 +50,7 @@ import com.google.inject.TypeLiteral;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "CommonSwiftClientTest")
-public abstract class CommonSwiftClientTest extends BaseAsyncClientTest<SwiftAsyncClient> {
+public abstract class CommonSwiftClientTest extends BaseAsyncClientTest<SwiftClient> {
public static final long UNIX_EPOCH_TIMESTAMP = 123456789L;
public static final String TEMPORARY_URL_KEY = "get-or-set-X-Account-Meta-Temp-Url-Key";
@@ -70,7 +70,7 @@ public abstract class CommonSwiftClientTest extends BaseAsyncClientTest<SwiftAsy
}
}
- public static class StaticTimeAndTemporaryUrlKeyModule extends TemporaryUrlExtensionModule<SwiftAsyncClient> {
+ public static class StaticTimeAndTemporaryUrlKeyModule extends TemporaryUrlExtensionModule<SwiftClient> {
@Override
protected Long unixEpochTimestampProvider() {
return UNIX_EPOCH_TIMESTAMP;
@@ -85,7 +85,7 @@ public abstract class CommonSwiftClientTest extends BaseAsyncClientTest<SwiftAsy
@Override
protected void bindRequestSigner() {
- bind(BlobRequestSigner.class).to(new TypeLiteral<SwiftBlobSigner<SwiftAsyncClient>>() {
+ bind(BlobRequestSigner.class).to(new TypeLiteral<SwiftBlobSigner<SwiftClient>>() {
});
}
}
@@ -95,7 +95,7 @@ public abstract class CommonSwiftClientTest extends BaseAsyncClientTest<SwiftAsy
return new SwiftApiMetadata().toBuilder()
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(StorageEndpointModule.class)
- .add(SwiftRestClientModule.class)
+ .add(SwiftHttpApiModule.class)
.add(SwiftBlobStoreContextModule.class)
.add(StaticTimeAndTemporaryUrlKeyModule.class).build()).build();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftClientLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftClientLiveTest.java
index bed0859..ef4bafc 100644
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftClientLiveTest.java
+++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftClientLiveTest.java
@@ -27,7 +27,6 @@ public class SwiftClientLiveTest extends CommonSwiftClientLiveTest<CommonSwiftCl
@Override
public CommonSwiftClient getApi() {
- return view.unwrap(SwiftApiMetadata.CONTEXT_TOKEN).getApi();
+ return view.unwrapApi(CommonSwiftClient.class);
}
-
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftKeystoneClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftKeystoneClientLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftKeystoneClientLiveTest.java
index 58128dc..9ae96e4 100644
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftKeystoneClientLiveTest.java
+++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftKeystoneClientLiveTest.java
@@ -27,6 +27,6 @@ public class SwiftKeystoneClientLiveTest extends CommonSwiftClientLiveTest<Commo
@Override
public CommonSwiftClient getApi() {
- return view.unwrap(SwiftKeystoneApiMetadata.CONTEXT_TOKEN).getApi();
+ return view.unwrapApi(CommonSwiftClient.class);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSignerExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSignerExpectTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSignerExpectTest.java
index 32d66a5..85c9b6b 100644
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSignerExpectTest.java
+++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSignerExpectTest.java
@@ -30,7 +30,7 @@ import org.jclouds.openstack.swift.CommonSwiftClientTest.StorageEndpointModule;
import org.jclouds.openstack.swift.SwiftApiMetadata;
import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule;
import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule.SwiftTemporaryUrlExtensionModule;
-import org.jclouds.openstack.swift.config.SwiftRestClientModule;
+import org.jclouds.openstack.swift.config.SwiftHttpApiModule;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
@@ -139,7 +139,7 @@ public class SwiftBlobSignerExpectTest extends BaseBlobSignerExpectTest {
.defaultModules(
ImmutableSet.<Class<? extends Module>> builder()
.add(StorageEndpointModule.class)
- .add(SwiftRestClientModule.class)
+ .add(SwiftHttpApiModule.class)
.add(SwiftBlobStoreContextModule.class)
.add(StaticTimeAndTemporaryUrlKeyModule.class).build()).build();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftKeystoneBlobSignerExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftKeystoneBlobSignerExpectTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftKeystoneBlobSignerExpectTest.java
index af087b4..5e761ba 100644
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftKeystoneBlobSignerExpectTest.java
+++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftKeystoneBlobSignerExpectTest.java
@@ -26,13 +26,13 @@ import org.jclouds.apis.ApiMetadata;
import org.jclouds.blobstore.internal.BaseBlobSignerExpectTest;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.keystone.v2_0.config.AuthenticationApiModule;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
-import org.jclouds.openstack.keystone.v2_0.config.MappedAuthenticationApiModule;
import org.jclouds.openstack.swift.SwiftKeystoneApiMetadata;
import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule;
import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule.SwiftKeystoneTemporaryUrlExtensionModule;
-import org.jclouds.openstack.swift.config.SwiftKeystoneRestClientModule;
-import org.jclouds.openstack.swift.config.SwiftRestClientModule.KeystoneStorageEndpointModule;
+import org.jclouds.openstack.swift.config.SwiftHttpApiModule.KeystoneStorageEndpointModule;
+import org.jclouds.openstack.swift.config.SwiftKeystoneHttpApiModule;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
@@ -139,10 +139,10 @@ public class SwiftKeystoneBlobSignerExpectTest extends BaseBlobSignerExpectTest
protected ApiMetadata createApiMetadata() {
return new SwiftKeystoneApiMetadata().toBuilder()
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
- .add(MappedAuthenticationApiModule.class)
+ .add(AuthenticationApiModule.class)
.add(KeystoneStorageEndpointModule.class)
.add(KeystoneAuthenticationModule.RegionModule.class)
- .add(SwiftKeystoneRestClientModule.class)
+ .add(SwiftKeystoneHttpApiModule.class)
.add(SwiftBlobStoreContextModule.class)
.add(StaticTimeAndTemporaryUrlKeyModule.class).build()).build();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/test/java/org/jclouds/openstack/swift/config/KeystoneStorageEndpointModuleTest.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/config/KeystoneStorageEndpointModuleTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/config/KeystoneStorageEndpointModuleTest.java
index 24e2aa8..3ca670f 100644
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/config/KeystoneStorageEndpointModuleTest.java
+++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/config/KeystoneStorageEndpointModuleTest.java
@@ -32,7 +32,7 @@ import java.util.Map;
import org.jclouds.location.suppliers.RegionIdToURISupplier;
import org.jclouds.openstack.services.ServiceType;
-import org.jclouds.openstack.swift.config.SwiftRestClientModule.KeystoneStorageEndpointModule;
+import org.jclouds.openstack.swift.config.SwiftHttpApiModule.KeystoneStorageEndpointModule;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/bbad831c/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java
deleted file mode 100644
index 4c30b84..0000000
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.swift.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
-import static com.google.common.util.concurrent.Futures.transform;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.blobstore.LocalAsyncBlobStore;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.functions.HttpGetOptionsListToGetOptions;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.lifecycle.Closer;
-import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
-import org.jclouds.openstack.swift.blobstore.functions.BlobToObject;
-import org.jclouds.openstack.swift.blobstore.functions.ListContainerOptionsToBlobStoreListContainerOptions;
-import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlob;
-import org.jclouds.openstack.swift.blobstore.functions.ResourceToObjectInfo;
-import org.jclouds.openstack.swift.blobstore.functions.ResourceToObjectList;
-import org.jclouds.openstack.swift.domain.AccountMetadata;
-import org.jclouds.openstack.swift.domain.ContainerMetadata;
-import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata;
-import org.jclouds.openstack.swift.domain.ObjectInfo;
-import org.jclouds.openstack.swift.domain.SwiftObject;
-import org.jclouds.openstack.swift.options.CreateContainerOptions;
-
-import com.google.common.base.Function;
-import com.google.common.base.Throwables;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * Implementation of {@link SwiftAsyncClient} which keeps all data in a local Map object.
- */
-@Singleton
-public class StubSwiftAsyncClient implements CommonSwiftAsyncClient {
- private final HttpGetOptionsListToGetOptions httpGetOptionsConverter;
- private final LocalAsyncBlobStore blobStore;
- private final SwiftObject.Factory objectProvider;
- private final ObjectToBlob object2Blob;
- private final BlobToObject blob2Object;
- private final ResourceToObjectInfo blob2ObjectInfo;
- private final ListContainerOptionsToBlobStoreListContainerOptions container2ContainerListOptions;
- private final ResourceToObjectList resource2ObjectList;
- private final ListeningExecutorService userExecutor;
- private final Closer closer;
-
- @Inject
- private StubSwiftAsyncClient(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- LocalAsyncBlobStore blobStore,
- SwiftObject.Factory objectProvider, HttpGetOptionsListToGetOptions httpGetOptionsConverter,
- ObjectToBlob object2Blob, BlobToObject blob2Object, ResourceToObjectInfo blob2ObjectInfo,
- ListContainerOptionsToBlobStoreListContainerOptions container2ContainerListOptions,
- ResourceToObjectList resource2ContainerList, Closer closer) {
- this.userExecutor = userExecutor;
- this.blobStore = blobStore;
- this.objectProvider = objectProvider;
- this.httpGetOptionsConverter = httpGetOptionsConverter;
- this.object2Blob = checkNotNull(object2Blob, "object2Blob");
- this.blob2Object = checkNotNull(blob2Object, "blob2Object");
- this.blob2ObjectInfo = checkNotNull(blob2ObjectInfo, "blob2ObjectInfo");
- this.container2ContainerListOptions = checkNotNull(container2ContainerListOptions,
- "container2ContainerListOptions");
- this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList");
- this.closer = checkNotNull(closer, "closer");
- }
-
- public ListenableFuture<Boolean> containerExists(final String container) {
- return blobStore.containerExists(container);
- }
-
- public ListenableFuture<Boolean> createContainer(String container) {
- return blobStore.createContainerInLocation(null, container);
- }
-
- public ListenableFuture<Boolean> deleteContainerIfEmpty(String container) {
- return blobStore.deleteContainerIfEmpty(container);
- }
-
- public ListenableFuture<Boolean> disableCDN(String container) {
- throw new UnsupportedOperationException();
- }
-
- public ListenableFuture<URI> enableCDN(String container, long ttl) {
- throw new UnsupportedOperationException();
- }
-
- public ListenableFuture<URI> enableCDN(String container) {
- throw new UnsupportedOperationException();
- }
-
- public ListenableFuture<AccountMetadata> getAccountStatistics() {
- throw new UnsupportedOperationException();
- }
-
- public ListenableFuture<SwiftObject> getObject(String container, String key, GetOptions... options) {
- org.jclouds.blobstore.options.GetOptions getOptions = httpGetOptionsConverter.apply(options);
- return transform(blobStore.getBlob(container, key, getOptions), blob2Object, userExecutor);
- }
-
- public ListenableFuture<MutableObjectInfoWithMetadata> getObjectInfo(String container, String key) {
- return transform(blobStore.blobMetadata(container, key),
- new Function<BlobMetadata, MutableObjectInfoWithMetadata>() {
-
- @Override
- public MutableObjectInfoWithMetadata apply(BlobMetadata from) {
-
- return blob2ObjectInfo.apply(from);
- }
-
- }, userExecutor);
- }
-
- public ListenableFuture<? extends Set<ContainerMetadata>> listContainers(
- org.jclouds.openstack.swift.options.ListContainerOptions... options) {
- PageSet<? extends StorageMetadata> listing;
- try {
- listing = blobStore.list().get();
- } catch (ExecutionException ee) {
- throw Throwables.propagate(ee);
- } catch (InterruptedException ie) {
- throw Throwables.propagate(ie);
- }
- return immediateFuture(Sets.newHashSet(Iterables.transform(listing,
- new Function<StorageMetadata, ContainerMetadata>() {
- public ContainerMetadata apply(StorageMetadata md) {
- return ContainerMetadata.builder().name(md.getName()).count(-1).bytes(-1).metadata(new HashMap<String, String>()).build();
- }
- })));
- }
-
- @Override
- public ListenableFuture<ContainerMetadata> getContainerMetadata(String container) {
- throw new UnsupportedOperationException();
- }
-
- public ListenableFuture<Boolean> setContainerMetadata(String container, Map<String, String> containerMetadata) {
- throw new UnsupportedOperationException();
- }
-
- public ListenableFuture<Boolean> deleteContainerMetadata(String container, Iterable<String> metadataKeys) {
- throw new UnsupportedOperationException();
- }
-
- public ListenableFuture<Boolean> createContainer(String container, CreateContainerOptions... options) {
- throw new UnsupportedOperationException();
- }
-
- public ListenableFuture<PageSet<ObjectInfo>> listObjects(String container,
- org.jclouds.openstack.swift.options.ListContainerOptions... optionsList) {
- ListContainerOptions options = container2ContainerListOptions.apply(optionsList);
- return transform(blobStore.list(container, options), resource2ObjectList, userExecutor);
- }
-
- public ListenableFuture<Boolean> copyObject(String sourceContainer, String sourceObject, String destinationContainer, String destinationObject) {
- throw new UnsupportedOperationException();
- }
-
- public ListenableFuture<String> putObject(String container, SwiftObject object) {
- return blobStore.putBlob(container, object2Blob.apply(object));
- }
-
- public ListenableFuture<Void> removeObject(String container, String key) {
- return blobStore.removeBlob(container, key);
- }
-
- @Override
- public ListenableFuture<String> putObjectManifest(String container, String name) {
- return null;
- }
-
- public ListenableFuture<Boolean> setObjectInfo(String container, String key, Map<String, String> userMetadata) {
- throw new UnsupportedOperationException();
- }
-
- public ListenableFuture<URI> updateCDN(String container, long ttl) {
- throw new UnsupportedOperationException();
- }
-
- public SwiftObject newSwiftObject() {
- return objectProvider.create(null);
- }
-
- @Override
- public ListenableFuture<Boolean> objectExists(String bucketName, String key) {
- return blobStore.blobExists(bucketName, key);
- }
-
- @Override
- public void close() throws IOException {
- closer.close();
- }
-}
[13/52] [abbrv] git commit: JCLOUDS-296 unasync keystone used by
swift derivatives and cloudfiles.
Posted by an...@apache.org.
JCLOUDS-296 unasync keystone used by swift derivatives and cloudfiles.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/dda43dfc
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/dda43dfc
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/dda43dfc
Branch: refs/heads/use-agentproxy-008
Commit: dda43dfc32955e2a0ab17f02577d69a2ec58282c
Parents: c13220d
Author: Adrian Cole <ac...@twitter.com>
Authored: Fri Oct 3 19:09:40 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Fri Oct 3 23:13:54 2014 -0700
----------------------------------------------------------------------
.../keystone/v2_0/AuthenticationAsyncApi.java | 93 -----------
.../keystone/v2_0/KeystoneApiMetadata.java | 9 -
.../keystone/v2_0/KeystoneAsyncApi.java | 117 -------------
.../config/KeystoneAuthenticationModule.java | 2 +-
.../v2_0/config/KeystoneRestClientModule.java | 167 -------------------
.../config/MappedAuthenticationApiModule.java | 40 -----
.../v2_0/extensions/RoleAdminAsyncApi.java | 110 ------------
.../v2_0/extensions/ServiceAdminAsyncApi.java | 126 --------------
.../v2_0/extensions/TenantAdminAsyncApi.java | 137 ---------------
.../v2_0/extensions/UserAdminAsyncApi.java | 113 -------------
.../keystone/v2_0/features/ServiceAsyncApi.java | 58 -------
.../keystone/v2_0/features/TenantAsyncApi.java | 101 -----------
.../keystone/v2_0/features/TokenAsyncApi.java | 94 -----------
.../keystone/v2_0/features/UserAsyncApi.java | 125 --------------
.../config/OpenStackAuthenticationModule.java | 5 +-
.../internal/OpenStackAuthAsyncClient.java | 57 -------
.../openstack/internal/OpenStackAuthClient.java | 6 +-
.../v1_1/AuthenticationAsyncClient.java | 54 ------
.../keystone/v1_1/AuthenticationClient.java | 11 +-
.../config/AuthenticationServiceModule.java | 5 +-
.../internal/OpenStackAuthAsyncClientTest.java | 80 ---------
.../internal/OpenStackAuthClientTest.java | 77 +++++++++
22 files changed, 93 insertions(+), 1494 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationAsyncApi.java
deleted file mode 100644
index 295f9ff..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationAsyncApi.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0;
-
-import java.io.Closeable;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.keystone.v2_0.binders.BindAuthToJsonPayload;
-import org.jclouds.openstack.keystone.v2_0.domain.Access;
-import org.jclouds.openstack.keystone.v2_0.domain.ApiAccessKeyCredentials;
-import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Service via their REST API.
- * <p/>
- *
- * @see AuthenticationApi
- * @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Api_Operations.html"
- * />
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported. please use {@link AuthenticationApi}
- */
-@Deprecated
-public interface AuthenticationAsyncApi extends Closeable {
-
- /**
- * @see AuthenticationApi#authenticateWithTenantNameAndCredentials(String,PasswordCredentials)
- */
- @POST
- @SelectJson("access")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tokens")
- @MapBinder(BindAuthToJsonPayload.class)
- ListenableFuture<Access> authenticateWithTenantNameAndCredentials(@Nullable @PayloadParam("tenantName") String tenantName,
- PasswordCredentials passwordCredentials);
-
- /**
- * @see AuthenticationApi#authenticateWithTenantIdAndCredentials(String,PasswordCredentials)
- */
- @POST
- @SelectJson("access")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tokens")
- @MapBinder(BindAuthToJsonPayload.class)
- ListenableFuture<Access> authenticateWithTenantIdAndCredentials(@Nullable @PayloadParam("tenantId") String tenantId,
- PasswordCredentials passwordCredentials);
-
- /**
- * @see AuthenticationApi#authenticateWithTenantNameAndCredentials(String,ApiAccessKeyCredentials)
- */
- @POST
- @SelectJson("access")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tokens")
- @MapBinder(BindAuthToJsonPayload.class)
- ListenableFuture<Access> authenticateWithTenantNameAndCredentials(@Nullable @PayloadParam("tenantName") String tenantName,
- ApiAccessKeyCredentials apiAccessKeyCredentials);
-
- /**
- * @see AuthenticationApi#authenticateWithTenantIdAndCredentials(String,ApiAccessKeyCredentials)
- */
- @POST
- @SelectJson("access")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tokens")
- @MapBinder(BindAuthToJsonPayload.class)
- ListenableFuture<Access> authenticateWithTenantIdAndCredentials(@Nullable @PayloadParam("tenantId") String tenantId,
- ApiAccessKeyCredentials apiAccessKeyCredentials);
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java
index ff21237..a46df20 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java
@@ -40,15 +40,6 @@ import com.google.inject.Module;
*/
public class KeystoneApiMetadata extends BaseHttpApiMetadata<KeystoneApi> {
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(KeystoneApi.class)} as
- * {@link KeystoneAsyncApi} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<KeystoneApi, KeystoneAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<KeystoneApi, KeystoneAsyncApi>>() {
- private static final long serialVersionUID = 1L;
- };
-
@Override
public Builder<?> toBuilder() {
return new ConcreteBuilder().fromApiMetadata(this);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java
deleted file mode 100644
index 426cce6..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0;
-
-import java.io.Closeable;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata;
-import org.jclouds.openstack.keystone.v2_0.extensions.RoleAdminAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.extensions.ServiceAdminAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.extensions.TenantAdminAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.extensions.UserAdminAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.features.ServiceAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.features.TenantAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.features.TokenAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.features.UserAsyncApi;
-import org.jclouds.openstack.v2_0.features.ExtensionAsyncApi;
-import org.jclouds.rest.annotations.Delegate;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides access to OpenStack keystone resources via their REST API.
- * <p/>
- *
- * @see <a href="http://keystone.openstack.org/" />
- * @see KeystoneApi
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(KeystoneApi.class)} as
- * {@link KeystoneAsyncApi} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-public interface KeystoneAsyncApi extends Closeable {
-
- /**
- * @see KeystoneApi#getApiMetadata()
- */
- @GET
- @SelectJson("version")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<ApiMetadata> getApiMetadata();
-
- /**
- * @see KeystoneApi#getServiceApi()
- */
- @Delegate
- ServiceAsyncApi getServiceApi();
-
- /**
- * Provides asynchronous access to Extension features.
- */
- @Delegate
- ExtensionAsyncApi getExtensionApi();
-
- /**
- * @see KeystoneApi#getTokenApi()
- */
- @Delegate
- Optional<? extends TokenAsyncApi> getTokenApi();
-
- /**
- * @see KeystoneApi#getUserApi()
- */
- @Delegate
- Optional<? extends UserAsyncApi> getUserApi();
-
- /**
- * @see KeystoneApi#getTenantApi()
- */
- @Delegate
- Optional<? extends TenantAsyncApi> getTenantApi();
-
- /**
- * @see KeystoneApi#getUserAdminApi()
- */
- @Delegate
- Optional<? extends UserAdminAsyncApi> getUserAdminApi();
-
- /**
- * @see KeystoneApi#getTenantAdminApi()
- */
- @Delegate
- Optional<? extends TenantAdminAsyncApi> getTenantAdminApi();
-
- /**
- * @see KeystoneApi#getRoleAdminApi()
- */
- @Delegate
- Optional<? extends RoleAdminAsyncApi> getRoleAdminApi();
-
- /**
- * @see KeystoneApi#getServiceAdminApi()
- */
- @Delegate
- Optional<? extends ServiceAdminAsyncApi> getServiceAdminApi();
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java
index eaff908..90e5488 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java
@@ -77,7 +77,7 @@ public class KeystoneAuthenticationModule extends AbstractModule {
* <li>add this module to your {@link org.jclouds.apis.ApiMetadata#getDefaultModules()}</li>
* <li>create a service-specific annotation, such as {@code @CloudDNS}, and make sure that has the meta-annotation
* {@link javax.inject.Qualifier}</li>
- * <li>add the above annotation to any {@link AsyncApi} classes by placing it on the type. ex.
+ * <li>add the above annotation to any {@code Api} classes by placing it on the type. ex.
* {@code @Endpoint(CloudDNS.class)}</li>
* <li>add the following to your {@link org.jclouds.rest.config.RestClientModule}</li>
*
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneRestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneRestClientModule.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneRestClientModule.java
deleted file mode 100644
index 4824edf..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneRestClientModule.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.config;
-
-import static org.jclouds.reflect.Reflection2.typeToken;
-import static org.jclouds.util.Suppliers2.getLastValueInMap;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.location.Provider;
-import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
-import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.extensions.RoleAdminApi;
-import org.jclouds.openstack.keystone.v2_0.extensions.RoleAdminAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.extensions.ServiceAdminApi;
-import org.jclouds.openstack.keystone.v2_0.extensions.ServiceAdminAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.extensions.TenantAdminApi;
-import org.jclouds.openstack.keystone.v2_0.extensions.TenantAdminAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.extensions.UserAdminApi;
-import org.jclouds.openstack.keystone.v2_0.extensions.UserAdminAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.features.ServiceApi;
-import org.jclouds.openstack.keystone.v2_0.features.ServiceAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.features.TenantApi;
-import org.jclouds.openstack.keystone.v2_0.features.TenantAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.features.TokenApi;
-import org.jclouds.openstack.keystone.v2_0.features.TokenAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.features.UserApi;
-import org.jclouds.openstack.keystone.v2_0.features.UserAsyncApi;
-import org.jclouds.openstack.keystone.v2_0.handlers.KeystoneErrorHandler;
-import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURIFromAccessForTypeAndVersion;
-import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURISupplier;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.domain.Extension;
-import org.jclouds.openstack.v2_0.features.ExtensionApi;
-import org.jclouds.openstack.v2_0.features.ExtensionAsyncApi;
-import org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet;
-import org.jclouds.openstack.v2_0.services.Identity;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.annotations.ApiVersion;
-import org.jclouds.rest.config.RestClientModule;
-import org.jclouds.rest.functions.ImplicitOptionalConverter;
-import org.jclouds.util.Suppliers2;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
-import com.google.common.reflect.TypeToken;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.assistedinject.FactoryModuleBuilder;
-
-/**
- * Configures the Keystone connection.
- */
-@ConfiguresRestClient
-public class KeystoneRestClientModule<S extends KeystoneApi, A extends KeystoneAsyncApi> extends
- RestClientModule<S, A> {
-
- public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
- .put(ServiceApi.class, ServiceAsyncApi.class)
- .put(ExtensionApi.class, ExtensionAsyncApi.class)
- .put(TokenApi.class, TokenAsyncApi.class)
- .put(UserApi.class, UserAsyncApi.class)
- .put(TenantApi.class, TenantAsyncApi.class)
- .put(UserAdminApi.class, UserAdminAsyncApi.class)
- .put(TenantAdminApi.class, TenantAdminAsyncApi.class)
- .put(RoleAdminApi.class, RoleAdminAsyncApi.class)
- .put(ServiceAdminApi.class, ServiceAdminAsyncApi.class)
- .build();
-
- @SuppressWarnings("unchecked")
- public KeystoneRestClientModule() {
- super(TypeToken.class.cast(typeToken(KeystoneApi.class)), TypeToken.class.cast(typeToken(KeystoneAsyncApi.class)), DELEGATE_MAP);
- }
-
- protected KeystoneRestClientModule(TypeToken<S> syncApiType, TypeToken<A> asyncApiType, Map<Class<?>, Class<?>> sync2Async) {
- super(syncApiType, asyncApiType, sync2Async);
- }
-
- public static class KeystoneAdminURLModule extends AbstractModule {
-
- @Override
- protected void configure() {
- install(new FactoryModuleBuilder().implement(RegionIdToAdminURISupplier.class,
- RegionIdToAdminURIFromAccessForTypeAndVersion.class).build(RegionIdToAdminURISupplier.Factory.class));
- }
-
- /**
- * in some cases, there is no {@link ServiceType#IDENTITY} entry in the service catalog. In
- * other cases, there's no adminURL entry present. Fallback to the provider in this case.
- */
- @Provides
- @Singleton
- @Identity
- protected Supplier<URI> provideStorageUrl(final RegionIdToAdminURISupplier.Factory factory,
- @ApiVersion final String version, @Provider final Supplier<URI> providerURI) {
- Supplier<URI> identityServiceForVersion = getLastValueInMap(factory.createForApiTypeAndVersion(
- ServiceType.IDENTITY, version));
- Supplier<URI> whenIdentityServiceIsntListedFallbackToProviderURI = Suppliers2.onThrowable(
- identityServiceForVersion, NoSuchElementException.class, providerURI);
- Supplier<URI> whenIdentityServiceHasNoAdminURLFallbackToProviderURI = Suppliers2.or(
- whenIdentityServiceIsntListedFallbackToProviderURI, providerURI);
- return whenIdentityServiceHasNoAdminURLFallbackToProviderURI;
- }
- }
-
- @Override
- protected void configure() {
- bind(ImplicitOptionalConverter.class).to(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.class);
- super.configure();
- }
-
- @Provides
- @Singleton
- public Multimap<URI, URI> aliases() {
- return ImmutableMultimap.<URI, URI>builder()
- .build();
- }
-
- @Provides
- @Singleton
- public LoadingCache<String, Set<? extends Extension>> provideExtensionsByRegion(final javax.inject.Provider<KeystoneApi> keystoneApi) {
- return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS)
- .build(CacheLoader.from(Suppliers.memoize(new Supplier<Set<? extends Extension>>() {
- @Override
- public Set<? extends Extension> get() {
- return keystoneApi.get().getExtensionApi().list();
- }
- })));
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(KeystoneErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(KeystoneErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(KeystoneErrorHandler.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/MappedAuthenticationApiModule.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/MappedAuthenticationApiModule.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/MappedAuthenticationApiModule.java
deleted file mode 100644
index 6c0dfba..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/MappedAuthenticationApiModule.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.config;
-
-import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi;
-
-import org.jclouds.openstack.keystone.v2_0.AuthenticationApi;
-import org.jclouds.openstack.keystone.v2_0.AuthenticationAsyncApi;
-
-import com.google.inject.AbstractModule;
-
-/**
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported. please use {@link AuthenticationApiModule}
- */
-@Deprecated
-public class MappedAuthenticationApiModule extends AbstractModule {
-
- @Override
- protected void configure() {
- // AuthenticationApi is used directly for filters and retry handlers, so let's bind it explicitly
- bindSyncToAsyncHttpApi(binder(), AuthenticationApi.class, AuthenticationAsyncApi.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminAsyncApi.java
deleted file mode 100644
index fe4ef53..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminAsyncApi.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.domain.Role;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.WrapWith;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to roles Administration actions.
- * <p/>
- *
- * @see org.jclouds.openstack.keystone.v2_0.extensions.RoleAdminApi
- */
-@Beta
-@Extension(of = ServiceType.IDENTITY, namespace = ExtensionNamespaces.OS_KSADM)
-@RequestFilters(AuthenticateRequest.class)
-public interface RoleAdminAsyncApi {
-
- /**
- * Returns a summary list of roles.
- *
- * @return The list of roles
- */
- @Named("role:list")
- @GET
- @Path("OS-KSADM/roles")
- @SelectJson("roles")
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- ListenableFuture<? extends FluentIterable<? extends Role>> list();
-
- /**
- * Creates a new role
- *
- * @return the new role
- */
- @Named("role:create")
- @POST
- @Path("OS-KSADM/roles")
- @SelectJson("role")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- @WrapWith("role")
- ListenableFuture<? extends Role> create(@PayloadParam("name") String name);
-
- /**
- * Gets the role
- *
- * @return the role
- */
- @Named("role:get")
- @GET
- @SelectJson("role")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("OS-KSADM/roles/{roleId}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Role> get(@PathParam("roleId") String roleId);
-
- /**
- * Deletes an role.
- *
- * @return true if successful
- */
- @Named("role:delete")
- @DELETE
- @Path("OS-KSADM/roles/{id}")
- @Consumes
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> delete(@PathParam("id") String id);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminAsyncApi.java
deleted file mode 100644
index 1dc0f3d..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminAsyncApi.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.collect.PagedIterable;
-import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.domain.Service;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseServices;
-import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseServices.ToPagedIterable;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.Transform;
-import org.jclouds.rest.annotations.WrapWith;
-
-import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to services Administration actions.
- * <p/>
- *
- * @see org.jclouds.openstack.keystone.v2_0.extensions.ServiceAdminApi
- */
-@Beta
-@Extension(of = ServiceType.IDENTITY, namespace = ExtensionNamespaces.OS_KSADM)
-@RequestFilters(AuthenticateRequest.class)
-public interface ServiceAdminAsyncApi {
-
- /**
- * @see ServiceApi#list()
- */
- @Named("service:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("OS-KSADM/services")
- @ResponseParser(ParseServices.class)
- @Transform(ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- ListenableFuture<? extends PagedIterable<? extends Service>> list();
-
- /** @see ServiceApi#list(PaginationOptions) */
- @Named("service:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("OS-KSADM/services")
- @ResponseParser(ParseServices.class)
- @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
- ListenableFuture<? extends PaginatedCollection<? extends Service>> list(PaginationOptions options);
-
- /**
- * Creates a new service
- *
- * @return the new service
- */
- @Named("service:create")
- @POST
- @Path("OS-KSADM/services")
- @SelectJson("OS-KSADM:service")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @WrapWith("OS-KSADM:service")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Service> create(@PayloadParam("name") String name, @PayloadParam("type") String type,
- @PayloadParam("description") String description);
-
- /**
- * Gets the service
- *
- * @return the service
- */
- @Named("service:get")
- @GET
- @SelectJson("OS-KSADM:service")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("OS-KSADM/services/{serviceId}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Service> get(@PathParam("serviceId") String serviceId);
-
- /**
- * Deletes a service.
- *
- * @return true if successful
- */
- @Named("service:delete")
- @DELETE
- @Path("OS-KSADM/services/{id}")
- @Consumes
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> delete(@PathParam("id") String id);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminAsyncApi.java
deleted file mode 100644
index 8a4ca7f..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminAsyncApi.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.keystone.v2_0.options.CreateTenantOptions;
-import org.jclouds.openstack.keystone.v2_0.options.UpdateTenantOptions;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to tenants Administration actions.
- * <p/>
- *
- * @see org.jclouds.openstack.keystone.v2_0.extensions.TenantAdminApi
- */
-@Beta
-@Extension(of = ServiceType.IDENTITY, namespace = ExtensionNamespaces.OS_KSADM)
-@RequestFilters(AuthenticateRequest.class)
-public interface TenantAdminAsyncApi {
-
- /**
- * Creates a new tenant
- *
- * @return the new tenant
- */
- @Named("tenant:create")
- @POST
- @Path("/tenants")
- @SelectJson("tenant")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Tenant> create(@PayloadParam("name") String name);
-
- /**
- * Creates a new tenant
- *
- * @return the new tenant
- */
- @Named("tenant:create")
- @POST
- @Path("/tenants")
- @SelectJson("tenant")
- @Consumes(MediaType.APPLICATION_JSON)
- @MapBinder(CreateTenantOptions.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Tenant> create(@PayloadParam("name") String name, CreateTenantOptions options);
-
- /**
- * Deletes a tenant.
- *
- * @return true if successful
- */
- @Named("tenant:delete")
- @DELETE
- @Path("/tenants/{id}")
- @Consumes
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> delete(@PathParam("id") String id);
-
- /**
- * Updates a tenant
- *
- * @return the updated tenant
- */
- @Named("tenant:updatetenant")
- @PUT
- @Path("/tenants/{id}")
- @SelectJson("tenant")
- @Consumes(MediaType.APPLICATION_JSON)
- @MapBinder(UpdateTenantOptions.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Tenant> update(@PathParam("id") String id, UpdateTenantOptions options);
-
- /**
- * Adds role to a user on a tenant
- *
- * @return true if successful
- */
- @Named("tenant:addroleontenant")
- @PUT
- @Path("/tenants/{id}/users/{userId}/roles/OS-KSADM/{roleId}")
- @Consumes
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> addRoleOnTenant(@PathParam("id") String tenantId, @PathParam("userId") String userdId,
- @PathParam("roleId") String roleId);
-
- /**
- * Deletes role to a user on tenant
- *
- * @return
- */
- @Named("tenant:deleteroleontenant")
- @DELETE
- @Path("/tenants/{id}/users/{userId}/roles/OS-KSADM/{roleId}")
- @Consumes
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> deleteRoleOnTenant(@PathParam("id") String tenantId, @PathParam("userId") String userdId,
- @PathParam("roleId") String roleId);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminAsyncApi.java
deleted file mode 100644
index b343c28..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminAsyncApi.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.extensions;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.domain.User;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.keystone.v2_0.options.CreateUserOptions;
-import org.jclouds.openstack.keystone.v2_0.options.UpdateUserOptions;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.openstack.v2_0.services.Extension;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Users Administration actions.
- * <p/>
- *
- * @see org.jclouds.openstack.keystone.v2_0.extensions.UserAdminApi
- */
-@Beta
-@Extension(of = ServiceType.IDENTITY, namespace = ExtensionNamespaces.OS_KSADM)
-@RequestFilters(AuthenticateRequest.class)
-public interface UserAdminAsyncApi {
-
- /**
- * Creates a new user
- *
- * @return the new user
- */
- @Named("user:create")
- @POST
- @Path("/users")
- @SelectJson("user")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends User> create(@PayloadParam("name") String name,
- @PayloadParam("password") String password);
-
- /**
- * Creates a new user
- *
- * @return the new user
- */
- @Named("user:create")
- @POST
- @Path("/users")
- @SelectJson("user")
- @Consumes(MediaType.APPLICATION_JSON)
- @MapBinder(CreateUserOptions.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends User> create(@PayloadParam("name") String name,
- @PayloadParam("password") String password, CreateUserOptions options);
-
- /**
- * Deletes an user.
- *
- * @return true if successful
- */
- @Named("user:delete")
- @DELETE
- @Path("/users/{id}")
- @Consumes
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> delete(@PathParam("id") String id);
-
- /**
- * Updates an user
- *
- * @return the updated user
- */
- @Named("user:updateuser")
- @PUT
- @Path("/users/{id}")
- @SelectJson("user")
- @Consumes(MediaType.APPLICATION_JSON)
- @MapBinder(UpdateUserOptions.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends User> update(@PathParam("id") String id, UpdateUserOptions options);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceAsyncApi.java
deleted file mode 100644
index 5b70c59..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceAsyncApi.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Service via their REST API.
- * <p/>
- *
- * @see ServiceApi
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Api_Operations.html"
- * />
- */
-public interface ServiceAsyncApi {
-
- /**
- * @see ServiceApi#listTenants()
- */
- @Named("service:listtenants")
- @GET
- @SelectJson("tenants")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tenants")
- @RequestFilters(AuthenticateRequest.class)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<? extends Tenant>> listTenants();
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantAsyncApi.java
deleted file mode 100644
index 7ce0b75..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantAsyncApi.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.features;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.collect.PagedIterable;
-import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseTenants;
-import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseTenants.ToPagedIterable;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-import org.jclouds.openstack.v2_0.services.Identity;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.Transform;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Tenant via their REST API.
- * <p/>
- *
- * @see TenantApi
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Tenant_Operations.html"
- * />
- */
-@org.jclouds.rest.annotations.Endpoint(Identity.class)
-public interface TenantAsyncApi {
-
- /**
- * @see TenantApi#list()
- */
- @Named("tenant:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tenants")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseTenants.class)
- @Transform(ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- ListenableFuture<? extends PagedIterable<? extends Tenant>> list();
-
- /** @see TenantApi#list(PaginationOptions) */
- @Named("tenant:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tenants")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseTenants.class)
- @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
- ListenableFuture<? extends PaginatedCollection<? extends Tenant>> list(PaginationOptions options);
-
- /** @see TenantApi#get(String) */
- @Named("tenant:get")
- @GET
- @SelectJson("tenant")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tenants/{tenantId}")
- @RequestFilters(AuthenticateRequest.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Tenant> get(@PathParam("tenantId") String tenantId);
-
- /** @see TenantApi#getByName(String) */
- @Named("tenant:get")
- @GET
- @SelectJson("tenant")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tenants")
- @RequestFilters(AuthenticateRequest.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Tenant> getByName(@QueryParam("name") String tenantName);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenAsyncApi.java
deleted file mode 100644
index ed8d807..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenAsyncApi.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
-import org.jclouds.openstack.keystone.v2_0.domain.Token;
-import org.jclouds.openstack.keystone.v2_0.domain.User;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.v2_0.services.Identity;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Token via their REST API.
- * <p/>
- *
- * @see TokenApi
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Token_Operations.html"
- * />
- */
-@org.jclouds.rest.annotations.Endpoint(Identity.class)
-public interface TokenAsyncApi {
-
-
- /** @see TokenApi#get(String) */
- @Named("token:get")
- @GET
- @SelectJson("token")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tokens/{token}")
- @RequestFilters(AuthenticateRequest.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends Token> get(@PathParam("token") String token);
-
- /** @see TokenApi#getUserOfToken(String) */
- @Named("token:getuser")
- @GET
- @SelectJson("user")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tokens/{token}")
- @RequestFilters(AuthenticateRequest.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends User> getUserOfToken(@PathParam("token") String token);
-
- /** @see TokenApi#isValid(String) */
- @Named("token:valid")
- @HEAD
- @Path("/tokens/{token}")
- @RequestFilters(AuthenticateRequest.class)
- @Fallback(FalseOnNotFoundOr404.class)
- ListenableFuture<Boolean> isValid(@PathParam("token") String token);
-
- /** @see TokenApi#listEndpointsForToken(String) */
- @Named("token:listendpoints")
- @GET
- @SelectJson("endpoints")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tokens/{token}/endpoints")
- @RequestFilters(AuthenticateRequest.class)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<? extends Endpoint>> listEndpointsForToken(@PathParam("token") String token);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserAsyncApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserAsyncApi.java
deleted file mode 100644
index c17728d..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserAsyncApi.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.features;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.collect.PagedIterable;
-import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
-import org.jclouds.openstack.keystone.v2_0.domain.Role;
-import org.jclouds.openstack.keystone.v2_0.domain.User;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseUsers;
-import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseUsers.ToPagedIterable;
-import org.jclouds.openstack.v2_0.options.PaginationOptions;
-import org.jclouds.openstack.v2_0.services.Identity;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.Transform;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to User via their REST API.
- * <p/>
- *
- * @see UserApi
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-identity-service/2.0/content/User_Operations.html"
- * />
- */
-@org.jclouds.rest.annotations.Endpoint(Identity.class)
-public interface UserAsyncApi {
-
- /**
- * @see UserApi#list()
- */
- @Named("user:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/users")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseUsers.class)
- @Transform(ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- ListenableFuture<? extends PagedIterable<? extends User>> list();
-
- /** @see UserApi#list(PaginationOptions) */
- @Named("user:list")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/users")
- @RequestFilters(AuthenticateRequest.class)
- @ResponseParser(ParseUsers.class)
- @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
- ListenableFuture<? extends PaginatedCollection<? extends User>> list(PaginationOptions options);
-
- /** @see UserApi#get(String) */
- @Named("user:get")
- @GET
- @SelectJson("user")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/users/{userId}")
- @RequestFilters(AuthenticateRequest.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends User> get(@PathParam("userId") String userId);
-
- /** @see UserApi#getByName(String) */
- @Named("user:get")
- @GET
- @SelectJson("user")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/users")
- @RequestFilters(AuthenticateRequest.class)
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<? extends User> getByName(@QueryParam("name") String userName);
-
- /** @see UserApi#listRolesOfUser(String) */
- @Named("user:listroles")
- @GET
- @SelectJson("roles")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/users/{userId}/roles")
- @RequestFilters(AuthenticateRequest.class)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<? extends Role>> listRolesOfUser(@PathParam("userId") String userId);
-
- /** @see UserApi#listRolesOfUserOnTenant(String, String) */
- @Named("user:listroles")
- @GET
- @SelectJson("roles")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/tenants/{tenantId}/users/{userId}/roles")
- @RequestFilters(AuthenticateRequest.class)
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<? extends Role>> listRolesOfUserOnTenant(@PathParam("userId") String userId,
- @PathParam("tenantId") String tenantId);
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/common/openstack/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java
----------------------------------------------------------------------
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java b/common/openstack/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java
index 9d675fa..9a98f7f 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java
@@ -17,7 +17,7 @@
package org.jclouds.openstack.config;
import static com.google.common.base.Suppliers.memoizeWithExpiration;
-import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi;
+import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
import java.util.Date;
import java.util.concurrent.ExecutionException;
@@ -36,7 +36,6 @@ import org.jclouds.openstack.domain.AuthenticationResponse;
import org.jclouds.openstack.functions.URIFromAuthenticationResponseForService;
import org.jclouds.openstack.handlers.RetryOnRenew;
import org.jclouds.openstack.internal.Authentication;
-import org.jclouds.openstack.internal.OpenStackAuthAsyncClient;
import org.jclouds.openstack.internal.OpenStackAuthClient;
import com.google.common.base.Supplier;
@@ -55,7 +54,7 @@ public class OpenStackAuthenticationModule extends AbstractModule {
@Override
protected void configure() {
// OpenStackAuthClient is used directly for filters and retry handlers, so let's bind it explicitly
- bindSyncToAsyncHttpApi(binder(), OpenStackAuthClient.class, OpenStackAuthAsyncClient.class);
+ bindHttpApi(binder(), OpenStackAuthClient.class);
install(new FactoryModuleBuilder().build(URIFromAuthenticationResponseForService.Factory.class));
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(RetryOnRenew.class);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClient.java
----------------------------------------------------------------------
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClient.java b/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClient.java
deleted file mode 100644
index 622b636..0000000
--- a/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClient.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.internal;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.Path;
-
-import org.jclouds.Constants;
-import org.jclouds.openstack.domain.AuthenticationResponse;
-import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders;
-import org.jclouds.openstack.reference.AuthHeaders;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.VirtualHost;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.inject.name.Named;
-
-/**
- * Provides access to Rackspace resources via their REST API.
- * <p/>
- *
- * @see <a href="http://docs.rackspacecloud.com/servers/api/cs-devguide-latest.pdf" />
- */
-@Path("/v{" + Constants.PROPERTY_API_VERSION + "}")
-@VirtualHost
-public interface OpenStackAuthAsyncClient {
-
- @Named("authenticate")
- @GET
- @Consumes
- @ResponseParser(ParseAuthenticationResponseFromHeaders.class)
- ListenableFuture<AuthenticationResponse> authenticate(@HeaderParam(AuthHeaders.AUTH_USER) String user,
- @HeaderParam(AuthHeaders.AUTH_KEY) String key);
-
- @Named("authenticate")
- @GET
- @Consumes
- @ResponseParser(ParseAuthenticationResponseFromHeaders.class)
- ListenableFuture<AuthenticationResponse> authenticateStorage(@HeaderParam(AuthHeaders.STORAGE_USER) String user,
- @HeaderParam(AuthHeaders.STORAGE_PASS) String key);
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthClient.java
----------------------------------------------------------------------
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthClient.java b/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthClient.java
index 9802c38..34355ce 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthClient.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthClient.java
@@ -15,6 +15,8 @@
* limitations under the License.
*/
package org.jclouds.openstack.internal;
+import java.io.Closeable;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
@@ -25,6 +27,7 @@ import org.jclouds.openstack.domain.AuthenticationResponse;
import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders;
import org.jclouds.openstack.reference.AuthHeaders;
import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.VirtualHost;
import com.google.inject.name.Named;
@@ -32,7 +35,8 @@ import com.google.inject.name.Named;
* Provides access to OpenStack auth.
*/
@Path("/v{" + Constants.PROPERTY_API_VERSION + "}")
-public interface OpenStackAuthClient {
+@VirtualHost
+public interface OpenStackAuthClient extends Closeable {
@Named("authenticate")
@GET
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationAsyncClient.java
----------------------------------------------------------------------
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationAsyncClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationAsyncClient.java
deleted file mode 100644
index b801e3b..0000000
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationAsyncClient.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v1_1;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.openstack.keystone.v1_1.binders.BindCredentialsToJsonPayload;
-import org.jclouds.openstack.keystone.v1_1.domain.Auth;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Service via their REST API.
- * <p/>
- *
- * @see AuthenticationClient
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Client_Operations.html"
- * />
- */
-@Path("/v1.1")
-public interface AuthenticationAsyncClient {
-
- /**
- * @see AuthenticationClient#authenticate
- */
- @POST
- @SelectJson("auth")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/auth")
- @MapBinder(BindCredentialsToJsonPayload.class)
- ListenableFuture<Auth> authenticate(@PayloadParam("username") String username, @PayloadParam("key") String key);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java
----------------------------------------------------------------------
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java
index b05a26e..6e470af 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java
@@ -16,6 +16,8 @@
*/
package org.jclouds.openstack.keystone.v1_1;
+import java.io.Closeable;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -24,26 +26,25 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.openstack.keystone.v1_1.binders.BindCredentialsToJsonPayload;
import org.jclouds.openstack.keystone.v1_1.domain.Auth;
import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.SelectJson;
-import com.google.inject.name.Named;
-
/**
* Provides access to the Keystone v1.1 Service API.
*/
@Consumes(MediaType.APPLICATION_JSON)
@Path("/v1.1")
-public interface AuthenticationClient {
+public interface AuthenticationClient extends Closeable {
/**
* Authenticate to generate a token.
*
* @return access with token
*/
- @Named("authenticate")
@POST
@SelectJson("auth")
+ @Consumes(MediaType.APPLICATION_JSON)
@Path("/auth")
@MapBinder(BindCredentialsToJsonPayload.class)
- Auth authenticate(String username, String key);
+ Auth authenticate(@PayloadParam("username") String username, @PayloadParam("key") String key);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/config/AuthenticationServiceModule.java
----------------------------------------------------------------------
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/config/AuthenticationServiceModule.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/config/AuthenticationServiceModule.java
index 7d9c048..f8d32e1 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/config/AuthenticationServiceModule.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/config/AuthenticationServiceModule.java
@@ -16,7 +16,7 @@
*/
package org.jclouds.openstack.keystone.v1_1.config;
-import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi;
+import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
import java.util.concurrent.ExecutionException;
@@ -33,7 +33,6 @@ import org.jclouds.location.Provider;
import org.jclouds.location.suppliers.ImplicitRegionIdSupplier;
import org.jclouds.location.suppliers.RegionIdToURISupplier;
import org.jclouds.openstack.internal.Authentication;
-import org.jclouds.openstack.keystone.v1_1.AuthenticationAsyncClient;
import org.jclouds.openstack.keystone.v1_1.AuthenticationClient;
import org.jclouds.openstack.keystone.v1_1.domain.Auth;
import org.jclouds.openstack.keystone.v1_1.handlers.RetryOnRenew;
@@ -54,7 +53,7 @@ public class AuthenticationServiceModule extends AbstractModule {
@Override
protected void configure() {
// ServiceClient is used directly for filters and retry handlers, so let's bind it explicitly
- bindSyncToAsyncHttpApi(binder(), AuthenticationClient.class, AuthenticationAsyncClient.class);
+ bindHttpApi(binder(), AuthenticationClient.class);
install(new FactoryModuleBuilder().implement(RegionIdToURISupplier.class,
RegionIdToURIFromAuthForServiceSupplier.class).build(RegionIdToURISupplier.Factory.class));
install(new FactoryModuleBuilder().implement(ImplicitRegionIdSupplier.class, V1DefaultRegionIdSupplier.class)
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClientTest.java b/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClientTest.java
deleted file mode 100644
index 1b7e884..0000000
--- a/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClientTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.internal;
-
-import static org.jclouds.reflect.Reflection2.method;
-
-import java.io.IOException;
-
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.IntegrationTestAsyncClient;
-import org.jclouds.http.IntegrationTestClient;
-import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders;
-import org.jclouds.rest.AnonymousRestApiMetadata;
-import org.jclouds.rest.internal.BaseAsyncClientTest;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.Invokable;
-/**
- * Tests behavior of {@code OpenStackAuthAsyncClient}
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
-@Test(groups = "unit", testName = "OpenStackAuthAsyncClientTest")
-public class OpenStackAuthAsyncClientTest extends BaseAsyncClientTest<OpenStackAuthAsyncClient> {
-
- public void testAuthenticate() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(OpenStackAuthAsyncClient.class, "authenticate", String.class, String.class);
- GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
-
- assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
- assertNonPayloadHeadersEqual(httpRequest, "Accept: */*\nHost: localhost:8080\nX-Auth-Key: bar\nX-Auth-User: foo\n");
- assertPayloadEquals(httpRequest, null, null, false);
-
- assertResponseParserClassEquals(method, httpRequest, ParseAuthenticationResponseFromHeaders.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
-
- }
-
- public void testAuthenticateStorage() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(OpenStackAuthAsyncClient.class, "authenticateStorage", String.class, String.class);
- GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
-
- assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
- assertNonPayloadHeadersEqual(httpRequest, "Accept: */*\nHost: localhost:8080\nX-Storage-Pass: bar\nX-Storage-User: foo\n");
- assertPayloadEquals(httpRequest, null, null, false);
-
- assertResponseParserClassEquals(method, httpRequest, ParseAuthenticationResponseFromHeaders.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
-
- }
-
- @Override
- public ApiMetadata createApiMetadata() {
- return AnonymousRestApiMetadata.forClientMappedToAsyncClient(IntegrationTestClient.class, IntegrationTestAsyncClient.class).toBuilder().defaultEndpoint(
- "http://localhost:8080").version("1.0").build();
- }
-
- @Override
- protected void checkFilters(HttpRequest request) {
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dda43dfc/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java
----------------------------------------------------------------------
diff --git a/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java b/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java
new file mode 100644
index 0000000..9e14ba7
--- /dev/null
+++ b/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.internal;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.IntegrationTestAsyncClient;
+import org.jclouds.http.IntegrationTestClient;
+import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders;
+import org.jclouds.rest.AnonymousRestApiMetadata;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+
+@Test(groups = "unit", testName = "OpenStackAuthClientTest")
+public class OpenStackAuthClientTest extends BaseAsyncClientTest<OpenStackAuthClient> {
+
+ public void testAuthenticate() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(OpenStackAuthClient.class, "authenticate", String.class, String.class);
+ GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
+
+ assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
+ assertNonPayloadHeadersEqual(httpRequest, "Accept: */*\nHost: localhost:8080\nX-Auth-Key: bar\nX-Auth-User: foo\n");
+ assertPayloadEquals(httpRequest, null, null, false);
+
+ assertResponseParserClassEquals(method, httpRequest, ParseAuthenticationResponseFromHeaders.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+ }
+
+ public void testAuthenticateStorage() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(OpenStackAuthClient.class, "authenticateStorage", String.class, String.class);
+ GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
+
+ assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
+ assertNonPayloadHeadersEqual(httpRequest, "Accept: */*\nHost: localhost:8080\nX-Storage-Pass: bar\nX-Storage-User: foo\n");
+ assertPayloadEquals(httpRequest, null, null, false);
+
+ assertResponseParserClassEquals(method, httpRequest, ParseAuthenticationResponseFromHeaders.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+ }
+
+ @Override
+ public ApiMetadata createApiMetadata() {
+ return AnonymousRestApiMetadata.forClientMappedToAsyncClient(IntegrationTestClient.class, IntegrationTestAsyncClient.class).toBuilder().defaultEndpoint(
+ "http://localhost:8080").version("1.0").build();
+ }
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ }
+}
[33/52] [abbrv] git commit: JCLOUDS-40 Replaced incorrect use of
@ConfiguresRestClient and deleted old rest client modules.
Posted by an...@apache.org.
JCLOUDS-40 Replaced incorrect use of @ConfiguresRestClient and deleted old rest client modules.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/1b2cee07
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/1b2cee07
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/1b2cee07
Branch: refs/heads/use-agentproxy-008
Commit: 1b2cee070041acd8069e0d19b7ede4a8cedd335b
Parents: d190040
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 14:47:33 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 16:21:16 2014 -0700
----------------------------------------------------------------------
.../config/ElasticStackHttpApiModule.java | 4 +-
.../nova/v2_0/config/NovaHttpApiModule.java | 4 +-
.../jclouds/aws/config/AWSRestClientModule.java | 93 --------------------
.../aws/config/FormSigningRestClientModule.java | 64 --------------
.../WithZonesFormSigningRestClientModule.java | 45 ----------
.../glesys/config/GleSYSHttpApiModule.java | 4 +-
.../gogrid/config/GoGridHttpApiModule.java | 4 +-
.../gogrid/features/BaseGoGridApiTest.java | 4 +-
.../features/BaseGoGridHttpApiExpectTest.java | 4 +-
9 files changed, 12 insertions(+), 214 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1b2cee07/apis/elasticstack/src/main/java/org/jclouds/elasticstack/config/ElasticStackHttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/config/ElasticStackHttpApiModule.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/config/ElasticStackHttpApiModule.java
index 71e68a6..86395cb 100644
--- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/config/ElasticStackHttpApiModule.java
+++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/config/ElasticStackHttpApiModule.java
@@ -40,7 +40,7 @@ import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.config.HttpApiModule;
import com.google.common.base.Function;
@@ -49,7 +49,7 @@ import com.google.inject.TypeLiteral;
/**
* Configures the elasticstack connection.
*/
-@ConfiguresRestClient
+@ConfiguresHttpApi
public class ElasticStackHttpApiModule extends HttpApiModule<ElasticStackApi> {
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1b2cee07/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaHttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaHttpApiModule.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaHttpApiModule.java
index f2a410f..1c5cc46 100644
--- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaHttpApiModule.java
+++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaHttpApiModule.java
@@ -32,7 +32,7 @@ import org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces;
import org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler;
import org.jclouds.openstack.v2_0.domain.Extension;
import org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.config.HttpApiModule;
import org.jclouds.rest.functions.ImplicitOptionalConverter;
@@ -47,7 +47,7 @@ import com.google.inject.Provides;
* Configures the Nova connection.
*
*/
-@ConfiguresRestClient
+@ConfiguresHttpApi
public class NovaHttpApiModule extends HttpApiModule<NovaApi> {
public NovaHttpApiModule() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1b2cee07/apis/sts/src/main/java/org/jclouds/aws/config/AWSRestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/sts/src/main/java/org/jclouds/aws/config/AWSRestClientModule.java b/apis/sts/src/main/java/org/jclouds/aws/config/AWSRestClientModule.java
deleted file mode 100644
index 0ef34bb..0000000
--- a/apis/sts/src/main/java/org/jclouds/aws/config/AWSRestClientModule.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.aws.config;
-
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Singleton;
-
-import org.jclouds.aws.handlers.AWSClientErrorRetryHandler;
-import org.jclouds.aws.handlers.AWSServerErrorRetryHandler;
-import org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpRetryHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
-import com.google.inject.Provides;
-
-
-/**
- *
- *
- * @deprecated will be removed in jclouds 1.7; use {@link AWSHttpApiModule}
- */
-@Deprecated
-@ConfiguresRestClient
-public abstract class AWSRestClientModule<S, A> extends RestClientModule<S, A> {
-
- protected AWSRestClientModule(Map<Class<?>, Class<?>> delegates) {
- super(delegates);
- }
-
- protected AWSRestClientModule() {
- }
-
- protected AWSRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType) {
- super(syncClientType, asyncClientType);
- }
-
- protected AWSRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
- Map<Class<?>, Class<?>> sync2Async) {
- super(syncClientType, asyncClientType, sync2Async);
- }
-
- @Provides
- @ClientError
- @Singleton
- protected Set<String> provideRetryableCodes() {
- return ImmutableSet.of("RequestTimeout", "OperationAborted", "SignatureDoesNotMatch");
- }
-
- @Provides
- @ServerError
- @Singleton
- protected Set<String> provideRetryableServerCodes() {
- return ImmutableSet.of("RequestLimitExceeded");
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseAWSErrorFromXmlContent.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseAWSErrorFromXmlContent.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseAWSErrorFromXmlContent.class);
- }
-
- @Override
- protected void bindRetryHandlers() {
- bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(AWSClientErrorRetryHandler.class);
- bind(HttpRetryHandler.class).annotatedWith(ServerError.class).to(AWSServerErrorRetryHandler.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1b2cee07/apis/sts/src/main/java/org/jclouds/aws/config/FormSigningRestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/sts/src/main/java/org/jclouds/aws/config/FormSigningRestClientModule.java b/apis/sts/src/main/java/org/jclouds/aws/config/FormSigningRestClientModule.java
deleted file mode 100644
index 6c18d52..0000000
--- a/apis/sts/src/main/java/org/jclouds/aws/config/FormSigningRestClientModule.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.aws.config;
-
-import java.util.Date;
-import java.util.Map;
-
-import javax.inject.Singleton;
-
-import org.jclouds.aws.filters.FormSigner;
-import org.jclouds.date.DateService;
-import org.jclouds.date.TimeStamp;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.RequestSigner;
-
-import com.google.common.reflect.TypeToken;
-import com.google.inject.Provides;
-
-@ConfiguresRestClient
-public abstract class FormSigningRestClientModule<S, A> extends AWSRestClientModule<S, A> {
-
- protected FormSigningRestClientModule(Map<Class<?>, Class<?>> delegates) {
- super(delegates);
- }
-
- protected FormSigningRestClientModule() {
- }
-
- protected FormSigningRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType) {
- super(syncClientType, asyncClientType);
- }
-
- protected FormSigningRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
- Map<Class<?>, Class<?>> sync2Async) {
- super(syncClientType, asyncClientType, sync2Async);
- }
-
- @Provides
- @TimeStamp
- protected String provideTimeStamp(DateService dateService) {
- return dateService.iso8601DateFormat(new Date(System.currentTimeMillis()));
- }
-
- @Provides
- @Singleton
- RequestSigner provideRequestSigner(FormSigner in) {
- return in;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1b2cee07/apis/sts/src/main/java/org/jclouds/aws/config/WithZonesFormSigningRestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/sts/src/main/java/org/jclouds/aws/config/WithZonesFormSigningRestClientModule.java b/apis/sts/src/main/java/org/jclouds/aws/config/WithZonesFormSigningRestClientModule.java
deleted file mode 100644
index 5306d58..0000000
--- a/apis/sts/src/main/java/org/jclouds/aws/config/WithZonesFormSigningRestClientModule.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.aws.config;
-
-
-import java.util.Map;
-
-import org.jclouds.rest.ConfiguresRestClient;
-
-import com.google.common.reflect.TypeToken;
-
-
-@ConfiguresRestClient
-public abstract class WithZonesFormSigningRestClientModule<S, A> extends FormSigningRestClientModule<S, A> {
- protected WithZonesFormSigningRestClientModule(Map<Class<?>, Class<?>> delegates) {
- super(delegates);
- }
-
- protected WithZonesFormSigningRestClientModule() {
- }
-
- protected WithZonesFormSigningRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType) {
- super(syncClientType, asyncClientType);
- }
-
- protected WithZonesFormSigningRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
- Map<Class<?>, Class<?>> sync2Async) {
- super(syncClientType, asyncClientType, sync2Async);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1b2cee07/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java
----------------------------------------------------------------------
diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java b/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java
index d8d7302..b1ac5be 100644
--- a/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java
+++ b/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java
@@ -26,7 +26,7 @@ import org.jclouds.http.annotation.ServerError;
import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.config.HttpApiModule;
import com.google.inject.Scopes;
@@ -34,7 +34,7 @@ import com.google.inject.Scopes;
/**
* Configures the GleSYS connection.
*/
-@ConfiguresRestClient
+@ConfiguresHttpApi
public class GleSYSHttpApiModule extends HttpApiModule<GleSYSApi> {
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1b2cee07/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java
index a41de28..3a691b4 100644
--- a/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java
+++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java
@@ -31,7 +31,7 @@ import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.config.HttpApiModule;
import com.google.common.base.Supplier;
@@ -42,7 +42,7 @@ import com.google.inject.Scopes;
/**
* Configures the GoGrid connection.
*/
-@ConfiguresRestClient
+@ConfiguresHttpApi
public class GoGridHttpApiModule extends HttpApiModule<GoGridApi> {
@Provides
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1b2cee07/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java
index b65ae53..4a90875 100644
--- a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java
+++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java
@@ -24,7 +24,7 @@ import org.jclouds.gogrid.config.GoGridHttpApiModule;
import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
import org.jclouds.http.HttpRequest;
import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.testng.annotations.Test;
@@ -39,7 +39,7 @@ public abstract class BaseGoGridApiTest<T> extends BaseAsyncClientTest<T> {
assertEquals(request.getFilters().get(0).getClass(), SharedKeyLiteAuthentication.class);
}
- @ConfiguresRestClient
+ @ConfiguresHttpApi
protected static final class TestGoGridHttpApiModule extends GoGridHttpApiModule {
@Override
protected void configure() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1b2cee07/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java
index e4a0cb1..4b6fd2d 100644
--- a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java
+++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java
@@ -19,7 +19,7 @@ package org.jclouds.gogrid.features;
import org.jclouds.date.TimeStamp;
import org.jclouds.gogrid.GoGridApi;
import org.jclouds.gogrid.config.GoGridHttpApiModule;
-import org.jclouds.rest.ConfiguresRestClient;
+import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.internal.BaseRestClientExpectTest;
import com.google.common.base.Supplier;
@@ -31,7 +31,7 @@ public class BaseGoGridHttpApiExpectTest extends BaseRestClientExpectTest<GoGrid
provider = "gogrid";
}
- @ConfiguresRestClient
+ @ConfiguresHttpApi
protected static final class TestGoGridHttpApiModule extends GoGridHttpApiModule {
@Override
[22/52] [abbrv] git commit: JCLOUDS-743 - Remove
greenhousedata-element-vcloud provider
Posted by an...@apache.org.
JCLOUDS-743 - Remove greenhousedata-element-vcloud provider
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/cc35ae55
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/cc35ae55
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/cc35ae55
Branch: refs/heads/use-agentproxy-008
Commit: cc35ae557c529c9312614aee6c356fb18903a8a5
Parents: 8639f5c
Author: Adrian Cole <ad...@gmail.com>
Authored: Sat Oct 4 09:12:12 2014 -0700
Committer: Jeremy Daggett <jd...@apache.org>
Committed: Sat Oct 4 16:43:27 2014 -0700
----------------------------------------------------------------------
allcompute/pom.xml | 5 -
providers/greenhousedata-element-vcloud/pom.xml | 125 ---------------
...nHouseDataElementVCloudProviderMetadata.java | 90 -----------
...lementVCloudComputeServiceContextModule.java | 35 -----
.../org.jclouds.providers.ProviderMetadata | 1 -
...GreenHouseDataElementVCloudProviderTest.java | 29 ----
...DataElementVCloudComputeServiceLiveTest.java | 28 ----
...ataElementVCloudTemplateBuilderLiveTest.java | 71 ---------
...ouseDataElementVCloudCatalogApiLiveTest.java | 28 ----
...ouseDataElementVCloudNetworkApiLiveTest.java | 28 ----
...eenHouseDataElementVCloudOrgApiLiveTest.java | 28 ----
...enHouseDataElementVCloudTaskApiLiveTest.java | 28 ----
...enHouseDataElementVCloudVAppApiLiveTest.java | 28 ----
...ataElementVCloudVAppTemplateApiLiveTest.java | 28 ----
...eenHouseDataElementVCloudVDCApiLiveTest.java | 28 ----
...reenHouseDataElementVCloudVmApiLiveTest.java | 29 ----
.../src/test/resources/log4j.xml | 157 -------------------
providers/pom.xml | 1 -
18 files changed, 767 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/allcompute/pom.xml
----------------------------------------------------------------------
diff --git a/allcompute/pom.xml b/allcompute/pom.xml
index 4b61b0a..b911cff 100644
--- a/allcompute/pom.xml
+++ b/allcompute/pom.xml
@@ -30,11 +30,6 @@
<dependencies>
<dependency>
<groupId>org.apache.jclouds.provider</groupId>
- <artifactId>greenhousedata-element-vcloud</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.provider</groupId>
<artifactId>aws-ec2</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/pom.xml
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/pom.xml b/providers/greenhousedata-element-vcloud/pom.xml
deleted file mode 100644
index 5b5e1c7..0000000
--- a/providers/greenhousedata-element-vcloud/pom.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-project</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../../project/pom.xml</relativePath>
- </parent>
- <groupId>org.apache.jclouds.provider</groupId>
- <artifactId>greenhousedata-element-vcloud</artifactId>
- <name>jclouds Green House Data Element vCloud provider</name>
- <description>vCloud implementation targeted to Green House Data Element</description>
- <packaging>bundle</packaging>
-
- <properties>
- <test.greenhousedata-element-vcloud.endpoint>https://mycloud.greenhousedata.com/api</test.greenhousedata-element-vcloud.endpoint>
- <test.greenhousedata-element-vcloud.api-version>1.0</test.greenhousedata-element-vcloud.api-version>
- <test.greenhousedata-element-vcloud.build-version>1.5.0.464915</test.greenhousedata-element-vcloud.build-version>
- <test.greenhousedata-element-vcloud.identity>FIXME_IDENTITY</test.greenhousedata-element-vcloud.identity>
- <test.greenhousedata-element-vcloud.credential>FIXME_CREDENTIAL</test.greenhousedata-element-vcloud.credential>
- <test.greenhousedata-element-vcloud.template />
- <jclouds.osgi.export>org.jclouds.greenhousedata.element.vcloud*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>
- org.jclouds.compute.internal;version="${project.version}",
- org.jclouds.rest.internal;version="${project.version}",
- org.jclouds*;version="${project.version}",
- *
- </jclouds.osgi.import>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>vcloud</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>vcloud</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-log4j</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-sshj</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>live</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <systemPropertyVariables>
- <test.greenhousedata-element-vcloud.endpoint>${test.greenhousedata-element-vcloud.endpoint}</test.greenhousedata-element-vcloud.endpoint>
- <test.greenhousedata-element-vcloud.api-version>${test.greenhousedata-element-vcloud.api-version}</test.greenhousedata-element-vcloud.api-version>
- <test.greenhousedata-element-vcloud.build-version>${test.greenhousedata-element-vcloud.build-version}</test.greenhousedata-element-vcloud.build-version>
- <test.greenhousedata-element-vcloud.identity>${test.greenhousedata-element-vcloud.identity}</test.greenhousedata-element-vcloud.identity>
- <test.greenhousedata-element-vcloud.credential>${test.greenhousedata-element-vcloud.credential}</test.greenhousedata-element-vcloud.credential>
- <test.greenhousedata-element-vcloud.template>${test.greenhousedata-element-vcloud.template}</test.greenhousedata-element-vcloud.template>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
-
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderMetadata.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderMetadata.java b/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderMetadata.java
deleted file mode 100644
index 1aa5288..0000000
--- a/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderMetadata.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud;
-
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.greenhousedata.element.vcloud.config.GreenHouseDataElementVCloudComputeServiceContextModule;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.providers.internal.BaseProviderMetadata;
-import org.jclouds.vcloud.VCloudApiMetadata;
-import org.jclouds.vcloud.config.VCloudHttpApiModule;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-/**
- * Implementation of {@link org.jclouds.types.ProviderMetadata} for Green House Data Element vCloud
- */
-public class GreenHouseDataElementVCloudProviderMetadata extends BaseProviderMetadata {
-
- public static Builder builder() {
- return new Builder();
- }
-
- @Override
- public Builder toBuilder() {
- return builder().fromProviderMetadata(this);
- }
-
- public GreenHouseDataElementVCloudProviderMetadata() {
- super(builder());
- }
-
- public GreenHouseDataElementVCloudProviderMetadata(Builder builder) {
- super(builder);
- }
-
- public static Properties defaultProperties() {
- Properties properties = new Properties();
- properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, "orgNet-.*-External");
- return properties;
- }
-
- public static class Builder extends BaseProviderMetadata.Builder {
-
- protected Builder() {
- id("greenhousedata-element-vcloud")
- .name("Green House Data Element vCloud")
- .apiMetadata(
- new VCloudApiMetadata().toBuilder()
- .buildVersion("1.5.0.464915")
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(VCloudHttpApiModule.class, GreenHouseDataElementVCloudComputeServiceContextModule.class))
- .build())
- .homepage(URI.create("http://www.greenhousedata.com/element-cloud-hosting/vcloud-services/"))
- .console(URI.create("https://mycloud.greenhousedata.com/cloud/org/YOUR_ORG_HERE"))
- .iso3166Codes("US-WY")
- .endpoint("https://mycloud.greenhousedata.com/api")
- .defaultProperties(GreenHouseDataElementVCloudProviderMetadata.defaultProperties());
- }
-
- @Override
- public GreenHouseDataElementVCloudProviderMetadata build() {
- return new GreenHouseDataElementVCloudProviderMetadata(this);
- }
-
- @Override
- public Builder fromProviderMetadata(
- ProviderMetadata in) {
- super.fromProviderMetadata(in);
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/config/GreenHouseDataElementVCloudComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/config/GreenHouseDataElementVCloudComputeServiceContextModule.java b/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/config/GreenHouseDataElementVCloudComputeServiceContextModule.java
deleted file mode 100644
index 425b1ee..0000000
--- a/providers/greenhousedata-element-vcloud/src/main/java/org/jclouds/greenhousedata/element/vcloud/config/GreenHouseDataElementVCloudComputeServiceContextModule.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud.config;
-
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
-import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
-import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
-
-import com.google.inject.Injector;
-
-/**
- * per docs, we are to use pool mode.
- */
-public class GreenHouseDataElementVCloudComputeServiceContextModule extends VCloudComputeServiceContextModule {
-
- @Override
- protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) {
- return options.as(VCloudTemplateOptions.class).ipAddressAllocationMode(IpAddressAllocationMode.POOL);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/providers/greenhousedata-element-vcloud/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
deleted file mode 100644
index 84a4ce2..0000000
--- a/providers/greenhousedata-element-vcloud/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
+++ /dev/null
@@ -1 +0,0 @@
-org.jclouds.greenhousedata.element.vcloud.GreenHouseDataElementVCloudProviderMetadata
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderTest.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderTest.java
deleted file mode 100644
index e01eb83..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/GreenHouseDataElementVCloudProviderTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud;
-
-import org.jclouds.providers.internal.BaseProviderMetadataTest;
-import org.jclouds.vcloud.VCloudApiMetadata;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "GreenHouseDataElementVCloudProviderTest")
-public class GreenHouseDataElementVCloudProviderTest extends BaseProviderMetadataTest {
-
- public GreenHouseDataElementVCloudProviderTest() {
- super(new GreenHouseDataElementVCloudProviderMetadata(), new VCloudApiMetadata());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/compute/GreenHouseDataElementVCloudComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/compute/GreenHouseDataElementVCloudComputeServiceLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/compute/GreenHouseDataElementVCloudComputeServiceLiveTest.java
deleted file mode 100644
index fa2850f..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/compute/GreenHouseDataElementVCloudComputeServiceLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud.compute;
-
-import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudComputeServiceLiveTest")
-public class GreenHouseDataElementVCloudComputeServiceLiveTest extends VCloudComputeServiceLiveTest {
- public GreenHouseDataElementVCloudComputeServiceLiveTest() {
- provider = "greenhousedata-element-vcloud";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/compute/GreenHouseDataElementVCloudTemplateBuilderLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/compute/GreenHouseDataElementVCloudTemplateBuilderLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/compute/GreenHouseDataElementVCloudTemplateBuilderLiveTest.java
deleted file mode 100644
index 31f586e..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/compute/GreenHouseDataElementVCloudTemplateBuilderLiveTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud.compute;
-
-import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.Set;
-
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.domain.OsFamilyVersion64Bit;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableSet;
-
-@Test(groups = "live", testName = "GreenHouseDataElementVCloudTemplateBuilderLiveTest")
-public class GreenHouseDataElementVCloudTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
-
- public GreenHouseDataElementVCloudTemplateBuilderLiveTest() {
- provider = "greenhousedata-element-vcloud";
- }
-
- @Override
- protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
- return new Predicate<OsFamilyVersion64Bit>() {
-
- @Override
- public boolean apply(OsFamilyVersion64Bit input) {
- switch (input.family) {
- case UBUNTU:
- return !input.version.equals("") || !input.is64Bit;
- default:
- return true;
- }
- }
-
- };
- }
-
- @Override
- public void testDefaultTemplateBuilder() throws IOException {
- Template defaultTemplate = view.getComputeService().templateBuilder().build();
- assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "");
- assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
- assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
- assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
- }
-
- @Override
- protected Set<String> getIso3166Codes() {
- return ImmutableSet.<String> of("US-WY");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudCatalogApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudCatalogApiLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudCatalogApiLiveTest.java
deleted file mode 100644
index ba18cee..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudCatalogApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud.features;
-
-import org.jclouds.vcloud.features.CatalogApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudCatalogApiLiveTest")
-public class GreenHouseDataElementVCloudCatalogApiLiveTest extends CatalogApiLiveTest {
-
- public GreenHouseDataElementVCloudCatalogApiLiveTest() {
- provider = "greenhousedata-element-vcloud";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudNetworkApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudNetworkApiLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudNetworkApiLiveTest.java
deleted file mode 100644
index 8053294..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudNetworkApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud.features;
-
-import org.jclouds.vcloud.features.NetworkApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudNetworkApiLiveTest")
-public class GreenHouseDataElementVCloudNetworkApiLiveTest extends NetworkApiLiveTest {
-
- public GreenHouseDataElementVCloudNetworkApiLiveTest() {
- provider = "greenhousedata-element-vcloud";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudOrgApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudOrgApiLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudOrgApiLiveTest.java
deleted file mode 100644
index eea7a5e..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudOrgApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud.features;
-
-import org.jclouds.vcloud.features.OrgApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudOrgApiLiveTest")
-public class GreenHouseDataElementVCloudOrgApiLiveTest extends OrgApiLiveTest {
-
- public GreenHouseDataElementVCloudOrgApiLiveTest() {
- provider = "greenhousedata-element-vcloud";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudTaskApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudTaskApiLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudTaskApiLiveTest.java
deleted file mode 100644
index 9b21369..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudTaskApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud.features;
-
-import org.jclouds.vcloud.features.TaskApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudTaskApiLiveTest")
-public class GreenHouseDataElementVCloudTaskApiLiveTest extends TaskApiLiveTest {
-
- public GreenHouseDataElementVCloudTaskApiLiveTest() {
- provider = "greenhousedata-element-vcloud";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppApiLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppApiLiveTest.java
deleted file mode 100644
index 7272047..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud.features;
-
-import org.jclouds.vcloud.features.VAppApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVAppApiLiveTest")
-public class GreenHouseDataElementVCloudVAppApiLiveTest extends VAppApiLiveTest {
-
- public GreenHouseDataElementVCloudVAppApiLiveTest() {
- provider = "greenhousedata-element-vcloud";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppTemplateApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppTemplateApiLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppTemplateApiLiveTest.java
deleted file mode 100644
index ee49804..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVAppTemplateApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud.features;
-
-import org.jclouds.vcloud.features.VAppTemplateApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVAppTemplateApiLiveTest")
-public class GreenHouseDataElementVCloudVAppTemplateApiLiveTest extends VAppTemplateApiLiveTest {
-
- public GreenHouseDataElementVCloudVAppTemplateApiLiveTest() {
- provider = "greenhousedata-element-vcloud";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVDCApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVDCApiLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVDCApiLiveTest.java
deleted file mode 100644
index d0f569a..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVDCApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud.features;
-
-import org.jclouds.vcloud.features.VDCApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVDCApiLiveTest")
-public class GreenHouseDataElementVCloudVDCApiLiveTest extends VDCApiLiveTest {
-
- public GreenHouseDataElementVCloudVDCApiLiveTest() {
- provider = "greenhousedata-element-vcloud";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVmApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVmApiLiveTest.java b/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVmApiLiveTest.java
deleted file mode 100644
index 76cb2b5..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/java/org/jclouds/greenhousedata/element/vcloud/features/GreenHouseDataElementVCloudVmApiLiveTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.greenhousedata.element.vcloud.features;
-
-import org.jclouds.vcloud.features.VmApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "GreenHouseDataElementVCloudVmApiLiveTest")
-public class GreenHouseDataElementVCloudVmApiLiveTest extends VmApiLiveTest {
-
- public GreenHouseDataElementVCloudVmApiLiveTest() {
- provider = "greenhousedata-element-vcloud";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/greenhousedata-element-vcloud/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/providers/greenhousedata-element-vcloud/src/test/resources/log4j.xml b/providers/greenhousedata-element-vcloud/src/test/resources/log4j.xml
deleted file mode 100644
index daefa0e..0000000
--- a/providers/greenhousedata-element-vcloud/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,157 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
- <!--
- For more configuration infromation and examples see the Apache
- Log4j website: http://logging.apache.org/log4j/
- -->
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
- debug="false">
-
- <!-- A time/date based rolling appender -->
- <appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds-wire.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <!-- A time/date based rolling appender -->
- <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <!-- A time/date based rolling appender -->
- <appender name="COMPUTEFILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds-compute.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <!-- A time/date based rolling appender -->
- <appender name="SSHFILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds-ssh.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <appender name="ASYNCCOMPUTE" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="COMPUTEFILE" />
- </appender>
-
- <appender name="ASYNCSSH" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="SSHFILE" />
- </appender>
-
- <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="FILE" />
- </appender>
-
- <appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="WIREFILE" />
- </appender>
-
- <!-- ================ -->
- <!-- Limit categories -->
- <!-- ================ -->
-
- <category name="org.jclouds">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNC" />
- </category>
-
- <!-- set to trace to get more info when parser fail -->
- <category name="org.jclouds.http.functions.ParseSax">
- <priority value="TRACE" />
- <appender-ref ref="ASYNC" />
- </category>
-
- <category name="jclouds.headers">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNCWIRE" />
- </category>
-
- <category name="jclouds.ssh">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNCSSH" />
- </category>
-
- <category name="jclouds.wire">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNCWIRE" />
- </category>
-
- <category name="jclouds.compute">
- <priority value="TRACE" />
- <appender-ref ref="ASYNCCOMPUTE" />
- </category>
- <!-- ======================= -->
- <!-- Setup the Root category -->
- <!-- ======================= -->
-
- <root>
- <priority value="WARN" />
- </root>
-
-</log4j:configuration>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cc35ae55/providers/pom.xml
----------------------------------------------------------------------
diff --git a/providers/pom.xml b/providers/pom.xml
index 6cccf18..08160de 100644
--- a/providers/pom.xml
+++ b/providers/pom.xml
@@ -49,7 +49,6 @@
<module>openhosting-east1</module>
<module>serverlove-z1-man</module>
<module>skalicloud-sdg-my</module>
- <module>greenhousedata-element-vcloud</module>
<module>go2cloud-jhb1</module>
<module>softlayer</module>
<module>hpcloud-compute</module>
[23/52] [abbrv] git commit: JCLOUDS-743 - Remove
bluelock-vcloud-zone01 provider
Posted by an...@apache.org.
JCLOUDS-743 - Remove bluelock-vcloud-zone01 provider
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/8c520d39
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/8c520d39
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/8c520d39
Branch: refs/heads/use-agentproxy-008
Commit: 8c520d39a4a21eb35bee21ee84316d3207be7e67
Parents: cc35ae5
Author: Adrian Cole <ac...@twitter.com>
Authored: Fri Oct 3 21:55:03 2014 -0700
Committer: Jeremy Daggett <jd...@apache.org>
Committed: Sat Oct 4 16:44:03 2014 -0700
----------------------------------------------------------------------
allcompute/pom.xml | 5 -
providers/bluelock-vcloud-zone01/pom.xml | 126 ---------
.../BluelockVCloudZone01ProviderMetadata.java | 81 ------
.../org.jclouds.providers.ProviderMetadata | 1 -
.../BluelockVCloudZone01ProviderTest.java | 29 --
...elockVCloudZone01ComputeServiceLiveTest.java | 28 --
...lockVCloudZone01TemplateBuilderLiveTest.java | 75 ------
.../BluelockVCloudZone01CatalogApiLiveTest.java | 28 --
.../BluelockVCloudZone01NetworkApiLiveTest.java | 28 --
.../BluelockVCloudZone01OrgApiLiveTest.java | 28 --
.../BluelockVCloudZone01TaskApiLiveTest.java | 28 --
.../BluelockVCloudZone01VAppApiLiveTest.java | 28 --
...lockVCloudZone01VAppTemplateApiLiveTest.java | 28 --
.../BluelockVCloudZone01VDCApiLiveTest.java | 28 --
.../BluelockVCloudZone01VmApiLiveTest.java | 28 --
.../src/test/resources/bluelock/vdc.xml | 265 -------------------
.../src/test/resources/log4j.xml | 151 -----------
providers/pom.xml | 1 -
18 files changed, 986 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/allcompute/pom.xml
----------------------------------------------------------------------
diff --git a/allcompute/pom.xml b/allcompute/pom.xml
index b911cff..095ac3a 100644
--- a/allcompute/pom.xml
+++ b/allcompute/pom.xml
@@ -75,11 +75,6 @@
</dependency>
<dependency>
<groupId>org.apache.jclouds.provider</groupId>
- <artifactId>bluelock-vcloud-zone01</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.provider</groupId>
<artifactId>gogrid</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/pom.xml
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/pom.xml b/providers/bluelock-vcloud-zone01/pom.xml
deleted file mode 100644
index 5a7f783..0000000
--- a/providers/bluelock-vcloud-zone01/pom.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-project</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../../project/pom.xml</relativePath>
- </parent>
- <groupId>org.apache.jclouds.provider</groupId>
- <artifactId>bluelock-vcloud-zone01</artifactId>
- <name>jclouds Bluelock vCloud Zone01 provider</name>
- <description>vCloud implementation targeted to Bluelock vCloud Zone01</description>
- <packaging>bundle</packaging>
-
- <properties>
- <test.bluelock-vcloud-zone01.endpoint>https://zone01.bluelock.com/api</test.bluelock-vcloud-zone01.endpoint>
- <test.bluelock-vcloud-zone01.api-version>1.0</test.bluelock-vcloud-zone01.api-version>
- <test.bluelock-vcloud-zone01.build-version>1.5.0.464915</test.bluelock-vcloud-zone01.build-version>
- <test.bluelock-vcloud-zone01.identity>FIXME_IDENTITY</test.bluelock-vcloud-zone01.identity>
- <test.bluelock-vcloud-zone01.credential>FIXME_CREDENTIAL</test.bluelock-vcloud-zone01.credential>
- <test.bluelock-vcloud-zone01.template />
- <jclouds.osgi.export>org.jclouds.bluelock.vcloud.zone01*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>
- org.jclouds.compute.internal;version="${project.version}",
- org.jclouds.rest.internal;version="${project.version}",
- org.jclouds*;version="${project.version}",
- *
- </jclouds.osgi.import>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>vcloud</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>vcloud</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-log4j</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-sshj</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>live</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <systemPropertyVariables>
- <test.bluelock-vcloud-zone01.endpoint>${test.bluelock-vcloud-zone01.endpoint}</test.bluelock-vcloud-zone01.endpoint>
- <test.bluelock-vcloud-zone01.api-version>${test.bluelock-vcloud-zone01.api-version}</test.bluelock-vcloud-zone01.api-version>
- <test.bluelock-vcloud-zone01.build-version>${test.bluelock-vcloud-zone01.build-version}</test.bluelock-vcloud-zone01.build-version>
- <test.bluelock-vcloud-zone01.identity>${test.bluelock-vcloud-zone01.identity}</test.bluelock-vcloud-zone01.identity>
- <test.bluelock-vcloud-zone01.credential>${test.bluelock-vcloud-zone01.credential}</test.bluelock-vcloud-zone01.credential>
- <test.bluelock-vcloud-zone01.template>${test.bluelock-vcloud-zone01.template}</test.bluelock-vcloud-zone01.template>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-
-</project>
-
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/main/java/org/jclouds/bluelock/vcloud/zone01/BluelockVCloudZone01ProviderMetadata.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/main/java/org/jclouds/bluelock/vcloud/zone01/BluelockVCloudZone01ProviderMetadata.java b/providers/bluelock-vcloud-zone01/src/main/java/org/jclouds/bluelock/vcloud/zone01/BluelockVCloudZone01ProviderMetadata.java
deleted file mode 100644
index 94c179c..0000000
--- a/providers/bluelock-vcloud-zone01/src/main/java/org/jclouds/bluelock/vcloud/zone01/BluelockVCloudZone01ProviderMetadata.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01;
-
-import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.providers.internal.BaseProviderMetadata;
-import org.jclouds.vcloud.VCloudApiMetadata;
-
-/**
- * Implementation of {@link org.jclouds.types.ProviderMetadata} for Bluelock vCloud Zone 1.
- */
-public class BluelockVCloudZone01ProviderMetadata extends BaseProviderMetadata {
-
- public static Builder builder() {
- return new Builder();
- }
-
- @Override
- public Builder toBuilder() {
- return builder().fromProviderMetadata(this);
- }
-
- public BluelockVCloudZone01ProviderMetadata() {
- super(builder());
- }
-
- public BluelockVCloudZone01ProviderMetadata(Builder builder) {
- super(builder);
- }
-
- public static Properties defaultProperties() {
- Properties properties = new Properties();
- properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, "internet01-.*");
- return properties;
- }
-
- public static class Builder extends BaseProviderMetadata.Builder {
-
- protected Builder() {
- id("bluelock-vcloud-zone01")
- .name("Bluelock vCloud Zone 1")
- .apiMetadata(
- new VCloudApiMetadata().toBuilder().buildVersion("1.5.0.464915").build())
- .homepage(URI.create("http://www.bluelock.com/bluelock-cloud-hosting"))
- .console(URI.create("https://zone01.bluelock.com/cloud/org/YOUR_ORG_HERE"))
- .iso3166Codes("US-IN")
- .endpoint("https://zone01.bluelock.com/api")
- .defaultProperties(BluelockVCloudZone01ProviderMetadata.defaultProperties());
- }
-
- @Override
- public BluelockVCloudZone01ProviderMetadata build() {
- return new BluelockVCloudZone01ProviderMetadata(this);
- }
-
- @Override
- public Builder fromProviderMetadata(ProviderMetadata in) {
- super.fromProviderMetadata(in);
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/providers/bluelock-vcloud-zone01/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
deleted file mode 100644
index 6f51746..0000000
--- a/providers/bluelock-vcloud-zone01/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
+++ /dev/null
@@ -1 +0,0 @@
-org.jclouds.bluelock.vcloud.zone01.BluelockVCloudZone01ProviderMetadata
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/BluelockVCloudZone01ProviderTest.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/BluelockVCloudZone01ProviderTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/BluelockVCloudZone01ProviderTest.java
deleted file mode 100644
index d5db810..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/BluelockVCloudZone01ProviderTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01;
-
-import org.jclouds.providers.internal.BaseProviderMetadataTest;
-import org.jclouds.vcloud.VCloudApiMetadata;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "BluelockVCloudZone01ProviderTest")
-public class BluelockVCloudZone01ProviderTest extends BaseProviderMetadataTest {
-
- public BluelockVCloudZone01ProviderTest() {
- super(new BluelockVCloudZone01ProviderMetadata(), new VCloudApiMetadata());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01ComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01ComputeServiceLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01ComputeServiceLiveTest.java
deleted file mode 100644
index 6c5ac15..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01ComputeServiceLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01.compute;
-
-import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01ComputeServiceLiveTest")
-public class BluelockVCloudZone01ComputeServiceLiveTest extends VCloudComputeServiceLiveTest {
- public BluelockVCloudZone01ComputeServiceLiveTest() {
- provider = "bluelock-vcloud-zone01";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01TemplateBuilderLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01TemplateBuilderLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01TemplateBuilderLiveTest.java
deleted file mode 100644
index 4a2f35d..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01TemplateBuilderLiveTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01.compute;
-
-import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.Set;
-
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.domain.OsFamilyVersion64Bit;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableSet;
-
-@Test(groups = "live", testName = "BluelockVCloudZone01TemplateBuilderLiveTest")
-public class BluelockVCloudZone01TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
-
- public BluelockVCloudZone01TemplateBuilderLiveTest() {
- provider = "bluelock-vcloud-zone01";
- }
-
- @Override
- protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
- return new Predicate<OsFamilyVersion64Bit>() {
-
- @Override
- public boolean apply(OsFamilyVersion64Bit input) {
- switch (input.family) {
- case UBUNTU:
- return !input.version.equals("") || !input.is64Bit;
- case RHEL:
- return !input.version.equals("");
- case WINDOWS:
- return !input.version.equals("");
- default:
- return true;
- }
- }
-
- };
- }
-
- @Override
- public void testDefaultTemplateBuilder() throws IOException {
- Template defaultTemplate = view.getComputeService().templateBuilder().build();
- assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "");
- assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
- assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
- assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
- }
-
- @Override
- protected Set<String> getIso3166Codes() {
- return ImmutableSet.<String> of("US-IN");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01CatalogApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01CatalogApiLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01CatalogApiLiveTest.java
deleted file mode 100644
index 7888f87..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01CatalogApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01.features;
-
-import org.jclouds.vcloud.features.CatalogApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01CatalogApiLiveTest")
-public class BluelockVCloudZone01CatalogApiLiveTest extends CatalogApiLiveTest {
-
- public BluelockVCloudZone01CatalogApiLiveTest() {
- provider = "bluelock-vcloud-zone01";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01NetworkApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01NetworkApiLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01NetworkApiLiveTest.java
deleted file mode 100644
index 2dc82ab..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01NetworkApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01.features;
-
-import org.jclouds.vcloud.features.NetworkApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01NetworkApiLiveTest")
-public class BluelockVCloudZone01NetworkApiLiveTest extends NetworkApiLiveTest {
-
- public BluelockVCloudZone01NetworkApiLiveTest() {
- provider = "bluelock-vcloud-zone01";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01OrgApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01OrgApiLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01OrgApiLiveTest.java
deleted file mode 100644
index eb710a5..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01OrgApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01.features;
-
-import org.jclouds.vcloud.features.OrgApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01OrgApiLiveTest")
-public class BluelockVCloudZone01OrgApiLiveTest extends OrgApiLiveTest {
-
- public BluelockVCloudZone01OrgApiLiveTest() {
- provider = "bluelock-vcloud-zone01";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01TaskApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01TaskApiLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01TaskApiLiveTest.java
deleted file mode 100644
index be809fd..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01TaskApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01.features;
-
-import org.jclouds.vcloud.features.TaskApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01TaskApiLiveTest")
-public class BluelockVCloudZone01TaskApiLiveTest extends TaskApiLiveTest {
-
- public BluelockVCloudZone01TaskApiLiveTest() {
- provider = "bluelock-vcloud-zone01";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppApiLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppApiLiveTest.java
deleted file mode 100644
index 6fe7b86..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01.features;
-
-import org.jclouds.vcloud.features.VAppApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VAppApiLiveTest")
-public class BluelockVCloudZone01VAppApiLiveTest extends VAppApiLiveTest {
-
- public BluelockVCloudZone01VAppApiLiveTest() {
- provider = "bluelock-vcloud-zone01";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppTemplateApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppTemplateApiLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppTemplateApiLiveTest.java
deleted file mode 100644
index 150c02d..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VAppTemplateApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01.features;
-
-import org.jclouds.vcloud.features.VAppTemplateApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VAppTemplateApiLiveTest")
-public class BluelockVCloudZone01VAppTemplateApiLiveTest extends VAppTemplateApiLiveTest {
-
- public BluelockVCloudZone01VAppTemplateApiLiveTest() {
- provider = "bluelock-vcloud-zone01";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VDCApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VDCApiLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VDCApiLiveTest.java
deleted file mode 100644
index 757f007..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VDCApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01.features;
-
-import org.jclouds.vcloud.features.VDCApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VDCApiLiveTest")
-public class BluelockVCloudZone01VDCApiLiveTest extends VDCApiLiveTest {
-
- public BluelockVCloudZone01VDCApiLiveTest() {
- provider = "bluelock-vcloud-zone01";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VmApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VmApiLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VmApiLiveTest.java
deleted file mode 100644
index 432f10e..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/features/BluelockVCloudZone01VmApiLiveTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.bluelock.vcloud.zone01.features;
-
-import org.jclouds.vcloud.features.VmApiLiveTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VmApiLiveTest")
-public class BluelockVCloudZone01VmApiLiveTest extends VmApiLiveTest {
-
- public BluelockVCloudZone01VmApiLiveTest() {
- provider = "bluelock-vcloud-zone01";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/resources/bluelock/vdc.xml
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/resources/bluelock/vdc.xml b/providers/bluelock-vcloud-zone01/src/test/resources/bluelock/vdc.xml
deleted file mode 100644
index 0eb6c68..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/resources/bluelock/vdc.xml
+++ /dev/null
@@ -1,265 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Vdc href="https://express3.bluelock.com/api/v0.8/vdc/133" name="jclouds"
- xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 https://express3.bluelock.com/api/v0.8/schemas/vcloud/vdc.xsd"
- xmlns="http://www.vmware.com/vcloud/v0.8"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <Link rel="add" href="https://express3.bluelock.com/api/v0.8/vdc/133/vApps"
- type="application/vnd.vmware.vcloud.vApp+xml" />
- <Link rel="add" href="https://express3.bluelock.com/api/v0.8/vdc/133/vAppTemplates"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" />
- <Link rel="add" href="https://express3.bluelock.com/api/v0.8/vdc/133/media"
- type="application/vnd.vmware.vcloud.media+xml" />
- <Description>people in paradise</Description>
- <ResourceEntities>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/447"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 4CPUx8GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/448"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 8CPUx16GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/449"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 8CPUx1GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/347"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 4CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/345"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 2CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/346"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 4CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/387"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 1CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/388"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 2CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/334"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 1CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/335"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 1CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/336"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 1CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/337"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 1CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/338"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 1CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/339"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 1CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/341"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 2CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/342"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 2CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/450"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 8CPUx2GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/451"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 8CPUx4GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/452"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 8CPUx512MBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/453"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 8CPUx8GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/348"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 4CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/349"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 4CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/350"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 4CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/351"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 4CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/352"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 8CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/353"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 8CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/354"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 8CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/355"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 8CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/356"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 8CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/344"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 2CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/358"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 1CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/359"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 1CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/360"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 1CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/361"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 1CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/362"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 1CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/363"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 1CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/364"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 2CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/365"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 2CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/366"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 2CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/367"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 2CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/368"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 2CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/369"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 2CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/370"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 4CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/371"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 4CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/372"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 4CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/373"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 4CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/375"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 4CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/376"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 8CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/377"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 8CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/378"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 8CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/379"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 8CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/380"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 8CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/381"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 8CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/382"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 1CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/383"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 1CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/384"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 1CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/385"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 1CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/386"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 1CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/389"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 2CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/390"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 2CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/392"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 2CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/393"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 2CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/394"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 4CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/395"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 4CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/396"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 4CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/397"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 4CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/398"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 4CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/399"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 4CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/400"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 8CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/401"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 8CPUx1GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/402"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 8CPUx2GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/403"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 8CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/404"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 8CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/405"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 8CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/406"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 1CPUx16GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/407"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 1CPUx1GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/409"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 1CPUx4GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/410"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 1CPUx512MBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/411"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 1CPUx8GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/412"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 2CPUx16GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/413"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 2CPUx1GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/414"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 2CPUx2GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/415"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 2CPUx4GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/416"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 2CPUx512MBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/343"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 2CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/417"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 2CPUx8GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/418"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 4CPUx16GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/419"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 4CPUx1GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/420"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 4CPUx2GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/421"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 4CPUx4GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/422"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 4CPUx512MBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/423"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 4CPUx8GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/424"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 8CPUx16GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/426"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 8CPUx2GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/427"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 8CPUx4GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/428"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 8CPUx512MBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/429"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 8CPUx8GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/430"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 1CPUx16GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/431"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 1CPUx1GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/442"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 4CPUx16GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/435"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 1CPUx8GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/436"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 2CPUx16GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/437"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 2CPUx1GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/438"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 2CPUx2GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/439"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 2CPUx4GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/440"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 2CPUx512MBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/441"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 2CPUx8GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/432"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 1CPUx2GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/433"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 1CPUx4GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/434"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 1CPUx512MBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/340"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 2CPUx16GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/425"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 8CPUx1GBx30GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/443"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 4CPUx1GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/444"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 4CPUx2GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/445"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 4CPUx4GBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/446"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008+SQLExpress 4CPUx512MBx40GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/357"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="CentOS5x64 8CPUx8GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/374"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="RedHat5x64 4CPUx512MBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/391"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Ubuntu904Serverx64 2CPUx4GBx20GB"/>
- <ResourceEntity href="https://express3.bluelock.com/api/v0.8/vAppTemplate/408"
- type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows2008stdx64 1CPUx2GBx30GB"/>
- </ResourceEntities>
- <AvailableNetworks>
- <Network href="https://express3.bluelock.com/api/v0.8/network/1"
- type="application/vnd.vmware.vcloud.network+xml" name="Pod03_Private"/>
- <Network href="https://express3.bluelock.com/api/v0.8/network/4"
- type="application/vnd.vmware.vcloud.network+xml" name="Internal Outbound Only"/>
- <Network href="https://express3.bluelock.com/api/v0.8/network/2"
- type="application/vnd.vmware.vcloud.network+xml" name="Pod03_Public"/>
- <Network href="https://express3.bluelock.com/api/v0.8/network/3"
- type="application/vnd.vmware.vcloud.network+xml" name="Internal In and Out"/>
- </AvailableNetworks>
-</Vdc>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/bluelock-vcloud-zone01/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/providers/bluelock-vcloud-zone01/src/test/resources/log4j.xml b/providers/bluelock-vcloud-zone01/src/test/resources/log4j.xml
deleted file mode 100644
index 63810d3..0000000
--- a/providers/bluelock-vcloud-zone01/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
- <!--
- For more configuration infromation and examples see the Apache
- Log4j website: http://logging.apache.org/log4j/
- -->
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
- debug="false">
-
- <!-- A time/date based rolling appender -->
- <appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds-wire.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <!-- A time/date based rolling appender -->
- <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <!-- A time/date based rolling appender -->
- <appender name="COMPUTEFILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds-compute.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <!-- A time/date based rolling appender -->
- <appender name="SSHFILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds-ssh.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <appender name="ASYNCCOMPUTE" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="COMPUTEFILE" />
- </appender>
-
- <appender name="ASYNCSSH" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="SSHFILE" />
- </appender>
-
- <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="FILE" />
- </appender>
-
- <appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="WIREFILE" />
- </appender>
-
- <!-- ================ -->
- <!-- Limit categories -->
- <!-- ================ -->
-
- <category name="org.jclouds">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNC" />
- </category>
-
- <category name="jclouds.headers">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNCWIRE" />
- </category>
-
- <category name="jclouds.ssh">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNCSSH" />
- </category>
-
- <category name="jclouds.wire">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNCWIRE" />
- </category>
-
- <category name="jclouds.compute">
- <priority value="TRACE" />
- <appender-ref ref="ASYNCCOMPUTE" />
- </category>
- <!-- ======================= -->
- <!-- Setup the Root category -->
- <!-- ======================= -->
-
- <root>
- <priority value="WARN" />
- </root>
-
-</log4j:configuration>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/8c520d39/providers/pom.xml
----------------------------------------------------------------------
diff --git a/providers/pom.xml b/providers/pom.xml
index 08160de..d1ef987 100644
--- a/providers/pom.xml
+++ b/providers/pom.xml
@@ -36,7 +36,6 @@
<module>aws-ec2</module>
<module>aws-sqs</module>
<module>aws-cloudwatch</module>
- <module>bluelock-vcloud-zone01</module>
<module>elastichosts-lon-p</module>
<module>elastichosts-sat-p</module>
<module>elastichosts-lon-b</module>
[28/52] [abbrv] git commit: JCLOUDS-40 Remove AsyncBlobStore
references from s3 api
Posted by an...@apache.org.
JCLOUDS-40 Remove AsyncBlobStore references from s3 api
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/cacc986d
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/cacc986d
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/cacc986d
Branch: refs/heads/use-agentproxy-008
Commit: cacc986dc4b69be5bb732fcd096ddafd5f9c57c2
Parents: a22a725
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 11:41:48 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 13:18:12 2014 -0700
----------------------------------------------------------------------
.../s3/blobstore/internal/S3BlobStoreContextImpl.java | 8 ++------
.../aws/s3/blobstore/internal/AWSS3BlobStoreContextImpl.java | 8 ++------
2 files changed, 4 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cacc986d/apis/s3/src/main/java/org/jclouds/s3/blobstore/internal/S3BlobStoreContextImpl.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/blobstore/internal/S3BlobStoreContextImpl.java b/apis/s3/src/main/java/org/jclouds/s3/blobstore/internal/S3BlobStoreContextImpl.java
index a2aaf9a..220606c 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/blobstore/internal/S3BlobStoreContextImpl.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/blobstore/internal/S3BlobStoreContextImpl.java
@@ -20,7 +20,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.Context;
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
@@ -37,11 +36,8 @@ public class S3BlobStoreContextImpl extends BlobStoreContextImpl implements S3Bl
@Inject
public S3BlobStoreContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
- Utils utils, ConsistencyModel consistencyModel,
- AsyncBlobStore ablobStore, BlobStore blobStore,
- BlobRequestSigner blobRequestSigner) {
- super(backend, backendType, utils, consistencyModel, ablobStore,
- blobStore, blobRequestSigner);
+ Utils utils, ConsistencyModel consistencyModel, BlobStore blobStore, BlobRequestSigner blobRequestSigner) {
+ super(backend, backendType, utils, consistencyModel, blobStore, blobRequestSigner);
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/cacc986d/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/internal/AWSS3BlobStoreContextImpl.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/internal/AWSS3BlobStoreContextImpl.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/internal/AWSS3BlobStoreContextImpl.java
index 9455f01..83d66b0 100644
--- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/internal/AWSS3BlobStoreContextImpl.java
+++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/internal/AWSS3BlobStoreContextImpl.java
@@ -22,7 +22,6 @@ import javax.inject.Singleton;
import org.jclouds.Context;
import org.jclouds.aws.s3.blobstore.AWSS3BlobStore;
import org.jclouds.aws.s3.blobstore.AWSS3BlobStoreContext;
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
@@ -37,11 +36,8 @@ public class AWSS3BlobStoreContextImpl extends S3BlobStoreContextImpl implements
@Inject
public AWSS3BlobStoreContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
- Utils utils, ConsistencyModel consistencyModel,
- AsyncBlobStore ablobStore, BlobStore blobStore,
- BlobRequestSigner blobRequestSigner) {
- super(backend, backendType, utils, consistencyModel, ablobStore,
- blobStore, blobRequestSigner);
+ Utils utils, ConsistencyModel consistencyModel, BlobStore blobStore, BlobRequestSigner blobRequestSigner) {
+ super(backend, backendType, utils, consistencyModel, blobStore, blobRequestSigner);
}
@Override
[20/52] [abbrv] git commit: JCLOUDS-296 unasync hpcloud storage
provider.
Posted by an...@apache.org.
JCLOUDS-296 unasync hpcloud storage provider.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/e243fa51
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/e243fa51
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/e243fa51
Branch: refs/heads/use-agentproxy-008
Commit: e243fa51a53a6c946e796008337c0abf754ff8b3
Parents: e3ada5b
Author: Adrian Cole <ac...@twitter.com>
Authored: Fri Oct 3 19:13:41 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Fri Oct 3 23:14:29 2014 -0700
----------------------------------------------------------------------
.../objectstorage/HPCloudObjectStorageApi.java | 50 +++++--
.../HPCloudObjectStorageApiMetadata.java | 54 +++----
.../HPCloudObjectStorageAsyncApi.java | 100 -------------
.../HPCloudObjectStorageAsyncBlobStore.java | 94 ------------
.../HPCloudObjectStorageBlobRequestSigner.java | 8 +-
...loudObjectStorageBlobStoreContextModule.java | 5 +-
.../HPCloudObjectStorageHttpApiModule.java | 93 ++++++++++++
.../HPCloudObjectStorageRestClientModule.java | 103 -------------
.../extensions/CDNContainerApi.java | 98 +++++++++---
.../extensions/CDNContainerAsyncApi.java | 148 -------------------
.../HPCloudObjectStorageClientLiveTest.java | 2 +-
...PCloudObjectStorageBlobSignerExpectTest.java | 10 +-
.../HPCloudObjectStorageEndpointModuleTest.java | 8 +-
13 files changed, 248 insertions(+), 525 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApi.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApi.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApi.java
index 0ef2d46..4dbceb5 100644
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApi.java
+++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApi.java
@@ -16,27 +16,39 @@
*/
package org.jclouds.hpcloud.objectstorage;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.jclouds.openstack.swift.SwiftFallbacks.TrueOn404FalseOn409;
+
import java.util.Set;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
import org.jclouds.hpcloud.objectstorage.extensions.CDNContainerApi;
import org.jclouds.location.Region;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.swift.CommonSwiftClient;
+import org.jclouds.openstack.swift.Storage;
+import org.jclouds.openstack.swift.domain.ContainerMetadata;
+import org.jclouds.openstack.swift.options.ListContainerOptions;
import org.jclouds.rest.annotations.Delegate;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.Provides;
-/**
- * Provides synchronous access to HP Cloud Object Storage via the REST API.
- *
- * <p/>
- * All commands return a ListenableFuture of the result. Any exceptions incurred during processing
- * will be backend in an {@link java.util.concurrent.ExecutionException} as documented in
- * {@link ListenableFuture#get()}.
- *
- * @see HPCloudObjectStorageAsyncApi
- * @see <a href="https://manage.hpcloud.com/pages/build/docs/objectstorage-lvs/api">HP Cloud Object
- * Storage API</a>
- */
+/** Provides synchronous access to HP Cloud Object Storage via the REST API. */
+@Deprecated
+@RequestFilters(AuthenticateRequest.class)
+@Endpoint(Storage.class)
public interface HPCloudObjectStorageApi extends CommonSwiftClient {
/**
*
@@ -46,6 +58,20 @@ public interface HPCloudObjectStorageApi extends CommonSwiftClient {
@Region
Set<String> getConfiguredRegions();
+ @Override
+ @Named("ListContainers")
+ @GET
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/") Set<ContainerMetadata> listContainers(ListContainerOptions... options);
+
+ @Override
+ @Named("DeleteContainer")
+ @DELETE
+ @Fallback(TrueOn404FalseOn409.class)
+ @Path("/{container}")
+ boolean deleteContainerIfEmpty(@PathParam("container") String container);
+
/**
* Provides synchronous access to CDN features.
*/
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java
index e7c0d0f..fa3f1ad 100644
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java
+++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java
@@ -16,46 +16,37 @@
*/
package org.jclouds.hpcloud.objectstorage;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
-import com.google.inject.Module;
-import com.google.inject.name.Named;
+import static org.jclouds.hpcloud.objectstorage.config.HPCloudObjectStorageHttpApiModule.HPCloudObjectStorageEndpointModule;
+import static org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule;
+import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
+import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
+import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
+
+import java.net.URI;
+import java.util.Properties;
+
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.hpcloud.objectstorage.blobstore.HPCloudObjectStorageBlobRequestSigner;
import org.jclouds.hpcloud.objectstorage.blobstore.config.HPCloudObjectStorageBlobStoreContextModule;
-import org.jclouds.hpcloud.objectstorage.config.HPCloudObjectStorageRestClientModule;
+import org.jclouds.hpcloud.objectstorage.config.HPCloudObjectStorageHttpApiModule;
import org.jclouds.location.suppliers.RegionIdToURISupplier;
+import org.jclouds.openstack.keystone.v2_0.config.AuthenticationApiModule;
import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
-import org.jclouds.openstack.keystone.v2_0.config.MappedAuthenticationApiModule;
import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURISupplier;
import org.jclouds.openstack.swift.SwiftKeystoneApiMetadata;
import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule;
-import org.jclouds.openstack.swift.extensions.KeystoneTemporaryUrlKeyAsyncApi;
+import org.jclouds.openstack.swift.extensions.KeystoneTemporaryUrlKeyApi;
import org.jclouds.openstack.swift.extensions.TemporaryUrlKeyApi;
import org.jclouds.rest.annotations.ApiVersion;
-import java.net.URI;
-import java.util.Properties;
-
-import static org.jclouds.hpcloud.objectstorage.config.HPCloudObjectStorageRestClientModule.HPCloudObjectStorageEndpointModule;
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule;
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
-import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+import com.google.inject.name.Named;
/**
* Implementation of {@link org.jclouds.providers.ProviderMetadata} for HP Cloud Services Object Storage
*/
public class HPCloudObjectStorageApiMetadata extends SwiftKeystoneApiMetadata {
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(HPCloudObjectStorageApi.class)} as
- * {@link HPCloudObjectStorageAsyncApi} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<HPCloudObjectStorageApi, HPCloudObjectStorageAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<HPCloudObjectStorageApi, HPCloudObjectStorageAsyncApi>>() {
- private static final long serialVersionUID = 1L;
- };
-
@Override
public Builder toBuilder() {
return new Builder().fromApiMetadata(this);
@@ -75,22 +66,20 @@ public class HPCloudObjectStorageApiMetadata extends SwiftKeystoneApiMetadata {
return properties;
}
- public static class Builder extends SwiftKeystoneApiMetadata.Builder<Builder> {
- @SuppressWarnings("deprecation")
+ public static class Builder extends SwiftKeystoneApiMetadata.Builder<HPCloudObjectStorageApi, Builder> {
protected Builder() {
- super(HPCloudObjectStorageApi.class, HPCloudObjectStorageAsyncApi.class);
+ super(HPCloudObjectStorageApi.class);
id("hpcloud-objectstorage")
.endpointName("identity service url ending in /v2.0/")
.defaultEndpoint("https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/")
.name("HP Cloud Services Object Storage API")
.documentation(URI.create("https://build.hpcloud.com/object-storage/api"))
.defaultProperties(HPCloudObjectStorageApiMetadata.defaultProperties())
- .context(CONTEXT_TOKEN)
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
- .add(MappedAuthenticationApiModule.class)
+ .add(AuthenticationApiModule.class)
.add(HPCloudObjectStorageEndpointModule.class)
.add(IgnoreRegionVersionsModule.class)
- .add(HPCloudObjectStorageRestClientModule.class)
+ .add(HPCloudObjectStorageHttpApiModule.class)
.add(HPCloudObjectStorageBlobStoreContextModule.class)
.add(HPCloudObjectStorageTemporaryUrlExtensionModule.class).build());
}
@@ -110,14 +99,15 @@ public class HPCloudObjectStorageApiMetadata extends SwiftKeystoneApiMetadata {
* Ensures keystone auth is used instead of swift auth
*/
public static class HPCloudObjectStorageTemporaryUrlExtensionModule extends
- TemporaryUrlExtensionModule<HPCloudObjectStorageAsyncApi> {
+ TemporaryUrlExtensionModule<HPCloudObjectStorageApi> {
@Override
protected void bindRequestSigner() {
bind(BlobRequestSigner.class).to(HPCloudObjectStorageBlobRequestSigner.class);
}
@Override
protected void bindTemporaryUrlKeyApi() {
- bindSyncToAsyncHttpApi(binder(), TemporaryUrlKeyApi.class, KeystoneTemporaryUrlKeyAsyncApi.class);
+ bindHttpApi(binder(), KeystoneTemporaryUrlKeyApi.class);
+ bind(TemporaryUrlKeyApi.class).to(KeystoneTemporaryUrlKeyApi.class);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageAsyncApi.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageAsyncApi.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageAsyncApi.java
deleted file mode 100644
index 51cb464..0000000
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageAsyncApi.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.hpcloud.objectstorage;
-
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.hpcloud.objectstorage.extensions.CDNContainerAsyncApi;
-import org.jclouds.location.Region;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
-import org.jclouds.openstack.swift.Storage;
-import org.jclouds.openstack.swift.SwiftFallbacks.TrueOn404FalseOn409;
-import org.jclouds.openstack.swift.domain.ContainerMetadata;
-import org.jclouds.openstack.swift.options.ListContainerOptions;
-import org.jclouds.rest.annotations.Delegate;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.inject.Provides;
-
-/**
- * Provides asynchronous access to HP Cloud Object Storage via the REST API.
- *
- * <p/>
- * All commands return a ListenableFuture of the result. Any exceptions incurred
- * during processing will be backend in an
- * {@link java.util.concurrent.ExecutionException} as documented in
- * {@link ListenableFuture#get()}.
- *
- * @see HPCloudObjectStorageApi
- * @see <a
- * href="https://api-docs.hpcloud.com/hpcloud-object-storage/1.0/content/ch_object-storage-dev-overview.html">HP
- * Cloud Object Storage API</a>
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(HPCloudObjectStorageApi.class)} as
- * {@link HPCloudObjectStorageAsyncApi} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-@RequestFilters(AuthenticateRequest.class)
-@Endpoint(Storage.class)
-public interface HPCloudObjectStorageAsyncApi extends CommonSwiftAsyncClient {
- /**
- *
- * @return the Region codes configured
- */
- @Provides
- @Region
- Set<String> getConfiguredRegions();
-
- /**
- * @see org.jclouds.openstack.swift.CommonSwiftClient#listContainers
- */
- @Named("ListContainers")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/")
- ListenableFuture<? extends Set<ContainerMetadata>> listContainers(ListContainerOptions... options);
-
- /**
- * @see org.jclouds.openstack.swift.CommonSwiftClient#deleteContainerIfEmpty
- */
- @Named("DeleteContainer")
- @DELETE
- @Fallback(TrueOn404FalseOn409.class)
- @Path("/{container}")
- ListenableFuture<Boolean> deleteContainerIfEmpty(@PathParam("container") String container);
-
- /**
- * Provides asynchronous access to CDN features.
- */
- @Delegate
- Optional<CDNContainerAsyncApi> getCDNExtension();
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageAsyncBlobStore.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageAsyncBlobStore.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageAsyncBlobStore.java
deleted file mode 100644
index dca8514..0000000
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageAsyncBlobStore.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.hpcloud.objectstorage.blobstore;
-
-import static com.google.common.util.concurrent.Futures.immediateFuture;
-import static com.google.common.util.concurrent.Futures.transform;
-
-import java.net.URI;
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageApi;
-import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageAsyncApi;
-import org.jclouds.hpcloud.objectstorage.blobstore.functions.EnableCDNAndCache;
-import org.jclouds.openstack.swift.blobstore.SwiftAsyncBlobStore;
-import org.jclouds.openstack.swift.blobstore.functions.BlobStoreListContainerOptionsToListContainerOptions;
-import org.jclouds.openstack.swift.blobstore.functions.BlobToObject;
-import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceList;
-import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceMetadata;
-import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlob;
-import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata;
-import org.jclouds.openstack.swift.blobstore.strategy.internal.AsyncMultipartUploadStrategy;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer
- * supported. Please use {@link HPCloudObjectStorageBlobStore}
- */
-@Deprecated
-@Singleton
-public class HPCloudObjectStorageAsyncBlobStore extends SwiftAsyncBlobStore {
- private final EnableCDNAndCache enableAndCache;
-
- @Inject
- protected HPCloudObjectStorageAsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, Supplier<Location> defaultLocation,
- @Memoized Supplier<Set<? extends Location>> locations, HPCloudObjectStorageApi sync, HPCloudObjectStorageAsyncApi async,
- ContainerToResourceMetadata container2ResourceMd,
- BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
- ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object,
- ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions,
- Provider<FetchBlobMetadata> fetchBlobMetadataProvider, EnableCDNAndCache enableAndCache,
- Provider<AsyncMultipartUploadStrategy> multipartUploadStrategy) {
- super(context, blobUtils, userExecutor, defaultLocation, locations, sync, async, container2ResourceMd,
- container2ContainerListOptions, container2ResourceList, object2Blob, blob2Object, object2BlobMd,
- blob2ObjectGetOptions, fetchBlobMetadataProvider, multipartUploadStrategy);
- this.enableAndCache = enableAndCache;
- }
-
- @Override
- public ListenableFuture<Boolean> createContainerInLocation(Location location, final String container,
- CreateContainerOptions options) {
- if (options.isPublicRead()) {
- return transform(immediateFuture(enableAndCache.apply(container)), new Function<URI, Boolean>() {
- public Boolean apply(URI from) {
- return from != null;
- }
- }, userExecutor);
- }
-
- return createContainerInLocation(location, container);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSigner.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSigner.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSigner.java
index 9453da8..7887f44 100644
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSigner.java
+++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSigner.java
@@ -41,7 +41,7 @@ import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
import org.jclouds.crypto.Crypto;
import org.jclouds.date.TimeStamp;
import org.jclouds.domain.Credentials;
-import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageAsyncApi;
+import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageApi;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.options.GetOptions;
import org.jclouds.openstack.keystone.v2_0.domain.Access;
@@ -94,9 +94,9 @@ public class HPCloudObjectStorageBlobRequestSigner implements BlobRequestSigner
this.blobToObject = checkNotNull(blobToObject, "blobToObject");
this.blob2HttpGetOptions = checkNotNull(blob2HttpGetOptions, "blob2HttpGetOptions");
- this.getMethod = method(HPCloudObjectStorageAsyncApi.class, "getObject", String.class, String.class, GetOptions[].class);
- this.deleteMethod = method(HPCloudObjectStorageAsyncApi.class, "removeObject", String.class, String.class);
- this.createMethod = method(HPCloudObjectStorageAsyncApi.class, "putObject", String.class, SwiftObject.class);
+ this.getMethod = method(HPCloudObjectStorageApi.class, "getObject", String.class, String.class, GetOptions[].class);
+ this.deleteMethod = method(HPCloudObjectStorageApi.class, "removeObject", String.class, String.class);
+ this.createMethod = method(HPCloudObjectStorageApi.class, "putObject", String.class, SwiftObject.class);
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/config/HPCloudObjectStorageBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/config/HPCloudObjectStorageBlobStoreContextModule.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/config/HPCloudObjectStorageBlobStoreContextModule.java
index 28ea5d5..e33788e 100644
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/config/HPCloudObjectStorageBlobStoreContextModule.java
+++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/config/HPCloudObjectStorageBlobStoreContextModule.java
@@ -29,8 +29,8 @@ import javax.inject.Singleton;
import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
+import org.jclouds.blobstore.internal.SubmissionAsyncBlobStore;
import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageApi;
-import org.jclouds.hpcloud.objectstorage.blobstore.HPCloudObjectStorageAsyncBlobStore;
import org.jclouds.hpcloud.objectstorage.blobstore.HPCloudObjectStorageBlobStore;
import org.jclouds.hpcloud.objectstorage.blobstore.functions.HPCloudObjectStorageObjectToBlobMetadata;
import org.jclouds.hpcloud.objectstorage.domain.CDNContainer;
@@ -46,6 +46,7 @@ import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.inject.Provides;
+import com.google.inject.Scopes;
public class HPCloudObjectStorageBlobStoreContextModule extends SwiftBlobStoreContextModule {
@@ -94,8 +95,8 @@ public class HPCloudObjectStorageBlobStoreContextModule extends SwiftBlobStoreCo
@Override
protected void configure() {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
- bind(AsyncBlobStore.class).to(HPCloudObjectStorageAsyncBlobStore.class);
bind(BlobStore.class).to(HPCloudObjectStorageBlobStore.class);
+ bind(AsyncBlobStore.class).to(SubmissionAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(ObjectToBlobMetadata.class).to(HPCloudObjectStorageObjectToBlobMetadata.class);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageHttpApiModule.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageHttpApiModule.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageHttpApiModule.java
new file mode 100644
index 0000000..01f88f1
--- /dev/null
+++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageHttpApiModule.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.hpcloud.objectstorage.config;
+
+import static org.jclouds.util.Suppliers2.getLastValueInMap;
+import static org.jclouds.util.Suppliers2.getValueInMapOrNull;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageApi;
+import org.jclouds.hpcloud.services.HPExtensionCDN;
+import org.jclouds.hpcloud.services.HPExtensionServiceType;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.location.reference.LocationConstants;
+import org.jclouds.location.suppliers.RegionIdToURISupplier;
+import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
+import org.jclouds.openstack.services.ServiceType;
+import org.jclouds.openstack.swift.CommonSwiftClient;
+import org.jclouds.openstack.swift.Storage;
+import org.jclouds.openstack.swift.config.SwiftHttpApiModule;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.annotations.ApiVersion;
+
+import com.google.common.base.Supplier;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+
+@ConfiguresHttpApi
+public class HPCloudObjectStorageHttpApiModule extends SwiftHttpApiModule<HPCloudObjectStorageApi> {
+
+ public HPCloudObjectStorageHttpApiModule() {
+ super(HPCloudObjectStorageApi.class);
+ }
+
+ protected void bindResolvedClientsToCommonSwift() {
+ bind(CommonSwiftClient.class).to(HPCloudObjectStorageApi.class).in(Scopes.SINGLETON);
+ }
+
+ private static Supplier<URI> getUriSupplier(String serviceType, String apiVersion, RegionIdToURISupplier.Factory factory, String region) {
+ Supplier<Map<String, Supplier<URI>>> endpointsSupplier = factory.createForApiTypeAndVersion(serviceType, apiVersion);
+
+ if (region.isEmpty()) {
+ return getLastValueInMap(endpointsSupplier);
+ } else {
+ return getValueInMapOrNull(endpointsSupplier, region);
+ }
+ }
+
+ @Provides
+ @Singleton
+ @HPExtensionCDN
+ @Nullable
+ protected Supplier<URI> provideCDNUrl(RegionIdToURISupplier.Factory factory,
+ @ApiVersion String apiVersion,
+ @Named(LocationConstants.PROPERTY_REGION) String region) {
+
+ return getUriSupplier(HPExtensionServiceType.CDN, apiVersion, factory, region);
+ }
+
+ // Ignores requested apiVersion to work around versionId issue in HP endpoints
+ public static class HPCloudObjectStorageEndpointModule extends KeystoneAuthenticationModule {
+ @Provides
+ @Singleton
+ @Storage
+ @Nullable
+ protected Supplier<URI> provideStorageUrl(RegionIdToURISupplier.Factory factory,
+ @ApiVersion String apiVersion,
+ @Named(LocationConstants.PROPERTY_REGION) String region) {
+
+ return getUriSupplier(ServiceType.OBJECT_STORE, null, factory, region);
+
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageRestClientModule.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageRestClientModule.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageRestClientModule.java
deleted file mode 100644
index 611a6e7..0000000
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageRestClientModule.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.hpcloud.objectstorage.config;
-import static org.jclouds.reflect.Reflection2.typeToken;
-import static org.jclouds.util.Suppliers2.getLastValueInMap;
-import static org.jclouds.util.Suppliers2.getValueInMapOrNull;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageApi;
-import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageAsyncApi;
-import org.jclouds.hpcloud.objectstorage.extensions.CDNContainerApi;
-import org.jclouds.hpcloud.objectstorage.extensions.CDNContainerAsyncApi;
-import org.jclouds.hpcloud.services.HPExtensionCDN;
-import org.jclouds.hpcloud.services.HPExtensionServiceType;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.location.reference.LocationConstants;
-import org.jclouds.location.suppliers.RegionIdToURISupplier;
-import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
-import org.jclouds.openstack.services.ServiceType;
-import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
-import org.jclouds.openstack.swift.CommonSwiftClient;
-import org.jclouds.openstack.swift.Storage;
-import org.jclouds.openstack.swift.config.SwiftRestClientModule;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.annotations.ApiVersion;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-
-@ConfiguresRestClient
-public class HPCloudObjectStorageRestClientModule extends
- SwiftRestClientModule<HPCloudObjectStorageApi, HPCloudObjectStorageAsyncApi> {
- public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder().put(
- CDNContainerApi.class, CDNContainerAsyncApi.class).build();
-
- public HPCloudObjectStorageRestClientModule() {
- super(typeToken(HPCloudObjectStorageApi.class), typeToken(HPCloudObjectStorageAsyncApi.class),
- DELEGATE_MAP);
- }
-
- protected void bindResolvedClientsToCommonSwift() {
- bind(CommonSwiftClient.class).to(HPCloudObjectStorageApi.class).in(Scopes.SINGLETON);
- bind(CommonSwiftAsyncClient.class).to(HPCloudObjectStorageAsyncApi.class).in(Scopes.SINGLETON);
- }
-
- private static Supplier<URI> getUriSupplier(String serviceType, String apiVersion, RegionIdToURISupplier.Factory factory, String region) {
- Supplier<Map<String, Supplier<URI>>> endpointsSupplier = factory.createForApiTypeAndVersion(serviceType, apiVersion);
-
- if (region.isEmpty()) {
- return getLastValueInMap(endpointsSupplier);
- } else {
- return getValueInMapOrNull(endpointsSupplier, region);
- }
- }
-
- @Provides
- @Singleton
- @HPExtensionCDN
- @Nullable
- protected Supplier<URI> provideCDNUrl(RegionIdToURISupplier.Factory factory,
- @ApiVersion String apiVersion,
- @Named(LocationConstants.PROPERTY_REGION) String region) {
-
- return getUriSupplier(HPExtensionServiceType.CDN, apiVersion, factory, region);
- }
-
- // Ignores requested apiVersion to work around versionId issue in HP endpoints
- public static class HPCloudObjectStorageEndpointModule extends KeystoneAuthenticationModule {
- @Provides
- @Singleton
- @Storage
- @Nullable
- protected Supplier<URI> provideStorageUrl(RegionIdToURISupplier.Factory factory,
- @ApiVersion String apiVersion,
- @Named(LocationConstants.PROPERTY_REGION) String region) {
-
- return getUriSupplier(ServiceType.OBJECT_STORE, null, factory, region);
-
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/extensions/CDNContainerApi.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/extensions/CDNContainerApi.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/extensions/CDNContainerApi.java
index b3f3e4b..20a006f 100644
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/extensions/CDNContainerApi.java
+++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/extensions/CDNContainerApi.java
@@ -16,40 +16,98 @@
*/
package org.jclouds.hpcloud.objectstorage.extensions;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import static org.jclouds.blobstore.BlobStoreFallbacks.NullOnContainerNotFound;
+import static org.jclouds.hpcloud.objectstorage.reference.HPCloudObjectStorageHeaders.CDN_ENABLED;
+import static org.jclouds.hpcloud.objectstorage.reference.HPCloudObjectStorageHeaders.CDN_TTL;
+
import java.net.URI;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
import org.jclouds.hpcloud.objectstorage.domain.CDNContainer;
+import org.jclouds.hpcloud.objectstorage.functions.ParseCDNContainerFromHeaders;
+import org.jclouds.hpcloud.objectstorage.functions.ParseCDNUriFromHeaders;
import org.jclouds.hpcloud.objectstorage.options.ListCDNContainerOptions;
+import org.jclouds.hpcloud.services.HPExtensionCDN;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
import com.google.common.annotations.Beta;
import com.google.common.collect.FluentIterable;
-/**
- * Provides synchronous access to HP Cloud Object Storage via the REST API.
- *
- * <p/>
- * All commands return a ListenableFuture of the result. Any exceptions incurred during processing
- * will be backend in an {@link java.util.concurrent.ExecutionException} as documented in {@link ListenableFuture#get()}.
- *
- * @see org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageApi
- * @see <a href="https://manage.hpcloud.com/pages/build/docs/objectstorage-lvs/api">HP Cloud Object
- * Storage API</a>
- * @see CDNContainerAsyncApi
- */
@Beta
+@RequestFilters(AuthenticateRequest.class)
+@Endpoint(HPExtensionCDN.class)
public interface CDNContainerApi {
-
+
+ @Beta
+ @Named("ListCDNEnabledContainers")
+ @GET
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ @Path("/")
FluentIterable<CDNContainer> list();
-
+
+ @Beta
+ @Named("ListCDNEnabledContainers")
+ @GET
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+ @Path("/")
FluentIterable<CDNContainer> list(ListCDNContainerOptions options);
- CDNContainer get(String container);
+ @Beta
+ @Named("ListCDNEnabledContainerMetadata")
+ @HEAD
+ @ResponseParser(ParseCDNContainerFromHeaders.class)
+ @Fallback(NullOnContainerNotFound.class)
+ @Path("/{container}")
+ CDNContainer get(@PathParam("container") String container);
- URI enable(String container, long ttl);
+ @Beta
+ @Named("CDNEnableContainer")
+ @PUT
+ @Path("/{container}")
+ @Headers(keys = CDN_ENABLED, values = "True")
+ @ResponseParser(ParseCDNUriFromHeaders.class)
+ URI enable(@PathParam("container") String container, @HeaderParam(CDN_TTL) long ttl);
- URI enable(String container);
+ @Beta
+ @Named("CDNEnableContainer")
+ @PUT
+ @Path("/{container}")
+ @Headers(keys = CDN_ENABLED, values = "True")
+ @ResponseParser(ParseCDNUriFromHeaders.class)
+ URI enable(@PathParam("container") String container);
- URI update(String container, long ttl);
-
- boolean disable(String container);
+ @Beta
+ @Named("UpdateCDNEnabledContainerMetadata")
+ @POST
+ @Path("/{container}")
+ @ResponseParser(ParseCDNUriFromHeaders.class)
+ URI update(@PathParam("container") String container, @HeaderParam(CDN_TTL) long ttl);
+ @Beta
+ @Named("DisableCDNEnabledContainer")
+ @PUT
+ @Path("/{container}")
+ @Headers(keys = CDN_ENABLED, values = "False")
+ boolean disable(@PathParam("container") String container);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/extensions/CDNContainerAsyncApi.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/extensions/CDNContainerAsyncApi.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/extensions/CDNContainerAsyncApi.java
deleted file mode 100644
index c24e4fb..0000000
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/extensions/CDNContainerAsyncApi.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.hpcloud.objectstorage.extensions;
-
-import java.net.URI;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnContainerNotFound;
-import org.jclouds.hpcloud.objectstorage.domain.CDNContainer;
-import org.jclouds.hpcloud.objectstorage.functions.ParseCDNContainerFromHeaders;
-import org.jclouds.hpcloud.objectstorage.functions.ParseCDNUriFromHeaders;
-import org.jclouds.hpcloud.objectstorage.options.ListCDNContainerOptions;
-import org.jclouds.hpcloud.objectstorage.reference.HPCloudObjectStorageHeaders;
-import org.jclouds.hpcloud.services.HPExtensionCDN;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.FluentIterable;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to HP Cloud Object Storage via the REST API.
- *
- * <p/>
- * All commands return a ListenableFuture of the result. Any exceptions incurred
- * during processing will be backend in an
- * {@link java.util.concurrent.ExecutionException} as documented in
- * {@link ListenableFuture#get()}.
- *
- * @see HPCloudObjectStorageApi
- * @see <a
- * href="https://api-docs.hpcloud.com/hpcloud-cdn-storage/1.0/content/ch_cdn-dev-overview.html">HP
- * Cloud Object Storage API</a>
- */
-@RequestFilters(AuthenticateRequest.class)
-@Endpoint(HPExtensionCDN.class)
-public interface CDNContainerAsyncApi {
- /**
- * @see HPCloudObjectStorageApi#list()
- */
- @Beta
- @Named("ListCDNEnabledContainers")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- @Path("/")
- ListenableFuture<FluentIterable<CDNContainer>> list();
-
- /**
- * @see HPCloudObjectStorageApi#list(ListCDNContainerOptions)
- */
- @Beta
- @Named("ListCDNEnabledContainers")
- @GET
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- @Path("/")
- ListenableFuture<FluentIterable<CDNContainer>> list(ListCDNContainerOptions options);
-
- /**
- * @see HPCloudObjectStorageApi#get(String)
- */
- @Beta
- @Named("ListCDNEnabledContainerMetadata")
- @HEAD
- @ResponseParser(ParseCDNContainerFromHeaders.class)
- @Fallback(NullOnContainerNotFound.class)
- @Path("/{container}")
- ListenableFuture<CDNContainer> get(@PathParam("container") String container);
-
- /**
- * @see HPCloudObjectStorageApi#enable(String, long)
- */
- @Beta
- @Named("CDNEnableContainer")
- @PUT
- @Path("/{container}")
- @Headers(keys = HPCloudObjectStorageHeaders.CDN_ENABLED, values = "True")
- @ResponseParser(ParseCDNUriFromHeaders.class)
- ListenableFuture<URI> enable(@PathParam("container") String container,
- @HeaderParam(HPCloudObjectStorageHeaders.CDN_TTL) long ttl);
-
- /**
- * @see HPCloudObjectStorageApi#enable(String)
- */
- @Beta
- @Named("CDNEnableContainer")
- @PUT
- @Path("/{container}")
- @Headers(keys = HPCloudObjectStorageHeaders.CDN_ENABLED, values = "True")
- @ResponseParser(ParseCDNUriFromHeaders.class)
- ListenableFuture<URI> enable(@PathParam("container") String container);
-
- /**
- * @see HPCloudObjectStorageApi#update(String, long)
- */
- @Beta
- @Named("UpdateCDNEnabledContainerMetadata")
- @POST
- @Path("/{container}")
- @ResponseParser(ParseCDNUriFromHeaders.class)
- ListenableFuture<URI> update(@PathParam("container") String container,
- @HeaderParam(HPCloudObjectStorageHeaders.CDN_TTL) long ttl);
-
- /**
- * @see HPCloudObjectStorageApi#disable(String)
- */
- @Beta
- @Named("DisableCDNEnabledContainer")
- @PUT
- @Path("/{container}")
- @Headers(keys = HPCloudObjectStorageHeaders.CDN_ENABLED, values = "False")
- ListenableFuture<Boolean> disable(@PathParam("container") String container);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageClientLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageClientLiveTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageClientLiveTest.java
index b5c7028..a86123c 100644
--- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageClientLiveTest.java
+++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageClientLiveTest.java
@@ -39,7 +39,7 @@ public class HPCloudObjectStorageClientLiveTest extends CommonSwiftClientLiveTes
@Override
public HPCloudObjectStorageApi getApi() {
- return view.unwrap(HPCloudObjectStorageApiMetadata.CONTEXT_TOKEN).getApi();
+ return view.unwrapApi(HPCloudObjectStorageApi.class);
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java
index 874fcf8..4857e98 100644
--- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java
+++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java
@@ -25,12 +25,12 @@ import org.jclouds.blobstore.internal.BaseBlobSignerExpectTest;
import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageApiMetadata;
import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageApiMetadata.HPCloudObjectStorageTemporaryUrlExtensionModule;
import org.jclouds.hpcloud.objectstorage.blobstore.config.HPCloudObjectStorageBlobStoreContextModule;
-import org.jclouds.hpcloud.objectstorage.config.HPCloudObjectStorageRestClientModule;
+import org.jclouds.hpcloud.objectstorage.config.HPCloudObjectStorageHttpApiModule;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.keystone.v2_0.config.MappedAuthenticationApiModule;
+import org.jclouds.openstack.keystone.v2_0.config.AuthenticationApiModule;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule;
-import org.jclouds.openstack.swift.config.SwiftRestClientModule.KeystoneStorageEndpointModule;
+import org.jclouds.openstack.swift.config.SwiftHttpApiModule.KeystoneStorageEndpointModule;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
@@ -132,10 +132,10 @@ public class HPCloudObjectStorageBlobSignerExpectTest extends BaseBlobSignerExpe
protected ApiMetadata createApiMetadata() {
return new HPCloudObjectStorageApiMetadata().toBuilder()
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
- .add(MappedAuthenticationApiModule.class)
+ .add(AuthenticationApiModule.class)
.add(KeystoneStorageEndpointModule.class)
.add(RegionModule.class)
- .add(HPCloudObjectStorageRestClientModule.class)
+ .add(HPCloudObjectStorageHttpApiModule.class)
.add(HPCloudObjectStorageBlobStoreContextModule.class)
.add(StaticTimeAndTemporaryUrlKeyModule.class).build()).build();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e243fa51/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageEndpointModuleTest.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageEndpointModuleTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageEndpointModuleTest.java
index 119ea78..dee2547 100644
--- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageEndpointModuleTest.java
+++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageEndpointModuleTest.java
@@ -78,7 +78,7 @@ public class HPCloudObjectStorageEndpointModuleTest {
@Test
public void testObjectStorageRegion() {
- final HPCloudObjectStorageRestClientModule.HPCloudObjectStorageEndpointModule moduleToTest = new HPCloudObjectStorageRestClientModule.HPCloudObjectStorageEndpointModule();
+ final HPCloudObjectStorageHttpApiModule.HPCloudObjectStorageEndpointModule moduleToTest = new HPCloudObjectStorageHttpApiModule.HPCloudObjectStorageEndpointModule();
for (int i = 1; i <= 3; i++) {
Supplier<URI> resultingSupplier = moduleToTest.provideStorageUrl(mockFactory, apiVersion, String.format("region%1$s", i));
@@ -93,7 +93,7 @@ public class HPCloudObjectStorageEndpointModuleTest {
@Test
public void testCDNRegion() {
- final HPCloudObjectStorageRestClientModule moduleToTest = new HPCloudObjectStorageRestClientModule();
+ final HPCloudObjectStorageHttpApiModule moduleToTest = new HPCloudObjectStorageHttpApiModule();
for (int i = 1; i <= 3; i++) {
Supplier<URI> resultingSupplier = moduleToTest.provideCDNUrl(mockCDNFactory, apiVersion, String.format("region%1$s", i));
@@ -111,7 +111,7 @@ public class HPCloudObjectStorageEndpointModuleTest {
*/
@Test
public void testObjectStorageUndefinedRegion() {
- final HPCloudObjectStorageRestClientModule.HPCloudObjectStorageEndpointModule moduleToTest = new HPCloudObjectStorageRestClientModule.HPCloudObjectStorageEndpointModule();
+ final HPCloudObjectStorageHttpApiModule.HPCloudObjectStorageEndpointModule moduleToTest = new HPCloudObjectStorageHttpApiModule.HPCloudObjectStorageEndpointModule();
Supplier<URI> resultingSupplier = moduleToTest.provideStorageUrl(mockFactory, apiVersion, "region-that-dne");
assertNotNull(resultingSupplier);
@@ -121,7 +121,7 @@ public class HPCloudObjectStorageEndpointModuleTest {
@Test
public void testCDNUndefinedRegion() {
- final HPCloudObjectStorageRestClientModule moduleToTest = new HPCloudObjectStorageRestClientModule();
+ final HPCloudObjectStorageHttpApiModule moduleToTest = new HPCloudObjectStorageHttpApiModule();
Supplier<URI> resultingSupplier = moduleToTest.provideCDNUrl(mockCDNFactory, apiVersion, "region-that-dne");
assertNotNull(resultingSupplier);
[32/52] [abbrv] git commit: fix checkstyle
Posted by an...@apache.org.
fix checkstyle
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/d1900400
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/d1900400
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/d1900400
Branch: refs/heads/use-agentproxy-008
Commit: d190040018424aaf260dba6233f6ae4ab484cd57
Parents: 1a54f0f
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 15:40:32 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 16:16:29 2014 -0700
----------------------------------------------------------------------
.../org/jclouds/compute/internal/BaseComputeServiceLiveTest.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/d1900400/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java b/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
index 3509196..bcf6107 100644
--- a/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
+++ b/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
@@ -49,6 +49,7 @@ import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
+
import java.io.IOException;
import java.util.Collection;
import java.util.List;
@@ -64,8 +65,6 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import javax.inject.Named;
-
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeTestUtils;
@@ -113,7 +112,6 @@ import com.google.common.net.HostAndPort;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
import com.google.inject.Key;
import com.google.inject.Module;
import com.google.inject.name.Names;
[30/52] [abbrv] git commit: Overriding modernizer-plugin exclusion
file location for jclouds-project
Posted by an...@apache.org.
Overriding modernizer-plugin exclusion file location for jclouds-project
Needs to use the local exclusions file, not the one from the
jclouds-resources dep (which is not present in jclouds-project)
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/ce76144e
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/ce76144e
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/ce76144e
Branch: refs/heads/use-agentproxy-008
Commit: ce76144e3b0061775a76052302df1f5760e6e26c
Parents: 79d4b48
Author: Andrew Phillips <an...@apache.org>
Authored: Sun Oct 5 14:30:33 2014 -0500
Committer: Andrew Phillips <an...@apache.org>
Committed: Sun Oct 5 18:36:15 2014 -0400
----------------------------------------------------------------------
project/pom.xml | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ce76144e/project/pom.xml
----------------------------------------------------------------------
diff --git a/project/pom.xml b/project/pom.xml
index c799d04..0372aaa 100644
--- a/project/pom.xml
+++ b/project/pom.xml
@@ -721,6 +721,7 @@
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<version>1.1.0</version>
+ <!-- configuration and dependencies set via profiles -->
<executions>
<execution>
<id>modernizer</id>
@@ -730,10 +731,6 @@
</goals>
</execution>
</executions>
- <configuration>
- <javaVersion>1.7</javaVersion>
- <exclusionsFile>resources/modernizer_exclusions.txt</exclusionsFile>
- </configuration>
</plugin>
</plugins>
<pluginManagement>
@@ -1082,6 +1079,17 @@
<violationSeverity>warning</violationSeverity>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.gaul</groupId>
+ <artifactId>modernizer-maven-plugin</artifactId>
+ <configuration>
+ <javaVersion>1.7</javaVersion>
+ <!-- in jclouds-project use the local file. ${project.basedir}
+ required here as 1.1.0 of the modernizer plugin can't find the
+ exclusions file otherwise -->
+ <exclusionsFile>${project.basedir}/../resources/modernizer_exclusions.txt</exclusionsFile>
+ </configuration>
+ </plugin>
</plugins>
</build>
</profile>
@@ -1124,6 +1132,10 @@
<version>${project.version}</version>
</dependency>
</dependencies>
+ <configuration>
+ <javaVersion>1.7</javaVersion>
+ <exclusionsFile>resources/modernizer_exclusions.txt</exclusionsFile>
+ </configuration>
</plugin>
</plugins>
</build>
[31/52] [abbrv] git commit: JCLOUDS-153 Remove deprecated
ExecutorService and HttpAsyncClient accessors.
Posted by an...@apache.org.
JCLOUDS-153 Remove deprecated ExecutorService and HttpAsyncClient accessors.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/1a54f0fb
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/1a54f0fb
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/1a54f0fb
Branch: refs/heads/use-agentproxy-008
Commit: 1a54f0fb098526fc9a4f6fa99f6b818444cc985a
Parents: ce76144
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 13:57:10 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 16:16:28 2014 -0700
----------------------------------------------------------------------
.../org/jclouds/compute/internal/UtilsImpl.java | 14 ++-------
.../internal/BaseComputeServiceLiveTest.java | 8 ++++-
core/src/main/java/org/jclouds/rest/Utils.java | 24 ---------------
.../org/jclouds/rest/config/HttpApiModule.java | 3 --
.../org/jclouds/rest/internal/UtilsImpl.java | 31 ++------------------
5 files changed, 12 insertions(+), 68 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1a54f0fb/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java
----------------------------------------------------------------------
diff --git a/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java b/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java
index 36ac90b..980b999 100644
--- a/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java
+++ b/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java
@@ -18,10 +18,8 @@ package org.jclouds.compute.internal;
import java.util.Map;
-import javax.inject.Named;
import javax.inject.Singleton;
-import org.jclouds.Constants;
import org.jclouds.compute.Utils;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.crypto.Crypto;
@@ -36,7 +34,6 @@ import org.jclouds.xml.XMLParser;
import com.google.common.base.Function;
import com.google.common.eventbus.EventBus;
-import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.Inject;
import com.google.inject.Injector;
@@ -46,15 +43,10 @@ public class UtilsImpl extends org.jclouds.rest.internal.UtilsImpl implements Ut
private Factory sshFactory;
private final Function<NodeMetadata, SshClient> sshForNode;
- @Inject
- UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient,
- org.jclouds.rest.HttpAsyncClient simpleAsyncClient, Crypto encryption, DateService date,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor, EventBus eventBus,
- Map<String, Credentials> credentialStore, LoggerFactory loggerFactory,
+ @Inject UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient, Crypto encryption,
+ DateService date, EventBus eventBus, Map<String, Credentials> credentialStore, LoggerFactory loggerFactory,
Function<NodeMetadata, SshClient> sshForNode) {
- super(injector, json, xml, simpleClient, simpleAsyncClient, encryption, date, userExecutor, ioExecutor, eventBus,
- credentialStore, loggerFactory);
+ super(injector, json, xml, simpleClient, encryption, date, eventBus, credentialStore, loggerFactory);
this.sshForNode = sshForNode;
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1a54f0fb/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java b/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
index a98d481..3509196 100644
--- a/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
+++ b/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
@@ -33,6 +33,7 @@ import static java.lang.String.format;
import static java.lang.System.currentTimeMillis;
import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.logging.Logger.getAnonymousLogger;
+import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import static org.jclouds.compute.options.RunScriptOptions.Builder.nameTask;
import static org.jclouds.compute.options.RunScriptOptions.Builder.wrapInInitScript;
import static org.jclouds.compute.options.TemplateOptions.Builder.overrideLoginCredentials;
@@ -63,6 +64,8 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import javax.inject.Named;
+
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeTestUtils;
@@ -111,7 +114,9 @@ import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
+import com.google.inject.Key;
import com.google.inject.Module;
+import com.google.inject.name.Names;
@Test(groups = { "integration", "live" }, singleThreaded = true)
public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceContextLiveTest {
@@ -448,7 +453,8 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
final long timeoutMs = 20 * 60 * 1000;
List<String> groups = Lists.newArrayList();
List<ListenableFuture<NodeMetadata>> futures = Lists.newArrayList();
- ListeningExecutorService userExecutor = MoreExecutors.listeningDecorator(context.utils().userExecutor());
+ ListeningExecutorService userExecutor = context.utils().injector()
+ .getInstance(Key.get(ListeningExecutorService.class, Names.named(PROPERTY_USER_THREADS)));
try {
for (int i = 0; i < 2; i++) {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1a54f0fb/core/src/main/java/org/jclouds/rest/Utils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/Utils.java b/core/src/main/java/org/jclouds/rest/Utils.java
index dc7ac50..f197702 100644
--- a/core/src/main/java/org/jclouds/rest/Utils.java
+++ b/core/src/main/java/org/jclouds/rest/Utils.java
@@ -28,7 +28,6 @@ import org.jclouds.xml.XMLParser;
import com.google.common.annotations.Beta;
import com.google.common.eventbus.EventBus;
-import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.ImplementedBy;
import com.google.inject.Injector;
@@ -56,34 +55,12 @@ public interface Utils {
Json json();
- /**
- *
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no
- * longer supported.
- */
- @Deprecated
- HttpAsyncClient asyncHttp();
-
HttpClient http();
Crypto crypto();
DateService date();
- /**
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no
- * longer supported.
- */
- @Deprecated
- ListeningExecutorService userExecutor();
-
- /**
- * @deprecated will be removed in jclouds 1.7, as async interfaces are no
- * longer supported.
- */
- @Deprecated
- ListeningExecutorService ioExecutor();
-
EventBus eventBus();
LoggerFactory loggerFactory();
@@ -92,5 +69,4 @@ public interface Utils {
Injector injector();
XMLParser xml();
-
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1a54f0fb/core/src/main/java/org/jclouds/rest/config/HttpApiModule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/config/HttpApiModule.java b/core/src/main/java/org/jclouds/rest/config/HttpApiModule.java
index dbfdb0f..820ee68 100644
--- a/core/src/main/java/org/jclouds/rest/config/HttpApiModule.java
+++ b/core/src/main/java/org/jclouds/rest/config/HttpApiModule.java
@@ -21,7 +21,6 @@ import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
import org.jclouds.reflect.Invocation;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.HttpAsyncClient;
import org.jclouds.rest.HttpClient;
import org.jclouds.rest.internal.InvokeHttpMethod;
@@ -56,8 +55,6 @@ public class HttpApiModule<A> extends RestModule {
}).to(InvokeHttpMethod.class);
bindHttpApi(binder(), api);
bindHttpApi(binder(), HttpClient.class);
- // TODO: remove when references are gone
- bindHttpApi(binder(), HttpAsyncClient.class);
bindErrorHandlers();
bindRetryHandlers();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/1a54f0fb/core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java b/core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java
index c756270..6b32d79 100644
--- a/core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java
+++ b/core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java
@@ -19,9 +19,7 @@ package org.jclouds.rest.internal;
import java.util.Map;
import javax.inject.Inject;
-import javax.inject.Named;
-import org.jclouds.Constants;
import org.jclouds.crypto.Crypto;
import org.jclouds.date.DateService;
import org.jclouds.domain.Credentials;
@@ -33,7 +31,6 @@ import org.jclouds.xml.XMLParser;
import com.google.common.annotations.Beta;
import com.google.common.eventbus.EventBus;
-import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.Injector;
import com.google.inject.Singleton;
@@ -42,11 +39,8 @@ public class UtilsImpl implements Utils {
private final Json json;
private final HttpClient simpleClient;
- private final org.jclouds.rest.HttpAsyncClient simpleAsyncClient;
private final Crypto encryption;
private final DateService date;
- private final ListeningExecutorService userExecutor;
- private final ListeningExecutorService ioExecutor;
private final EventBus eventBus;
private final Map<String, Credentials> credentialStore;
private final LoggerFactory loggerFactory;
@@ -54,18 +48,13 @@ public class UtilsImpl implements Utils {
private XMLParser xml;
@Inject
- protected UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient, org.jclouds.rest.HttpAsyncClient simpleAsyncClient,
- Crypto encryption, DateService date, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor, EventBus eventBus,
- Map<String, Credentials> credentialStore, LoggerFactory loggerFactory) {
+ protected UtilsImpl(Injector injector, Json json, XMLParser xml, HttpClient simpleClient, Crypto encryption,
+ DateService date, EventBus eventBus, Map<String, Credentials> credentialStore, LoggerFactory loggerFactory) {
this.injector = injector;
this.json = json;
this.simpleClient = simpleClient;
- this.simpleAsyncClient = simpleAsyncClient;
this.encryption = encryption;
this.date = date;
- this.userExecutor = userExecutor;
- this.ioExecutor = ioExecutor;
this.eventBus = eventBus;
this.credentialStore = credentialStore;
this.loggerFactory = loggerFactory;
@@ -73,12 +62,6 @@ public class UtilsImpl implements Utils {
}
@Override
- @Deprecated
- public org.jclouds.rest.HttpAsyncClient asyncHttp() {
- return simpleAsyncClient;
- }
-
- @Override
public DateService date() {
return date;
}
@@ -94,16 +77,6 @@ public class UtilsImpl implements Utils {
}
@Override
- public ListeningExecutorService ioExecutor() {
- return ioExecutor;
- }
-
- @Override
- public ListeningExecutorService userExecutor() {
- return userExecutor;
- }
-
- @Override
public EventBus eventBus() {
return eventBus;
}
[46/52] [abbrv] git commit: JCLOUDS-40 unasync Fallback
Posted by an...@apache.org.
JCLOUDS-40 unasync Fallback
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/b9525a08
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/b9525a08
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/b9525a08
Branch: refs/heads/use-agentproxy-008
Commit: b9525a087730642dd116cfa1d394f4afaef28fe5
Parents: 0a236f5
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 22:55:07 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Mon Oct 6 13:14:59 2014 -0700
----------------------------------------------------------------------
.../fallbacks/EndpointIfAlreadyExists.java | 7 ---
.../fallbacks/TrueOn404FalseOnPathNotEmpty.java | 8 ---
.../fallbacks/EndpointIfAlreadyExistsTest.java | 11 ++--
.../functions/CloudStackFallbacks.java | 8 ---
.../main/java/org/jclouds/ec2/EC2Fallbacks.java | 7 ---
.../keystone/v2_0/KeystoneFallbacks.java | 9 +--
.../main/java/org/jclouds/s3/S3Fallbacks.java | 8 ---
...ByYouOrOperationAbortedWhenBucketExists.java | 8 ---
.../java/org/jclouds/s3/S3ClientMockTest.java | 1 -
...uOrOperationAbortedWhenBucketExistsTest.java | 17 +++---
.../jclouds/openstack/swift/SwiftFallbacks.java | 8 ---
.../jclouds/blobstore/BlobStoreFallbacks.java | 33 -----------
core/src/main/java/org/jclouds/Fallback.java | 4 +-
core/src/main/java/org/jclouds/Fallbacks.java | 58 --------------------
.../fallbacks/HeaderToRetryAfterException.java | 14 ++---
.../fallbacks/MapHttp4xxCodesToExceptions.java | 11 +---
.../fallbacks/PropagateIfRetryAfter.java | 12 ++--
.../HeaderToRetryAfterExceptionTest.java | 47 +++++++---------
.../MapHttp4xxCodesToExceptionsTest.java | 14 ++---
.../org/jclouds/http/IntegrationTestClient.java | 7 ---
.../internal/RestAnnotationProcessorTest.java | 1 -
.../jclouds/azureblob/AzureBlobFallbacks.java | 8 ---
.../org/jclouds/dynect/v3/DynECTFallbacks.java | 8 ---
23 files changed, 56 insertions(+), 253 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/apis/atmos/src/main/java/org/jclouds/atmos/fallbacks/EndpointIfAlreadyExists.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/fallbacks/EndpointIfAlreadyExists.java b/apis/atmos/src/main/java/org/jclouds/atmos/fallbacks/EndpointIfAlreadyExists.java
index 4cae37c..041a6ed 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/fallbacks/EndpointIfAlreadyExists.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/fallbacks/EndpointIfAlreadyExists.java
@@ -18,7 +18,6 @@ package org.jclouds.atmos.fallbacks;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import java.net.URI;
@@ -29,18 +28,12 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.rest.InvocationContext;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.util.concurrent.ListenableFuture;
public class EndpointIfAlreadyExists implements Fallback<URI>, InvocationContext<EndpointIfAlreadyExists> {
private URI endpoint;
@Override
- public ListenableFuture<URI> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
- @Override
public URI createOrPropagate(Throwable t) throws Exception {
if (checkNotNull(t, "throwable") instanceof KeyAlreadyExistsException) {
return endpoint;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/apis/atmos/src/main/java/org/jclouds/atmos/fallbacks/TrueOn404FalseOnPathNotEmpty.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/fallbacks/TrueOn404FalseOnPathNotEmpty.java b/apis/atmos/src/main/java/org/jclouds/atmos/fallbacks/TrueOn404FalseOnPathNotEmpty.java
index 18dda1e..d30be6d 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/fallbacks/TrueOn404FalseOnPathNotEmpty.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/fallbacks/TrueOn404FalseOnPathNotEmpty.java
@@ -17,7 +17,6 @@
package org.jclouds.atmos.fallbacks;
import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
import org.jclouds.Fallback;
@@ -25,15 +24,8 @@ import org.jclouds.atmos.AtmosResponseException;
import org.jclouds.atmos.reference.AtmosErrorCode;
import org.jclouds.http.HttpUtils;
-import com.google.common.util.concurrent.ListenableFuture;
-
public final class TrueOn404FalseOnPathNotEmpty implements Fallback<Boolean> {
@Override
- public ListenableFuture<Boolean> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
- @Override
public Boolean createOrPropagate(Throwable t) throws Exception {
if (HttpUtils.contains404(t)) {
return true;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/apis/atmos/src/test/java/org/jclouds/atmos/fallbacks/EndpointIfAlreadyExistsTest.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/fallbacks/EndpointIfAlreadyExistsTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/fallbacks/EndpointIfAlreadyExistsTest.java
index d6c4216..6a41351 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/fallbacks/EndpointIfAlreadyExistsTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/fallbacks/EndpointIfAlreadyExistsTest.java
@@ -16,7 +16,6 @@
*/
package org.jclouds.atmos.fallbacks;
-import static com.google.common.util.concurrent.Futures.getUnchecked;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
@@ -30,23 +29,23 @@ public class EndpointIfAlreadyExistsTest {
@Test
public void testFoundIsNullWhenEndpointNotSet() throws Exception {
- assertNull(getUnchecked(new EndpointIfAlreadyExists().create(new KeyAlreadyExistsException())));
+ assertNull(new EndpointIfAlreadyExists().createOrPropagate(new KeyAlreadyExistsException()));
}
@Test
public void testFoundIsEndpointWhenSet() throws Exception {
assertEquals(
- getUnchecked(new EndpointIfAlreadyExists().setEndpoint(URI.create("foo")).create(
- new KeyAlreadyExistsException())), URI.create("foo"));
+ new EndpointIfAlreadyExists().setEndpoint(URI.create("foo")).createOrPropagate(
+ new KeyAlreadyExistsException()), URI.create("foo"));
}
@Test(expectedExceptions = RuntimeException.class)
public void testNotFoundPropagates() throws Exception {
- new EndpointIfAlreadyExists().create(new RuntimeException());
+ new EndpointIfAlreadyExists().createOrPropagate(new RuntimeException());
}
@Test(expectedExceptions = NullPointerException.class)
public void testNullIsBad() throws Exception {
- new EndpointIfAlreadyExists().create(null);
+ new EndpointIfAlreadyExists().createOrPropagate(null);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CloudStackFallbacks.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CloudStackFallbacks.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CloudStackFallbacks.java
index 50185ed..c2b5ec8 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CloudStackFallbacks.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/CloudStackFallbacks.java
@@ -17,14 +17,11 @@
package org.jclouds.cloudstack.functions;
import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.Fallbacks.valOnNotFoundOr404;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
import org.jclouds.Fallback;
-import com.google.common.util.concurrent.ListenableFuture;
-
public final class CloudStackFallbacks {
private CloudStackFallbacks() {
}
@@ -35,11 +32,6 @@ public final class CloudStackFallbacks {
*/
public static final class VoidOnNotFoundOr404OrUnableToFindAccountOwner implements Fallback<Void> {
@Override
- public ListenableFuture<Void> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
- @Override
public Void createOrPropagate(Throwable t) throws Exception {
IllegalStateException e = getFirstThrowableOfType(checkNotNull(t, "throwable"), IllegalStateException.class);
if (e != null && e.getMessage().indexOf("Unable to find account owner for") != -1) {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/apis/ec2/src/main/java/org/jclouds/ec2/EC2Fallbacks.java
----------------------------------------------------------------------
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/EC2Fallbacks.java b/apis/ec2/src/main/java/org/jclouds/ec2/EC2Fallbacks.java
index 7cb4675..c16f5af 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/EC2Fallbacks.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/EC2Fallbacks.java
@@ -18,14 +18,12 @@ package org.jclouds.ec2;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import org.jclouds.Fallback;
import org.jclouds.aws.AWSResponseException;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet;
-import com.google.common.util.concurrent.ListenableFuture;
public final class EC2Fallbacks {
private EC2Fallbacks() {
@@ -33,11 +31,6 @@ public final class EC2Fallbacks {
public static final class VoidOnVolumeAvailable implements Fallback<Void> {
@Override
- public ListenableFuture<Void> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
- @Override
public Void createOrPropagate(Throwable t) throws Exception {
if (checkNotNull(t, "throwable") instanceof AWSResponseException) {
AWSResponseException e = AWSResponseException.class.cast(t);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneFallbacks.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneFallbacks.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneFallbacks.java
index 409022f..f5cf9ea 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneFallbacks.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneFallbacks.java
@@ -16,15 +16,13 @@
*/
package org.jclouds.openstack.keystone.v2_0;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.Fallbacks.valOnNotFoundOr404;
import org.jclouds.Fallback;
-import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
import com.google.common.collect.ImmutableSet;
-import com.google.common.util.concurrent.ListenableFuture;
public final class KeystoneFallbacks {
private KeystoneFallbacks() {
@@ -36,11 +34,6 @@ public final class KeystoneFallbacks {
};
@Override
- public ListenableFuture<PaginatedCollection<Object>> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
- @Override
public PaginatedCollection<Object> createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(EMPTY, t);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/apis/s3/src/main/java/org/jclouds/s3/S3Fallbacks.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/S3Fallbacks.java b/apis/s3/src/main/java/org/jclouds/s3/S3Fallbacks.java
index 73edb0e..6795c91 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/S3Fallbacks.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/S3Fallbacks.java
@@ -19,26 +19,18 @@ package org.jclouds.s3;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.equalTo;
import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.returnValueOnCodeOrNull;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
import org.jclouds.Fallback;
import org.jclouds.blobstore.ContainerNotFoundException;
-import com.google.common.util.concurrent.ListenableFuture;
-
public final class S3Fallbacks {
private S3Fallbacks() {
}
public static final class TrueOn404OrNotFoundFalseOnIllegalState implements Fallback<Boolean> {
@Override
- public ListenableFuture<Boolean> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
- @Override
public Boolean createOrPropagate(Throwable t) throws Exception {
if (getFirstThrowableOfType(checkNotNull(t, "throwable"), IllegalStateException.class) != null)
return false;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/apis/s3/src/main/java/org/jclouds/s3/fallbacks/FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/fallbacks/FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.java b/apis/s3/src/main/java/org/jclouds/s3/fallbacks/FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.java
index 998fe33..4b58ffa 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/fallbacks/FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/fallbacks/FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists.java
@@ -18,7 +18,6 @@ package org.jclouds.s3.fallbacks;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.s3.util.S3Utils.getBucketName;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
@@ -31,8 +30,6 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.rest.InvocationContext;
import org.jclouds.s3.S3Client;
-import com.google.common.util.concurrent.ListenableFuture;
-
public class FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists implements Fallback<Boolean>,
InvocationContext<FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists> {
@@ -45,11 +42,6 @@ public class FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists im
}
@Override
- public ListenableFuture<Boolean> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
- @Override
public Boolean createOrPropagate(Throwable t) throws Exception {
AWSResponseException exception = getFirstThrowableOfType(checkNotNull(t, "throwable"), AWSResponseException.class);
if (exception != null && exception.getError() != null && exception.getError().getCode() != null) {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java b/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
index 097d49d..5cb2db5 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
@@ -21,7 +21,6 @@ import static com.google.common.net.HttpHeaders.ETAG;
import static com.google.common.net.HttpHeaders.EXPECT;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static org.jclouds.Constants.PROPERTY_MAX_RETRIES;
-import static org.jclouds.Constants.PROPERTY_SO_TIMEOUT;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/apis/s3/src/test/java/org/jclouds/s3/fallbacks/FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/fallbacks/FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTest.java b/apis/s3/src/test/java/org/jclouds/s3/fallbacks/FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTest.java
index 7c31a39..9e3989e 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/fallbacks/FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/fallbacks/FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.jclouds.s3.fallbacks;
-import static com.google.common.util.concurrent.Futures.getUnchecked;
+
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
@@ -55,8 +55,8 @@ public class FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTes
replay(client);
Exception e = getErrorWithCode("BucketAlreadyOwnedByYou");
- assertFalse(getUnchecked(new FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists(client).setContext(
- putBucket).create(e)));
+ assertFalse(new FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists(client).setContext(
+ putBucket).createOrPropagate(e));
verify(client);
}
@@ -66,8 +66,8 @@ public class FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTes
expect(client.bucketExists("bucket")).andReturn(true);
replay(client);
Exception e = getErrorWithCode("OperationAborted");
- assertFalse(getUnchecked(new FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists(client).setContext(
- putBucket).create(e)));
+ assertFalse(new FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists(client).setContext(
+ putBucket).createOrPropagate(e));
verify(client);
}
@@ -77,7 +77,8 @@ public class FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTes
expect(client.bucketExists("bucket")).andReturn(false);
replay(client);
Exception e = getErrorWithCode("OperationAborted");
- new FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists(client).setContext(putBucket).create(e);
+ new FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists(client).setContext(putBucket)
+ .createOrPropagate(e);
}
@Test(expectedExceptions = IllegalStateException.class)
@@ -86,7 +87,7 @@ public class FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTes
replay(client);
Exception e = new IllegalStateException();
- new FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists(client).create(e);
+ new FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists(client).createOrPropagate(e);
}
@Test(expectedExceptions = AWSResponseException.class)
@@ -94,7 +95,7 @@ public class FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTes
S3Client client = createMock(S3Client.class);
replay(client);
Exception e = getErrorWithCode("blah");
- new FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists(client).create(e);
+ new FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExists(client).createOrPropagate(e);
}
private Exception getErrorWithCode(String code) {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftFallbacks.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftFallbacks.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftFallbacks.java
index daec13a..44ca048 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftFallbacks.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftFallbacks.java
@@ -19,25 +19,17 @@ package org.jclouds.openstack.swift;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.equalTo;
import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.http.HttpUtils.returnValueOnCodeOrNull;
import org.jclouds.Fallback;
-import com.google.common.util.concurrent.ListenableFuture;
-
public final class SwiftFallbacks {
private SwiftFallbacks() {
}
public static final class TrueOn404FalseOn409 implements Fallback<Boolean> {
@Override
- public ListenableFuture<Boolean> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
- @Override
public Boolean createOrPropagate(Throwable t) throws Exception {
if (contains404(checkNotNull(t, "throwable")))
return true;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreFallbacks.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreFallbacks.java b/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreFallbacks.java
index 5434545..42a11ae 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreFallbacks.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreFallbacks.java
@@ -18,48 +18,31 @@ package org.jclouds.blobstore;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import org.jclouds.Fallback;
-import com.google.common.util.concurrent.ListenableFuture;
-
public final class BlobStoreFallbacks {
private BlobStoreFallbacks() {
}
public static final class ThrowContainerNotFoundOn404 implements Fallback<Object> {
- public ListenableFuture<Object> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Object createOrPropagate(Throwable t) throws Exception {
if (contains404(checkNotNull(t, "throwable")))
throw new ContainerNotFoundException(t);
throw propagate(t);
}
-
}
public static final class ThrowKeyNotFoundOn404 implements Fallback<Object> {
- public ListenableFuture<Object> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Object createOrPropagate(Throwable t) throws Exception {
if (contains404(checkNotNull(t, "throwable")))
throw new KeyNotFoundException(t);
throw propagate(t);
}
-
}
public static final class FalseOnContainerNotFound implements Fallback<Boolean> {
- public ListenableFuture<Boolean> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Boolean createOrPropagate(Throwable t) throws Exception {
if (checkNotNull(t, "throwable") instanceof ContainerNotFoundException) {
return false;
@@ -69,10 +52,6 @@ public final class BlobStoreFallbacks {
}
public static final class FalseOnKeyNotFound implements Fallback<Boolean> {
- public ListenableFuture<Boolean> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Boolean createOrPropagate(Throwable t) throws Exception {
if (checkNotNull(t, "throwable") instanceof KeyNotFoundException) {
return false;
@@ -82,10 +61,6 @@ public final class BlobStoreFallbacks {
}
public static final class NullOnContainerNotFound implements Fallback<Object> {
- public ListenableFuture<Object> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Object createOrPropagate(Throwable t) throws Exception {
if (checkNotNull(t, "throwable") instanceof ContainerNotFoundException) {
return null;
@@ -95,10 +70,6 @@ public final class BlobStoreFallbacks {
}
public static final class NullOnKeyNotFound implements Fallback<Object> {
- public ListenableFuture<Object> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Object createOrPropagate(Throwable t) throws Exception {
if (checkNotNull(t, "throwable") instanceof KeyNotFoundException) {
return null;
@@ -108,10 +79,6 @@ public final class BlobStoreFallbacks {
}
public static final class NullOnKeyAlreadyExists implements Fallback<Object> {
- public ListenableFuture<Object> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Object createOrPropagate(Throwable t) throws Exception {
if (checkNotNull(t, "throwable") instanceof KeyAlreadyExistsException) {
return null;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/core/src/main/java/org/jclouds/Fallback.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/Fallback.java b/core/src/main/java/org/jclouds/Fallback.java
index bb7bd07..e24a245 100644
--- a/core/src/main/java/org/jclouds/Fallback.java
+++ b/core/src/main/java/org/jclouds/Fallback.java
@@ -17,7 +17,6 @@
package org.jclouds;
import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.FutureFallback;
/**
* Provides a backup value to replace an earlier exception.
@@ -25,11 +24,10 @@ import com.google.common.util.concurrent.FutureFallback;
* @param <V>
* the result type of the backup value
*
- * @see FutureFallback
* @since 1.6
*/
@Beta
-public interface Fallback<V> extends FutureFallback<V> {
+public interface Fallback<V> {
/**
* The exception is provided so that the {@code Fallback} implementation can
* conditionally determine whether to propagate the exception or to attempt
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/core/src/main/java/org/jclouds/Fallbacks.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/Fallbacks.java b/core/src/main/java/org/jclouds/Fallbacks.java
index c49994b..823e5ea 100644
--- a/core/src/main/java/org/jclouds/Fallbacks.java
+++ b/core/src/main/java/org/jclouds/Fallbacks.java
@@ -21,7 +21,6 @@ import static com.google.common.base.Predicates.equalTo;
import static com.google.common.base.Predicates.in;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.primitives.Ints.asList;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.contains404;
import static org.jclouds.http.HttpUtils.returnValueOnCodeOrNull;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
@@ -38,57 +37,36 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
-import com.google.common.util.concurrent.ListenableFuture;
public final class Fallbacks {
private Fallbacks() {
}
public static final class NullOnNotFoundOr404 implements Fallback<Object> {
- public ListenableFuture<Object> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Object createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(null, checkNotNull(t, "throwable"));
}
}
public static final class VoidOnNotFoundOr404 implements Fallback<Void> {
- public ListenableFuture<Void> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Void createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(null, checkNotNull(t, "throwable"));
}
}
public static final class TrueOnNotFoundOr404 implements Fallback<Boolean> {
- public ListenableFuture<Boolean> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Boolean createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(true, checkNotNull(t, "throwable"));
}
}
public static final class FalseOnNotFoundOr404 implements Fallback<Boolean> {
- public ListenableFuture<Boolean> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Boolean createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(false, checkNotNull(t, "throwable"));
}
}
public static final class FalseOnNotFoundOr422 implements Fallback<Boolean> {
- public ListenableFuture<Boolean> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Boolean createOrPropagate(Throwable t) throws Exception {
if (containsResourceNotFoundException(checkNotNull(t, "throwable"))
|| returnValueOnCodeOrNull(t, true, equalTo(422)) != null)
@@ -100,10 +78,6 @@ public final class Fallbacks {
/**
*/
public static final class AbsentOn403Or404Or500 implements Fallback<Optional<Object>> {
- public ListenableFuture<Optional<Object>> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public Optional<Object> createOrPropagate(Throwable t) throws Exception {
Boolean returnVal = returnValueOnCodeOrNull(checkNotNull(t, "throwable"), true, in(asList(403, 404, 500)));
if (returnVal != null)
@@ -113,30 +87,18 @@ public final class Fallbacks {
}
public static final class EmptyFluentIterableOnNotFoundOr404 implements Fallback<FluentIterable<Object>> {
- public ListenableFuture<FluentIterable<Object>> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public FluentIterable<Object> createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(FluentIterable.from(ImmutableSet.of()), checkNotNull(t, "throwable"));
}
}
public static final class EmptyIterableWithMarkerOnNotFoundOr404 implements Fallback<IterableWithMarker<Object>> {
- public ListenableFuture<IterableWithMarker<Object>> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public IterableWithMarker<Object> createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(IterableWithMarkers.from(ImmutableSet.of()), checkNotNull(t, "throwable"));
}
}
public static final class EmptyPagedIterableOnNotFoundOr404 implements Fallback<PagedIterable<Object>> {
- public ListenableFuture<PagedIterable<Object>> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public PagedIterable<Object> createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(PagedIterables.of(IterableWithMarkers.from(ImmutableSet.of())),
checkNotNull(t, "throwable"));
@@ -144,44 +106,24 @@ public final class Fallbacks {
}
public static final class EmptyListOnNotFoundOr404 implements Fallback<ImmutableList<Object>> { // NO_UCD
- // (unused
- // code)
- public ListenableFuture<ImmutableList<Object>> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public ImmutableList<Object> createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(ImmutableList.of(), checkNotNull(t, "throwable"));
}
}
public static final class EmptySetOnNotFoundOr404 implements Fallback<ImmutableSet<Object>> {
- public ListenableFuture<ImmutableSet<Object>> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public ImmutableSet<Object> createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(ImmutableSet.of(), checkNotNull(t, "throwable"));
}
}
public static final class EmptyMapOnNotFoundOr404 implements Fallback<ImmutableMap<Object, Object>> {
- public ListenableFuture<ImmutableMap<Object, Object>> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public ImmutableMap<Object, Object> createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(ImmutableMap.of(), checkNotNull(t, "throwable"));
}
}
public static final class EmptyMultimapOnNotFoundOr404 implements Fallback<ImmutableMultimap<Object, Object>> { // NO_UCD
- // (unused
- // code)
- public ListenableFuture<ImmutableMultimap<Object, Object>> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
public ImmutableMultimap<Object, Object> createOrPropagate(Throwable t) throws Exception {
return valOnNotFoundOr404(ImmutableMultimap.of(), checkNotNull(t, "throwable"));
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/core/src/main/java/org/jclouds/fallbacks/HeaderToRetryAfterException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/fallbacks/HeaderToRetryAfterException.java b/core/src/main/java/org/jclouds/fallbacks/HeaderToRetryAfterException.java
index f21b3c2..1d330a5 100644
--- a/core/src/main/java/org/jclouds/fallbacks/HeaderToRetryAfterException.java
+++ b/core/src/main/java/org/jclouds/fallbacks/HeaderToRetryAfterException.java
@@ -18,7 +18,6 @@ package org.jclouds.fallbacks;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
@@ -34,7 +33,6 @@ import com.google.common.annotations.Beta;
import com.google.common.base.Optional;
import com.google.common.base.Ticker;
import com.google.common.net.HttpHeaders;
-import com.google.common.util.concurrent.ListenableFuture;
/**
* propagates as {@link RetryAfterException} if a Throwable is an
@@ -54,7 +52,7 @@ public final class HeaderToRetryAfterException implements PropagateIfRetryAfter
*
* @param ticker
* how to read current time
- * @param dateParser
+ * @param dateCodec
* how to parse the {@link HttpHeaders#RETRY_AFTER} header, if it
* is a Date.
* @return
@@ -76,13 +74,13 @@ public final class HeaderToRetryAfterException implements PropagateIfRetryAfter
this.dateCodec = checkNotNull(dateCodec, "dateCodec");
}
- @Override
- public ListenableFuture<Object> create(Throwable t) {
+ @Override public Object createOrPropagate(Throwable t) throws Exception {
if (!(t instanceof HttpResponseException))
throw propagate(t);
HttpResponse response = HttpResponseException.class.cast(t).getResponse();
- if (response == null)
- return immediateFuture(null);
+ if (response == null) {
+ return null;
+ }
// https://tools.ietf.org/html/rfc2616#section-14.37
String retryAfter = response.getFirstHeaderOrNull(HttpHeaders.RETRY_AFTER);
@@ -92,7 +90,7 @@ public final class HeaderToRetryAfterException implements PropagateIfRetryAfter
throw retryException.get();
}
- return immediateFuture(null);
+ return null;
}
/**
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/core/src/main/java/org/jclouds/fallbacks/MapHttp4xxCodesToExceptions.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/fallbacks/MapHttp4xxCodesToExceptions.java b/core/src/main/java/org/jclouds/fallbacks/MapHttp4xxCodesToExceptions.java
index 9078e32..a810c9f 100644
--- a/core/src/main/java/org/jclouds/fallbacks/MapHttp4xxCodesToExceptions.java
+++ b/core/src/main/java/org/jclouds/fallbacks/MapHttp4xxCodesToExceptions.java
@@ -18,7 +18,6 @@ package org.jclouds.fallbacks;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -28,8 +27,6 @@ import org.jclouds.http.HttpResponseException;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.ResourceNotFoundException;
-import com.google.common.util.concurrent.ListenableFuture;
-
@Singleton
public final class MapHttp4xxCodesToExceptions implements Fallback<Object> {
@@ -39,15 +36,9 @@ public final class MapHttp4xxCodesToExceptions implements Fallback<Object> {
MapHttp4xxCodesToExceptions(PropagateIfRetryAfter propagateIfRetryAfter) { // NO_UCD
this.propagateIfRetryAfter = checkNotNull(propagateIfRetryAfter, "propagateIfRetryAfter");
}
-
- @Override
- public ListenableFuture<Object> create(Throwable t) throws Exception { // NO_UCD
- return immediateFuture(createOrPropagate(t));
- }
-
@Override
public Object createOrPropagate(Throwable t) throws Exception {
- propagateIfRetryAfter.create(t); // if we pass here, we aren't a retry-after exception
+ propagateIfRetryAfter.createOrPropagate(t); // if we pass here, we aren't a retry-after exception
if (t instanceof HttpResponseException) {
HttpResponseException responseException = HttpResponseException.class.cast(t);
if (responseException.getResponse() != null)
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/core/src/main/java/org/jclouds/fallbacks/PropagateIfRetryAfter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/fallbacks/PropagateIfRetryAfter.java b/core/src/main/java/org/jclouds/fallbacks/PropagateIfRetryAfter.java
index c76d6c0..aac6e76 100644
--- a/core/src/main/java/org/jclouds/fallbacks/PropagateIfRetryAfter.java
+++ b/core/src/main/java/org/jclouds/fallbacks/PropagateIfRetryAfter.java
@@ -16,8 +16,8 @@
*/
package org.jclouds.fallbacks;
-import com.google.common.util.concurrent.FutureFallback;
-import com.google.common.util.concurrent.ListenableFuture;
+import org.jclouds.Fallback;
+
import com.google.inject.ImplementedBy;
/**
@@ -25,12 +25,10 @@ import com.google.inject.ImplementedBy;
* offset.
*/
@ImplementedBy(HeaderToRetryAfterException.class)
-public interface PropagateIfRetryAfter extends FutureFallback<Object> {
+public interface PropagateIfRetryAfter extends Fallback<Object> {
/**
- * if input is not of type {@link org.jclouds.http.HttpResponseException}, this method propagates. Otherwise, immediate future of
+ * if input is not of type {@link org.jclouds.http.HttpResponseException}, this method propagates. Otherwise,
* {@code null}, if didn't coerce to {@link org.jclouds.rest.RetryAfterException}
*/
- @Override
- ListenableFuture<Object> create(Throwable t);
-
+ @Override Object createOrPropagate(Throwable t) throws Exception;
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/core/src/test/java/org/jclouds/fallbacks/HeaderToRetryAfterExceptionTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/fallbacks/HeaderToRetryAfterExceptionTest.java b/core/src/test/java/org/jclouds/fallbacks/HeaderToRetryAfterExceptionTest.java
index d00a4aa..f81eeaa 100644
--- a/core/src/test/java/org/jclouds/fallbacks/HeaderToRetryAfterExceptionTest.java
+++ b/core/src/test/java/org/jclouds/fallbacks/HeaderToRetryAfterExceptionTest.java
@@ -34,47 +34,42 @@ import com.google.common.net.HttpHeaders;
public class HeaderToRetryAfterExceptionTest {
@Test(expectedExceptions = RuntimeException.class)
- public void testArbitraryExceptionDoesntConvert() {
- fn.create(new RuntimeException());
+ public void testArbitraryExceptionDoesntConvert() throws Exception {
+ fn.createOrPropagate(new RuntimeException());
}
- public void testHttpResponseExceptionWithoutResponseDoesntPropagate() {
- fn.create(new HttpResponseException("message", command, null));
+ public void testHttpResponseExceptionWithoutResponseDoesntPropagate() throws Exception {
+ fn.createOrPropagate(new HttpResponseException("message", command, null));
}
- public void testHttpResponseExceptionWithoutRetryAfterHeaderDoesntPropagate() {
- fn.create(new HttpResponseException(command, HttpResponse.builder().statusCode(500).build()));
+ public void testHttpResponseExceptionWithoutRetryAfterHeaderDoesntPropagate() throws Exception {
+ fn.createOrPropagate(new HttpResponseException(command, HttpResponse.builder().statusCode(500).build()));
}
- public void testHttpResponseExceptionWithMalformedRetryAfterHeaderDoesntConvert() {
- fn.create(new HttpResponseException(command,
- HttpResponse.builder()
- .statusCode(503)
- .addHeader(HttpHeaders.RETRY_AFTER, "Fri, 31 Dec 1999 23:59:59 ZBW").build()));
+ public void testHttpResponseExceptionWithMalformedRetryAfterHeaderDoesntConvert() throws Exception {
+ fn.createOrPropagate(new HttpResponseException(command,
+ HttpResponse.builder().statusCode(503).addHeader(HttpHeaders.RETRY_AFTER, "Fri, 31 Dec 1999 23:59:59 ZBW")
+ .build()));
}
@Test(expectedExceptions = RetryAfterException.class, expectedExceptionsMessageRegExp = "retry now")
- public void testHttpResponseExceptionWithRetryAfterDate() {
- fn.create(new HttpResponseException(command,
- HttpResponse.builder()
- .statusCode(503)
- .addHeader(HttpHeaders.RETRY_AFTER, "Fri, 31 Dec 1999 23:59:59 GMT").build()));
+ public void testHttpResponseExceptionWithRetryAfterDate() throws Exception {
+ fn.createOrPropagate(new HttpResponseException(command,
+ HttpResponse.builder().statusCode(503).addHeader(HttpHeaders.RETRY_AFTER, "Fri, 31 Dec 1999 23:59:59 GMT")
+ .build()));
}
@Test(expectedExceptions = RetryAfterException.class, expectedExceptionsMessageRegExp = "retry in 700 seconds")
- public void testHttpResponseExceptionWithRetryAfterOffset() {
- fn.create(new HttpResponseException(command,
- HttpResponse.builder()
- .statusCode(503)
- .addHeader(HttpHeaders.RETRY_AFTER, "700").build()));
+ public void testHttpResponseExceptionWithRetryAfterOffset() throws Exception {
+ fn.createOrPropagate(new HttpResponseException(command,
+ HttpResponse.builder().statusCode(503).addHeader(HttpHeaders.RETRY_AFTER, "700").build()));
}
@Test(expectedExceptions = RetryAfterException.class, expectedExceptionsMessageRegExp = "retry in 86400 seconds")
- public void testHttpResponseExceptionWithRetryAfterPastIsZero() {
- fn.create(new HttpResponseException(command,
- HttpResponse.builder()
- .statusCode(503)
- .addHeader(HttpHeaders.RETRY_AFTER, "Sun, 2 Jan 2000 00:00:00 GMT").build()));
+ public void testHttpResponseExceptionWithRetryAfterPastIsZero() throws Exception {
+ fn.createOrPropagate(new HttpResponseException(command,
+ HttpResponse.builder().statusCode(503).addHeader(HttpHeaders.RETRY_AFTER, "Sun, 2 Jan 2000 00:00:00 GMT")
+ .build()));
}
public static HttpCommand command = new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub").build());
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/core/src/test/java/org/jclouds/fallbacks/MapHttp4xxCodesToExceptionsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/fallbacks/MapHttp4xxCodesToExceptionsTest.java b/core/src/test/java/org/jclouds/fallbacks/MapHttp4xxCodesToExceptionsTest.java
index 7cbd5f4..4bbcf57 100644
--- a/core/src/test/java/org/jclouds/fallbacks/MapHttp4xxCodesToExceptionsTest.java
+++ b/core/src/test/java/org/jclouds/fallbacks/MapHttp4xxCodesToExceptionsTest.java
@@ -31,27 +31,27 @@ public class MapHttp4xxCodesToExceptionsTest {
@Test(expectedExceptions = AuthorizationException.class)
public void test401ToAuthorizationException() throws Exception {
- fn.create(new HttpResponseException(command, HttpResponse.builder().statusCode(401).build()));
+ fn.createOrPropagate(new HttpResponseException(command, HttpResponse.builder().statusCode(401).build()));
}
@Test(expectedExceptions = AuthorizationException.class)
public void test403ToAuthorizationException() throws Exception {
- fn.create(new HttpResponseException(command, HttpResponse.builder().statusCode(403).build()));
+ fn.createOrPropagate(new HttpResponseException(command, HttpResponse.builder().statusCode(403).build()));
}
@Test(expectedExceptions = ResourceNotFoundException.class)
public void test404ToResourceNotFoundException() throws Exception {
- fn.create(new HttpResponseException(command, HttpResponse.builder().statusCode(404).build()));
+ fn.createOrPropagate(new HttpResponseException(command, HttpResponse.builder().statusCode(404).build()));
}
@Test(expectedExceptions = IllegalStateException.class)
public void test409ToIllegalStateException() throws Exception {
- fn.create(new HttpResponseException(command, HttpResponse.builder().statusCode(409).build()));
+ fn.createOrPropagate(new HttpResponseException(command, HttpResponse.builder().statusCode(409).build()));
}
@Test(expectedExceptions = RetryAfterException.class, expectedExceptionsMessageRegExp = "retry now")
public void testHttpResponseExceptionWithRetryAfterDate() throws Exception {
- fn.create(new HttpResponseException(command,
+ fn.createOrPropagate(new HttpResponseException(command,
HttpResponse.builder()
.statusCode(503)
.addHeader(HttpHeaders.RETRY_AFTER, "Fri, 31 Dec 1999 23:59:59 GMT").build()));
@@ -59,7 +59,7 @@ public class MapHttp4xxCodesToExceptionsTest {
@Test(expectedExceptions = RetryAfterException.class, expectedExceptionsMessageRegExp = "retry in 700 seconds")
public void testHttpResponseExceptionWithRetryAfterOffset() throws Exception {
- fn.create(new HttpResponseException(command,
+ fn.createOrPropagate(new HttpResponseException(command,
HttpResponse.builder()
.statusCode(503)
.addHeader(HttpHeaders.RETRY_AFTER, "700").build()));
@@ -67,7 +67,7 @@ public class MapHttp4xxCodesToExceptionsTest {
@Test(expectedExceptions = RetryAfterException.class, expectedExceptionsMessageRegExp = "retry in 86400 seconds")
public void testHttpResponseExceptionWithRetryAfterPastIsZero() throws Exception {
- fn.create(new HttpResponseException(command,
+ fn.createOrPropagate(new HttpResponseException(command,
HttpResponse.builder()
.statusCode(503)
.addHeader(HttpHeaders.RETRY_AFTER, "Sun, 2 Jan 2000 00:00:00 GMT").build()));
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/core/src/test/java/org/jclouds/http/IntegrationTestClient.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/http/IntegrationTestClient.java b/core/src/test/java/org/jclouds/http/IntegrationTestClient.java
index 27ec54b..afdfa59 100644
--- a/core/src/test/java/org/jclouds/http/IntegrationTestClient.java
+++ b/core/src/test/java/org/jclouds/http/IntegrationTestClient.java
@@ -16,8 +16,6 @@
*/
package org.jclouds.http;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
-
import java.io.Closeable;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -51,7 +49,6 @@ import org.jclouds.util.Strings2;
import com.google.common.base.Function;
import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.Provides;
/**
@@ -89,10 +86,6 @@ public interface IntegrationTestClient extends Closeable {
String downloadException(@PathParam("id") String id, HttpRequestOptions options);
static class FooOnException implements org.jclouds.Fallback<String> {
- public ListenableFuture<String> create(Throwable t) throws Exception {
- return immediateFuture("foo");
- }
-
public String createOrPropagate(Throwable t) throws Exception {
return "foo";
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
index 16ace50..4e5782c 100644
--- a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
+++ b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
@@ -146,7 +146,6 @@ import com.google.common.io.ByteSource;
import com.google.common.io.Files;
import com.google.common.net.HttpHeaders;
import com.google.common.reflect.Invokable;
-import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.AbstractModule;
import com.google.inject.ConfigurationException;
import com.google.inject.Injector;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobFallbacks.java
----------------------------------------------------------------------
diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobFallbacks.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobFallbacks.java
index c12bf71..71a5dca 100644
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobFallbacks.java
+++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/AzureBlobFallbacks.java
@@ -18,24 +18,16 @@ package org.jclouds.azureblob;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import org.jclouds.Fallback;
import org.jclouds.azure.storage.AzureStorageResponseException;
-import com.google.common.util.concurrent.ListenableFuture;
-
public final class AzureBlobFallbacks {
private AzureBlobFallbacks() {
}
public static final class FalseIfContainerAlreadyExists implements Fallback<Boolean> {
@Override
- public ListenableFuture<Boolean> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
- @Override
public Boolean createOrPropagate(Throwable t) throws Exception {
if (checkNotNull(t, "throwable") instanceof AzureStorageResponseException) {
AzureStorageResponseException responseException = AzureStorageResponseException.class.cast(t);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/b9525a08/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTFallbacks.java
----------------------------------------------------------------------
diff --git a/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTFallbacks.java b/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTFallbacks.java
index 0f87e7b..6cc3b3d 100644
--- a/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTFallbacks.java
+++ b/providers/dynect/src/main/java/org/jclouds/dynect/v3/DynECTFallbacks.java
@@ -18,24 +18,16 @@ package org.jclouds.dynect.v3;
import static com.google.common.base.Predicates.equalTo;
import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.http.HttpUtils.returnValueOnCodeOrNull;
import org.jclouds.Fallback;
-import com.google.common.util.concurrent.ListenableFuture;
-
public final class DynECTFallbacks {
private DynECTFallbacks() {
}
public static class FalseOn400 implements Fallback<Boolean> {
@Override
- public ListenableFuture<Boolean> create(Throwable t) throws Exception {
- return immediateFuture(createOrPropagate(t));
- }
-
- @Override
public Boolean createOrPropagate(Throwable t) throws Exception {
if (returnValueOnCodeOrNull(t, false, equalTo(400)) != null)
return false;
[43/52] [abbrv] git commit: Restoring
BlobStoreUtils.parseDirectoryFromPath
Posted by an...@apache.org.
Restoring BlobStoreUtils.parseDirectoryFromPath
Removed in 56a2a8b but used in downstream repos, e.g. jclouds-karaf
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/ffc0df11
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/ffc0df11
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/ffc0df11
Branch: refs/heads/use-agentproxy-008
Commit: ffc0df11c93045a4208795d926159b0af023100f
Parents: c349753
Author: Andrew Phillips <an...@apache.org>
Authored: Mon Oct 6 09:50:24 2014 -0400
Committer: Andrew Phillips <an...@apache.org>
Committed: Mon Oct 6 09:50:24 2014 -0400
----------------------------------------------------------------------
.../src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/ffc0df11/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java b/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java
index c2208cc..823184f 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java
@@ -40,6 +40,10 @@ public class BlobStoreUtils {
.headers(returnVal.getHeaders()).payload(returnVal.getPayload()).build();
}
+ public static String parseDirectoryFromPath(String path) {
+ return checkNotNull(path, "path").substring(0, path.lastIndexOf('/'));
+ }
+
private static Pattern keyFromContainer = Pattern.compile("/?[^/]+/(.*)");
public static String getNameFor(GeneratedHttpRequest request) {
[38/52] [abbrv] git commit: JCLOUDS-150 clear remaining async stuff
from aws
Posted by an...@apache.org.
JCLOUDS-150 clear remaining async stuff from aws
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/100d4336
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/100d4336
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/100d4336
Branch: refs/heads/use-agentproxy-008
Commit: 100d43360ae9ae2960b44235100d7c56fb74aedc
Parents: 360e8b8
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 18:04:32 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 22:32:27 2014 -0700
----------------------------------------------------------------------
.../s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java | 3 +--
.../jclouds/sqs/features/PermissionApiLiveTest.java | 13 +++----------
.../java/org/jclouds/aws/filters/FormSignerTest.java | 9 +++------
3 files changed, 7 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/100d4336/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java b/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java
index 2923c15..a35928f 100644
--- a/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java
+++ b/apis/s3/src/main/java/org/jclouds/s3/S3ApiMetadata.java
@@ -30,7 +30,6 @@ import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.rest.internal.BaseHttpApiMetadata;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
import org.jclouds.s3.blobstore.S3BlobStoreContext;
import org.jclouds.s3.blobstore.config.S3BlobStoreContextModule;
import org.jclouds.s3.config.S3HttpApiModule;
@@ -69,7 +68,7 @@ public class S3ApiMetadata extends BaseHttpApiMetadata {
}
public static Properties defaultProperties() {
- Properties properties = BaseRestApiMetadata.defaultProperties();
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
properties.setProperty(PROPERTY_HEADER_TAG, S3Headers.DEFAULT_AMAZON_HEADERTAG);
properties.setProperty(PROPERTY_S3_SERVICE_PATH, "/");
http://git-wip-us.apache.org/repos/asf/jclouds/blob/100d4336/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java
index aad0473..2c96ab2 100644
--- a/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java
+++ b/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java
@@ -17,7 +17,7 @@
package org.jclouds.sqs.features;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
-import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.jclouds.sqs.reference.SQSParameters.ACTION;
import static org.testng.Assert.assertEquals;
@@ -39,7 +39,6 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
-import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.Module;
@Test(groups = "live", singleThreaded = true, testName = "PermissionApiLiveTest")
@@ -57,15 +56,11 @@ public class PermissionApiLiveTest extends BaseSQSApiLiveTest {
}
interface AnonymousAttributesApi extends Closeable {
- String getQueueArn();
- }
-
- interface AnonymousAttributesAsyncApi extends Closeable {
@POST
@Path("/")
@FormParams(keys = { ACTION, "AttributeName.1" }, values = { "GetQueueAttributes", "QueueArn" })
@XMLResponseParser(ValueHandler.class)
- ListenableFuture<String> getQueueArn();
+ String getQueueArn();
}
public void testAddAnonymousPermission() throws InterruptedException {
@@ -95,9 +90,7 @@ public class PermissionApiLiveTest extends BaseSQSApiLiveTest {
}
private AnonymousAttributesApi getAnonymousAttributesApi(URI queue) {
- return ContextBuilder.newBuilder(
- forClientMappedToAsyncClientOnEndpoint(AnonymousAttributesApi.class,
- AnonymousAttributesAsyncApi.class, queue.toASCIIString()))
+ return ContextBuilder.newBuilder(forApiOnEndpoint(AnonymousAttributesApi.class, queue.toASCIIString()))
.modules(ImmutableSet.<Module> of(new ExecutorServiceModule(newDirectExecutorService(), newDirectExecutorService())))
.buildApi(AnonymousAttributesApi.class);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/100d4336/apis/sts/src/test/java/org/jclouds/aws/filters/FormSignerTest.java
----------------------------------------------------------------------
diff --git a/apis/sts/src/test/java/org/jclouds/aws/filters/FormSignerTest.java b/apis/sts/src/test/java/org/jclouds/aws/filters/FormSignerTest.java
index 2b03358..2325751 100644
--- a/apis/sts/src/test/java/org/jclouds/aws/filters/FormSignerTest.java
+++ b/apis/sts/src/test/java/org/jclouds/aws/filters/FormSignerTest.java
@@ -18,6 +18,7 @@ package org.jclouds.aws.filters;
import static javax.ws.rs.HttpMethod.GET;
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
+import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.testng.Assert.assertEquals;
import org.jclouds.ContextBuilder;
@@ -25,10 +26,8 @@ import org.jclouds.aws.xml.SessionCredentialsHandlerTest;
import org.jclouds.date.TimeStamp;
import org.jclouds.domain.Credentials;
import org.jclouds.http.HttpRequest;
-import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
import org.jclouds.logging.config.NullLoggingModule;
-import org.jclouds.providers.AnonymousProviderMetadata;
import org.jclouds.rest.RequestSigner;
import org.jclouds.rest.internal.BaseRestApiTest.MockModule;
import org.testng.annotations.Test;
@@ -36,11 +35,11 @@ import org.testng.annotations.Test;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultimap;
+import com.google.common.net.HttpHeaders;
import com.google.inject.AbstractModule;
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.name.Names;
-import com.google.common.net.HttpHeaders;
/**
* Tests behavior of {@code FormSigner}
*/
@@ -50,9 +49,7 @@ import com.google.common.net.HttpHeaders;
public class FormSignerTest {
public static Injector injector(Credentials creds) {
return ContextBuilder
- .newBuilder(
- AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(IntegrationTestClient.class,
- IntegrationTestAsyncClient.class, "http://localhost"))
+ .newBuilder(forApiOnEndpoint(IntegrationTestClient.class, "http://localhost"))
.credentialsSupplier(Suppliers.<Credentials> ofInstance(creds)).apiVersion("apiVersion")
.modules(ImmutableList.<Module> of(new MockModule(), new NullLoggingModule(), new AbstractModule() {
@Override
[11/52] [abbrv] git commit: JCLOUDS-40 unasync azureblob;
plus fold otherwise unused azure-common into it.
Posted by an...@apache.org.
JCLOUDS-40 unasync azureblob; plus fold otherwise unused azure-common into it.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/4c95a578
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/4c95a578
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/4c95a578
Branch: refs/heads/use-agentproxy-008
Commit: 4c95a57880d939f2fedee5d33a85a1852646d4c7
Parents: 9b71a9d
Author: Adrian Cole <ac...@twitter.com>
Authored: Fri Oct 3 17:35:37 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Fri Oct 3 22:15:01 2014 -0700
----------------------------------------------------------------------
common/azure/README.txt | 6 -
common/azure/pom.xml | 54 ---
.../storage/AzureStorageResponseException.java | 72 ----
.../config/AzureStorageParserModule.java | 31 --
.../config/AzureStorageRestClientModule.java | 98 ------
.../azure/storage/domain/AzureStorageError.java | 114 -------
.../azure/storage/domain/BoundedSet.java | 33 --
.../storage/domain/internal/BoundedHashSet.java | 64 ----
.../filters/SharedKeyLiteAuthentication.java | 207 ------------
.../AzureStorageClientErrorRetryHandler.java | 89 -----
.../ParseAzureStorageErrorFromXmlContent.java | 115 -------
.../azure/storage/options/CreateOptions.java | 74 -----
.../azure/storage/options/ListOptions.java | 131 --------
.../storage/reference/AzureStorageHeaders.java | 33 --
.../azure/storage/util/AzureStorageUtils.java | 59 ----
.../jclouds/azure/storage/xml/ErrorHandler.java | 53 ---
.../SharedKeyLiteAuthenticationTest.java | 142 --------
.../ParseAzureErrorFromXmlContentTest.java | 116 -------
.../storage/options/CreateOptionsTest.java | 54 ---
.../azure/storage/options/ListOptionsTest.java | 71 ----
.../azure/storage/xml/ErrorHandlerTest.java | 47 ---
common/azure/src/test/resources/log4j.xml | 118 -------
common/azure/src/test/resources/test_error.xml | 15 -
common/pom.xml | 1 -
providers/azureblob/pom.xml | 2 +-
.../storage/AzureStorageResponseException.java | 72 ++++
.../azure/storage/domain/AzureStorageError.java | 114 +++++++
.../azure/storage/domain/BoundedSet.java | 33 ++
.../storage/domain/internal/BoundedHashSet.java | 64 ++++
.../filters/SharedKeyLiteAuthentication.java | 207 ++++++++++++
.../AzureStorageClientErrorRetryHandler.java | 89 +++++
.../ParseAzureStorageErrorFromXmlContent.java | 115 +++++++
.../azure/storage/options/CreateOptions.java | 74 +++++
.../azure/storage/options/ListOptions.java | 131 ++++++++
.../storage/reference/AzureStorageHeaders.java | 33 ++
.../azure/storage/util/AzureStorageUtils.java | 59 ++++
.../jclouds/azure/storage/xml/ErrorHandler.java | 53 +++
.../jclouds/azureblob/AzureBlobApiMetadata.java | 28 +-
.../jclouds/azureblob/AzureBlobAsyncClient.java | 328 -------------------
.../org/jclouds/azureblob/AzureBlobClient.java | 245 +++++++++++---
.../blobstore/AzureAsyncBlobStore.java | 307 -----------------
.../blobstore/AzureBlobRequestSigner.java | 8 +-
.../config/AzureBlobStoreContextModule.java | 7 +-
.../config/AzureBlobHttpApiModule.java | 88 +++++
.../config/AzureBlobRestClientModule.java | 48 ---
.../SharedKeyLiteAuthenticationTest.java | 142 ++++++++
.../ParseAzureErrorFromXmlContentTest.java | 116 +++++++
.../storage/options/CreateOptionsTest.java | 54 +++
.../azure/storage/options/ListOptionsTest.java | 71 ++++
.../azure/storage/xml/ErrorHandlerTest.java | 47 +++
.../azureblob/AzureBlobAsyncClientTest.java | 294 -----------------
.../azureblob/AzureBlobClientLiveTest.java | 15 +-
.../jclouds/azureblob/AzureBlobClientTest.java | 291 ++++++++++++++++
.../BindAzureBlobMetadataToRequestTest.java | 8 +-
.../blobstore/AzureBlobRequestSignerTest.java | 14 +-
.../azureblob/src/test/resources/test_error.xml | 15 +
56 files changed, 2098 insertions(+), 2871 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/README.txt
----------------------------------------------------------------------
diff --git a/common/azure/README.txt b/common/azure/README.txt
deleted file mode 100644
index 46ef3fc..0000000
--- a/common/azure/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# The jclouds provider for Microsoft Windows Azure (http://www.microsoft.com/windowsazure/).
-#
-# TODO: Implementation status.
-# TODO: Supported features.
-# TODO: Usage example.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/pom.xml
----------------------------------------------------------------------
diff --git a/common/azure/pom.xml b/common/azure/pom.xml
deleted file mode 100644
index d262593..0000000
--- a/common/azure/pom.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-project</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../../project/pom.xml</relativePath>
- </parent>
- <groupId>org.apache.jclouds.common</groupId>
- <artifactId>azure-common</artifactId>
- <name>jclouds Azure Components Core</name>
- <description>jclouds Core components to access Azure</description>
- <packaging>bundle</packaging>
-
- <properties>
- <jclouds.osgi.export>org.jclouds.azure*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/AzureStorageResponseException.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/AzureStorageResponseException.java b/common/azure/src/main/java/org/jclouds/azure/storage/AzureStorageResponseException.java
deleted file mode 100644
index 744de08..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/AzureStorageResponseException.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage;
-
-import org.jclouds.azure.storage.domain.AzureStorageError;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-
-/**
- * Encapsulates an Error from Azure Storage Services.
- *
- * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/UsingRESTError.html" />
- * @see AzureStorageError
- * @see org.jclouds.aws.handlers.ParseAzureStorageErrorFromXmlContent
- */
-public class AzureStorageResponseException extends HttpResponseException {
-
- private AzureStorageError error = new AzureStorageError();
-
- public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error) {
- super(String.format("command %s failed with code %s, error: %s", command.toString(), response
- .getStatusCode(), error.toString()), command, response);
- this.setError(error);
-
- }
-
- public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error,
- Throwable cause) {
- super(String.format("command %1$s failed with error: %2$s", command.toString(), error
- .toString()), command, response, cause);
- this.setError(error);
-
- }
-
- public AzureStorageResponseException(String message, HttpCommand command, HttpResponse response,
- AzureStorageError error) {
- super(message, command, response);
- this.setError(error);
-
- }
-
- public AzureStorageResponseException(String message, HttpCommand command, HttpResponse response,
- AzureStorageError error, Throwable cause) {
- super(message, command, response, cause);
- this.setError(error);
-
- }
-
- public void setError(AzureStorageError error) {
- this.error = error;
- }
-
- public AzureStorageError getError() {
- return error;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/config/AzureStorageParserModule.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/config/AzureStorageParserModule.java b/common/azure/src/main/java/org/jclouds/azure/storage/config/AzureStorageParserModule.java
deleted file mode 100644
index a7bdd24..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/config/AzureStorageParserModule.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.config;
-
-import org.jclouds.json.config.GsonModule.DateAdapter;
-import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
-
-import com.google.inject.AbstractModule;
-
-public class AzureStorageParserModule extends AbstractModule {
-
- @Override
- protected void configure() {
- bind(DateAdapter.class).to(Iso8601DateAdapter.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/config/AzureStorageRestClientModule.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/config/AzureStorageRestClientModule.java b/common/azure/src/main/java/org/jclouds/azure/storage/config/AzureStorageRestClientModule.java
deleted file mode 100644
index 5f2e885..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/config/AzureStorageRestClientModule.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.config;
-
-import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
-
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Named;
-
-import org.jclouds.azure.storage.handlers.AzureStorageClientErrorRetryHandler;
-import org.jclouds.azure.storage.handlers.ParseAzureStorageErrorFromXmlContent;
-import org.jclouds.date.DateService;
-import org.jclouds.date.TimeStamp;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpRetryHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.reflect.TypeToken;
-import com.google.inject.Provides;
-
-/**
- * Configures the AzureStorage connection, including logging and http transport.
- */
-@ConfiguresRestClient
-public class AzureStorageRestClientModule<S, A> extends RestClientModule<S, A> {
- protected AzureStorageRestClientModule() {
-
- }
-
- public AzureStorageRestClientModule(Map<Class<?>, Class<?>> delegate) {
- super(delegate);
- }
-
- public AzureStorageRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType) {
- super(syncClientType, asyncClientType);
- }
-
- @Provides
- @TimeStamp
- protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
- return cache.get();
- }
-
- /**
- * borrowing concurrency code to ensure that caching takes place properly
- */
- @Provides
- @TimeStamp
- protected Supplier<String> provideTimeStampCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
- final DateService dateService) {
- return Suppliers.memoizeWithExpiration(new Supplier<String>() {
- public String get() {
- return dateService.rfc822DateFormat();
- }
- }, seconds, TimeUnit.SECONDS);
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseAzureStorageErrorFromXmlContent.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseAzureStorageErrorFromXmlContent.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseAzureStorageErrorFromXmlContent.class);
- }
-
- @Override
- protected void bindRetryHandlers() {
- bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(AzureStorageClientErrorRetryHandler.class);
- }
-
- @Override
- protected void configure() {
- install(new AzureStorageParserModule());
- super.configure();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/domain/AzureStorageError.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/domain/AzureStorageError.java b/common/azure/src/main/java/org/jclouds/azure/storage/domain/AzureStorageError.java
deleted file mode 100644
index ec57979..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/domain/AzureStorageError.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.domain;
-
-import java.util.Map;
-
-import com.google.common.collect.Maps;
-
-/**
- * When an Azure Storage request is in error, the client receives an error response.
- *
- * @see <a href="http://msdn.microsoft.com/en-us/library/dd573365.aspx" />
- */
-public class AzureStorageError {
- private String code;
- private String message;
- private String requestId;
- private Map<String, String> details = Maps.newHashMap();
- private String stringSigned;
- private String signature;
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("AzureError");
- sb.append("{requestId='").append(requestId).append('\'');
- if (code != null)
- sb.append(", code='").append(code).append('\'');
- if (message != null)
- sb.append(", message='").append(message).append('\'');
- if (stringSigned != null)
- sb.append(", stringSigned='").append(stringSigned).append('\'');
- if (getSignature() != null)
- sb.append(", signature='").append(getSignature()).append('\'');
- if (!details.isEmpty())
- sb.append(", context='").append(details.toString()).append('\'').append('}');
- return sb.toString();
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- /**
- * If a request is consistently failing and you have verified that the request is properly
- * formulated, you may use this value to report the error to Microsoft. In your report, include
- * the value of x-ms-request-id, the approximate time that the request was made, the storage
- * service against which the request was made, and the type of operation that the request
- * attempted
- */
- public String getRequestId() {
- return requestId;
- }
-
- public void setStringSigned(String stringSigned) {
- this.stringSigned = stringSigned;
- }
-
- /**
- * @return what jclouds signed before sending the request.
- */
- public String getStringSigned() {
- return stringSigned;
- }
-
- public void setDetails(Map<String, String> context) {
- this.details = context;
- }
-
- /**
- * @return additional details surrounding the error.
- */
- public Map<String, String> getDetails() {
- return details;
- }
-
- public void setSignature(String signature) {
- this.signature = signature;
- }
-
- public String getSignature() {
- return signature;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/domain/BoundedSet.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/domain/BoundedSet.java b/common/azure/src/main/java/org/jclouds/azure/storage/domain/BoundedSet.java
deleted file mode 100644
index 8778ae6..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/domain/BoundedSet.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.domain;
-
-import java.net.URI;
-import java.util.Set;
-
-public interface BoundedSet<T> extends Set<T> {
- URI getUrl();
-
- String getPrefix();
-
- String getMarker();
-
- int getMaxResults();
-
- String getNextMarker();
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/domain/internal/BoundedHashSet.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/domain/internal/BoundedHashSet.java b/common/azure/src/main/java/org/jclouds/azure/storage/domain/internal/BoundedHashSet.java
deleted file mode 100644
index b9767ec..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/domain/internal/BoundedHashSet.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.domain.internal;
-
-import java.net.URI;
-import java.util.HashSet;
-
-import org.jclouds.azure.storage.domain.BoundedSet;
-
-import com.google.common.collect.Iterables;
-
-public class BoundedHashSet<T> extends HashSet<T> implements BoundedSet<T> {
-
- protected final URI url;
- protected final String prefix;
- protected final String marker;
- protected final Integer maxResults;
- protected final String nextMarker;
-
- public BoundedHashSet(Iterable<T> contents, URI url, String prefix, String marker,
- Integer maxResults, String nextMarker) {
- Iterables.addAll(this, contents);
- this.url = url;
- this.prefix = prefix;
- this.nextMarker = nextMarker;
- this.maxResults = maxResults;
- this.marker = marker;
- }
-
- public String getPrefix() {
- return prefix;
- }
-
- public String getMarker() {
- return marker;
- }
-
- public int getMaxResults() {
- return maxResults;
- }
-
- public String getNextMarker() {
- return nextMarker;
- }
-
- public URI getUrl() {
- return url;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java b/common/azure/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java
deleted file mode 100644
index 8e56390..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.filters;
-
-import static com.google.common.io.BaseEncoding.base64;
-import static com.google.common.io.ByteStreams.readBytes;
-import static org.jclouds.crypto.Macs.asByteProcessor;
-import static org.jclouds.util.Patterns.NEWLINE_PATTERN;
-import static org.jclouds.util.Strings2.toInputStream;
-
-import java.util.Collection;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.crypto.Crypto;
-import org.jclouds.date.TimeStamp;
-import org.jclouds.domain.Credentials;
-import org.jclouds.http.HttpException;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpRequestFilter;
-import org.jclouds.http.HttpUtils;
-import org.jclouds.http.internal.SignatureWire;
-import org.jclouds.logging.Logger;
-import org.jclouds.util.Strings2;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Strings;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
-import com.google.common.collect.Multimaps;
-import com.google.common.collect.Sets;
-import com.google.common.io.ByteProcessor;
-import com.google.common.net.HttpHeaders;
-
-/**
- * Signs the Azure Storage request.
- *
- * @see <a href= "http://msdn.microsoft.com/en-us/library/dd179428.aspx" />
- */
-@Singleton
-public class SharedKeyLiteAuthentication implements HttpRequestFilter {
- private static final Collection<String> FIRST_HEADERS_TO_SIGN = ImmutableList.of(HttpHeaders.DATE);
-
- private final SignatureWire signatureWire;
- private final Supplier<Credentials> creds;
- private final Provider<String> timeStampProvider;
- private final Crypto crypto;
- private final HttpUtils utils;
-
- @Resource
- @Named(Constants.LOGGER_SIGNATURE)
- Logger signatureLog = Logger.NULL;
-
- @Inject
- public SharedKeyLiteAuthentication(SignatureWire signatureWire,
- @org.jclouds.location.Provider Supplier<Credentials> creds, @TimeStamp Provider<String> timeStampProvider,
- Crypto crypto, HttpUtils utils) {
- this.crypto = crypto;
- this.utils = utils;
- this.signatureWire = signatureWire;
- this.creds = creds;
- this.timeStampProvider = timeStampProvider;
- }
-
- public HttpRequest filter(HttpRequest request) throws HttpException {
- request = replaceDateHeader(request);
- String signature = calculateSignature(createStringToSign(request));
- request = replaceAuthorizationHeader(request, signature);
- utils.logRequest(signatureLog, request, "<<");
- return request;
- }
-
- HttpRequest replaceAuthorizationHeader(HttpRequest request, String signature) {
- return request.toBuilder()
- .replaceHeader(HttpHeaders.AUTHORIZATION, "SharedKeyLite " + creds.get().identity + ":" + signature)
- .build();
- }
-
- HttpRequest replaceDateHeader(HttpRequest request) {
- Builder<String, String> builder = ImmutableMap.builder();
- String date = timeStampProvider.get();
- builder.put(HttpHeaders.DATE, date);
- request = request.toBuilder().replaceHeaders(Multimaps.forMap(builder.build())).build();
- return request;
- }
-
- public String createStringToSign(HttpRequest request) {
- utils.logRequest(signatureLog, request, ">>");
- StringBuilder buffer = new StringBuilder();
- // re-sign the request
- appendMethod(request, buffer);
- appendPayloadMetadata(request, buffer);
- appendHttpHeaders(request, buffer);
- appendCanonicalizedHeaders(request, buffer);
- appendCanonicalizedResource(request, buffer);
- if (signatureWire.enabled())
- signatureWire.output(buffer.toString());
- return buffer.toString();
- }
-
- private void appendPayloadMetadata(HttpRequest request, StringBuilder buffer) {
- buffer.append(
- HttpUtils.nullToEmpty(request.getPayload() == null ? null : request.getPayload().getContentMetadata()
- .getContentMD5())).append("\n");
- buffer.append(
- Strings.nullToEmpty(request.getPayload() == null ? null : request.getPayload().getContentMetadata()
- .getContentType())).append("\n");
- }
-
- private String calculateSignature(String toSign) throws HttpException {
- String signature = signString(toSign);
- if (signatureWire.enabled())
- signatureWire.input(Strings2.toInputStream(signature));
- return signature;
- }
-
- public String signString(String toSign) {
- try {
- ByteProcessor<byte[]> hmacSHA256 = asByteProcessor(crypto.hmacSHA256(base64().decode(creds.get().credential)));
- return base64().encode(readBytes(toInputStream(toSign), hmacSHA256));
- } catch (Exception e) {
- throw new HttpException("error signing request", e);
- }
- }
-
- private void appendMethod(HttpRequest request, StringBuilder toSign) {
- toSign.append(request.getMethod()).append("\n");
- }
-
- private void appendCanonicalizedHeaders(HttpRequest request, StringBuilder toSign) {
- // TreeSet == Sort the headers alphabetically.
- Set<String> headers = Sets.newTreeSet(request.getHeaders().keySet());
- for (String header : headers) {
- if (header.startsWith("x-ms-")) {
- toSign.append(header.toLowerCase()).append(":");
- for (String value : request.getHeaders().get(header)) {
- toSign.append(NEWLINE_PATTERN.matcher(value).replaceAll("")).append(",");
- }
- toSign.deleteCharAt(toSign.lastIndexOf(","));
- toSign.append("\n");
- }
- }
- }
-
- private void appendHttpHeaders(HttpRequest request, StringBuilder toSign) {
- for (String header : FIRST_HEADERS_TO_SIGN)
- toSign.append(HttpUtils.nullToEmpty(request.getHeaders().get(header))).append("\n");
- }
-
- @VisibleForTesting
- void appendCanonicalizedResource(HttpRequest request, StringBuilder toSign) {
- // 1. Beginning with an empty string (""), append a forward slash (/), followed by the name of
- // the identity that owns the resource being accessed.
- toSign.append("/").append(creds.get().identity);
- appendUriPath(request, toSign);
- }
-
- @VisibleForTesting
- void appendUriPath(HttpRequest request, StringBuilder toSign) {
- // 2. Append the resource's encoded URI path
- toSign.append(request.getEndpoint().getRawPath());
-
- // If the request URI addresses a component of the
- // resource, append the appropriate query string. The query string should include the question
- // mark and the comp parameter (for example, ?comp=metadata). No other parameters should be
- // included on the query string.
- if (request.getEndpoint().getQuery() != null) {
- StringBuilder paramsToSign = new StringBuilder("?");
-
- String[] params = request.getEndpoint().getQuery().split("&");
- for (String param : params) {
- String[] paramNameAndValue = param.split("=");
-
- if ("comp".equals(paramNameAndValue[0])) {
- paramsToSign.append(param);
- }
- }
-
- if (paramsToSign.length() > 1) {
- toSign.append(paramsToSign);
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/handlers/AzureStorageClientErrorRetryHandler.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/handlers/AzureStorageClientErrorRetryHandler.java b/common/azure/src/main/java/org/jclouds/azure/storage/handlers/AzureStorageClientErrorRetryHandler.java
deleted file mode 100644
index fadc772..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/handlers/AzureStorageClientErrorRetryHandler.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.handlers;
-
-import java.io.ByteArrayInputStream;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-
-import org.jclouds.Constants;
-import org.jclouds.azure.storage.domain.AzureStorageError;
-import org.jclouds.azure.storage.util.AzureStorageUtils;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpException;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpRetryHandler;
-import org.jclouds.http.HttpUtils;
-import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
-import org.jclouds.logging.Logger;
-
-import com.google.inject.Inject;
-
-/**
- * Handles Retryable responses with error codes in the 4xx range
- */
-public class AzureStorageClientErrorRetryHandler implements HttpRetryHandler {
-
- @Inject(optional = true)
- @Named(Constants.PROPERTY_MAX_RETRIES)
- private int retryCountLimit = 5;
-
- private final AzureStorageUtils utils;
- private final BackoffLimitedRetryHandler backoffHandler;
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- @Inject
- public AzureStorageClientErrorRetryHandler(BackoffLimitedRetryHandler backoffHandler,
- AzureStorageUtils utils) {
- this.backoffHandler = backoffHandler;
- this.utils = utils;
- }
-
- public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
- byte[] content = HttpUtils.closeClientButKeepContentStream(response);
- command.incrementFailureCount();
- if (!command.isReplayable()) {
- logger.warn("Cannot retry after server error, command is not replayable: %1$s", command);
- return false;
- } else if (command.getFailureCount() > retryCountLimit) {
- logger.warn(
- "Cannot retry after server error, command has exceeded retry limit %1$d: %2$s",
- retryCountLimit, command);
- return false;
- } else if (response.getStatusCode() == 409) {
- // Content can be null in the case of HEAD requests
- if (content != null) {
- try {
- AzureStorageError error = utils.parseAzureStorageErrorFromContent(command, response,
- new ByteArrayInputStream(content));
- if ("ContainerBeingDeleted".equals(error.getCode())) {
- backoffHandler.imposeBackoffExponentialDelay(100L, 3, retryCountLimit, command
- .getFailureCount(), command.toString());
- return true;
- }
- } catch (HttpException e) {
- logger.warn(e, "error parsing response: %s", new String(content));
- }
- }
- }
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/handlers/ParseAzureStorageErrorFromXmlContent.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/handlers/ParseAzureStorageErrorFromXmlContent.java b/common/azure/src/main/java/org/jclouds/azure/storage/handlers/ParseAzureStorageErrorFromXmlContent.java
deleted file mode 100644
index ece8176..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/handlers/ParseAzureStorageErrorFromXmlContent.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.handlers;
-
-import static org.jclouds.http.HttpUtils.releasePayload;
-
-import java.io.IOException;
-import java.util.regex.Pattern;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-
-import org.jclouds.azure.storage.AzureStorageResponseException;
-import org.jclouds.azure.storage.domain.AzureStorageError;
-import org.jclouds.azure.storage.util.AzureStorageUtils;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.jclouds.util.Strings2;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- *
- * @see AzureStorageError
- */
-public class ParseAzureStorageErrorFromXmlContent implements HttpErrorHandler {
- @Resource
- protected Logger logger = Logger.NULL;
-
- private final AzureStorageUtils utils;
-
- @Inject
- public ParseAzureStorageErrorFromXmlContent(AzureStorageUtils utils) {
- this.utils = utils;
- }
-
- public static final Pattern CONTAINER_PATH = Pattern.compile("^[/]?([^/]+)$");
- public static final Pattern CONTAINER_KEY_PATH = Pattern.compile("^[/]?([^/]+)/(.*)$");
-
- public void handleError(HttpCommand command, HttpResponse response) {
- Exception exception = new HttpResponseException(command, response);
- String message = null;
- AzureStorageError error = null;
- try {
- if (response.getPayload() != null) {
- String contentType = response.getPayload().getContentMetadata().getContentType();
- if (contentType != null && (contentType.indexOf("xml") != -1 || contentType.indexOf("unknown") != -1)
- && !Long.valueOf(0).equals(response.getPayload().getContentMetadata().getContentLength())) {
- try {
- error = utils.parseAzureStorageErrorFromContent(command, response, response.getPayload().getInput());
- if (error != null) {
- message = error.getMessage();
- exception = new AzureStorageResponseException(command, response, error);
- }
- } catch (RuntimeException e) {
- try {
- message = Strings2.toStringAndClose(response.getPayload().openStream());
- exception = new HttpResponseException(command, response, message);
- } catch (IOException e1) {
- }
- }
- } else {
- try {
- message = Strings2.toStringAndClose(response.getPayload().openStream());
- exception = new HttpResponseException(command, response, message);
- } catch (IOException e) {
- }
- }
- }
- message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
- response.getStatusLine());
- exception = refineException(command, response, exception, error, message);
- } finally {
- releasePayload(response);
- command.setException(exception);
- }
- }
-
- protected Exception refineException(HttpCommand command, HttpResponse response, Exception exception,
- AzureStorageError error, String message) {
- switch (response.getStatusCode()) {
- case 401:
- exception = new AuthorizationException(message, exception);
- break;
- case 404:
- if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
- exception = new ResourceNotFoundException(message, exception);
- }
- break;
- case 411:
- exception = new IllegalArgumentException(message);
- break;
- }
- return exception;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/options/CreateOptions.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/options/CreateOptions.java b/common/azure/src/main/java/org/jclouds/azure/storage/options/CreateOptions.java
deleted file mode 100644
index 3fed43b..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/options/CreateOptions.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.options;
-
-import java.util.Map.Entry;
-
-import org.jclouds.azure.storage.reference.AzureStorageHeaders;
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-import com.google.common.collect.Multimap;
-
-/**
- * Contains common options supported in the REST API for the Create operation. <h2>
- * Usage</h2> The recommended way to instantiate a CreateOptions object is to statically import
- * CreateOptions.* and invoke a static creation method followed by an instance mutator (if
- * needed):
- * <p/>
- * <code>
- * import static org.jclouds.azure.storage.options.CreateOptions.Builder.*
- * import org.jclouds.azure.storage.queue.AzureQueueClient;
- * <p/>
- * AzureQueueClient connection = // get connection
- * Multimap<String,String> metadata = // ...
- * boolean createdWithPublicAcl = connection.createQueue("containerName", withMetadata(metadata));
- * <code> *
- *
- * @see <a href="http://msdn.microsoft.com/en-us/library/dd179466.aspx" />
- */
-public class CreateOptions extends BaseHttpRequestOptions {
- public static final CreateOptions NONE = new CreateOptions();
-
- /**
- * A name-value pair to associate with the container as metadata.
- *
- * Note that these are stored at the server under the prefix: x-ms-meta-
- */
- public CreateOptions withMetadata(Multimap<String, String> metadata) {
- for (Entry<String, String> entry : metadata.entries()) {
- if (entry.getKey().startsWith(AzureStorageHeaders.USER_METADATA_PREFIX))
- headers.put(entry.getKey(), entry.getValue());
- else
- headers
- .put(AzureStorageHeaders.USER_METADATA_PREFIX + entry.getKey(), entry
- .getValue());
- }
- return this;
- }
-
- public static class Builder {
-
- /**
- * @see CreateOptions#withMetadata(Multimap<String, String>)
- */
- public static CreateOptions withMetadata(Multimap<String, String> metadata) {
- CreateOptions options = new CreateOptions();
- return options.withMetadata(metadata);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/options/ListOptions.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/options/ListOptions.java b/common/azure/src/main/java/org/jclouds/azure/storage/options/ListOptions.java
deleted file mode 100644
index fba5f39..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/options/ListOptions.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Options used to control paginated results (aka list commands).
- *
- * @see <a href="http://msdn.microsoft.com/en-us/library/dd179466.aspx" />
- */
-public class ListOptions extends BaseHttpRequestOptions {
- public static final ListOptions NONE = new ListOptions();
-
- /**
- * Include this parameter to specify that the container's metadata be returned as part of the
- * response body.
- *
- * Note that metadata requested with this parameter must be stored in accordance with the naming
- * restrictions imposed by the 2009-09-19 version of the Blob service. Beginning with this
- * version, all metadata names must adhere to the naming conventions for C# identifiers.
- */
- public ListOptions includeMetadata() {
- this.queryParameters.replaceValues("include", ImmutableSet.of("metadata"));
- return this;
- }
-
- public boolean getIncludeMetadata() {
- return getFirstQueryOrNull("include").equals("metadata");
- }
-
- /**
- * Filters the results to return only objects whose name begins with the specified prefix.
- */
- public ListOptions prefix(String prefix) {
- this.queryParameters.put("prefix", checkNotNull(prefix, "prefix"));
- return this;
- }
-
- public String getPrefix() {
- return getFirstQueryOrNull("prefix");
- }
-
- /**
- * A string value that identifies the portion of the list to be returned with the next list
- * operation. The operation returns a marker value within the response body if the list returned
- * was not complete. The marker value may then be used in a subsequent call to request the next
- * set of list items.
- * <p/>
- * The marker value is opaque to the client.
- */
- public ListOptions marker(String marker) {
- this.queryParameters.put("marker", checkNotNull(marker, "marker"));
- return this;
- }
-
- public String getMarker() {
- return getFirstQueryOrNull("marker");
- }
-
- /**
- * Specifies the maximum number of containers to return. If maxresults is not specified, the
- * server will return up to 5,000 items. If the parameter is set to a value greater than 5,000,
- * the server will return a Bad Request (400) error
- */
- public ListOptions maxResults(int maxresults) {
- checkState(maxresults >= 0, "maxresults must be >= 0");
- checkState(maxresults <= 10000, "maxresults must be <= 5000");
- queryParameters.put("maxresults", Integer.toString(maxresults));
- return this;
- }
-
- public Integer getMaxResults() {
- String maxresults = getFirstQueryOrNull("maxresults");
- return (maxresults != null) ? Integer.valueOf(maxresults) : null;
- }
-
- public static class Builder {
- /**
- * @see ListOptions#includeMetadata()
- */
- public static ListOptions includeMetadata() {
- ListOptions options = new ListOptions();
- return options.includeMetadata();
- }
-
- /**
- * @see ListOptions#prefix(String)
- */
- public static ListOptions prefix(String prefix) {
- ListOptions options = new ListOptions();
- return options.prefix(prefix);
- }
-
- /**
- * @see ListOptions#marker(String)
- */
- public static ListOptions marker(String marker) {
- ListOptions options = new ListOptions();
- return options.marker(marker);
- }
-
- /**
- * @see ListOptions#maxResults(long)
- */
- public static ListOptions maxResults(int maxKeys) {
- ListOptions options = new ListOptions();
- return options.maxResults(maxKeys);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/reference/AzureStorageHeaders.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/reference/AzureStorageHeaders.java b/common/azure/src/main/java/org/jclouds/azure/storage/reference/AzureStorageHeaders.java
deleted file mode 100644
index 0c60e51..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/reference/AzureStorageHeaders.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.reference;
-
-/**
- * Additional headers specified by Azure Storage REST API.
- *
- * @see <a href="http://msdn.microsoft.com/en-us/library/dd179357.aspx" />
- */
-public final class AzureStorageHeaders {
-
- public static final String USER_METADATA_PREFIX = "x-ms-meta-";
- public static final String REQUEST_ID = "x-ms-request-id";
- public static final String VERSION = "x-ms-version";
-
- private AzureStorageHeaders() {
- throw new AssertionError("intentionally unimplemented");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/util/AzureStorageUtils.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/util/AzureStorageUtils.java b/common/azure/src/main/java/org/jclouds/azure/storage/util/AzureStorageUtils.java
deleted file mode 100644
index bf62ff82a..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/util/AzureStorageUtils.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.util;
-
-import java.io.InputStream;
-
-import javax.inject.Inject;
-import javax.inject.Provider;
-
-import org.jclouds.azure.storage.domain.AzureStorageError;
-import org.jclouds.azure.storage.filters.SharedKeyLiteAuthentication;
-import org.jclouds.azure.storage.reference.AzureStorageHeaders;
-import org.jclouds.azure.storage.xml.ErrorHandler;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpException;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseSax;
-
-/**
- * Encryption, Hashing, and IO Utilities needed to sign and verify Azure Storage requests and
- * responses.
- */
-public class AzureStorageUtils {
-
- @Inject
- SharedKeyLiteAuthentication signer;
-
- @Inject
- ParseSax.Factory factory;
-
- @Inject
- Provider<ErrorHandler> errorHandlerProvider;
-
- public AzureStorageError parseAzureStorageErrorFromContent(HttpCommand command,
- HttpResponse response, InputStream content) throws HttpException {
- AzureStorageError error = factory.create(errorHandlerProvider.get()).parse(content);
- error.setRequestId(response.getFirstHeaderOrNull(AzureStorageHeaders.REQUEST_ID));
- if ("AuthenticationFailed".equals(error.getCode())) {
- error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
- error.setSignature(signer.signString(error.getStringSigned()));
- }
- return error;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/main/java/org/jclouds/azure/storage/xml/ErrorHandler.java
----------------------------------------------------------------------
diff --git a/common/azure/src/main/java/org/jclouds/azure/storage/xml/ErrorHandler.java b/common/azure/src/main/java/org/jclouds/azure/storage/xml/ErrorHandler.java
deleted file mode 100644
index 2467fe7..0000000
--- a/common/azure/src/main/java/org/jclouds/azure/storage/xml/ErrorHandler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.xml;
-
-import org.jclouds.azure.storage.domain.AzureStorageError;
-import org.jclouds.http.functions.ParseSax;
-
-/**
- * Parses the error from the Amazon S3 REST API.
- *
- * @see <a
- * href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?UsingRESTError.html"
- * />
- */
-public class ErrorHandler extends ParseSax.HandlerWithResult<AzureStorageError> {
-
- private AzureStorageError error = new AzureStorageError();
- private StringBuilder currentText = new StringBuilder();
-
- public AzureStorageError getResult() {
- return error;
- }
-
- public void endElement(String uri, String name, String qName) {
-
- if (qName.equals("Code")) {
- error.setCode(currentText.toString().trim());
- } else if (qName.equals("Message")) {
- error.setMessage(currentText.toString().trim());
- } else if (!qName.equals("Error")) {
- error.getDetails().put(qName, currentText.toString());
- }
- currentText.setLength(0);
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/common/azure/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java b/common/azure/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java
deleted file mode 100644
index 5bea836..0000000
--- a/common/azure/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.filters;
-
-import static org.jclouds.reflect.Reflection2.typeToken;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.net.URI;
-
-import javax.ws.rs.HttpMethod;
-
-import org.jclouds.ContextBuilder;
-import org.jclouds.azure.storage.config.AzureStorageRestClientModule;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.IntegrationTestAsyncClient;
-import org.jclouds.http.IntegrationTestClient;
-import org.jclouds.logging.config.NullLoggingModule;
-import org.jclouds.rest.AnonymousRestApiMetadata;
-import org.jclouds.rest.internal.BaseRestApiTest.MockModule;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.net.HttpHeaders;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-@Test(groups = "unit")
-public class SharedKeyLiteAuthenticationTest {
-
- private static final String ACCOUNT = "foo";
- private Injector injector;
- private SharedKeyLiteAuthentication filter;
-
- @DataProvider(parallel = true)
- public Object[][] dataProvider() {
- return new Object[][] {
- { HttpRequest.builder().method(HttpMethod.PUT).endpoint("http://" + ACCOUNT
- + ".blob.core.windows.net/movies/MOV1.avi?comp=block&blockid=BlockId1&timeout=60").build() },
- { HttpRequest.builder().method(HttpMethod.PUT).endpoint("http://" + ACCOUNT
- + ".blob.core.windows.net/movies/MOV1.avi?comp=blocklist&timeout=120").build() },
- { HttpRequest.builder().method(HttpMethod.GET).endpoint("http://" + ACCOUNT + ".blob.core.windows.net/movies/MOV1.avi").build() } };
- }
-
- /**
- * NOTE this test is dependent on how frequently the timestamp updates. At
- * the time of writing, this was once per second. If this timestamp update
- * interval is increased, it could make this test appear to hang for a long
- * time.
- */
- @Test(threadPoolSize = 3, dataProvider = "dataProvider", timeOut = 3000)
- void testIdempotent(HttpRequest request) {
- request = filter.filter(request);
- String signature = request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION);
- String date = request.getFirstHeaderOrNull(HttpHeaders.DATE);
- int iterations = 1;
- while (request.getFirstHeaderOrNull(HttpHeaders.DATE).equals(date)) {
- date = request.getFirstHeaderOrNull(HttpHeaders.DATE);
- iterations++;
- assertEquals(signature, request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION));
- request = filter.filter(request);
- }
- System.out.printf("%s: %d iterations before the timestamp updated %n", Thread.currentThread().getName(),
- iterations);
- }
-
- @Test
- void testAclQueryStringRoot() {
- URI host = URI.create("http://" + ACCOUNT + ".blob.core.windows.net/?comp=list");
- HttpRequest request = HttpRequest.builder().method(HttpMethod.GET).endpoint(host).build();
- StringBuilder builder = new StringBuilder();
- filter.appendUriPath(request, builder);
- assertEquals(builder.toString(), "/?comp=list");
- }
-
- @Test
- void testAclQueryStringResTypeNotSignificant() {
- URI host = URI.create("http://" + ACCOUNT + ".blob.core.windows.net/mycontainer?restype=container");
- HttpRequest request = HttpRequest.builder().method(HttpMethod.GET).endpoint(host).build();
- StringBuilder builder = new StringBuilder();
- filter.appendUriPath(request, builder);
- assertEquals(builder.toString(), "/mycontainer");
- }
-
- @Test
- void testAclQueryStringComp() {
- URI host = URI.create("http://" + ACCOUNT + ".blob.core.windows.net/mycontainer?comp=list");
- HttpRequest request = HttpRequest.builder().method(HttpMethod.GET).endpoint(host).build();
- StringBuilder builder = new StringBuilder();
- filter.appendUriPath(request, builder);
- assertEquals(builder.toString(), "/mycontainer?comp=list");
- }
-
- @Test
- void testAclQueryStringRelativeWithExtraJunk() {
- URI host = URI.create("http://" + ACCOUNT
- + ".blob.core.windows.net/mycontainer?comp=list&marker=marker&maxresults=1&prefix=prefix");
- HttpRequest request = HttpRequest.builder().method(HttpMethod.GET).endpoint(host).build();
- StringBuilder builder = new StringBuilder();
- filter.appendUriPath(request, builder);
- assertEquals(builder.toString(), "/mycontainer?comp=list");
- }
-
- /**
- * before class, as we need to ensure that the filter is threadsafe.
- *
- * @throws IOException
- *
- */
- @BeforeClass
- protected void createFilter() throws IOException {
- injector = ContextBuilder
- .newBuilder(
- AnonymousRestApiMetadata
- .forClientMappedToAsyncClient(IntegrationTestClient.class, IntegrationTestAsyncClient.class)
- .toBuilder().build())
- .endpoint("https://${jclouds.identity}.blob.core.windows.net")
- .credentials(ACCOUNT, "credential")
- .modules(
- ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule(),
- new AzureStorageRestClientModule<IntegrationTestClient, IntegrationTestAsyncClient>(
- typeToken(IntegrationTestClient.class), typeToken(IntegrationTestAsyncClient.class))))
- .buildInjector();
- filter = injector.getInstance(SharedKeyLiteAuthentication.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/test/java/org/jclouds/azure/storage/handlers/ParseAzureErrorFromXmlContentTest.java
----------------------------------------------------------------------
diff --git a/common/azure/src/test/java/org/jclouds/azure/storage/handlers/ParseAzureErrorFromXmlContentTest.java b/common/azure/src/test/java/org/jclouds/azure/storage/handlers/ParseAzureErrorFromXmlContentTest.java
deleted file mode 100644
index 5cfbffe..0000000
--- a/common/azure/src/test/java/org/jclouds/azure/storage/handlers/ParseAzureErrorFromXmlContentTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.handlers;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.reportMatcher;
-import static org.easymock.EasyMock.verify;
-
-import java.net.URI;
-
-import org.easymock.IArgumentMatcher;
-import org.jclouds.azure.storage.AzureStorageResponseException;
-import org.jclouds.azure.storage.filters.SharedKeyLiteAuthentication;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.config.SaxParserModule;
-import org.testng.annotations.Test;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-
-@Test(groups = { "unit" })
-public class ParseAzureErrorFromXmlContentTest {
-
- @Test
- public void test411WithTextHtmlIllegalArgumentException() {
- assertCodeMakes("PUT",
- URI.create("https://jclouds.blob.core.windows.net/adriancole-azureblob-413790770?restype=container"), 411,
- "Length Required", "text/html; charset=us-ascii", "<HTML><HEAD><TITLE>Length Required</TITLE>\r\n",
- IllegalArgumentException.class);
- }
-
- @Test
- public void test304WithNoContentIllegalArgumentException() {
- assertCodeMakes("GET", URI.create("https://jclouds.blob.core.windows.net/adriancole-blobstore0/apples"), 411,
- "HTTP/1.1 304 The condition specified using HTTP conditional header(s) is not met.", "application/unknown",
- "", IllegalArgumentException.class);
- }
-
-
- @Test
- public void test412WithTextHtmlHttpResponseException() {
- assertCodeMakes(
- "GET",
- URI.create("https://jclouds.blob.core.windows.net/adriancole-blobstore2?restype=container&comp=list&prefix=apps/apps/apps/&include=metadata"),
- 412,
- "HTTP/1.1 412 The condition specified using HTTP conditional header(s) is not met.",
- "application/xml",
- "<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>ConditionNotMet</Code><Message>The condition specified using HTTP conditional header(s) is not met.\nRequestId:921efcad-84bc-4e0a-863d-24810d1096e1\nTime:2010-11-04T15:03:07.8694513Z</Message></Error>",
- AzureStorageResponseException.class);
- }
-
- private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
- String content, Class<? extends Exception> expected) {
-
- ParseAzureStorageErrorFromXmlContent function = Guice.createInjector(new SaxParserModule(), new AbstractModule() {
-
- @Override
- protected void configure() {
- bind(SharedKeyLiteAuthentication.class).toInstance(createMock(SharedKeyLiteAuthentication.class));
- }
-
- }).getInstance(ParseAzureStorageErrorFromXmlContent.class);
-
- HttpCommand command = createMock(HttpCommand.class);
- HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
- HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
- response.getPayload().getContentMetadata().setContentType(contentType);
-
- expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
- command.setException(classEq(expected));
-
- replay(command);
-
- function.handleError(command, response);
-
- verify(command);
- }
-
- public static Exception classEq(final Class<? extends Exception> in) {
- reportMatcher(new IArgumentMatcher() {
-
- @Override
- public void appendTo(StringBuffer buffer) {
- buffer.append("classEq(");
- buffer.append(in);
- buffer.append(")");
- }
-
- @Override
- public boolean matches(Object arg) {
- return arg.getClass() == in;
- }
-
- });
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/test/java/org/jclouds/azure/storage/options/CreateOptionsTest.java
----------------------------------------------------------------------
diff --git a/common/azure/src/test/java/org/jclouds/azure/storage/options/CreateOptionsTest.java b/common/azure/src/test/java/org/jclouds/azure/storage/options/CreateOptionsTest.java
deleted file mode 100644
index b582783..0000000
--- a/common/azure/src/test/java/org/jclouds/azure/storage/options/CreateOptionsTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.options;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.azure.storage.reference.AzureStorageHeaders;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMultimap;
-
-/**
- * Tests behavior of {@code CreateOptions}
- */
-@Test(groups = "unit")
-public class CreateOptionsTest {
-
- public void testMetadata() {
- CreateOptions options = new CreateOptions().withMetadata(ImmutableMultimap.of(
- "test", "foo"));
- assertEquals(ImmutableList.of("foo"), options.buildRequestHeaders().get(
- AzureStorageHeaders.USER_METADATA_PREFIX + "test"));
- }
-
- public void testMetadataAlreadyPrefixed() {
- CreateOptions options = new CreateOptions().withMetadata(ImmutableMultimap.of(
- AzureStorageHeaders.USER_METADATA_PREFIX + "test", "foo"));
- assertEquals(ImmutableList.of("foo"), options.buildRequestHeaders().get(
- AzureStorageHeaders.USER_METADATA_PREFIX + "test"));
- }
-
- public void testMetadataStatic() {
- CreateOptions options = CreateOptions.Builder.withMetadata(ImmutableMultimap.of(
- "test", "foo"));
- assertEquals(ImmutableList.of("foo"), options.buildRequestHeaders().get(
- AzureStorageHeaders.USER_METADATA_PREFIX + "test"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/test/java/org/jclouds/azure/storage/options/ListOptionsTest.java
----------------------------------------------------------------------
diff --git a/common/azure/src/test/java/org/jclouds/azure/storage/options/ListOptionsTest.java b/common/azure/src/test/java/org/jclouds/azure/storage/options/ListOptionsTest.java
deleted file mode 100644
index 67fc768..0000000
--- a/common/azure/src/test/java/org/jclouds/azure/storage/options/ListOptionsTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.options;
-
-import static org.testng.Assert.assertEquals;
-
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Tests behavior of {@code ListOptions}
- */
-@Test(groups = "unit")
-public class ListOptionsTest {
- public void testIncludeMetadata() {
- ListOptions options = new ListOptions().includeMetadata();
- assertEquals(ImmutableList.of("metadata"), options.buildQueryParameters().get("include"));
- }
-
- public void testIncludeMetadataStatic() {
- ListOptions options = ListOptions.Builder.includeMetadata();
- assertEquals(ImmutableList.of("metadata"), options.buildQueryParameters().get("include"));
- }
-
- public void testPrefix() {
- ListOptions options = new ListOptions().prefix("a");
- assertEquals(ImmutableList.of("a"), options.buildQueryParameters().get("prefix"));
- }
-
- public void testMarker() {
- ListOptions options = new ListOptions().marker("a");
- assertEquals(ImmutableList.of("a"), options.buildQueryParameters().get("marker"));
- }
-
- public void testMaxResults() {
- int limit = 1;
- ListOptions options = new ListOptions().maxResults(limit);
- assertEquals(ImmutableList.of("1"), options.buildQueryParameters().get("maxresults"));
- }
-
- public void testPrefixStatic() {
- ListOptions options = ListOptions.Builder.prefix("a");
- assertEquals(ImmutableList.of("a"), options.buildQueryParameters().get("prefix"));
- }
-
- public void testMarkerStatic() {
- ListOptions options = ListOptions.Builder.marker("a");
- assertEquals(ImmutableList.of("a"), options.buildQueryParameters().get("marker"));
- }
-
- public void testMaxResultsStatic() {
- int limit = 1;
- ListOptions options = ListOptions.Builder.maxResults(limit);
- assertEquals(ImmutableList.of("1"), options.buildQueryParameters().get("maxresults"));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/test/java/org/jclouds/azure/storage/xml/ErrorHandlerTest.java
----------------------------------------------------------------------
diff --git a/common/azure/src/test/java/org/jclouds/azure/storage/xml/ErrorHandlerTest.java b/common/azure/src/test/java/org/jclouds/azure/storage/xml/ErrorHandlerTest.java
deleted file mode 100644
index 1698cd6..0000000
--- a/common/azure/src/test/java/org/jclouds/azure/storage/xml/ErrorHandlerTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.azure.storage.xml;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.InputStream;
-
-import org.jclouds.azure.storage.domain.AzureStorageError;
-import org.jclouds.http.functions.BaseHandlerTest;
-import org.jclouds.http.functions.ParseSax;
-import org.testng.annotations.Test;
-
-/**
- * Tests behavior of {@code ErrorHandler}
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
-@Test(groups = "unit", testName = "ErrorHandlerTest")
-public class ErrorHandlerTest extends BaseHandlerTest {
-
- ParseSax<AzureStorageError> createParser() {
- ParseSax<AzureStorageError> parser = factory.create(injector
- .getInstance(ErrorHandler.class));
- return parser;
- }
-
- public void testApplyInputStream() {
- InputStream is = getClass().getResourceAsStream("/test_error.xml");
- ParseSax<AzureStorageError> parser = createParser();
- AzureStorageError result = parser.parse(is);
- assertEquals(result.getCode(), "AuthenticationFailed");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/common/azure/src/test/resources/log4j.xml b/common/azure/src/test/resources/log4j.xml
deleted file mode 100644
index acaa72d..0000000
--- a/common/azure/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
- <!--
- For more configuration infromation and examples see the Apache
- Log4j website: http://logging.apache.org/log4j/
- -->
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
- debug="false">
-
- <!-- A time/date based rolling appender -->
- <appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds-wire.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <!-- A time/date based rolling appender -->
- <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="FILE" />
- </appender>
-
- <appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="WIREFILE" />
- </appender>
-
- <!-- A time/date based rolling appender -->
- <appender name="BLOBSTOREFILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="target/test-data/jclouds-blobstore.log" />
- <param name="Append" value="true" />
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd" />
-
- <param name="Threshold" value="TRACE" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
-
- <!--
- The full pattern: Date MS Priority [Category]
- (Thread:NDC) Message\n <param name="ConversionPattern"
- value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <appender name="ASYNCBLOBSTORE" class="org.apache.log4j.AsyncAppender">
- <appender-ref ref="BLOBSTOREFILE" />
- </appender>
- <!-- ================ -->
- <!-- Limit categories -->
- <!-- ================ -->
- <category name="jclouds.blobstore">
- <priority value="TRACE" />
- <appender-ref ref="ASYNCBLOBSTORE" />
- </category>
-
- <category name="org.jclouds">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNC" />
- </category>
-
- <category name="jclouds.headers">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNCWIRE" />
- </category>
-
- <category name="jclouds.wire">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNCWIRE" />
- </category>
- <!-- ======================= -->
- <!-- Setup the Root category -->
- <!-- ======================= -->
-
- <root>
- <priority value="WARN" />
- </root>
-
-</log4j:configuration>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/azure/src/test/resources/test_error.xml
----------------------------------------------------------------------
diff --git a/common/azure/src/test/resources/test_error.xml b/common/azure/src/test/resources/test_error.xml
deleted file mode 100644
index 6c12fac..0000000
--- a/common/azure/src/test/resources/test_error.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Error>
- <Code>AuthenticationFailed</Code>
- <Message>Server failed to authenticate the request. Make sure the value
- of Authorization header is formed correctly including the signature.
- RequestId:7859e884-e8b9-4ed0-aa62-ac6963b91bf6
- Time:2009-09-02T23:32:36.7507749Z</Message>
- <AuthenticationErrorDetail>The MAC signature found in the HTTP request
- 'XEv0NqP+zePZxlrHmxy2F6MiyoRD8LIJt1f/Swgzn1U=' is not the same as any
- computed signature. Server used following string to sign: 'GET
-
-
- Wed, 02 Sep 2009 23:32:34 GMT
- /jclouds/?comp=list'.</AuthenticationErrorDetail>
-</Error>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/common/pom.xml
----------------------------------------------------------------------
diff --git a/common/pom.xml b/common/pom.xml
index a19ce3d..d12c7b8 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -30,7 +30,6 @@
<packaging>pom</packaging>
<name>jclouds commons project</name>
<modules>
- <module>azure</module>
<module>openstack</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/jclouds/blob/4c95a578/providers/azureblob/pom.xml
----------------------------------------------------------------------
diff --git a/providers/azureblob/pom.xml b/providers/azureblob/pom.xml
index c80c59d..bbeef91 100644
--- a/providers/azureblob/pom.xml
+++ b/providers/azureblob/pom.xml
@@ -38,7 +38,7 @@
<test.azureblob.identity>${test.azure.identity}</test.azureblob.identity>
<test.azureblob.credential>${test.azure.credential}</test.azureblob.credential>
- <jclouds.osgi.export>org.jclouds.azureblob*;version="${project.version}"</jclouds.osgi.export>
+ <jclouds.osgi.export>org.jclouds.azureblob*;version="${project.version}",org.jclouds.azure.storage*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>
</properties>
[27/52] [abbrv] git commit: JCLOUDS-40 Remove AsyncBlobStore
references from filesystem api
Posted by an...@apache.org.
JCLOUDS-40 Remove AsyncBlobStore references from filesystem api
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/a22a7252
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/a22a7252
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/a22a7252
Branch: refs/heads/use-agentproxy-008
Commit: a22a72529332a2d8620c21c0aaa7ae39a435b2fb
Parents: a4e3c1a
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 11:41:36 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 13:18:02 2014 -0700
----------------------------------------------------------------------
.../util/internal/FileSystemBlobUtilsImpl.java | 2 +-
.../FilesystemAsyncBlobStoreTest.java | 859 -------------------
.../filesystem/FilesystemBlobStoreTest.java | 817 ++++++++++++++++++
.../src/test/resources/logging.properties | 2 -
4 files changed, 818 insertions(+), 862 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a22a7252/apis/filesystem/src/main/java/org/jclouds/filesystem/util/internal/FileSystemBlobUtilsImpl.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/main/java/org/jclouds/filesystem/util/internal/FileSystemBlobUtilsImpl.java b/apis/filesystem/src/main/java/org/jclouds/filesystem/util/internal/FileSystemBlobUtilsImpl.java
index 3dfcd31..2dbd2ad 100644
--- a/apis/filesystem/src/main/java/org/jclouds/filesystem/util/internal/FileSystemBlobUtilsImpl.java
+++ b/apis/filesystem/src/main/java/org/jclouds/filesystem/util/internal/FileSystemBlobUtilsImpl.java
@@ -30,7 +30,7 @@ import com.google.inject.Inject;
/**
* Implements the {@link BlobUtils} interfaced and act as a bridge to
- * {@link LocalStorageStrategy} when used inside {@link AsyncBlobStore}
+ * {@link LocalStorageStrategy} when used inside {@link BlobStore}
*/
public class FileSystemBlobUtilsImpl implements BlobUtils {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a22a7252/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java
deleted file mode 100644
index 3129241..0000000
--- a/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java
+++ /dev/null
@@ -1,859 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.filesystem;
-
-import static com.google.common.io.BaseEncoding.base16;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNotSame;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-
-import org.jclouds.ContextBuilder;
-import org.jclouds.blobstore.BlobRequestSigner;
-import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.ContainerNotFoundException;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.MutableBlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.domain.StorageType;
-import org.jclouds.blobstore.options.GetOptions;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.filesystem.reference.FilesystemConstants;
-import org.jclouds.filesystem.util.Utils;
-import org.jclouds.filesystem.utils.TestUtils;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.io.ByteStreams2;
-import org.jclouds.io.Payload;
-import org.jclouds.io.payloads.PhantomPayload;
-import org.jclouds.io.payloads.StringPayload;
-import org.jclouds.util.Closeables2;
-import org.jclouds.util.Strings2;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Sets;
-import com.google.common.io.ByteSource;
-import com.google.common.io.Files;
-import com.google.inject.CreationException;
-
-/**
- * Test class for {@link FilesystemAsyncBlobStore} class
- */
-@Test(groups = "unit", testName = "filesystem.FilesystemAsyncBlobStoreTest", singleThreaded = true)
-public class FilesystemAsyncBlobStoreTest {
-
- private static final String CONTAINER_NAME = "fun-blobstore-test";
- private static final String TARGET_CONTAINER_NAME = TestUtils.TARGET_BASE_DIR + CONTAINER_NAME;
- private static final String LOGGING_CONFIG_KEY = "java.util.logging.config.file";
- private static final String LOGGING_CONFIG_VALUE = "src/main/resources/logging.properties";
-
- private static final String PROVIDER = "filesystem";
-
- static {
- System.setProperty(LOGGING_CONFIG_KEY, LOGGING_CONFIG_VALUE);
- }
-
- private BlobStoreContext context = null;
- private BlobStore blobStore = null;
-
- @BeforeMethod
- protected void setUp() throws Exception {
- // create context for filesystem container
- Properties prop = new Properties();
- prop.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR);
- context = ContextBuilder.newBuilder(PROVIDER).overrides(prop).build(BlobStoreContext.class);
- // create a container in the default location
- blobStore = context.getBlobStore();
- new File(TestUtils.TARGET_BASE_DIR).mkdir();
- TestUtils.createResources();
- }
-
- @AfterMethod
- protected void tearDown() throws IOException {
- context.close();
- Utils.deleteRecursively(new File(TestUtils.TARGET_BASE_DIR));
- }
-
- /**
- * Checks if context parameters are managed in the correct way
- */
- public void testParameters() {
- // no base directory declared in properties
- try {
- Properties props = new Properties();
- context = ContextBuilder.newBuilder(PROVIDER).overrides(props).build(BlobStoreContext.class);
- fail("No error if base directory is not specified");
- } catch (CreationException e) {
- }
-
- // no base directory declared in properties
- try {
- Properties props = new Properties();
- props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, null);
- context = ContextBuilder.newBuilder(PROVIDER).overrides(props).build(BlobStoreContext.class);
- fail("No error if base directory is null in the option");
- } catch (NullPointerException e) {
- }
- }
-
- /**
- * Test of list method of the root context
- */
- public void testList_Root() throws IOException {
- PageSet<? extends StorageMetadata> containersRetrieved;
- Set<String> containersCreated = Sets.newHashSet();
-
- // Testing list with no containers
- containersRetrieved = blobStore.list();
- assertTrue(containersRetrieved.isEmpty(), "List operation returns a not empty set of container");
-
- // Testing list with some containers
- String[] containerNames = {"34343", "aaaa", "bbbbb"};
- containersCreated = Sets.newHashSet();
- for (String containerName : containerNames) {
- blobStore.createContainerInLocation(null, containerName);
- containersCreated.add(containerName);
- }
-
- containersRetrieved = blobStore.list();
- assertEquals(containersCreated.size(), containersRetrieved.size(), "Different numbers of container");
-
- for (StorageMetadata data : containersRetrieved) {
- String containerName = data.getName();
- if (!containersCreated.remove(containerName)) {
- fail("Container list contains unexpected value [" + containerName + "]");
- }
- }
- assertTrue(containersCreated.isEmpty(), "List operation doesn't return all values.");
-
- for (String containerName : containerNames) {
- // delete all creaded containers
- blobStore.deleteContainer(containerName);
- }
- containersRetrieved = blobStore.list();
- assertTrue(containersRetrieved.isEmpty(), "List operation returns a not empty set of container");
- }
-
- /**
- * Test of list method, of class FilesystemAsyncBlobStore.
- */
- public void testList_NoOptionSingleContainer() throws IOException {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- // Testing list for an empty container
- checkForContainerContent(CONTAINER_NAME, null);
-
- // creates blobs in first container
- Set<String> blobsExpected = TestUtils.createBlobsInContainer(CONTAINER_NAME, "bbb" + File.separator + "ccc"
- + File.separator + "ddd" + File.separator + "1234.jpg", "4rrr.jpg", "rrr" + File.separator + "sss"
- + File.separator + "788.jpg", "xdc" + File.separator + "wert.kpg");
-
- checkForContainerContent(CONTAINER_NAME, blobsExpected);
- }
-
- public void testList_NotExistingContainer() {
- // Testing list for a not existing container
- try {
- blobStore.list(CONTAINER_NAME);
- fail("Found a not existing container");
- } catch (ContainerNotFoundException e) {
- // ok if arriver here
- }
- }
-
- /**
- * Test of list method, of class FilesystemAsyncBlobStore.
- */
- public void testList_NoOptionDoubleContainer() throws IOException {
- final String CONTAINER_NAME2 = "container2";
-
- // create first container
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- // checks for empty container
- checkForContainerContent(CONTAINER_NAME, null);
-
- // create second container
- blobStore.createContainerInLocation(null, CONTAINER_NAME2);
- // checks for empty
- checkForContainerContent(CONTAINER_NAME2, null);
-
- // creates blobs in first container
-
- Set<String> blobNamesCreatedInContainer1 = TestUtils.createBlobsInContainer(CONTAINER_NAME, "bbb"
- + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg",
- TestUtils.createRandomBlobKey(), "rrr" + File.separator + "sss" + File.separator + "788.jpg", "xdc"
- + File.separator + "wert.kpg");
-
- // creates blobs in second container
- blobStore.createContainerInLocation(null, CONTAINER_NAME2);
- Set<String> blobNamesCreatedInContainer2 = TestUtils.createBlobsInContainer(CONTAINER_NAME2, "asd"
- + File.separator + "bbb" + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg",
- TestUtils.createRandomBlobKey(), "rrr" + File.separator + "sss" + File.separator + "788.jpg", "xdc"
- + File.separator + "wert.kpg");
-
- // test blobs in first container
- checkForContainerContent(CONTAINER_NAME, blobNamesCreatedInContainer1);
- // test blobs in second container
- checkForContainerContent(CONTAINER_NAME2, blobNamesCreatedInContainer2);
- }
-
- public void testList_Subdirectory() throws IOException {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- // Testing list for an empty container
- checkForContainerContent(CONTAINER_NAME, null);
-
- // creates blobs in first container
- Set<String> blobsExpected = TestUtils.createBlobsInContainer(CONTAINER_NAME, "bbb" + File.separator + "ccc"
- + File.separator + "ddd" + File.separator + "1234.jpg", "4rrr.jpg", "rrr" + File.separator + "sss"
- + File.separator + "788.jpg", "rrr" + File.separator + "wert.kpg");
-
- // remove not expected values
- blobsExpected.remove("bbb" + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg");
- blobsExpected.remove("4rrr.jpg");
-
- checkForContainerContent(CONTAINER_NAME, "rrr", blobsExpected);
- }
-
- /**
- * TODO Should throws an exception?
- */
- public void testClearContainer_NotExistingContainer() {
- blobStore.clearContainer(CONTAINER_NAME);
- }
-
- /**
- * Integration test, because clearContainer is not redefined in
- * {@link FilesystemAsyncBlobStore} class
- */
- public void testClearContainer_NoOptions() throws IOException {
- final String CONTAINER_NAME2 = "containerToClear";
-
- // create containers
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- blobStore.createContainerInLocation(null, CONTAINER_NAME2);
-
- // creates blobs in first container
- Set<String> blobNamesCreatedInContainer1 = TestUtils.createBlobsInContainer(CONTAINER_NAME, "bbb"
- + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg",
- TestUtils.createRandomBlobKey(), "rrr" + File.separator + "sss" + File.separator + "788.jpg", "xdc"
- + File.separator + "wert.kpg");
-
- // creates blobs in second container
- blobStore.createContainerInLocation(null, CONTAINER_NAME2);
- Set<String> blobNamesCreatedInContainer2 = TestUtils.createBlobsInContainer(CONTAINER_NAME2, "asd"
- + File.separator + "bbb" + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg",
- TestUtils.createRandomBlobKey(), "rrr" + File.separator + "sss" + File.separator + "788.jpg", "xdc"
- + File.separator + "wert.kpg");
-
- // test blobs in containers
- checkForContainerContent(CONTAINER_NAME, blobNamesCreatedInContainer1);
- checkForContainerContent(CONTAINER_NAME2, blobNamesCreatedInContainer2);
-
- // delete blobs in first container
- blobStore.clearContainer(CONTAINER_NAME);
- checkForContainerContent(CONTAINER_NAME, null);
- checkForContainerContent(CONTAINER_NAME2, blobNamesCreatedInContainer2);
- // delete blobs in second container
- blobStore.clearContainer(CONTAINER_NAME2);
- checkForContainerContent(CONTAINER_NAME2, null);
- }
-
- /**
- * Integration test, because countBlobs is not redefined in
- * {@link FilesystemAsyncBlobStore} class
- */
- public void testCountBlobs_NotExistingContainer() {
- blobStore.countBlobs(PROVIDER);
- }
-
- /**
- * Integration test, because countBlobs is not redefined in
- * {@link FilesystemAsyncBlobStore} class
- */
- public void testCountBlobs_NoOptionsEmptyContainer() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- blobStore.countBlobs(PROVIDER);
- }
-
- /**
- * Integration test, because countBlobs is not redefined in
- * {@link FilesystemAsyncBlobStore} class
- */
- public void testCountBlobs_NoOptions() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- blobStore.countBlobs(PROVIDER);
- }
-
- public void testRemoveBlob_SimpleBlobKey() throws IOException {
- final String BLOB_KEY = TestUtils.createRandomBlobKey(null, ".txt");
- boolean result;
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
-
- // checks that blob doesn't exists
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertFalse(result, "Blob exists");
-
- // create the blob
- TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertTrue(result, "Blob exists");
-
- // remove it
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertFalse(result, "Blob still exists");
- TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY, false);
- }
-
- public void testRemoveBlob_TwoSimpleBlobKeys() throws IOException {
- final String BLOB_KEY1 = TestUtils.createRandomBlobKey(null, null);
- final String BLOB_KEY2 = TestUtils.createRandomBlobKey(null, null);
- boolean result;
-
- // create the container and checks that blob doesn't exists
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertFalse(result, "Blob1 exists");
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertFalse(result, "Blob2 exists");
-
- // create the blob
- TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY1, BLOB_KEY2);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertTrue(result, "Blob " + BLOB_KEY1 + " doesn't exist");
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertTrue(result, "Blob " + BLOB_KEY2 + " doesn't exist");
-
- // remove first blob
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY1);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertFalse(result, "Blob1 still exists");
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertTrue(result, "Blob2 doesn't exist");
- TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY1, false);
- TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, true);
- // remove second blob
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY2);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertFalse(result, "Blob2 still exists");
- TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, false);
- }
-
- /**
- * Test of removeBlob method, with only one blob with a complex path as key
- */
- @Test
- public void testRemoveBlob_ComplexBlobKey() throws IOException {
- final String BLOB_KEY = TestUtils.createRandomBlobKey("aa/bb/cc/dd/", null);
- boolean result;
-
- // checks that blob doesn't exists
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertFalse(result, "Blob exists");
- TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY, false);
-
- // create the blob
- TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertTrue(result, "Blob doesn't exist");
-
- // remove it
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
- assertFalse(result, "Blob still exists");
- // file removed
- TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY, false);
- // also the entire directory structure was removed
- TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa", false);
- }
-
- /**
- * Test of removeBlob method, with two blobs with a complex path as key and
- * when first blob is removed, not all of its key's path is removed, because
- * it is shared with the second blob's key
- */
- @Test
- public void testRemoveBlob_TwoComplexBlobKeys() throws IOException {
- final String BLOB_KEY1 = TestUtils.createRandomBlobKey("aa/bb/cc/dd/", null);
- final String BLOB_KEY2 = TestUtils.createRandomBlobKey("aa/bb/ee/ff/", null);
- boolean result;
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
-
- // checks that blob doesn't exist
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertFalse(result, "Blob1 exists");
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertFalse(result, "Blob2 exists");
-
- // create the blobs
- TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY1, BLOB_KEY2);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertTrue(result, "Blob " + BLOB_KEY1 + " doesn't exist");
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertTrue(result, "Blob " + BLOB_KEY2 + " doesn't exist");
-
- // remove first blob
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY1);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
- assertFalse(result, "Blob still exists");
- // first file deleted, not the second
- TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY1, false);
- TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, true);
- // only partial directory structure was removed, because it shares a path
- // with the second blob created
- TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa/bb/cc/dd", false);
- TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa/bb", true);
- // remove second blob
- blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY2);
- result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
- assertFalse(result, "Blob still exists");
- TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, false);
- // now all the directory structure is empty
- TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa", false);
- }
-
- /**
- * Test of containerExists method, of class FilesystemAsyncBlobStore.
- */
- public void testContainerExists() throws IOException {
- boolean result;
-
- result = blobStore.containerExists(CONTAINER_NAME);
- assertFalse(result, "Container exists");
-
- // create container
- TestUtils.createContainerAsDirectory(CONTAINER_NAME);
-
- result = blobStore.containerExists(CONTAINER_NAME);
- assertTrue(result, "Container doesn't exist");
- }
-
- /**
- * Test of createContainerInLocation method, of class
- * FilesystemAsyncBlobStore.
- */
- public void testCreateContainerInLocation() throws IOException {
- final String CONTAINER_NAME2 = "funambol-test-2";
- final String TARGET_CONTAINER_NAME2 = TestUtils.TARGET_BASE_DIR + CONTAINER_NAME2;
-
- boolean result;
-
- result = blobStore.containerExists(CONTAINER_NAME);
- assertFalse(result, "Container exists");
- result = blobStore.createContainerInLocation(null, CONTAINER_NAME);
- assertTrue(result, "Container not created");
- result = blobStore.containerExists(CONTAINER_NAME);
- assertTrue(result, "Container doesn't exist");
- TestUtils.directoryExists(TARGET_CONTAINER_NAME, true);
-
- result = blobStore.containerExists(CONTAINER_NAME2);
- assertFalse(result, "Container exists");
- result = blobStore.createContainerInLocation(null, CONTAINER_NAME2);
- assertTrue(result, "Container not created");
- result = blobStore.containerExists(CONTAINER_NAME2);
- assertTrue(result, "Container doesn't exist");
- TestUtils.directoryExists(TestUtils.TARGET_BASE_DIR + CONTAINER_NAME2, true);
- }
-
- /**
- * Test of putBlob method, of class FilesystemAsyncBlobStore. with a simple
- * filename - no path in the filename, eg filename.jpg
- */
- public void testPutBlobSimpleName() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- putBlobAndCheckIt(TestUtils.createRandomBlobKey("putBlob-", ".jpg"));
- putBlobAndCheckIt(TestUtils.createRandomBlobKey("putBlob-", ".jpg"));
- }
-
- /**
- * Test of putBlob method with a complex key, with path in the filename, eg
- * picture/filename.jpg
- */
- public void testPutBlobComplexName1() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- putBlobAndCheckIt(TestUtils.createRandomBlobKey("picture/putBlob-", ".jpg"));
- putBlobAndCheckIt(TestUtils.createRandomBlobKey("video/putBlob-", ".jpg"));
- putBlobAndCheckIt(TestUtils.createRandomBlobKey("putBlob-", ".jpg"));
- putBlobAndCheckIt(TestUtils.createRandomBlobKey("video/putBlob-", ".jpg"));
- }
-
- /**
- * Test of putBlob method with a complex key, with path in the filename, eg
- * picture/filename.jpg
- */
- public void testPutBlobComplexName2() {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- putBlobAndCheckIt(TestUtils.createRandomBlobKey("aa/bb/cc/dd/ee/putBlob-", ".jpg"));
- putBlobAndCheckIt(TestUtils.createRandomBlobKey("aa/bb/cc/dd/ee/putBlob-", ".jpg"));
- putBlobAndCheckIt(TestUtils.createRandomBlobKey("putBlob-", ".jpg"));
- }
-
- /**
- * Test of blobExists method, of class FilesystemAsyncBlobStore.
- */
- public void testBlobExists() throws IOException {
- boolean result;
- String blobKey;
-
- // when location doesn't exists
- blobKey = TestUtils.createRandomBlobKey();
- try {
- blobStore.blobExists(CONTAINER_NAME, blobKey);
- fail();
- } catch (ContainerNotFoundException cnfe) {
- // expected
- }
-
- // when location exists
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- result = blobStore.blobExists(CONTAINER_NAME, blobKey);
- assertFalse(result, "Blob exists");
-
- // create blob
- TestUtils.createBlobAsFile(CONTAINER_NAME, blobKey, TestUtils.getImageForBlobPayload());
- result = blobStore.blobExists(CONTAINER_NAME, blobKey);
- assertTrue(result, "Blob doesn't exist");
-
- // complex path test
- blobKey = TestUtils.createRandomBlobKey("ss/asdas/", "");
- result = blobStore.blobExists(CONTAINER_NAME, blobKey);
- assertFalse(result, "Blob exists");
- TestUtils.createBlobAsFile(CONTAINER_NAME, blobKey, TestUtils.getImageForBlobPayload());
- result = blobStore.blobExists(CONTAINER_NAME, blobKey);
- assertTrue(result, "Blob doesn't exist");
- }
-
- public void testGetBlob_NotExistingContainer() {
- try {
- blobStore.getBlob(CONTAINER_NAME, TestUtils.createRandomBlobKey(), null);
- fail("Retrieve must fail, container does not exist.");
- } catch (ContainerNotFoundException e) {
- // correct if arrive here
- }
- }
-
- /**
- * Test of getBlob method, of class FilesystemAsyncBlobStore.
- */
- public void testGetBlob() throws IOException {
- String blobKey = TestUtils.createRandomBlobKey();
- GetOptions options = null;
- Blob resultBlob;
-
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
-
- resultBlob = blobStore.getBlob(CONTAINER_NAME, blobKey, options);
- assertNull(resultBlob, "Blob exists");
-
- // create blob
- TestUtils.createBlobsInContainer(CONTAINER_NAME, blobKey);
-
- resultBlob = blobStore.getBlob(CONTAINER_NAME, blobKey, options);
-
- assertNotNull(resultBlob, "Blob exists");
- // checks file content
- ByteSource expectedFile = Files.asByteSource(new File(TARGET_CONTAINER_NAME, blobKey));
- assertEquals(expectedFile.read(), ByteStreams2.toByteArrayAndClose(resultBlob.getPayload().openStream()),
- "Blob payload differs from file content");
- // metadata are verified in the test for blobMetadata, so no need to
- // perform a complete test here
- assertNotNull(resultBlob.getMetadata(), "Metadata null");
- MutableBlobMetadata metadata = resultBlob.getMetadata();
- assertEquals(blobKey, metadata.getName(), "Wrong blob metadata");
- }
-
- public void testBlobMetadata_withDefaultMetadata() throws IOException {
- String BLOB_KEY = TestUtils.createRandomBlobKey(null, null);
- // create the blob
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- Blob blob = blobStore.blobBuilder(BLOB_KEY)
- .payload(TestUtils.getImageForBlobPayload())
- .build();
- blobStore.putBlob(CONTAINER_NAME, blob);
-
- BlobMetadata metadata = blobStore.blobMetadata(CONTAINER_NAME, BLOB_KEY);
- assertNotNull(metadata, "Metadata null");
-
- assertEquals(metadata.getName(), BLOB_KEY, "Wrong blob name");
- assertEquals(metadata.getType(), StorageType.BLOB, "Wrong blob type");
- assertEquals(metadata.getContentMetadata().getContentType(), "application/unknown", "Wrong blob content-type");
- assertEquals(base16().lowerCase().encode(metadata.getContentMetadata().getContentMD5()), metadata.getETag(),
- "Wrong blob MD5");
- assertEquals(metadata.getLocation(), null, "Wrong blob location");
- assertEquals(metadata.getProviderId(), null, "Wrong blob provider id");
- assertEquals(metadata.getUri(), null, "Wrong blob URI");
- assertNotNull(metadata.getUserMetadata(), "No blob UserMetadata");
- assertEquals(metadata.getUserMetadata().size(), 0, "Wrong blob UserMetadata");
- // metadata.getLastModified()
- File file = new File(TARGET_CONTAINER_NAME, BLOB_KEY);
- assertEquals(metadata.getContentMetadata().getContentLength(), Long.valueOf(file.length()), "Wrong blob size");
- }
-
- public void testDeleteContainer_NotExistingContainer() {
- blobStore.deleteContainer(CONTAINER_NAME);
- }
-
- public void testDeleteContainer_EmptyContanier() {
- boolean result;
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
-
- result = blobStore.containerExists(CONTAINER_NAME);
- assertTrue(result, "Container doesn't exists");
- TestUtils.directoryExists(TARGET_CONTAINER_NAME, true);
-
- // delete container
- blobStore.deleteContainer(CONTAINER_NAME);
- result = blobStore.containerExists(CONTAINER_NAME);
- assertFalse(result, "Container still exists");
- TestUtils.directoryExists(TARGET_CONTAINER_NAME, false);
- }
-
- public void testDeleteContainer() throws IOException {
- boolean result;
- String CONTAINER_NAME2 = "container-to-delete";
- String TARGET_CONTAINER_NAME2 = TestUtils.TARGET_BASE_DIR + CONTAINER_NAME2;
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- blobStore.createContainerInLocation(null, CONTAINER_NAME2);
-
- result = blobStore.containerExists(CONTAINER_NAME);
- assertTrue(result, "Container [" + CONTAINER_NAME + "] doesn't exists");
- TestUtils.directoryExists(TARGET_CONTAINER_NAME, true);
- result = blobStore.containerExists(CONTAINER_NAME2);
- assertTrue(result, "Container [" + CONTAINER_NAME2 + "] doesn't exists");
- TestUtils.directoryExists(TARGET_CONTAINER_NAME2, true);
-
- // create blobs inside container
- TestUtils.createBlobsInContainer(CONTAINER_NAME, TestUtils.createRandomBlobKey("testutils-", null),
- TestUtils.createRandomBlobKey("testutils-", null),
- TestUtils.createRandomBlobKey("ab123s" + File.separator + "testutils-", null));
- TestUtils.createBlobsInContainer(CONTAINER_NAME, TestUtils.createRandomBlobKey("testutils-", null),
- TestUtils.createRandomBlobKey("testutils-", null),
- TestUtils.createRandomBlobKey("asda123s" + File.separator + "testutils-", null),
- TestUtils.createRandomBlobKey("123-_3s" + File.separator + "testutils-", null));
-
- // delete first container
- blobStore.deleteContainer(CONTAINER_NAME);
- result = blobStore.containerExists(CONTAINER_NAME);
- assertFalse(result, "Container [" + CONTAINER_NAME + "] still exists");
- TestUtils.directoryExists(TARGET_CONTAINER_NAME, false);
- result = blobStore.containerExists(CONTAINER_NAME2);
- assertTrue(result, "Container [" + CONTAINER_NAME2 + "] still exists");
- TestUtils.directoryExists(TARGET_CONTAINER_NAME2, true);
- // delete second container
- blobStore.deleteContainer(CONTAINER_NAME2);
- result = blobStore.containerExists(CONTAINER_NAME2);
- assertFalse(result, "Container [" + CONTAINER_NAME2 + "] still exists");
- TestUtils.directoryExists(TARGET_CONTAINER_NAME2, false);
- }
-
- @Test
- public void testInvalidContainerName() {
- String containerName = "file" + File.separator + "system";
- try {
- blobStore.createContainerInLocation(null, containerName);
- fail("Wrong container name not recognized");
- } catch (IllegalArgumentException e) {
- }
- try {
- blobStore.containerExists(containerName);
- fail("Wrong container name not recognized");
- } catch (IllegalArgumentException e) {
- }
- }
-
- public void testRanges() throws IOException {
- blobStore.createContainerInLocation(null, CONTAINER_NAME);
- String input = "abcdefgh";
- Payload payload;
- Blob blob = blobStore.blobBuilder("test").payload(new StringPayload(input)).build();
- blobStore.putBlob(CONTAINER_NAME, blob);
-
- GetOptions getOptionsRangeStartAt = new GetOptions();
- getOptionsRangeStartAt.startAt(1);
- Blob blobRangeStartAt = blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsRangeStartAt);
- payload = blobRangeStartAt.getPayload();
- try {
- assertEquals(input.substring(1), Strings2.toStringAndClose(payload.openStream()));
- } finally {
- Closeables2.closeQuietly(payload);
- }
-
- GetOptions getOptionsRangeTail = new GetOptions();
- getOptionsRangeTail.tail(3);
- Blob blobRangeTail = blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsRangeTail);
- payload = blobRangeTail.getPayload();
- try {
- assertEquals(input.substring(5), Strings2.toStringAndClose(payload.openStream()));
- } finally {
- Closeables2.closeQuietly(payload);
- }
-
- GetOptions getOptionsFragment = new GetOptions();
- getOptionsFragment.range(4, 6);
- Blob blobFragment = blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsFragment);
- payload = blobFragment.getPayload();
- try {
- assertEquals(input.substring(4, 7), Strings2.toStringAndClose(payload.openStream()));
- } finally {
- Closeables2.closeQuietly(payload);
- }
- }
-
- /** Test that BlobRequestSigner creates expected URIs. */
- public void testBlobRequestSigner() throws Exception {
- String containerName = "container";
- String blobName = "blob";
- URI endPoint = new URI("http", "localhost",
- String.format("/transient/%s/%s", containerName, blobName),
- /*fragment=*/ null);
- BlobRequestSigner signer = context.getSigner();
- HttpRequest request;
- HttpRequest expected;
-
- request = signer.signGetBlob(containerName, blobName);
- expected = HttpRequest.builder()
- .method("GET")
- .endpoint(endPoint)
- .headers(request.getHeaders())
- .build();
- assertEquals(expected, request);
-
- request = signer.signRemoveBlob(containerName, blobName);
- expected = HttpRequest.builder()
- .method("DELETE")
- .endpoint(endPoint)
- .headers(request.getHeaders())
- .build();
- assertEquals(expected, request);
-
- Blob blob = blobStore.blobBuilder(blobName).forSigning().build();
- request = signer.signPutBlob(containerName, blob);
- expected = HttpRequest.builder()
- .method("PUT")
- .endpoint(endPoint)
- .headers(request.getHeaders())
- .payload(new PhantomPayload())
- .build();
- assertEquals(expected, request);
- }
-
- // public void testInvalidBlobKey() {
- // try {
- // blobStore.newBlob(File.separator + "testwrongblobkey");
- // fail("Wrong blob key not recognized");
- // } catch (IllegalArgumentException e) {}
- //
- // try {
- // blobStore.newBlob("testwrongblobkey" + File.separator);
- // fail("Wrong blob key not recognized");
- // } catch (IllegalArgumentException e) {}
- // }
-
- // ---------------------------------------------------------- Private Methods
-
- /**
- * Creates a {@link Blob} object filled with data from a file
- *
- * @param keyName
- * @param fileContent
- * @return
- */
- private Blob createBlob(String keyName, File filePayload) {
- return blobStore.blobBuilder(keyName).payload(filePayload).build();
- }
-
- /**
- * Tests if container contains only the expected blobs
- *
- * @param containerName
- * @param expectedBlobKeys
- */
- private void checkForContainerContent(final String containerName, Set<String> expectedBlobKeys) {
- checkForContainerContent(containerName, null, expectedBlobKeys);
- }
-
- private void checkForContainerContent(final String containerName, String inDirectory, Set<String> expectedBlobKeys) {
- ListContainerOptions options = ListContainerOptions.Builder.recursive();
- if (null != inDirectory && !"".equals(inDirectory))
- options.inDirectory(inDirectory);
-
- PageSet<? extends StorageMetadata> blobsRetrieved = blobStore.list(containerName, options);
- for (Iterator<? extends StorageMetadata> it = blobsRetrieved.iterator(); it.hasNext();) {
- // TODO: FluentIterable
- if (it.next().getType() != StorageType.BLOB) {
- it.remove();
- }
- }
-
- // nothing expected
- if (null == expectedBlobKeys || 0 == expectedBlobKeys.size()) {
- assertTrue(blobsRetrieved.isEmpty(), "Wrong blob number retrieved in the container [" + containerName + "]");
- return;
- }
-
- // copies values
- Set<String> expectedBlobKeysCopy = Sets.newHashSet();
- for (String value : expectedBlobKeys) {
- expectedBlobKeysCopy.add(value);
- }
- assertEquals(blobsRetrieved.size(), expectedBlobKeysCopy.size(),
- "Wrong blob number retrieved in the container [" + containerName + "]");
- for (StorageMetadata data : blobsRetrieved) {
- String blobName = data.getName();
- if (!expectedBlobKeysCopy.remove(blobName)) {
- fail("List for container [" + containerName + "] contains unexpected value [" + blobName + "]");
- }
- }
- assertTrue(expectedBlobKeysCopy.isEmpty(), "List operation for container [" + containerName
- + "] doesn't return all values.");
- }
-
- /**
- * Create a blob with putBlob method
- */
- private void putBlobAndCheckIt(String blobKey) {
- Blob blob;
-
- TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + blobKey, false);
-
- // create the blob
- blob = createBlob(blobKey, TestUtils.getImageForBlobPayload());
- String eTag = blobStore.putBlob(CONTAINER_NAME, blob);
- assertNotNull(eTag, "putBlob result null");
- assertNotSame(eTag, "", "putBlob result empty");
-
- // checks if the blob exists
- TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + blobKey, true);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a22a7252/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemBlobStoreTest.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemBlobStoreTest.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemBlobStoreTest.java
new file mode 100644
index 0000000..ad2bc92
--- /dev/null
+++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemBlobStoreTest.java
@@ -0,0 +1,817 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.filesystem;
+
+import static com.google.common.io.BaseEncoding.base16;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNotSame;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+
+import org.jclouds.ContextBuilder;
+import org.jclouds.blobstore.BlobRequestSigner;
+import org.jclouds.blobstore.BlobStore;
+import org.jclouds.blobstore.BlobStoreContext;
+import org.jclouds.blobstore.ContainerNotFoundException;
+import org.jclouds.blobstore.domain.Blob;
+import org.jclouds.blobstore.domain.BlobMetadata;
+import org.jclouds.blobstore.domain.MutableBlobMetadata;
+import org.jclouds.blobstore.domain.PageSet;
+import org.jclouds.blobstore.domain.StorageMetadata;
+import org.jclouds.blobstore.domain.StorageType;
+import org.jclouds.blobstore.options.GetOptions;
+import org.jclouds.blobstore.options.ListContainerOptions;
+import org.jclouds.filesystem.reference.FilesystemConstants;
+import org.jclouds.filesystem.util.Utils;
+import org.jclouds.filesystem.utils.TestUtils;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.io.ByteStreams2;
+import org.jclouds.io.Payload;
+import org.jclouds.io.payloads.PhantomPayload;
+import org.jclouds.io.payloads.StringPayload;
+import org.jclouds.util.Closeables2;
+import org.jclouds.util.Strings2;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Sets;
+import com.google.common.io.ByteSource;
+import com.google.common.io.Files;
+import com.google.inject.CreationException;
+
+@Test(groups = "unit", testName = "FilesystemBlobStoreTest", singleThreaded = true)
+public class FilesystemBlobStoreTest {
+
+ private static final String CONTAINER_NAME = "fun-blobstore-test";
+ private static final String TARGET_CONTAINER_NAME = TestUtils.TARGET_BASE_DIR + CONTAINER_NAME;
+ private static final String LOGGING_CONFIG_KEY = "java.util.logging.config.file";
+ private static final String LOGGING_CONFIG_VALUE = "src/main/resources/logging.properties";
+
+ private static final String PROVIDER = "filesystem";
+
+ static {
+ System.setProperty(LOGGING_CONFIG_KEY, LOGGING_CONFIG_VALUE);
+ }
+
+ private BlobStoreContext context = null;
+ private BlobStore blobStore = null;
+
+ @BeforeMethod
+ protected void setUp() throws Exception {
+ // create context for filesystem container
+ Properties prop = new Properties();
+ prop.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR);
+ context = ContextBuilder.newBuilder(PROVIDER).overrides(prop).build(BlobStoreContext.class);
+ // create a container in the default location
+ blobStore = context.getBlobStore();
+ new File(TestUtils.TARGET_BASE_DIR).mkdir();
+ TestUtils.createResources();
+ }
+
+ @AfterMethod
+ protected void tearDown() throws IOException {
+ context.close();
+ Utils.deleteRecursively(new File(TestUtils.TARGET_BASE_DIR));
+ }
+
+ /**
+ * Checks if context parameters are managed in the correct way
+ */
+ public void testParameters() {
+ // no base directory declared in properties
+ try {
+ Properties props = new Properties();
+ context = ContextBuilder.newBuilder(PROVIDER).overrides(props).build(BlobStoreContext.class);
+ fail("No error if base directory is not specified");
+ } catch (CreationException e) {
+ }
+
+ // no base directory declared in properties
+ try {
+ Properties props = new Properties();
+ props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, null);
+ context = ContextBuilder.newBuilder(PROVIDER).overrides(props).build(BlobStoreContext.class);
+ fail("No error if base directory is null in the option");
+ } catch (NullPointerException e) {
+ }
+ }
+
+ /**
+ * Test of list method of the root context
+ */
+ public void testList_Root() throws IOException {
+ PageSet<? extends StorageMetadata> containersRetrieved;
+ Set<String> containersCreated = Sets.newHashSet();
+
+ // Testing list with no containers
+ containersRetrieved = blobStore.list();
+ assertTrue(containersRetrieved.isEmpty(), "List operation returns a not empty set of container");
+
+ // Testing list with some containers
+ String[] containerNames = {"34343", "aaaa", "bbbbb"};
+ containersCreated = Sets.newHashSet();
+ for (String containerName : containerNames) {
+ blobStore.createContainerInLocation(null, containerName);
+ containersCreated.add(containerName);
+ }
+
+ containersRetrieved = blobStore.list();
+ assertEquals(containersCreated.size(), containersRetrieved.size(), "Different numbers of container");
+
+ for (StorageMetadata data : containersRetrieved) {
+ String containerName = data.getName();
+ if (!containersCreated.remove(containerName)) {
+ fail("Container list contains unexpected value [" + containerName + "]");
+ }
+ }
+ assertTrue(containersCreated.isEmpty(), "List operation doesn't return all values.");
+
+ for (String containerName : containerNames) {
+ // delete all creaded containers
+ blobStore.deleteContainer(containerName);
+ }
+ containersRetrieved = blobStore.list();
+ assertTrue(containersRetrieved.isEmpty(), "List operation returns a not empty set of container");
+ }
+
+ public void testList_NoOptionSingleContainer() throws IOException {
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ // Testing list for an empty container
+ checkForContainerContent(CONTAINER_NAME, null);
+
+ // creates blobs in first container
+ Set<String> blobsExpected = TestUtils.createBlobsInContainer(CONTAINER_NAME, "bbb" + File.separator + "ccc"
+ + File.separator + "ddd" + File.separator + "1234.jpg", "4rrr.jpg", "rrr" + File.separator + "sss"
+ + File.separator + "788.jpg", "xdc" + File.separator + "wert.kpg");
+
+ checkForContainerContent(CONTAINER_NAME, blobsExpected);
+ }
+
+ public void testList_NotExistingContainer() {
+ // Testing list for a not existing container
+ try {
+ blobStore.list(CONTAINER_NAME);
+ fail("Found a not existing container");
+ } catch (ContainerNotFoundException e) {
+ // ok if arriver here
+ }
+ }
+
+ public void testList_NoOptionDoubleContainer() throws IOException {
+ final String CONTAINER_NAME2 = "container2";
+
+ // create first container
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ // checks for empty container
+ checkForContainerContent(CONTAINER_NAME, null);
+
+ // create second container
+ blobStore.createContainerInLocation(null, CONTAINER_NAME2);
+ // checks for empty
+ checkForContainerContent(CONTAINER_NAME2, null);
+
+ // creates blobs in first container
+
+ Set<String> blobNamesCreatedInContainer1 = TestUtils.createBlobsInContainer(CONTAINER_NAME, "bbb"
+ + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg",
+ TestUtils.createRandomBlobKey(), "rrr" + File.separator + "sss" + File.separator + "788.jpg", "xdc"
+ + File.separator + "wert.kpg");
+
+ // creates blobs in second container
+ blobStore.createContainerInLocation(null, CONTAINER_NAME2);
+ Set<String> blobNamesCreatedInContainer2 = TestUtils.createBlobsInContainer(CONTAINER_NAME2, "asd"
+ + File.separator + "bbb" + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg",
+ TestUtils.createRandomBlobKey(), "rrr" + File.separator + "sss" + File.separator + "788.jpg", "xdc"
+ + File.separator + "wert.kpg");
+
+ // test blobs in first container
+ checkForContainerContent(CONTAINER_NAME, blobNamesCreatedInContainer1);
+ // test blobs in second container
+ checkForContainerContent(CONTAINER_NAME2, blobNamesCreatedInContainer2);
+ }
+
+ public void testList_Subdirectory() throws IOException {
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ // Testing list for an empty container
+ checkForContainerContent(CONTAINER_NAME, null);
+
+ // creates blobs in first container
+ Set<String> blobsExpected = TestUtils.createBlobsInContainer(CONTAINER_NAME, "bbb" + File.separator + "ccc"
+ + File.separator + "ddd" + File.separator + "1234.jpg", "4rrr.jpg", "rrr" + File.separator + "sss"
+ + File.separator + "788.jpg", "rrr" + File.separator + "wert.kpg");
+
+ // remove not expected values
+ blobsExpected.remove("bbb" + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg");
+ blobsExpected.remove("4rrr.jpg");
+
+ checkForContainerContent(CONTAINER_NAME, "rrr", blobsExpected);
+ }
+
+ /**
+ * TODO Should throws an exception?
+ */
+ public void testClearContainer_NotExistingContainer() {
+ blobStore.clearContainer(CONTAINER_NAME);
+ }
+
+ public void testClearContainer_NoOptions() throws IOException {
+ final String CONTAINER_NAME2 = "containerToClear";
+
+ // create containers
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ blobStore.createContainerInLocation(null, CONTAINER_NAME2);
+
+ // creates blobs in first container
+ Set<String> blobNamesCreatedInContainer1 = TestUtils.createBlobsInContainer(CONTAINER_NAME, "bbb"
+ + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg",
+ TestUtils.createRandomBlobKey(), "rrr" + File.separator + "sss" + File.separator + "788.jpg", "xdc"
+ + File.separator + "wert.kpg");
+
+ // creates blobs in second container
+ blobStore.createContainerInLocation(null, CONTAINER_NAME2);
+ Set<String> blobNamesCreatedInContainer2 = TestUtils.createBlobsInContainer(CONTAINER_NAME2, "asd"
+ + File.separator + "bbb" + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg",
+ TestUtils.createRandomBlobKey(), "rrr" + File.separator + "sss" + File.separator + "788.jpg", "xdc"
+ + File.separator + "wert.kpg");
+
+ // test blobs in containers
+ checkForContainerContent(CONTAINER_NAME, blobNamesCreatedInContainer1);
+ checkForContainerContent(CONTAINER_NAME2, blobNamesCreatedInContainer2);
+
+ // delete blobs in first container
+ blobStore.clearContainer(CONTAINER_NAME);
+ checkForContainerContent(CONTAINER_NAME, null);
+ checkForContainerContent(CONTAINER_NAME2, blobNamesCreatedInContainer2);
+ // delete blobs in second container
+ blobStore.clearContainer(CONTAINER_NAME2);
+ checkForContainerContent(CONTAINER_NAME2, null);
+ }
+
+ public void testCountBlobs_NotExistingContainer() {
+ blobStore.countBlobs(PROVIDER);
+ }
+
+ public void testCountBlobs_NoOptionsEmptyContainer() {
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ blobStore.countBlobs(PROVIDER);
+ }
+
+ public void testCountBlobs_NoOptions() {
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ blobStore.countBlobs(PROVIDER);
+ }
+
+ public void testRemoveBlob_SimpleBlobKey() throws IOException {
+ final String BLOB_KEY = TestUtils.createRandomBlobKey(null, ".txt");
+ boolean result;
+
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+
+ // checks that blob doesn't exists
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
+ assertFalse(result, "Blob exists");
+
+ // create the blob
+ TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
+ assertTrue(result, "Blob exists");
+
+ // remove it
+ blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
+ assertFalse(result, "Blob still exists");
+ TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY, false);
+ }
+
+ public void testRemoveBlob_TwoSimpleBlobKeys() throws IOException {
+ final String BLOB_KEY1 = TestUtils.createRandomBlobKey(null, null);
+ final String BLOB_KEY2 = TestUtils.createRandomBlobKey(null, null);
+ boolean result;
+
+ // create the container and checks that blob doesn't exists
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
+ assertFalse(result, "Blob1 exists");
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
+ assertFalse(result, "Blob2 exists");
+
+ // create the blob
+ TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY1, BLOB_KEY2);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
+ assertTrue(result, "Blob " + BLOB_KEY1 + " doesn't exist");
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
+ assertTrue(result, "Blob " + BLOB_KEY2 + " doesn't exist");
+
+ // remove first blob
+ blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY1);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
+ assertFalse(result, "Blob1 still exists");
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
+ assertTrue(result, "Blob2 doesn't exist");
+ TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY1, false);
+ TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, true);
+ // remove second blob
+ blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY2);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
+ assertFalse(result, "Blob2 still exists");
+ TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, false);
+ }
+
+ /**
+ * Test of removeBlob method, with only one blob with a complex path as key
+ */
+ @Test
+ public void testRemoveBlob_ComplexBlobKey() throws IOException {
+ final String BLOB_KEY = TestUtils.createRandomBlobKey("aa/bb/cc/dd/", null);
+ boolean result;
+
+ // checks that blob doesn't exists
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
+ assertFalse(result, "Blob exists");
+ TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY, false);
+
+ // create the blob
+ TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
+ assertTrue(result, "Blob doesn't exist");
+
+ // remove it
+ blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
+ assertFalse(result, "Blob still exists");
+ // file removed
+ TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY, false);
+ // also the entire directory structure was removed
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa", false);
+ }
+
+ /**
+ * Test of removeBlob method, with two blobs with a complex path as key and
+ * when first blob is removed, not all of its key's path is removed, because
+ * it is shared with the second blob's key
+ */
+ @Test
+ public void testRemoveBlob_TwoComplexBlobKeys() throws IOException {
+ final String BLOB_KEY1 = TestUtils.createRandomBlobKey("aa/bb/cc/dd/", null);
+ final String BLOB_KEY2 = TestUtils.createRandomBlobKey("aa/bb/ee/ff/", null);
+ boolean result;
+
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+
+ // checks that blob doesn't exist
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
+ assertFalse(result, "Blob1 exists");
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
+ assertFalse(result, "Blob2 exists");
+
+ // create the blobs
+ TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY1, BLOB_KEY2);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
+ assertTrue(result, "Blob " + BLOB_KEY1 + " doesn't exist");
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
+ assertTrue(result, "Blob " + BLOB_KEY2 + " doesn't exist");
+
+ // remove first blob
+ blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY1);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
+ assertFalse(result, "Blob still exists");
+ // first file deleted, not the second
+ TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY1, false);
+ TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, true);
+ // only partial directory structure was removed, because it shares a path
+ // with the second blob created
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa/bb/cc/dd", false);
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa/bb", true);
+ // remove second blob
+ blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY2);
+ result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
+ assertFalse(result, "Blob still exists");
+ TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, false);
+ // now all the directory structure is empty
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa", false);
+ }
+
+ public void testContainerExists() throws IOException {
+ boolean result;
+
+ result = blobStore.containerExists(CONTAINER_NAME);
+ assertFalse(result, "Container exists");
+
+ // create container
+ TestUtils.createContainerAsDirectory(CONTAINER_NAME);
+
+ result = blobStore.containerExists(CONTAINER_NAME);
+ assertTrue(result, "Container doesn't exist");
+ }
+
+ public void testCreateContainerInLocation() throws IOException {
+ final String CONTAINER_NAME2 = "funambol-test-2";
+ final String TARGET_CONTAINER_NAME2 = TestUtils.TARGET_BASE_DIR + CONTAINER_NAME2;
+
+ boolean result;
+
+ result = blobStore.containerExists(CONTAINER_NAME);
+ assertFalse(result, "Container exists");
+ result = blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ assertTrue(result, "Container not created");
+ result = blobStore.containerExists(CONTAINER_NAME);
+ assertTrue(result, "Container doesn't exist");
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME, true);
+
+ result = blobStore.containerExists(CONTAINER_NAME2);
+ assertFalse(result, "Container exists");
+ result = blobStore.createContainerInLocation(null, CONTAINER_NAME2);
+ assertTrue(result, "Container not created");
+ result = blobStore.containerExists(CONTAINER_NAME2);
+ assertTrue(result, "Container doesn't exist");
+ TestUtils.directoryExists(TestUtils.TARGET_BASE_DIR + CONTAINER_NAME2, true);
+ }
+
+ public void testPutBlobSimpleName() {
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ putBlobAndCheckIt(TestUtils.createRandomBlobKey("putBlob-", ".jpg"));
+ putBlobAndCheckIt(TestUtils.createRandomBlobKey("putBlob-", ".jpg"));
+ }
+
+ /**
+ * Test of putBlob method with a complex key, with path in the filename, eg
+ * picture/filename.jpg
+ */
+ public void testPutBlobComplexName1() {
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ putBlobAndCheckIt(TestUtils.createRandomBlobKey("picture/putBlob-", ".jpg"));
+ putBlobAndCheckIt(TestUtils.createRandomBlobKey("video/putBlob-", ".jpg"));
+ putBlobAndCheckIt(TestUtils.createRandomBlobKey("putBlob-", ".jpg"));
+ putBlobAndCheckIt(TestUtils.createRandomBlobKey("video/putBlob-", ".jpg"));
+ }
+
+ /**
+ * Test of putBlob method with a complex key, with path in the filename, eg
+ * picture/filename.jpg
+ */
+ public void testPutBlobComplexName2() {
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ putBlobAndCheckIt(TestUtils.createRandomBlobKey("aa/bb/cc/dd/ee/putBlob-", ".jpg"));
+ putBlobAndCheckIt(TestUtils.createRandomBlobKey("aa/bb/cc/dd/ee/putBlob-", ".jpg"));
+ putBlobAndCheckIt(TestUtils.createRandomBlobKey("putBlob-", ".jpg"));
+ }
+
+ public void testBlobExists() throws IOException {
+ boolean result;
+ String blobKey;
+
+ // when location doesn't exists
+ blobKey = TestUtils.createRandomBlobKey();
+ try {
+ blobStore.blobExists(CONTAINER_NAME, blobKey);
+ fail();
+ } catch (ContainerNotFoundException cnfe) {
+ // expected
+ }
+
+ // when location exists
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ result = blobStore.blobExists(CONTAINER_NAME, blobKey);
+ assertFalse(result, "Blob exists");
+
+ // create blob
+ TestUtils.createBlobAsFile(CONTAINER_NAME, blobKey, TestUtils.getImageForBlobPayload());
+ result = blobStore.blobExists(CONTAINER_NAME, blobKey);
+ assertTrue(result, "Blob doesn't exist");
+
+ // complex path test
+ blobKey = TestUtils.createRandomBlobKey("ss/asdas/", "");
+ result = blobStore.blobExists(CONTAINER_NAME, blobKey);
+ assertFalse(result, "Blob exists");
+ TestUtils.createBlobAsFile(CONTAINER_NAME, blobKey, TestUtils.getImageForBlobPayload());
+ result = blobStore.blobExists(CONTAINER_NAME, blobKey);
+ assertTrue(result, "Blob doesn't exist");
+ }
+
+ public void testGetBlob_NotExistingContainer() {
+ try {
+ blobStore.getBlob(CONTAINER_NAME, TestUtils.createRandomBlobKey(), null);
+ fail("Retrieve must fail, container does not exist.");
+ } catch (ContainerNotFoundException e) {
+ // correct if arrive here
+ }
+ }
+
+ public void testGetBlob() throws IOException {
+ String blobKey = TestUtils.createRandomBlobKey();
+ GetOptions options = null;
+ Blob resultBlob;
+
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+
+ resultBlob = blobStore.getBlob(CONTAINER_NAME, blobKey, options);
+ assertNull(resultBlob, "Blob exists");
+
+ // create blob
+ TestUtils.createBlobsInContainer(CONTAINER_NAME, blobKey);
+
+ resultBlob = blobStore.getBlob(CONTAINER_NAME, blobKey, options);
+
+ assertNotNull(resultBlob, "Blob exists");
+ // checks file content
+ ByteSource expectedFile = Files.asByteSource(new File(TARGET_CONTAINER_NAME, blobKey));
+ assertEquals(expectedFile.read(), ByteStreams2.toByteArrayAndClose(resultBlob.getPayload().openStream()),
+ "Blob payload differs from file content");
+ // metadata are verified in the test for blobMetadata, so no need to
+ // perform a complete test here
+ assertNotNull(resultBlob.getMetadata(), "Metadata null");
+ MutableBlobMetadata metadata = resultBlob.getMetadata();
+ assertEquals(blobKey, metadata.getName(), "Wrong blob metadata");
+ }
+
+ public void testBlobMetadata_withDefaultMetadata() throws IOException {
+ String BLOB_KEY = TestUtils.createRandomBlobKey(null, null);
+ // create the blob
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ Blob blob = blobStore.blobBuilder(BLOB_KEY)
+ .payload(TestUtils.getImageForBlobPayload())
+ .build();
+ blobStore.putBlob(CONTAINER_NAME, blob);
+
+ BlobMetadata metadata = blobStore.blobMetadata(CONTAINER_NAME, BLOB_KEY);
+ assertNotNull(metadata, "Metadata null");
+
+ assertEquals(metadata.getName(), BLOB_KEY, "Wrong blob name");
+ assertEquals(metadata.getType(), StorageType.BLOB, "Wrong blob type");
+ assertEquals(metadata.getContentMetadata().getContentType(), "application/unknown", "Wrong blob content-type");
+ assertEquals(base16().lowerCase().encode(metadata.getContentMetadata().getContentMD5()), metadata.getETag(),
+ "Wrong blob MD5");
+ assertEquals(metadata.getLocation(), null, "Wrong blob location");
+ assertEquals(metadata.getProviderId(), null, "Wrong blob provider id");
+ assertEquals(metadata.getUri(), null, "Wrong blob URI");
+ assertNotNull(metadata.getUserMetadata(), "No blob UserMetadata");
+ assertEquals(metadata.getUserMetadata().size(), 0, "Wrong blob UserMetadata");
+ // metadata.getLastModified()
+ File file = new File(TARGET_CONTAINER_NAME, BLOB_KEY);
+ assertEquals(metadata.getContentMetadata().getContentLength(), Long.valueOf(file.length()), "Wrong blob size");
+ }
+
+ public void testDeleteContainer_NotExistingContainer() {
+ blobStore.deleteContainer(CONTAINER_NAME);
+ }
+
+ public void testDeleteContainer_EmptyContanier() {
+ boolean result;
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+
+ result = blobStore.containerExists(CONTAINER_NAME);
+ assertTrue(result, "Container doesn't exists");
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME, true);
+
+ // delete container
+ blobStore.deleteContainer(CONTAINER_NAME);
+ result = blobStore.containerExists(CONTAINER_NAME);
+ assertFalse(result, "Container still exists");
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME, false);
+ }
+
+ public void testDeleteContainer() throws IOException {
+ boolean result;
+ String CONTAINER_NAME2 = "container-to-delete";
+ String TARGET_CONTAINER_NAME2 = TestUtils.TARGET_BASE_DIR + CONTAINER_NAME2;
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ blobStore.createContainerInLocation(null, CONTAINER_NAME2);
+
+ result = blobStore.containerExists(CONTAINER_NAME);
+ assertTrue(result, "Container [" + CONTAINER_NAME + "] doesn't exists");
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME, true);
+ result = blobStore.containerExists(CONTAINER_NAME2);
+ assertTrue(result, "Container [" + CONTAINER_NAME2 + "] doesn't exists");
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME2, true);
+
+ // create blobs inside container
+ TestUtils.createBlobsInContainer(CONTAINER_NAME, TestUtils.createRandomBlobKey("testutils-", null),
+ TestUtils.createRandomBlobKey("testutils-", null),
+ TestUtils.createRandomBlobKey("ab123s" + File.separator + "testutils-", null));
+ TestUtils.createBlobsInContainer(CONTAINER_NAME, TestUtils.createRandomBlobKey("testutils-", null),
+ TestUtils.createRandomBlobKey("testutils-", null),
+ TestUtils.createRandomBlobKey("asda123s" + File.separator + "testutils-", null),
+ TestUtils.createRandomBlobKey("123-_3s" + File.separator + "testutils-", null));
+
+ // delete first container
+ blobStore.deleteContainer(CONTAINER_NAME);
+ result = blobStore.containerExists(CONTAINER_NAME);
+ assertFalse(result, "Container [" + CONTAINER_NAME + "] still exists");
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME, false);
+ result = blobStore.containerExists(CONTAINER_NAME2);
+ assertTrue(result, "Container [" + CONTAINER_NAME2 + "] still exists");
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME2, true);
+ // delete second container
+ blobStore.deleteContainer(CONTAINER_NAME2);
+ result = blobStore.containerExists(CONTAINER_NAME2);
+ assertFalse(result, "Container [" + CONTAINER_NAME2 + "] still exists");
+ TestUtils.directoryExists(TARGET_CONTAINER_NAME2, false);
+ }
+
+ @Test
+ public void testInvalidContainerName() {
+ String containerName = "file" + File.separator + "system";
+ try {
+ blobStore.createContainerInLocation(null, containerName);
+ fail("Wrong container name not recognized");
+ } catch (IllegalArgumentException e) {
+ }
+ try {
+ blobStore.containerExists(containerName);
+ fail("Wrong container name not recognized");
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ public void testRanges() throws IOException {
+ blobStore.createContainerInLocation(null, CONTAINER_NAME);
+ String input = "abcdefgh";
+ Payload payload;
+ Blob blob = blobStore.blobBuilder("test").payload(new StringPayload(input)).build();
+ blobStore.putBlob(CONTAINER_NAME, blob);
+
+ GetOptions getOptionsRangeStartAt = new GetOptions();
+ getOptionsRangeStartAt.startAt(1);
+ Blob blobRangeStartAt = blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsRangeStartAt);
+ payload = blobRangeStartAt.getPayload();
+ try {
+ assertEquals(input.substring(1), Strings2.toStringAndClose(payload.openStream()));
+ } finally {
+ Closeables2.closeQuietly(payload);
+ }
+
+ GetOptions getOptionsRangeTail = new GetOptions();
+ getOptionsRangeTail.tail(3);
+ Blob blobRangeTail = blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsRangeTail);
+ payload = blobRangeTail.getPayload();
+ try {
+ assertEquals(input.substring(5), Strings2.toStringAndClose(payload.openStream()));
+ } finally {
+ Closeables2.closeQuietly(payload);
+ }
+
+ GetOptions getOptionsFragment = new GetOptions();
+ getOptionsFragment.range(4, 6);
+ Blob blobFragment = blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsFragment);
+ payload = blobFragment.getPayload();
+ try {
+ assertEquals(input.substring(4, 7), Strings2.toStringAndClose(payload.openStream()));
+ } finally {
+ Closeables2.closeQuietly(payload);
+ }
+ }
+
+ /** Test that BlobRequestSigner creates expected URIs. */
+ public void testBlobRequestSigner() throws Exception {
+ String containerName = "container";
+ String blobName = "blob";
+ URI endPoint = new URI("http", "localhost",
+ String.format("/transient/%s/%s", containerName, blobName),
+ /*fragment=*/ null);
+ BlobRequestSigner signer = context.getSigner();
+ HttpRequest request;
+ HttpRequest expected;
+
+ request = signer.signGetBlob(containerName, blobName);
+ expected = HttpRequest.builder()
+ .method("GET")
+ .endpoint(endPoint)
+ .headers(request.getHeaders())
+ .build();
+ assertEquals(expected, request);
+
+ request = signer.signRemoveBlob(containerName, blobName);
+ expected = HttpRequest.builder()
+ .method("DELETE")
+ .endpoint(endPoint)
+ .headers(request.getHeaders())
+ .build();
+ assertEquals(expected, request);
+
+ Blob blob = blobStore.blobBuilder(blobName).forSigning().build();
+ request = signer.signPutBlob(containerName, blob);
+ expected = HttpRequest.builder()
+ .method("PUT")
+ .endpoint(endPoint)
+ .headers(request.getHeaders())
+ .payload(new PhantomPayload())
+ .build();
+ assertEquals(expected, request);
+ }
+
+ // public void testInvalidBlobKey() {
+ // try {
+ // blobStore.newBlob(File.separator + "testwrongblobkey");
+ // fail("Wrong blob key not recognized");
+ // } catch (IllegalArgumentException e) {}
+ //
+ // try {
+ // blobStore.newBlob("testwrongblobkey" + File.separator);
+ // fail("Wrong blob key not recognized");
+ // } catch (IllegalArgumentException e) {}
+ // }
+
+ // ---------------------------------------------------------- Private Methods
+
+ /**
+ * Creates a {@link Blob} object filled with data from a file
+ *
+ * @param keyName
+ * @param fileContent
+ * @return
+ */
+ private Blob createBlob(String keyName, File filePayload) {
+ return blobStore.blobBuilder(keyName).payload(filePayload).build();
+ }
+
+ /**
+ * Tests if container contains only the expected blobs
+ *
+ * @param containerName
+ * @param expectedBlobKeys
+ */
+ private void checkForContainerContent(final String containerName, Set<String> expectedBlobKeys) {
+ checkForContainerContent(containerName, null, expectedBlobKeys);
+ }
+
+ private void checkForContainerContent(final String containerName, String inDirectory, Set<String> expectedBlobKeys) {
+ ListContainerOptions options = ListContainerOptions.Builder.recursive();
+ if (null != inDirectory && !"".equals(inDirectory))
+ options.inDirectory(inDirectory);
+
+ PageSet<? extends StorageMetadata> blobsRetrieved = blobStore.list(containerName, options);
+ for (Iterator<? extends StorageMetadata> it = blobsRetrieved.iterator(); it.hasNext();) {
+ // TODO: FluentIterable
+ if (it.next().getType() != StorageType.BLOB) {
+ it.remove();
+ }
+ }
+
+ // nothing expected
+ if (null == expectedBlobKeys || 0 == expectedBlobKeys.size()) {
+ assertTrue(blobsRetrieved.isEmpty(), "Wrong blob number retrieved in the container [" + containerName + "]");
+ return;
+ }
+
+ // copies values
+ Set<String> expectedBlobKeysCopy = Sets.newHashSet();
+ for (String value : expectedBlobKeys) {
+ expectedBlobKeysCopy.add(value);
+ }
+ assertEquals(blobsRetrieved.size(), expectedBlobKeysCopy.size(),
+ "Wrong blob number retrieved in the container [" + containerName + "]");
+ for (StorageMetadata data : blobsRetrieved) {
+ String blobName = data.getName();
+ if (!expectedBlobKeysCopy.remove(blobName)) {
+ fail("List for container [" + containerName + "] contains unexpected value [" + blobName + "]");
+ }
+ }
+ assertTrue(expectedBlobKeysCopy.isEmpty(), "List operation for container [" + containerName
+ + "] doesn't return all values.");
+ }
+
+ /**
+ * Create a blob with putBlob method
+ */
+ private void putBlobAndCheckIt(String blobKey) {
+ Blob blob;
+
+ TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + blobKey, false);
+
+ // create the blob
+ blob = createBlob(blobKey, TestUtils.getImageForBlobPayload());
+ String eTag = blobStore.putBlob(CONTAINER_NAME, blob);
+ assertNotNull(eTag, "putBlob result null");
+ assertNotSame(eTag, "", "putBlob result empty");
+
+ // checks if the blob exists
+ TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + blobKey, true);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/a22a7252/apis/filesystem/src/test/resources/logging.properties
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/test/resources/logging.properties b/apis/filesystem/src/test/resources/logging.properties
index 2b76983..6f45f70 100644
--- a/apis/filesystem/src/test/resources/logging.properties
+++ b/apis/filesystem/src/test/resources/logging.properties
@@ -25,5 +25,3 @@
handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-org.jclouds.filesystem.FilesystemAsyncBlobStore.level=ALL
-org.jclouds.filesystem.FilesystemAsyncBlobStore.handler=java.util.logging.ConsoleHandler
[07/52] [abbrv] JCLOUDS-40 unasync atmos.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9b71a9dc/apis/atmos/src/test/java/org/jclouds/atmos/internal/StubAtmosAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/internal/StubAtmosAsyncClient.java b/apis/atmos/src/test/java/org/jclouds/atmos/internal/StubAtmosAsyncClient.java
deleted file mode 100644
index 211d0a4..0000000
--- a/apis/atmos/src/test/java/org/jclouds/atmos/internal/StubAtmosAsyncClient.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.atmos.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.concurrent.ExecutionException;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.Constants;
-import org.jclouds.atmos.AtmosAsyncClient;
-import org.jclouds.atmos.blobstore.functions.BlobMetadataToObject;
-import org.jclouds.atmos.blobstore.functions.BlobToObject;
-import org.jclouds.atmos.blobstore.functions.ListOptionsToBlobStoreListOptions;
-import org.jclouds.atmos.blobstore.functions.ObjectToBlob;
-import org.jclouds.atmos.blobstore.functions.ResourceMetadataListToDirectoryEntryList;
-import org.jclouds.atmos.domain.AtmosObject;
-import org.jclouds.atmos.domain.BoundedSet;
-import org.jclouds.atmos.domain.DirectoryEntry;
-import org.jclouds.atmos.domain.SystemMetadata;
-import org.jclouds.atmos.domain.UserMetadata;
-import org.jclouds.atmos.options.ListOptions;
-import org.jclouds.atmos.options.PutOptions;
-import org.jclouds.blobstore.LocalAsyncBlobStore;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.functions.HttpGetOptionsListToGetOptions;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.lifecycle.Closer;
-
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Throwables;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * Implementation of {@link AtmosAsyncClient} which keeps all data in a local Map object.
- */
-public class StubAtmosAsyncClient implements AtmosAsyncClient {
- private final HttpGetOptionsListToGetOptions httpGetOptionsConverter;
- private final LocalAsyncBlobStore blobStore;
- private final AtmosObject.Factory objectProvider;
- private final ObjectToBlob object2Blob;
- private final BlobToObject blob2Object;
- private final BlobMetadataToObject blob2ObjectInfo;
- private final ListOptionsToBlobStoreListOptions container2ContainerListOptions;
- private final ResourceMetadataListToDirectoryEntryList resource2ObjectList;
- private final ListeningExecutorService userExecutor;
- private final Closer closer;
-
- @Inject
- private StubAtmosAsyncClient(LocalAsyncBlobStore blobStore, AtmosObject.Factory objectProvider,
- HttpGetOptionsListToGetOptions httpGetOptionsConverter, ObjectToBlob object2Blob, BlobToObject blob2Object,
- BlobMetadataToObject blob2ObjectInfo, ListOptionsToBlobStoreListOptions container2ContainerListOptions,
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- ResourceMetadataListToDirectoryEntryList resource2ContainerList, Closer closer) {
- this.blobStore = blobStore;
- this.objectProvider = objectProvider;
- this.httpGetOptionsConverter = httpGetOptionsConverter;
- this.object2Blob = checkNotNull(object2Blob, "object2Blob");
- this.blob2Object = checkNotNull(blob2Object, "blob2Object");
- this.blob2ObjectInfo = checkNotNull(blob2ObjectInfo, "blob2ObjectInfo");
- this.container2ContainerListOptions = checkNotNull(container2ContainerListOptions,
- "container2ContainerListOptions");
- this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList");
- this.userExecutor = userExecutor;
- this.closer = checkNotNull(closer, "closer");
- }
-
- @Override
- public ListenableFuture<URI> createDirectory(String directoryName, PutOptions... options) {
- final String container;
- final String path;
- if (directoryName.indexOf('/') != -1) {
- container = directoryName.substring(0, directoryName.indexOf('/'));
- path = directoryName.substring(directoryName.indexOf('/') + 1);
- } else {
- container = directoryName;
- path = null;
- }
- return Futures.transform(blobStore.createContainerInLocation(null, container), new Function<Boolean, URI>() {
-
- public URI apply(Boolean from) {
- if (path != null) {
- Blob blob = blobStore.blobBuilder(path + "/").payload("").contentType("application/directory").build();
- blobStore.putBlob(container, blob);
- }
- return URI.create("http://stub/containers/" + container);
- }
-
- }, userExecutor);
- }
-
- @Override
- public ListenableFuture<URI> createFile(String parent, AtmosObject object, PutOptions... options) {
- final String uri = "http://stub/containers/" + parent + "/" + object.getContentMetadata().getName();
- String file = object.getContentMetadata().getName();
- String container = parent;
- if (parent.indexOf('/') != -1) {
- container = parent.substring(0, parent.indexOf('/'));
- String path = parent.substring(parent.indexOf('/') + 1);
- if (!path.equals(""))
- object.getContentMetadata().setName(path + "/" + file);
- }
- Blob blob = object2Blob.apply(object);
- return Futures.transform(blobStore.putBlob(container, blob), new Function<String, URI>() {
-
- public URI apply(String from) {
- return URI.create(uri);
- }
-
- }, userExecutor);
- }
-
- @Override
- public ListenableFuture<Boolean> deletePath(String path) {
- if (path.indexOf('/') == path.length() - 1) {
- // chop off the trailing slash
- return blobStore.deleteContainerIfEmpty(path.substring(0, path.length() - 1));
- } else {
- String container = path.substring(0, path.indexOf('/'));
- path = path.substring(path.indexOf('/') + 1);
- return Futures.transform(blobStore.removeBlob(container, path), Functions.constant(Boolean.TRUE), userExecutor);
- }
- }
-
- @Override
- public ListenableFuture<SystemMetadata> getSystemMetadata(String path) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ListenableFuture<UserMetadata> getUserMetadata(String path) {
- if (path.indexOf('/') == -1)
- throw new UnsupportedOperationException();
- else {
- String container = path.substring(0, path.indexOf('/'));
- path = path.substring(path.indexOf('/') + 1);
- return Futures.transform(blobStore.blobMetadata(container, path), new Function<BlobMetadata, UserMetadata>() {
- public UserMetadata apply(BlobMetadata from) {
- return blob2ObjectInfo.apply(from).getUserMetadata();
- }
- }, userExecutor);
- }
- }
-
- @Override
- public ListenableFuture<AtmosObject> headFile(String path) {
- String container = path.substring(0, path.indexOf('/'));
- path = path.substring(path.indexOf('/') + 1);
- try {
- return Futures.transform(blobStore.getBlob(container, path), blob2Object, userExecutor);
- } catch (Exception e) {
- return immediateFailedFuture(Throwables.getRootCause(e));
- }
- }
-
- @Override
- public ListenableFuture<BoundedSet<? extends DirectoryEntry>> listDirectories(ListOptions... optionsList) {
- // org.jclouds.blobstore.options.ListOptions options = container2ContainerListOptions
- // .apply(optionsList);
- return Futures.transform(blobStore.list(), resource2ObjectList, userExecutor);
- }
-
- @Override
- public ListenableFuture<BoundedSet<? extends DirectoryEntry>> listDirectory(String directoryName,
- ListOptions... optionsList) {
- org.jclouds.blobstore.options.ListContainerOptions options = container2ContainerListOptions.apply(optionsList);
- String container = directoryName;
- if (directoryName.indexOf('/') != -1) {
- container = directoryName.substring(0, directoryName.indexOf('/'));
- String path = directoryName.substring(directoryName.indexOf('/') + 1);
- if (!path.equals(""))
- options.inDirectory(path);
- }
- return Futures.transform(blobStore.list(container, options), resource2ObjectList, userExecutor);
- }
-
- @Override
- public AtmosObject newObject() {
- return this.objectProvider.create(null);
- }
-
- @Override
- public ListenableFuture<Boolean> pathExists(final String path) {
- if (path.indexOf('/') == path.length() - 1) {
- // chop off the trailing slash
- return blobStore.containerExists(path.substring(0, path.length() - 1));
- } else {
- String container = path.substring(0, path.indexOf('/'));
- String blobName = path.substring(path.indexOf('/') + 1);
- try {
- return immediateFuture(blobStore.blobMetadata(container, blobName).get() != null);
- } catch (InterruptedException e) {
- return immediateFailedFuture(e);
- } catch (ExecutionException e) {
- return immediateFailedFuture(e);
- }
- }
- }
-
- @Override
- public ListenableFuture<AtmosObject> readFile(String path, GetOptions... options) {
- String container = path.substring(0, path.indexOf('/'));
- String blobName = path.substring(path.indexOf('/') + 1);
- org.jclouds.blobstore.options.GetOptions getOptions = httpGetOptionsConverter.apply(options);
- return Futures.transform(blobStore.getBlob(container, blobName, getOptions), blob2Object, userExecutor);
- }
-
- @Override
- public ListenableFuture<Void> updateFile(String parent, AtmosObject object, PutOptions... options) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ListenableFuture<Boolean> isPublic(String path) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void close() throws IOException {
- closer.close();
- }
-}
[45/52] [abbrv] git commit: JCLOUDS-153 remove IO Executor and usage
of it.
Posted by an...@apache.org.
JCLOUDS-153 remove IO Executor and usage of it.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/0a236f59
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/0a236f59
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/0a236f59
Branch: refs/heads/use-agentproxy-008
Commit: 0a236f59ad4aa0207b0603b287b76de1d7c0c19f
Parents: ffc0df1
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 22:53:38 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Mon Oct 6 07:56:31 2014 -0700
----------------------------------------------------------------------
.../v2_0/internal/BaseOpenStackMockTest.java | 2 +-
.../java/org/jclouds/s3/S3ClientMockTest.java | 2 +-
.../sqs/features/PermissionApiLiveTest.java | 2 +-
.../ParallelMultipartUploadStrategy.java | 14 +-
...quentialMultipartUploadStrategyMockTest.java | 4 +-
.../stub/config/StubComputeServiceAdapter.java | 15 +-
.../extensions/StubSecurityGroupExtension.java | 9 -
...ScriptUsingSshAndBlockUntilCompleteTest.java | 4 +-
core/src/main/java/org/jclouds/Constants.java | 3 +
.../main/java/org/jclouds/ContextBuilder.java | 2 +-
.../jclouds/apis/internal/BaseApiMetadata.java | 2 -
.../config/ExecutorServiceModule.java | 45 +++--
.../http/HttpCommandExecutorService.java | 15 +-
.../BaseHttpCommandExecutorService.java | 38 ----
.../JavaUrlHttpCommandExecutorService.java | 6 +-
.../lifecycle/config/LifeCycleModule.java | 6 -
.../config/ExecutorServiceModuleTest.java | 33 ++--
.../events/config/EventBusModuleTest.java | 1 -
...tpCommandExecutorServiceIntegrationTest.java | 3 -
...ackingJavaUrlHttpCommandExecutorService.java | 16 +-
.../lifecycle/config/LifeCycleModuleTest.java | 7 -
.../rest/annotationparsing/ClosableApiTest.java | 2 +-
.../rest/internal/BaseRestApiExpectTest.java | 10 +-
.../jclouds/rest/internal/BaseRestApiTest.java | 2 -
.../internal/RestAnnotationProcessorTest.java | 54 ------
.../ApacheHCHttpCommandExecutorService.java | 13 +-
...CHttpCommandExecutorServiceTestDisabled.java | 2 -
.../config/EnterpriseConfigurationModule.java | 10 ++
.../gae/AsyncGaeHttpCommandExecutorService.java | 175 -------------------
.../gae/GaeHttpCommandExecutorService.java | 6 +-
...AsyncGoogleAppEngineConfigurationModule.java | 57 ------
.../CurrentRequestExecutorServiceModule.java | 7 -
.../GoogleAppEngineConfigurationModule.java | 2 +-
...AsyncGoogleAppEngineConfigurationModule.java | 64 -------
...tpCommandExecutorServiceIntegrationTest.java | 95 ----------
...tpCommandExecutorServiceIntegrationTest.java | 95 ++++++++++
.../okhttp/OkHttpCommandExecutorService.java | 5 +-
.../OkHttpCommandExecutorServiceTest.java | 3 -
.../ParallelMultipartUploadStrategy.java | 14 +-
...quentialMultipartUploadStrategyMockTest.java | 4 +-
.../dynect/v3/config/DynECTHttpApiModule.java | 5 +-
.../jclouds/dynect/v3/DynectApiMockTest.java | 2 +-
.../BaseHPCloudObjectStorageMockTest.java | 2 +-
43 files changed, 189 insertions(+), 669 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/apis/openstack-keystone/src/test/java/org/jclouds/openstack/v2_0/internal/BaseOpenStackMockTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/v2_0/internal/BaseOpenStackMockTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/v2_0/internal/BaseOpenStackMockTest.java
index d6fb2f9..af27d40 100644
--- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/v2_0/internal/BaseOpenStackMockTest.java
+++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/v2_0/internal/BaseOpenStackMockTest.java
@@ -58,7 +58,7 @@ public class BaseOpenStackMockTest<A extends Closeable> {
public static final String accessRackspace = "{\"access\":{\"token\":{\"id\":\"b84f4a37-5126-4603-9521-ccd0665fbde1\",\"expires\":\"2013-04-13T16:49:57.000-05:00\",\"tenant\":{\"id\":\"123123\",\"name\":\"123123\"}},\"serviceCatalog\":[{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudMonitoring\",\"type\":\"rax:monitor\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"},{\"region\":\"ORD\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"}],\"name\":\"cloudFilesCDN\",\"type\":\"rax:object-cdn\"},{\"endpoints\":[{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"},{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudLoadBalancers\",\"type\":\"rax:load-
balancer\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudDatabases\",\"type\":\"rax:database\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"internalURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"},{\"region\":\"ORD\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"internalURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"}],\"name\":\"cloudFiles\",\"type\":\"object-store\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\",\"versionInfo\":\"URL/v1.0\",\"versionList\":\"URL/\",\"versionId\":\"1.0\"}],\"name\":\"cloudServers\",\"type\":\"compute\"},{\"end
points\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v2/123123\",\"versionInfo\":\"URL/v2\",\"versionList\":\"URL/\",\"versionId\":\"2\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v2/123123\",\"versionInfo\":\"URL/v2\",\"versionList\":\"URL/\",\"versionId\":\"2\"}],\"name\":\"cloudServersOpenStack\",\"type\":\"compute\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudDNS\",\"type\":\"rax:dns\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudBackup\",\"type\":\"rax:backup\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\"}],\"name\":\"cloudBlockStorage\",\"type\":\"volume\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\",\"internalURL\":\"URL/v1/123123\"},{\"region\":\"ORD\",\"tenantId\":
\"123123\",\"publicURL\":\"URL/v1/123123\",\"internalURL\":\"URL/v1/123123\"}],\"name\":\"marconi\",\"type\":\"queuing\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\",\"internalURL\":\"URL/v1/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\",\"internalURL\":\"URL/v1/123123\"}],\"name\":\"autoscale\",\"type\":\"rax:autoscale\"}],\"user\":{\"id\":\"1234\",\"roles\":[{\"id\":\"3\",\"description\":\"User Admin Role.\",\"name\":\"identity:user-admin\"}],\"name\":\"jclouds-joe\",\"RAX-AUTH:defaultRegion\":\"DFW\"}}}";
private final Set<Module> modules = ImmutableSet.<Module> of(
- new ExecutorServiceModule(newDirectExecutorService(), newDirectExecutorService()));
+ new ExecutorServiceModule(newDirectExecutorService()));
/**
* Pattern for replacing the URL token with the correct local address.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
----------------------------------------------------------------------
diff --git a/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java b/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
index c9f67dc..097d49d 100644
--- a/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
+++ b/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java
@@ -46,7 +46,7 @@ import com.squareup.okhttp.mockwebserver.RecordedRequest;
public class S3ClientMockTest {
private static final Set<Module> modules = ImmutableSet.<Module> of(new OkHttpCommandExecutorServiceModule(),
- new ExecutorServiceModule(newDirectExecutorService(), newDirectExecutorService()));
+ new ExecutorServiceModule(newDirectExecutorService()));
static S3Client getS3Client(URL server) {
Properties overrides = new Properties();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java
index 2c96ab2..b8a7f31 100644
--- a/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java
+++ b/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java
@@ -91,7 +91,7 @@ public class PermissionApiLiveTest extends BaseSQSApiLiveTest {
private AnonymousAttributesApi getAnonymousAttributesApi(URI queue) {
return ContextBuilder.newBuilder(forApiOnEndpoint(AnonymousAttributesApi.class, queue.toASCIIString()))
- .modules(ImmutableSet.<Module> of(new ExecutorServiceModule(newDirectExecutorService(), newDirectExecutorService())))
+ .modules(ImmutableSet.<Module> of(new ExecutorServiceModule(newDirectExecutorService())))
.buildApi(AnonymousAttributesApi.class);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
index 6257799..446b451 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/strategy/internal/ParallelMultipartUploadStrategy.java
@@ -89,17 +89,17 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
@Named(Constants.PROPERTY_REQUEST_TIMEOUT)
protected Long maxTime;
- private final ListeningExecutorService ioExecutor;
+ private final ListeningExecutorService executor;
protected final SwiftBlobStore blobstore;
protected final PayloadSlicer slicer;
@Inject
public ParallelMultipartUploadStrategy(SwiftBlobStore blobstore, PayloadSlicer slicer,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor) {
+ @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService executor) {
this.blobstore = checkNotNull(blobstore, "blobstore");
this.slicer = checkNotNull(slicer, "slicer");
- this.ioExecutor = checkNotNull(ioExecutor, "ioExecutor");
+ this.executor = checkNotNull(executor, "executor");
}
@@ -125,7 +125,7 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
final Blob blobPart = blobstore.blobBuilder(blobPartName).payload(chunkedPart).
contentDisposition(blobPartName).build();
- final ListenableFuture<String> futureETag = ioExecutor.submit(new Callable<String>() {
+ final ListenableFuture<String> futureETag = executor.submit(new Callable<String>() {
@Override public String call() throws Exception {
return client.putObject(container, blob2Object.apply(blobPart));
}
@@ -155,13 +155,13 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
latch.countDown();
}
}
- }, ioExecutor);
+ }, executor);
futureParts.put(part, futureETag);
}
@Override
public ListenableFuture<String> execute(final String container, final Blob blob, final PutOptions options, final BlobToObject blob2Object) {
- return ioExecutor.submit(new Callable<String>() {
+ return executor.submit(new Callable<String>() {
@Override
public String call() throws Exception {
String key = blob.getMetadata().getName();
@@ -248,7 +248,7 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
throw rtex;
}
} else {
- ListenableFuture<String> futureETag = ioExecutor.submit(new Callable<String>() {
+ ListenableFuture<String> futureETag = executor.submit(new Callable<String>() {
@Override public String call() throws Exception {
return blobstore.putBlob(container, blob, options);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/strategy/internal/SequentialMultipartUploadStrategyMockTest.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/strategy/internal/SequentialMultipartUploadStrategyMockTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/strategy/internal/SequentialMultipartUploadStrategyMockTest.java
index cba3a29..352cf8d 100644
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/strategy/internal/SequentialMultipartUploadStrategyMockTest.java
+++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/strategy/internal/SequentialMultipartUploadStrategyMockTest.java
@@ -97,8 +97,8 @@ public class SequentialMultipartUploadStrategyMockTest {
}
}
- private static final Set<Module> modules = ImmutableSet.<Module> of(new ExecutorServiceModule(newDirectExecutorService(),
- newDirectExecutorService()));
+ private static final Set<Module> modules = ImmutableSet.<Module> of(
+ new ExecutorServiceModule(newDirectExecutorService()));
static SequentialMultipartUploadStrategy mockSequentialMultipartUploadStrategy(String uri, int partSize) {
Properties overrides = new Properties();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/compute/src/main/java/org/jclouds/compute/stub/config/StubComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/compute/src/main/java/org/jclouds/compute/stub/config/StubComputeServiceAdapter.java b/compute/src/main/java/org/jclouds/compute/stub/config/StubComputeServiceAdapter.java
index 0823fd5..03ba0ea 100644
--- a/compute/src/main/java/org/jclouds/compute/stub/config/StubComputeServiceAdapter.java
+++ b/compute/src/main/java/org/jclouds/compute/stub/config/StubComputeServiceAdapter.java
@@ -66,9 +66,8 @@ public class StubComputeServiceAdapter implements JCloudsNativeComputeServiceAda
private final Supplier<Location> location;
private final ConcurrentMap<String, NodeMetadata> nodes;
private final Multimap<String, SecurityGroup> groupsForNodes;
- private final ListeningExecutorService ioExecutor;
+ private final ListeningExecutorService executor;
private final Provider<Integer> idProvider;
- private final Provider<Integer> groupIdProvider;
private final String publicIpPrefix;
private final String privateIpPrefix;
private final String passwordPrefix;
@@ -78,14 +77,13 @@ public class StubComputeServiceAdapter implements JCloudsNativeComputeServiceAda
@Inject
public StubComputeServiceAdapter(ConcurrentMap<String, NodeMetadata> nodes,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor, Supplier<Location> location,
+ @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService executor, Supplier<Location> location,
@Named("NODE_ID") Provider<Integer> idProvider, @Named("PUBLIC_IP_PREFIX") String publicIpPrefix,
@Named("PRIVATE_IP_PREFIX") String privateIpPrefix, @Named("PASSWORD_PREFIX") String passwordPrefix,
JustProvider locationSupplier, Map<OsFamily, Map<String, String>> osToVersionMap,
- Multimap<String, SecurityGroup> groupsForNodes, @Named("GROUP_ID") Provider<Integer> groupIdProvider,
- Optional<SecurityGroupExtension> securityGroupExtension) {
+ Multimap<String, SecurityGroup> groupsForNodes, Optional<SecurityGroupExtension> securityGroupExtension) {
this.nodes = nodes;
- this.ioExecutor = ioExecutor;
+ this.executor = executor;
this.location = location;
this.idProvider = idProvider;
this.publicIpPrefix = publicIpPrefix;
@@ -94,7 +92,6 @@ public class StubComputeServiceAdapter implements JCloudsNativeComputeServiceAda
this.locationSupplier = locationSupplier;
this.osToVersionMap = osToVersionMap;
this.groupsForNodes = groupsForNodes;
- this.groupIdProvider = groupIdProvider;
this.securityGroupExtension = securityGroupExtension;
}
@@ -106,7 +103,7 @@ public class StubComputeServiceAdapter implements JCloudsNativeComputeServiceAda
if (millis == 0l)
setStateOnNode(status, node);
else
- ioExecutor.execute(new Runnable() {
+ executor.execute(new Runnable() {
@Override
public void run() {
@@ -220,7 +217,7 @@ public class StubComputeServiceAdapter implements JCloudsNativeComputeServiceAda
setStateOnNodeAfterDelay(Status.TERMINATED, node, 50);
groupsForNodes.removeAll(id);
- ioExecutor.execute(new Runnable() {
+ executor.execute(new Runnable() {
@Override
public void run() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/compute/src/main/java/org/jclouds/compute/stub/extensions/StubSecurityGroupExtension.java
----------------------------------------------------------------------
diff --git a/compute/src/main/java/org/jclouds/compute/stub/extensions/StubSecurityGroupExtension.java b/compute/src/main/java/org/jclouds/compute/stub/extensions/StubSecurityGroupExtension.java
index 9f65647..4a57d73 100644
--- a/compute/src/main/java/org/jclouds/compute/stub/extensions/StubSecurityGroupExtension.java
+++ b/compute/src/main/java/org/jclouds/compute/stub/extensions/StubSecurityGroupExtension.java
@@ -28,12 +28,10 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
-import org.jclouds.Constants;
import org.jclouds.compute.domain.SecurityGroup;
import org.jclouds.compute.domain.SecurityGroupBuilder;
import org.jclouds.compute.extensions.SecurityGroupExtension;
import org.jclouds.domain.Location;
-import org.jclouds.location.suppliers.all.JustProvider;
import org.jclouds.net.domain.IpPermission;
import org.jclouds.net.domain.IpProtocol;
@@ -42,7 +40,6 @@ import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.ListeningExecutorService;
/**
* An extension to compute service to allow for the manipulation of {@link SecurityGroup}s. Implementation
@@ -52,23 +49,17 @@ public class StubSecurityGroupExtension implements SecurityGroupExtension {
private final Supplier<Location> location;
private final Provider<Integer> groupIdProvider;
- private final Supplier<Set<? extends Location>> locationSupplier;
- private final ListeningExecutorService ioExecutor;
private final ConcurrentMap<String, SecurityGroup> groups;
private final Multimap<String, SecurityGroup> groupsForNodes;
@Inject
public StubSecurityGroupExtension(ConcurrentMap<String, SecurityGroup> groups,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor,
Supplier<Location> location,
@Named("GROUP_ID") Provider<Integer> groupIdProvider,
- JustProvider locationSupplier,
Multimap<String, SecurityGroup> groupsForNodes) {
this.groups = groups;
- this.ioExecutor = ioExecutor;
this.location = location;
this.groupIdProvider = groupIdProvider;
- this.locationSupplier = locationSupplier;
this.groupsForNodes = groupsForNodes;
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/compute/src/test/java/org/jclouds/compute/callables/RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilCompleteTest.java
----------------------------------------------------------------------
diff --git a/compute/src/test/java/org/jclouds/compute/callables/RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilCompleteTest.java b/compute/src/test/java/org/jclouds/compute/callables/RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilCompleteTest.java
index afc88e0..bd3a299 100644
--- a/compute/src/test/java/org/jclouds/compute/callables/RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilCompleteTest.java
+++ b/compute/src/test/java/org/jclouds/compute/callables/RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilCompleteTest.java
@@ -22,7 +22,6 @@ import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
-import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_SCRIPT_COMPLETE;
import static org.jclouds.scriptbuilder.domain.Statements.exec;
@@ -52,11 +51,10 @@ import com.google.inject.assistedinject.FactoryModuleBuilder;
@Test(groups = "unit", singleThreaded = true, testName = "RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilCompleteTest")
public class RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilCompleteTest {
- Injector injector = Guice.createInjector(new ExecutorServiceModule(newDirectExecutorService(), newDirectExecutorService()),
+ Injector injector = Guice.createInjector(new ExecutorServiceModule(newDirectExecutorService()),
new AbstractModule() {
protected void configure() {
bindConstant().annotatedWith(named(PROPERTY_USER_THREADS)).to(1);
- bindConstant().annotatedWith(named(PROPERTY_IO_WORKER_THREADS)).to(1);
bindConstant().annotatedWith(named(TIMEOUT_SCRIPT_COMPLETE)).to(100);
install(new FactoryModuleBuilder().build(BlockUntilInitScriptStatusIsZeroThenReturnOutput.Factory.class));
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/main/java/org/jclouds/Constants.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/Constants.java b/core/src/main/java/org/jclouds/Constants.java
index f49227f..a1e77a1 100644
--- a/core/src/main/java/org/jclouds/Constants.java
+++ b/core/src/main/java/org/jclouds/Constants.java
@@ -34,7 +34,10 @@ public final class Constants {
* Integer property. default (20)
* <p/>
* Amount of threads servicing the I/O of http connections.
+ *
+ * @deprecated No longer used. Will be removed in jclouds v2
*/
+ @Deprecated
public static final String PROPERTY_IO_WORKER_THREADS = "jclouds.io-worker-threads";
/**
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/main/java/org/jclouds/ContextBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/ContextBuilder.java b/core/src/main/java/org/jclouds/ContextBuilder.java
index 020d728..ef52f20 100644
--- a/core/src/main/java/org/jclouds/ContextBuilder.java
+++ b/core/src/main/java/org/jclouds/ContextBuilder.java
@@ -540,7 +540,7 @@ public class ContextBuilder {
return input.getClass().isAnnotationPresent(SingleThreaded.class);
}
})) {
- modules.add(new ExecutorServiceModule(newDirectExecutorService(), newDirectExecutorService()));
+ modules.add(new ExecutorServiceModule(newDirectExecutorService()));
} else {
modules.add(new ExecutorServiceModule());
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/main/java/org/jclouds/apis/internal/BaseApiMetadata.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/apis/internal/BaseApiMetadata.java b/core/src/main/java/org/jclouds/apis/internal/BaseApiMetadata.java
index 5fd88e3..410d27b 100644
--- a/core/src/main/java/org/jclouds/apis/internal/BaseApiMetadata.java
+++ b/core/src/main/java/org/jclouds/apis/internal/BaseApiMetadata.java
@@ -19,7 +19,6 @@ package org.jclouds.apis.internal;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.Constants.PROPERTY_CONNECTION_TIMEOUT;
-import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_CONTEXT;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST;
@@ -67,7 +66,6 @@ public abstract class BaseApiMetadata implements ApiMetadata {
props.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 0 + "");
props.setProperty(PROPERTY_SO_TIMEOUT, 60000 + "");
props.setProperty(PROPERTY_CONNECTION_TIMEOUT, 60000 + "");
- props.setProperty(PROPERTY_IO_WORKER_THREADS, 20 + "");
// Successfully tested 50 user threads with BlobStore.clearContainer.
props.setProperty(PROPERTY_USER_THREADS, numUserThreads + "");
props.setProperty(PROPERTY_SCHEDULER_THREADS, 10 + "");
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/main/java/org/jclouds/concurrent/config/ExecutorServiceModule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/concurrent/config/ExecutorServiceModule.java b/core/src/main/java/org/jclouds/concurrent/config/ExecutorServiceModule.java
index dd7dd08..9e0e81d 100644
--- a/core/src/main/java/org/jclouds/concurrent/config/ExecutorServiceModule.java
+++ b/core/src/main/java/org/jclouds/concurrent/config/ExecutorServiceModule.java
@@ -17,7 +17,6 @@
package org.jclouds.concurrent.config;
import static com.google.common.util.concurrent.MoreExecutors.listeningDecorator;
-import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import static org.jclouds.concurrent.DynamicExecutors.newScalingThreadPool;
@@ -74,22 +73,37 @@ public class ExecutorServiceModule extends AbstractModule {
}
final ListeningExecutorService userExecutorFromConstructor;
- final ListeningExecutorService ioExecutorFromConstructor;
public ExecutorServiceModule() {
this.userExecutorFromConstructor = null;
- this.ioExecutorFromConstructor = null;
}
+ /**
+ * @deprecated {@code ioExecutor} is no longer used. This constructor will be removed in jclouds v2.
+ * Use {@link #ExecutorServiceModule(ExecutorService)} instead.
+ */
+ @Deprecated
public ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ExecutorService userExecutor,
- @Named(PROPERTY_IO_WORKER_THREADS) ExecutorService ioExecutor) {
- this(listeningDecorator(userExecutor), listeningDecorator(ioExecutor));
+ ExecutorService ioExecutor) {
+ this(userExecutor);
}
+ /**
+ * @deprecated {@code ioExecutor} is no longer used. This constructor will be removed in jclouds v2.
+ * Use {@link #ExecutorServiceModule(ListeningExecutorService)} instead.
+ */
+ @Deprecated
public ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- @Named(PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor) {
+ ListeningExecutorService ioExecutor) {
+ this(userExecutor);
+ }
+
+ public ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ExecutorService userExecutor) {
+ this(listeningDecorator(userExecutor));
+ }
+
+ public ExecutorServiceModule(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
this.userExecutorFromConstructor = WithSubmissionTrace.wrap(userExecutor);
- this.ioExecutorFromConstructor = WithSubmissionTrace.wrap(ioExecutor);
}
@Override
@@ -113,28 +127,11 @@ public class ExecutorServiceModule extends AbstractModule {
@Provides
@Singleton
- @Named(PROPERTY_IO_WORKER_THREADS)
- ListeningExecutorService provideListeningIOExecutorService(@Named(PROPERTY_IO_WORKER_THREADS) int count,
- Closer closer) { // NO_UCD
- if (ioExecutorFromConstructor != null)
- return ioExecutorFromConstructor;
- return shutdownOnClose(WithSubmissionTrace.wrap(newThreadPoolNamed("i/o thread %d", count)), closer);
- }
-
- @Provides
- @Singleton
@Named(PROPERTY_USER_THREADS)
ExecutorService provideUserExecutorService(@Named(PROPERTY_USER_THREADS) ListeningExecutorService in) { // NO_UCD
return in;
}
- @Provides
- @Singleton
- @Named(PROPERTY_IO_WORKER_THREADS)
- ExecutorService provideIOExecutorService(@Named(PROPERTY_IO_WORKER_THREADS) ListeningExecutorService in) { // NO_UCD
- return in;
- }
-
static <T extends ListeningExecutorService> T shutdownOnClose(final T service, Closer closer) {
closer.addToClose(new ShutdownExecutorOnClose(service));
return service;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/main/java/org/jclouds/http/HttpCommandExecutorService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/http/HttpCommandExecutorService.java b/core/src/main/java/org/jclouds/http/HttpCommandExecutorService.java
index eed2910..74254f3 100644
--- a/core/src/main/java/org/jclouds/http/HttpCommandExecutorService.java
+++ b/core/src/main/java/org/jclouds/http/HttpCommandExecutorService.java
@@ -16,27 +16,14 @@
*/
package org.jclouds.http;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
/**
* Capable of invoking http commands.
*/
-public interface HttpCommandExecutorService {
+public interface HttpCommandExecutorService {
/**
- * Returns a potentially deferred {@code HttpResponse} from a server responding to the
- * {@code command}. The output {@code ListenableFuture} need not be
- * {@linkplain Future#isDone done}, making {@code HttpCommandExecutorService}
- * suitable for asynchronous derivations.
- *
- */
- ListenableFuture<HttpResponse> submit(HttpCommand command);
-
- /**
* Returns a {@code HttpResponse} from the server which responded to the
* {@code command}.
*/
HttpResponse invoke(HttpCommand command);
-
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/main/java/org/jclouds/http/internal/BaseHttpCommandExecutorService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/http/internal/BaseHttpCommandExecutorService.java b/core/src/main/java/org/jclouds/http/internal/BaseHttpCommandExecutorService.java
index 270a217..6921aa5 100644
--- a/core/src/main/java/org/jclouds/http/internal/BaseHttpCommandExecutorService.java
+++ b/core/src/main/java/org/jclouds/http/internal/BaseHttpCommandExecutorService.java
@@ -23,7 +23,6 @@ import static org.jclouds.http.HttpUtils.wirePayloadIfEnabled;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
import java.io.IOException;
-import java.util.concurrent.Callable;
import javax.annotation.Resource;
import javax.inject.Inject;
@@ -43,9 +42,6 @@ import org.jclouds.http.handlers.DelegatingRetryHandler;
import org.jclouds.io.ContentMetadataCodec;
import org.jclouds.logging.Logger;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandExecutorService {
protected final HttpUtils utils;
protected final ContentMetadataCodec contentMetadataCodec;
@@ -53,7 +49,6 @@ public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandEx
protected final DelegatingRetryHandler retryHandler;
protected final IOExceptionRetryHandler ioRetryHandler;
protected final DelegatingErrorHandler errorHandler;
- protected final ListeningExecutorService ioExecutor;
@Resource
protected Logger logger = Logger.NULL;
@@ -65,7 +60,6 @@ public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandEx
@Inject
protected BaseHttpCommandExecutorService(HttpUtils utils, ContentMetadataCodec contentMetadataCodec,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor,
DelegatingRetryHandler retryHandler, IOExceptionRetryHandler ioRetryHandler,
DelegatingErrorHandler errorHandler, HttpWire wire) {
this.utils = checkNotNull(utils, "utils");
@@ -73,7 +67,6 @@ public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandEx
this.retryHandler = checkNotNull(retryHandler, "retryHandler");
this.ioRetryHandler = checkNotNull(ioRetryHandler, "ioRetryHandler");
this.errorHandler = checkNotNull(errorHandler, "errorHandler");
- this.ioExecutor = checkNotNull(ioExecutor, "ioExecutor");
this.wire = checkNotNull(wire, "wire");
}
@@ -137,37 +130,6 @@ public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandEx
return shouldContinue;
}
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- HttpRequest request = command.getCurrentRequest();
- checkRequestHasContentLengthOrChunkedEncoding(request,
- "if the request has a payload, it must be set to chunked encoding or specify a content length: " + request);
- return ioExecutor.submit(new HttpResponseCallable(command));
- }
-
- public class HttpResponseCallable implements Callable<HttpResponse> {
- private final HttpCommand command;
-
- public HttpResponseCallable(HttpCommand command) {
- this.command = command;
- }
-
- public HttpResponse call() throws Exception {
- try {
- return invoke(command);
- } finally {
- if (command.getException() != null)
- throw command.getException();
- }
- }
-
- @Override
- public String toString() {
- return command.toString();
- }
-
- }
-
protected abstract Q convert(HttpRequest request) throws IOException, InterruptedException;
protected abstract HttpResponse invoke(Q nativeRequest) throws IOException, InterruptedException;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java b/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java
index 3647ef2..47a8575 100644
--- a/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java
+++ b/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
package org.jclouds.http.internal;
+
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.io.ByteStreams.toByteArray;
@@ -43,7 +44,6 @@ import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
-import org.jclouds.Constants;
import org.jclouds.JcloudsVersion;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
@@ -62,7 +62,6 @@ import com.google.common.collect.ImmutableMultimap.Builder;
import com.google.common.io.ByteStreams;
import com.google.common.io.Closeables;
import com.google.common.io.CountingOutputStream;
-import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.Inject;
/**
@@ -82,12 +81,11 @@ public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorSe
@Inject
public JavaUrlHttpCommandExecutorService(HttpUtils utils, ContentMetadataCodec contentMetadataCodec,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor,
DelegatingRetryHandler retryHandler, IOExceptionRetryHandler ioRetryHandler,
DelegatingErrorHandler errorHandler, HttpWire wire, @Named("untrusted") HostnameVerifier verifier,
@Named("untrusted") Supplier<SSLContext> untrustedSSLContextProvider, Function<URI, Proxy> proxyForURI)
throws SecurityException, NoSuchFieldException {
- super(utils, contentMetadataCodec, ioExecutor, retryHandler, ioRetryHandler, errorHandler, wire);
+ super(utils, contentMetadataCodec, retryHandler, ioRetryHandler, errorHandler, wire);
if (utils.getMaxConnections() > 0)
System.setProperty("http.maxConnections", String.valueOf(checkNotNull(utils, "utils").getMaxConnections()));
this.untrustedSSLContextProvider = checkNotNull(untrustedSSLContextProvider, "untrustedSSLContextProvider");
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java b/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java
index ef4cabc..e978c24 100644
--- a/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java
+++ b/core/src/main/java/org/jclouds/lifecycle/config/LifeCycleModule.java
@@ -20,7 +20,6 @@ import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static com.google.inject.matcher.Matchers.any;
-import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_SCHEDULER_THREADS;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import static org.jclouds.reflect.Reflection2.methods;
@@ -70,9 +69,6 @@ public class LifeCycleModule extends AbstractModule {
@Inject
@Named(PROPERTY_USER_THREADS)
ListeningExecutorService userExecutor;
- @Inject
- @Named(PROPERTY_IO_WORKER_THREADS)
- ListeningExecutorService ioExecutor;
// ScheduledExecutor is defined in an optional module
@Inject(optional = true)
@Named(PROPERTY_SCHEDULER_THREADS)
@@ -81,8 +77,6 @@ public class LifeCycleModule extends AbstractModule {
public void close() throws IOException {
assert userExecutor != null;
userExecutor.shutdownNow();
- assert ioExecutor != null;
- ioExecutor.shutdownNow();
// ScheduledExecutor is defined in an optional module
if (scheduledExecutor != null)
scheduledExecutor.shutdownNow();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/test/java/org/jclouds/concurrent/config/ExecutorServiceModuleTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/concurrent/config/ExecutorServiceModuleTest.java b/core/src/test/java/org/jclouds/concurrent/config/ExecutorServiceModuleTest.java
index a935999..ead684d 100644
--- a/core/src/test/java/org/jclouds/concurrent/config/ExecutorServiceModuleTest.java
+++ b/core/src/test/java/org/jclouds/concurrent/config/ExecutorServiceModuleTest.java
@@ -23,7 +23,6 @@ import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
-import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotEquals;
@@ -55,7 +54,6 @@ public class ExecutorServiceModuleTest {
ExecutorServiceModule module = new ExecutorServiceModule() {
@Override
protected void configure() {
- bindConstant().annotatedWith(named(PROPERTY_IO_WORKER_THREADS)).to(1);
bindConstant().annotatedWith(named(PROPERTY_USER_THREADS)).to(1);
super.configure();
}
@@ -63,18 +61,14 @@ public class ExecutorServiceModuleTest {
injector = Guice.createInjector(module);
assertNull(module.userExecutorFromConstructor);
- assertNull(module.ioExecutorFromConstructor);
}
@AfterClass
private void close() throws IOException {
ListeningExecutorService user = injector.getInstance(Key.get(ListeningExecutorService.class,
named(PROPERTY_USER_THREADS)));
- ListeningExecutorService io = injector.getInstance(Key.get(ListeningExecutorService.class,
- named(PROPERTY_IO_WORKER_THREADS)));
injector.getInstance(Closer.class).close();
assertTrue(user.isShutdown());
- assertTrue(io.isShutdown());
}
@Test
@@ -95,23 +89,18 @@ public class ExecutorServiceModuleTest {
@Test(timeOut = 5000)
public void testExceptionInSubmitRunnableIncludesSubmissionTrace() throws Exception {
- ListeningExecutorService user = injector.getInstance(Key.get(ListeningExecutorService.class,
+ ListeningExecutorService exec = injector.getInstance(Key.get(ListeningExecutorService.class,
named(PROPERTY_USER_THREADS)));
- ListeningExecutorService io = injector.getInstance(Key.get(ListeningExecutorService.class,
- named(PROPERTY_IO_WORKER_THREADS)));
-
- for (ListeningExecutorService exec : ImmutableList.of(user, io)) {
- String submission = null;
- try {
- // this is sensitive to formatting as we are looking for the stack traces to match. if you wrap the below
- // line again, you'll need to change incrementInitialElement to 3 line numbers instead of 2.
- submission = getStackTraceAsString(incrementInitialElement(new RuntimeException(), 2)).replaceFirst(format(".*%s", LINE_SEPARATOR),
- "");
- exec.submit(runnableThrowsRTE()).get();
- } catch (ExecutionException e) {
- assertTraceHasSubmission(getStackTraceAsString(e), submission);
- assertTraceHasSubmission(getStackTraceAsString(e.getCause()), submission);
- }
+ String submission = null;
+ try {
+ // this is sensitive to formatting as we are looking for the stack traces to match. if you wrap the below
+ // line again, you'll need to change incrementInitialElement to 3 line numbers instead of 2.
+ submission = getStackTraceAsString(incrementInitialElement(new RuntimeException(), 2)).replaceFirst(format(".*%s", LINE_SEPARATOR),
+ "");
+ exec.submit(runnableThrowsRTE()).get();
+ } catch (ExecutionException e) {
+ assertTraceHasSubmission(getStackTraceAsString(e), submission);
+ assertTraceHasSubmission(getStackTraceAsString(e.getCause()), submission);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/test/java/org/jclouds/events/config/EventBusModuleTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/events/config/EventBusModuleTest.java b/core/src/test/java/org/jclouds/events/config/EventBusModuleTest.java
index 3a0af75..8259d96 100644
--- a/core/src/test/java/org/jclouds/events/config/EventBusModuleTest.java
+++ b/core/src/test/java/org/jclouds/events/config/EventBusModuleTest.java
@@ -45,7 +45,6 @@ public class EventBusModuleTest {
ExecutorServiceModule userExecutorModule = new ExecutorServiceModule() {
@Override
protected void configure() {
- bindConstant().annotatedWith(Names.named(Constants.PROPERTY_IO_WORKER_THREADS)).to(1);
bindConstant().annotatedWith(Names.named(Constants.PROPERTY_USER_THREADS)).to(1);
super.configure();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/test/java/org/jclouds/http/JavaUrlHttpCommandExecutorServiceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/http/JavaUrlHttpCommandExecutorServiceIntegrationTest.java b/core/src/test/java/org/jclouds/http/JavaUrlHttpCommandExecutorServiceIntegrationTest.java
index 53184c1..d1d4c60 100644
--- a/core/src/test/java/org/jclouds/http/JavaUrlHttpCommandExecutorServiceIntegrationTest.java
+++ b/core/src/test/java/org/jclouds/http/JavaUrlHttpCommandExecutorServiceIntegrationTest.java
@@ -16,7 +16,6 @@
*/
package org.jclouds.http;
-import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_CONTEXT;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
@@ -41,8 +40,6 @@ public class JavaUrlHttpCommandExecutorServiceIntegrationTest extends BaseHttpCo
protected void addOverrideProperties(Properties props) {
props.setProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT, 50 + "");
props.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 0 + "");
- // IO workers not used in this executor
- props.setProperty(PROPERTY_IO_WORKER_THREADS, 0 + "");
props.setProperty(PROPERTY_USER_THREADS, 5 + "");
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/test/java/org/jclouds/http/internal/TrackingJavaUrlHttpCommandExecutorService.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/http/internal/TrackingJavaUrlHttpCommandExecutorService.java b/core/src/test/java/org/jclouds/http/internal/TrackingJavaUrlHttpCommandExecutorService.java
index fbf0f24..bb808a2 100644
--- a/core/src/test/java/org/jclouds/http/internal/TrackingJavaUrlHttpCommandExecutorService.java
+++ b/core/src/test/java/org/jclouds/http/internal/TrackingJavaUrlHttpCommandExecutorService.java
@@ -27,9 +27,7 @@ import javax.inject.Singleton;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
-import org.jclouds.Constants;
import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpResponse;
import org.jclouds.http.HttpUtils;
import org.jclouds.http.IOExceptionRetryHandler;
import org.jclouds.http.handlers.DelegatingErrorHandler;
@@ -41,8 +39,6 @@ import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
import com.google.common.reflect.Invokable;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.TypeLiteral;
@@ -87,20 +83,12 @@ public class TrackingJavaUrlHttpCommandExecutorService extends JavaUrlHttpComman
@Inject
public TrackingJavaUrlHttpCommandExecutorService(HttpUtils utils, ContentMetadataCodec contentMetadataCodec,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor,
DelegatingRetryHandler retryHandler, IOExceptionRetryHandler ioRetryHandler,
DelegatingErrorHandler errorHandler, HttpWire wire, @Named("untrusted") HostnameVerifier verifier,
@Named("untrusted") Supplier<SSLContext> untrustedSSLContextProvider, Function<URI, Proxy> proxyForURI,
List<HttpCommand> commandsInvoked) throws SecurityException, NoSuchFieldException {
- super(utils, contentMetadataCodec, ioExecutor, retryHandler, ioRetryHandler, errorHandler, wire, verifier,
- untrustedSSLContextProvider, proxyForURI);
+ super(utils, contentMetadataCodec, retryHandler, ioRetryHandler, errorHandler, wire, verifier,
+ untrustedSSLContextProvider, proxyForURI);
this.commandsInvoked = commandsInvoked;
}
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- commandsInvoked.add(command);
- return super.submit(command);
- }
-
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/test/java/org/jclouds/lifecycle/config/LifeCycleModuleTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/lifecycle/config/LifeCycleModuleTest.java b/core/src/test/java/org/jclouds/lifecycle/config/LifeCycleModuleTest.java
index 1ae52ab..6feb182 100644
--- a/core/src/test/java/org/jclouds/lifecycle/config/LifeCycleModuleTest.java
+++ b/core/src/test/java/org/jclouds/lifecycle/config/LifeCycleModuleTest.java
@@ -17,7 +17,6 @@
package org.jclouds.lifecycle.config;
import static com.google.inject.name.Names.named;
-import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import java.io.Closeable;
@@ -48,13 +47,11 @@ public class LifeCycleModuleTest {
void testBindsExecutor() {
Injector i = createInjector();
assert i.getInstance(Key.get(ListeningExecutorService.class, named(PROPERTY_USER_THREADS))) != null;
- assert i.getInstance(Key.get(ListeningExecutorService.class, named(PROPERTY_IO_WORKER_THREADS))) != null;
}
private Injector createInjector() {
Injector i = Guice.createInjector(new AbstractModule() {
protected void configure() {
- bindConstant().annotatedWith(named(PROPERTY_IO_WORKER_THREADS)).to(1);
bindConstant().annotatedWith(named(PROPERTY_USER_THREADS)).to(1);
}
}, new LifeCycleModule(), new ExecutorServiceModule());
@@ -90,14 +87,10 @@ public class LifeCycleModuleTest {
ListeningExecutorService userExecutor = i.getInstance(Key.get(ListeningExecutorService.class,
named(PROPERTY_USER_THREADS)));
assert !userExecutor.isShutdown();
- ListeningExecutorService ioExecutor = i.getInstance(Key.get(ListeningExecutorService.class,
- named(PROPERTY_IO_WORKER_THREADS)));
- assert !ioExecutor.isShutdown();
Closer closer = i.getInstance(Closer.class);
assert closer.getState() == Closer.State.AVAILABLE;
closer.close();
assert userExecutor.isShutdown();
- assert ioExecutor.isShutdown();
assert closer.getState() == Closer.State.DONE;
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/test/java/org/jclouds/rest/annotationparsing/ClosableApiTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/annotationparsing/ClosableApiTest.java b/core/src/test/java/org/jclouds/rest/annotationparsing/ClosableApiTest.java
index ea6b5cd..b124309 100644
--- a/core/src/test/java/org/jclouds/rest/annotationparsing/ClosableApiTest.java
+++ b/core/src/test/java/org/jclouds/rest/annotationparsing/ClosableApiTest.java
@@ -56,7 +56,7 @@ public class ClosableApiTest {
DelegatingApi api = ContextBuilder.newBuilder(provider)
.modules(ImmutableSet.<Module> builder()
- .add(new ExecutorServiceModule(executor, executor))
+ .add(new ExecutorServiceModule(executor))
.build())
.buildApi(DelegatingApi.class);
api.close();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/test/java/org/jclouds/rest/internal/BaseRestApiExpectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/BaseRestApiExpectTest.java b/core/src/test/java/org/jclouds/rest/internal/BaseRestApiExpectTest.java
index 34a461e..92bf77b 100644
--- a/core/src/test/java/org/jclouds/rest/internal/BaseRestApiExpectTest.java
+++ b/core/src/test/java/org/jclouds/rest/internal/BaseRestApiExpectTest.java
@@ -19,7 +19,6 @@ package org.jclouds.rest.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static com.google.inject.name.Names.named;
-import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_MAX_RETRIES;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import static org.testng.Assert.assertEquals;
@@ -191,11 +190,9 @@ public abstract class BaseRestApiExpectTest<S> {
@Inject
public ExpectHttpCommandExecutorService(Function<HttpRequest, HttpResponse> fn, HttpUtils utils,
- ContentMetadataCodec contentMetadataCodec,
- @Named(PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor,
- IOExceptionRetryHandler ioRetryHandler, DelegatingRetryHandler retryHandler,
- DelegatingErrorHandler errorHandler, HttpWire wire) {
- super(utils, contentMetadataCodec, ioExecutor, retryHandler, ioRetryHandler, errorHandler, wire);
+ ContentMetadataCodec contentMetadataCodec, IOExceptionRetryHandler ioRetryHandler,
+ DelegatingRetryHandler retryHandler, DelegatingErrorHandler errorHandler, HttpWire wire) {
+ super(utils, contentMetadataCodec, retryHandler, ioRetryHandler, errorHandler, wire);
this.fn = checkNotNull(fn, "fn");
}
@@ -228,7 +225,6 @@ public abstract class BaseRestApiExpectTest<S> {
@Override
public void configure() {
bind(ListeningExecutorService.class).annotatedWith(named(PROPERTY_USER_THREADS)).toInstance(newDirectExecutorService());
- bind(ListeningExecutorService.class).annotatedWith(named(PROPERTY_IO_WORKER_THREADS)).toInstance(newDirectExecutorService());
bind(new TypeLiteral<Function<HttpRequest, HttpResponse>>() {
}).toInstance(fn);
bind(HttpCommandExecutorService.class).to(ExpectHttpCommandExecutorService.class);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/test/java/org/jclouds/rest/internal/BaseRestApiTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/BaseRestApiTest.java b/core/src/test/java/org/jclouds/rest/internal/BaseRestApiTest.java
index c151c4e..915aa99 100644
--- a/core/src/test/java/org/jclouds/rest/internal/BaseRestApiTest.java
+++ b/core/src/test/java/org/jclouds/rest/internal/BaseRestApiTest.java
@@ -21,7 +21,6 @@ import static com.google.common.net.HttpHeaders.TRANSFER_ENCODING;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static com.google.inject.name.Names.named;
import static org.easymock.EasyMock.createMock;
-import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
@@ -79,7 +78,6 @@ public abstract class BaseRestApiTest {
@Override
protected void configure() {
bind(ListeningExecutorService.class).annotatedWith(named(PROPERTY_USER_THREADS)).toInstance(newDirectExecutorService());
- bind(ListeningExecutorService.class).annotatedWith(named(PROPERTY_IO_WORKER_THREADS)).toInstance(newDirectExecutorService());
bind(HttpCommandExecutorService.class).toInstance(mock);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
index a16eb91..16ace50 100644
--- a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
+++ b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java
@@ -244,12 +244,6 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
int callCounter = 0;
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- throw new AssertionError();
- }
-
@Override
public HttpResponse invoke(HttpCommand command) {
if (callCounter == 1)
@@ -279,19 +273,12 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public void testDelegateWithPathParamIsLazyLoadedAndRequestIncludesEndpointVersionAndPath()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- throw new AssertionError("jclouds no longer uses the submit method");
- }
-
@Override
public HttpResponse invoke(HttpCommand command) {
assertEquals(command.getCurrentRequest().getRequestLine(),
"GET http://howdyboys/testing/testing/thepathparam/client/1/foo HTTP/1.1");
return HttpResponse.builder().build();
}
-
});
try {
@@ -310,18 +297,11 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public void testDelegateWithHeaderParamIsLazyLoadedAndRequestIncludesEndpointVersionAndHeader()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- throw new AssertionError("jclouds no longer uses the submit method");
- }
-
@Override
public HttpResponse invoke(HttpCommand command) {
assertEquals(command.getCurrentRequest().getFirstHeaderOrNull("header"), "theheaderparam");
return HttpResponse.builder().build();
}
-
});
try {
@@ -338,12 +318,6 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public void testDelegateWithoutProducesAndConsumes()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- throw new AssertionError("jclouds no longer uses the submit method");
- }
-
@Override
public HttpResponse invoke(HttpCommand command) {
assertEquals(
@@ -352,7 +326,6 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertTrue(command.getCurrentRequest().getHeaders().get("Accept").contains(APPLICATION_JSON));
return HttpResponse.builder().build();
}
-
});
try {
@@ -368,12 +341,6 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public void testDelegateWithProducesAndConsumesOnMethodIsLazyLoaded()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- throw new AssertionError("jclouds no longer uses the submit method");
- }
-
@Override
public HttpResponse invoke(HttpCommand command) {
assertEquals(
@@ -398,12 +365,6 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public void testDelegateWithProducesAndConsumesOnClassIsLazyLoaded()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- throw new AssertionError("jclouds no longer uses the submit method");
- }
-
@Override
public HttpResponse invoke(HttpCommand command) {
assertEquals(
@@ -412,7 +373,6 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertTrue(command.getCurrentRequest().getHeaders().get("Accept").contains(APPLICATION_XML));
return HttpResponse.builder().build();
}
-
});
try {
@@ -428,18 +388,11 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public void testDelegateIsLazyLoadedAndRequestIncludesEndpointVersionAndPathOptionalPresent()
throws InterruptedException, ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- throw new AssertionError("jclouds no longer uses the submit method");
- }
-
@Override
public HttpResponse invoke(HttpCommand command) {
assertEquals(command.getCurrentRequest().getRequestLine(), "GET http://howdyboys/client/1/foo HTTP/1.1");
return HttpResponse.builder().build();
}
-
});
try {
@@ -458,18 +411,11 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public void testDelegateIsLazyLoadedAndRequestIncludesEndpointVersionAndPath() throws InterruptedException,
ExecutionException {
Injector child = injectorForCaller(new HttpCommandExecutorService() {
-
- @Override
- public ListenableFuture<HttpResponse> submit(HttpCommand command) {
- throw new AssertionError("jclouds no longer uses the submit method");
- }
-
@Override
public HttpResponse invoke(HttpCommand command) {
assertEquals(command.getCurrentRequest().getRequestLine(), "GET http://howdyboys/client/1/foo HTTP/1.1");
return HttpResponse.builder().build();
}
-
});
try {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorService.java
----------------------------------------------------------------------
diff --git a/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorService.java b/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorService.java
index 8448a55..74d3628 100644
--- a/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorService.java
+++ b/drivers/apachehc/src/main/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorService.java
@@ -15,6 +15,7 @@
* limitations under the License.
*/
package org.jclouds.http.apachehc;
+
import static com.google.common.hash.Hashing.md5;
import static com.google.common.io.BaseEncoding.base64;
import static org.jclouds.http.HttpUtils.filterOutContentHeaders;
@@ -22,14 +23,13 @@ import static org.jclouds.http.HttpUtils.filterOutContentHeaders;
import java.io.IOException;
import java.net.URI;
-import javax.inject.Named;
+import javax.inject.Inject;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpUriRequest;
-import org.jclouds.Constants;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.http.HttpUtils;
@@ -38,18 +38,16 @@ import org.jclouds.http.handlers.DelegatingErrorHandler;
import org.jclouds.http.handlers.DelegatingRetryHandler;
import org.jclouds.http.internal.BaseHttpCommandExecutorService;
import org.jclouds.http.internal.HttpWire;
-import org.jclouds.io.ContentMetadataCodec;
import org.jclouds.io.ByteStreams2;
+import org.jclouds.io.ContentMetadataCodec;
import org.jclouds.io.Payload;
import org.jclouds.io.Payloads;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.inject.Inject;
/**
- * Simple implementation of a {@link HttpFutureCommandClient}, Apache Components HttpClient 4.x.
+ * Simple implementation of a {@link HttpCommandExecutorService}, Apache Components HttpClient 4.x.
*/
public class ApacheHCHttpCommandExecutorService extends BaseHttpCommandExecutorService<HttpUriRequest> {
private final HttpClient client;
@@ -57,10 +55,9 @@ public class ApacheHCHttpCommandExecutorService extends BaseHttpCommandExecutorS
@Inject
ApacheHCHttpCommandExecutorService(HttpUtils utils, ContentMetadataCodec contentMetadataCodec,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor,
DelegatingRetryHandler retryHandler, IOExceptionRetryHandler ioRetryHandler,
DelegatingErrorHandler errorHandler, HttpWire wire, HttpClient client) {
- super(utils, contentMetadataCodec, ioExecutor, retryHandler, ioRetryHandler, errorHandler, wire);
+ super(utils, contentMetadataCodec, retryHandler, ioRetryHandler, errorHandler, wire);
this.client = client;
this.apacheHCUtils = new ApacheHCUtils(contentMetadataCodec);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/apachehc/src/test/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorServiceTestDisabled.java
----------------------------------------------------------------------
diff --git a/drivers/apachehc/src/test/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorServiceTestDisabled.java b/drivers/apachehc/src/test/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorServiceTestDisabled.java
index 7b46eda..016f997 100644
--- a/drivers/apachehc/src/test/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorServiceTestDisabled.java
+++ b/drivers/apachehc/src/test/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorServiceTestDisabled.java
@@ -17,7 +17,6 @@
package org.jclouds.http.apachehc;
import static org.jclouds.Constants.PROPERTY_CONNECTION_TIMEOUT;
-import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_CONTEXT;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST;
import static org.jclouds.Constants.PROPERTY_SO_TIMEOUT;
@@ -49,7 +48,6 @@ public class ApacheHCHttpCommandExecutorServiceTestDisabled extends BaseHttpComm
props.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 0 + "");
props.setProperty(PROPERTY_CONNECTION_TIMEOUT, 100 + "");
props.setProperty(PROPERTY_SO_TIMEOUT, 100 + "");
- props.setProperty(PROPERTY_IO_WORKER_THREADS, 3 + "");
props.setProperty(PROPERTY_USER_THREADS, 0 + "");
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/enterprise/src/main/java/org/jclouds/enterprise/config/EnterpriseConfigurationModule.java
----------------------------------------------------------------------
diff --git a/drivers/enterprise/src/main/java/org/jclouds/enterprise/config/EnterpriseConfigurationModule.java b/drivers/enterprise/src/main/java/org/jclouds/enterprise/config/EnterpriseConfigurationModule.java
index 5dfab86..abdfd13 100644
--- a/drivers/enterprise/src/main/java/org/jclouds/enterprise/config/EnterpriseConfigurationModule.java
+++ b/drivers/enterprise/src/main/java/org/jclouds/enterprise/config/EnterpriseConfigurationModule.java
@@ -30,10 +30,20 @@ import com.google.common.util.concurrent.ListeningExecutorService;
@ConfiguresExecutorService
public class EnterpriseConfigurationModule extends ExecutorServiceModule {
+ /**
+ * @deprecated {@code ioExecutor} is no longer used. This constructor will be removed in jclouds v2.
+ * Use {@link #EnterpriseConfigurationModule(ListeningExecutorService)} instead.
+ */
+ @Deprecated
public EnterpriseConfigurationModule(ListeningExecutorService userExecutor, ListeningExecutorService ioExecutor) {
super(userExecutor, ioExecutor);
}
+ @Deprecated
+ public EnterpriseConfigurationModule(ListeningExecutorService userExecutor) {
+ super(userExecutor);
+ }
+
public EnterpriseConfigurationModule() {
super();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/gae/src/main/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorService.java
----------------------------------------------------------------------
diff --git a/drivers/gae/src/main/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorService.java b/drivers/gae/src/main/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorService.java
deleted file mode 100644
index b8410b5..0000000
--- a/drivers/gae/src/main/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorService.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.gae;
-
-import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.Futures.transform;
-import static com.google.common.util.concurrent.JdkFutureAdapters.listenInPoolThread;
-import static org.jclouds.http.HttpUtils.checkRequestHasContentLengthOrChunkedEncoding;
-import static org.jclouds.http.HttpUtils.wirePayloadIfEnabled;
-
-import java.io.IOException;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.JcloudsVersion;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpRequestFilter;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.http.HttpUtils;
-import org.jclouds.http.IOExceptionRetryHandler;
-import org.jclouds.http.handlers.DelegatingErrorHandler;
-import org.jclouds.http.handlers.DelegatingRetryHandler;
-import org.jclouds.http.internal.BaseHttpCommandExecutorService;
-import org.jclouds.http.internal.HttpWire;
-import org.jclouds.io.ContentMetadataCodec;
-import org.jclouds.util.Throwables2;
-
-import com.google.appengine.api.urlfetch.HTTPRequest;
-import com.google.appengine.api.urlfetch.HTTPResponse;
-import com.google.appengine.api.urlfetch.URLFetchService;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * Google App Engine version of {@link HttpCommandExecutorService} using their
- * fetchAsync call
- */
-@Singleton
-public class AsyncGaeHttpCommandExecutorService extends BaseHttpCommandExecutorService<HTTPRequest> {
- // TODO: look up gae version
- public static final String USER_AGENT = String.format("jclouds/%s urlfetch/%s", JcloudsVersion.get(), "1.6.5");
-
- private final URLFetchService urlFetchService;
- private final ConvertToGaeRequest convertToGaeRequest;
- private final ConvertToJcloudsResponse convertToJcloudsResponse;
- private final ListeningExecutorService ioExecutor;
-
- @Inject
- public AsyncGaeHttpCommandExecutorService(URLFetchService urlFetchService, HttpUtils utils,
- ContentMetadataCodec contentMetadataCodec,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor,
- IOExceptionRetryHandler ioRetryHandler, DelegatingRetryHandler retryHandler,
- DelegatingErrorHandler errorHandler, HttpWire wire, ConvertToGaeRequest convertToGaeRequest,
- ConvertToJcloudsResponse convertToJcloudsResponse) {
- super(utils, contentMetadataCodec, ioExecutor, retryHandler, ioRetryHandler, errorHandler, wire);
- this.ioExecutor = ioExecutor;
- this.urlFetchService = urlFetchService;
- this.convertToGaeRequest = convertToGaeRequest;
- this.convertToJcloudsResponse = convertToJcloudsResponse;
- }
-
- @VisibleForTesting
- protected HttpResponse convert(HTTPResponse gaeResponse) {
- return convertToJcloudsResponse.apply(gaeResponse);
- }
-
- @VisibleForTesting
- protected HTTPRequest convert(HttpRequest request) throws IOException {
- return convertToGaeRequest.apply(request);
- }
-
- /**
- * nothing to clean up.
- */
- @Override
- protected void cleanup(HTTPRequest nativeRequest) {
- }
-
- @Override
- protected HttpResponse invoke(HTTPRequest request) throws IOException {
- return convert(urlFetchService.fetch(request));
- }
-
- public HTTPRequest filterLogAndConvertRe(HttpRequest request) {
- for (HttpRequestFilter filter : request.getFilters()) {
- request = filter.filter(request);
- }
- checkRequestHasContentLengthOrChunkedEncoding(request,
- "After filtering, the request has neither chunked encoding nor content length: " + request);
- logger.debug("Sending request %s: %s", request.hashCode(), request.getRequestLine());
- wirePayloadIfEnabled(wire, request);
- HTTPRequest nativeRequest = convertToGaeRequest.apply(request);
- utils.logRequest(headerLog, request, ">>");
- return nativeRequest;
- }
-
- @Override
- public ListenableFuture<HttpResponse> submit(final HttpCommand command) {
- HTTPRequest nativeRequest = filterLogAndConvertRe(command.getCurrentRequest());
- ListenableFuture<HttpResponse> response = transform(
- listenInPoolThread(urlFetchService.fetchAsync(nativeRequest)), convertToJcloudsResponse);
-
- return transform(response, new Function<HttpResponse, HttpResponse>() {
- public HttpResponse apply(HttpResponse response) {
- return receiveResponse(command, response);
- }
-
- }, ioExecutor);
- }
-
- private HttpResponse receiveResponse(HttpCommand command, HttpResponse response) {
- try {
- logger.debug("Receiving response %s: %s", command.getCurrentRequest().hashCode(), response.getStatusLine());
- utils.logResponse(headerLog, response, "<<");
- if (response.getPayload() != null && wire.enabled())
- wire.input(response);
- int statusCode = response.getStatusCode();
- if (statusCode >= 300) {
- if (shouldContinue(command, response))
- return submit(command).get();
- else
- return response;
- }
- return response;
- } catch (Exception e) {
- IOException ioe = Throwables2.getFirstThrowableOfType(e, IOException.class);
- if (ioe != null && ioRetryHandler.shouldRetryRequest(command, ioe)) {
- try {
- return submit(command).get();
- } catch (Exception e1) {
- command.setException(e1);
- return response;
- }
- } else {
- command.setException(new HttpResponseException(e.getMessage() + " connecting to "
- + command.getCurrentRequest().getRequestLine(), command, null, e));
- return response;
- }
- } finally {
- if (command.getException() != null)
- propagate(command.getException());
- }
- }
-
- private boolean shouldContinue(HttpCommand command, HttpResponse response) {
- boolean shouldContinue = false;
- if (retryHandler.shouldRetryRequest(command, response)) {
- shouldContinue = true;
- } else {
- errorHandler.handleError(command, response);
- }
- return shouldContinue;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/gae/src/main/java/org/jclouds/gae/GaeHttpCommandExecutorService.java
----------------------------------------------------------------------
diff --git a/drivers/gae/src/main/java/org/jclouds/gae/GaeHttpCommandExecutorService.java b/drivers/gae/src/main/java/org/jclouds/gae/GaeHttpCommandExecutorService.java
index ac84afe..79ff28d 100644
--- a/drivers/gae/src/main/java/org/jclouds/gae/GaeHttpCommandExecutorService.java
+++ b/drivers/gae/src/main/java/org/jclouds/gae/GaeHttpCommandExecutorService.java
@@ -19,10 +19,8 @@ package org.jclouds.gae;
import java.io.IOException;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Singleton;
-import org.jclouds.Constants;
import org.jclouds.JcloudsVersion;
import org.jclouds.concurrent.SingleThreaded;
import org.jclouds.http.HttpRequest;
@@ -39,7 +37,6 @@ import com.google.appengine.api.urlfetch.HTTPRequest;
import com.google.appengine.api.urlfetch.HTTPResponse;
import com.google.appengine.api.urlfetch.URLFetchService;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.util.concurrent.ListeningExecutorService;
/**
* Google App Engine version of {@link HttpCommandExecutorService}
@@ -57,11 +54,10 @@ public class GaeHttpCommandExecutorService extends BaseHttpCommandExecutorServic
@Inject
public GaeHttpCommandExecutorService(URLFetchService urlFetchService, HttpUtils utils,
ContentMetadataCodec contentMetadataCodec,
- @Named(Constants.PROPERTY_IO_WORKER_THREADS) ListeningExecutorService ioExecutor,
IOExceptionRetryHandler ioRetryHandler, DelegatingRetryHandler retryHandler,
DelegatingErrorHandler errorHandler, HttpWire wire, ConvertToGaeRequest convertToGaeRequest,
ConvertToJcloudsResponse convertToJcloudsResponse) {
- super(utils, contentMetadataCodec, ioExecutor, retryHandler, ioRetryHandler, errorHandler, wire);
+ super(utils, contentMetadataCodec, retryHandler, ioRetryHandler, errorHandler, wire);
this.urlFetchService = urlFetchService;
this.convertToGaeRequest = convertToGaeRequest;
this.convertToJcloudsResponse = convertToJcloudsResponse;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/gae/src/main/java/org/jclouds/gae/config/AsyncGoogleAppEngineConfigurationModule.java
----------------------------------------------------------------------
diff --git a/drivers/gae/src/main/java/org/jclouds/gae/config/AsyncGoogleAppEngineConfigurationModule.java b/drivers/gae/src/main/java/org/jclouds/gae/config/AsyncGoogleAppEngineConfigurationModule.java
deleted file mode 100644
index d6979b8..0000000
--- a/drivers/gae/src/main/java/org/jclouds/gae/config/AsyncGoogleAppEngineConfigurationModule.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.gae.config;
-
-import org.jclouds.concurrent.SingleThreaded;
-import org.jclouds.concurrent.config.ConfiguresExecutorService;
-import org.jclouds.gae.AsyncGaeHttpCommandExecutorService;
-import org.jclouds.http.HttpCommandExecutorService;
-import org.jclouds.http.config.ConfiguresHttpCommandExecutorService;
-
-import com.google.common.base.Supplier;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.inject.Module;
-
-/**
- * Configures {@link AsyncGaeHttpCommandExecutorService}.
- */
-@ConfiguresHttpCommandExecutorService
-@ConfiguresExecutorService
-@SingleThreaded
-public class AsyncGoogleAppEngineConfigurationModule extends GoogleAppEngineConfigurationModule {
- public AsyncGoogleAppEngineConfigurationModule() {
- super();
- }
-
- public AsyncGoogleAppEngineConfigurationModule(Module userExecutorModule) {
- super(userExecutorModule);
- }
-
- /**
- * Used when you are creating multiple contexts in the same app.
- * @param memoizedCurrentRequestExecutorService
- * @see CurrentRequestExecutorServiceModule#memoizedCurrentRequestExecutorService
- */
- public AsyncGoogleAppEngineConfigurationModule(Supplier<ListeningExecutorService> memoizedCurrentRequestExecutorService) {
- super(memoizedCurrentRequestExecutorService);
- }
-
- protected void bindHttpCommandExecutorService() {
- bind(HttpCommandExecutorService.class).to(AsyncGaeHttpCommandExecutorService.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/gae/src/main/java/org/jclouds/gae/config/CurrentRequestExecutorServiceModule.java
----------------------------------------------------------------------
diff --git a/drivers/gae/src/main/java/org/jclouds/gae/config/CurrentRequestExecutorServiceModule.java b/drivers/gae/src/main/java/org/jclouds/gae/config/CurrentRequestExecutorServiceModule.java
index 8e1a777..70c8f19 100644
--- a/drivers/gae/src/main/java/org/jclouds/gae/config/CurrentRequestExecutorServiceModule.java
+++ b/drivers/gae/src/main/java/org/jclouds/gae/config/CurrentRequestExecutorServiceModule.java
@@ -102,11 +102,4 @@ public class CurrentRequestExecutorServiceModule extends AbstractModule {
protected ListeningExecutorService userExecutor() {
return memoizedCurrentRequestExecutorService.get();
}
-
- @Provides
- @Singleton
- @Named(Constants.PROPERTY_IO_WORKER_THREADS)
- protected ListeningExecutorService ioExecutor() {
- return memoizedCurrentRequestExecutorService.get();
- }
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/gae/src/main/java/org/jclouds/gae/config/GoogleAppEngineConfigurationModule.java
----------------------------------------------------------------------
diff --git a/drivers/gae/src/main/java/org/jclouds/gae/config/GoogleAppEngineConfigurationModule.java b/drivers/gae/src/main/java/org/jclouds/gae/config/GoogleAppEngineConfigurationModule.java
index e3264a3..21d40e2 100644
--- a/drivers/gae/src/main/java/org/jclouds/gae/config/GoogleAppEngineConfigurationModule.java
+++ b/drivers/gae/src/main/java/org/jclouds/gae/config/GoogleAppEngineConfigurationModule.java
@@ -46,7 +46,7 @@ public class GoogleAppEngineConfigurationModule extends AbstractModule {
private final Module userExecutorModule;
public GoogleAppEngineConfigurationModule() {
- this(new ExecutorServiceModule(newDirectExecutorService(), newDirectExecutorService()));
+ this(new ExecutorServiceModule(newDirectExecutorService()));
}
/**
http://git-wip-us.apache.org/repos/asf/jclouds/blob/0a236f59/drivers/gae/src/main/java/org/jclouds/gae/config/MultithreadedAsyncGoogleAppEngineConfigurationModule.java
----------------------------------------------------------------------
diff --git a/drivers/gae/src/main/java/org/jclouds/gae/config/MultithreadedAsyncGoogleAppEngineConfigurationModule.java b/drivers/gae/src/main/java/org/jclouds/gae/config/MultithreadedAsyncGoogleAppEngineConfigurationModule.java
deleted file mode 100644
index cc5d442..0000000
--- a/drivers/gae/src/main/java/org/jclouds/gae/config/MultithreadedAsyncGoogleAppEngineConfigurationModule.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.gae.config;
-
-import org.jclouds.concurrent.config.ConfiguresExecutorService;
-import org.jclouds.gae.AsyncGaeHttpCommandExecutorService;
-import org.jclouds.http.HttpCommandExecutorService;
-import org.jclouds.http.config.ConfiguresHttpCommandExecutorService;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Supplier;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-/**
- * Configures {@link AsyncGaeHttpCommandExecutorService}.
- */
-@Beta
-@ConfiguresHttpCommandExecutorService
-@ConfiguresExecutorService
-public class MultithreadedAsyncGoogleAppEngineConfigurationModule extends GoogleAppEngineConfigurationModule {
- public MultithreadedAsyncGoogleAppEngineConfigurationModule() {
- super(new CurrentRequestExecutorServiceModule());
- }
-
- /**
- * Used when you are creating multiple contexts in the same app.
- *
- * @param currentRequestThreadFactory
- * @see CurrentRequestExecutorServiceModule#currentRequestThreadFactory
- */
- public MultithreadedAsyncGoogleAppEngineConfigurationModule(ListeningExecutorService currentRequestThreadFactory) {
- super(new CurrentRequestExecutorServiceModule(currentRequestThreadFactory));
- }
-
- /**
- * Used when you are creating multiple contexts in the same app.
- *
- * @param memoizedCurrentRequestExecutorService
- * @see CurrentRequestExecutorServiceModule#memoizedCurrentRequestExecutorService
- */
- public MultithreadedAsyncGoogleAppEngineConfigurationModule(
- Supplier<ListeningExecutorService> memoizedCurrentRequestExecutorService) {
- super(memoizedCurrentRequestExecutorService);
- }
-
- protected void bindHttpCommandExecutorService() {
- bind(HttpCommandExecutorService.class).to(AsyncGaeHttpCommandExecutorService.class);
- }
-
-}
[25/52] [abbrv] git commit: JCLOUDS-40 Remove internal usage of
AsyncBlobStore.
Posted by an...@apache.org.
JCLOUDS-40 Remove internal usage of AsyncBlobStore.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/56a2a8bf
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/56a2a8bf
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/56a2a8bf
Branch: refs/heads/use-agentproxy-008
Commit: 56a2a8bf4a0a957db04feeca99610ae1432d7c21
Parents: dfb583b
Author: Adrian Cole <ac...@twitter.com>
Authored: Sat Oct 4 23:02:37 2014 -0700
Committer: Adrian Cole <ad...@gmail.com>
Committed: Sun Oct 5 08:49:54 2014 -0700
----------------------------------------------------------------------
.../blobstore/CloudFilesBlobStore.java | 15 ++--
.../swift/blobstore/SwiftBlobStore.java | 34 +++++++--
.../strategy/internal/FetchBlobMetadata.java | 18 +++--
.../GetAllBlobsInListAndRetryOnFailure.java | 18 +++--
.../MarkersDeleteDirectoryStrategy.java | 20 +++---
.../strategy/internal/PutBlobsStrategyImpl.java | 19 +++--
.../jclouds/blobstore/util/BlobStoreUtils.java | 24 -------
.../blobstore/util/BlobStoreUtilsTest.java | 74 +-------------------
.../org/jclouds/aws/s3/AWSS3ClientLiveTest.java | 15 ----
.../HPCloudObjectStorageBlobStore.java | 27 ++++---
10 files changed, 104 insertions(+), 160 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/56a2a8bf/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobStore.java
----------------------------------------------------------------------
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobStore.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobStore.java
index 7c5979d..96a813b 100644
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobStore.java
+++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobStore.java
@@ -16,9 +16,12 @@
*/
package org.jclouds.cloudfiles.blobstore;
+import static org.jclouds.Constants.PROPERTY_USER_THREADS;
+
import java.util.Set;
import javax.inject.Inject;
+import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;
@@ -38,9 +41,10 @@ import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceList;
import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceMetadata;
import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlob;
import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata;
+import org.jclouds.openstack.swift.blobstore.strategy.internal.MultipartUploadStrategy;
import com.google.common.base.Supplier;
-import org.jclouds.openstack.swift.blobstore.strategy.internal.MultipartUploadStrategy;
+import com.google.common.util.concurrent.ListeningExecutorService;
@Singleton
public class CloudFilesBlobStore extends SwiftBlobStore {
@@ -48,7 +52,8 @@ public class CloudFilesBlobStore extends SwiftBlobStore {
private EnableCDNAndCache enableCDNAndCache;
@Inject
- protected CloudFilesBlobStore(BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
+ protected CloudFilesBlobStore(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
+ BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
@Memoized Supplier<Set<? extends Location>> locations, CommonSwiftClient sync,
ContainerToResourceMetadata container2ResourceMd,
BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
@@ -56,9 +61,9 @@ public class CloudFilesBlobStore extends SwiftBlobStore {
ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions,
Provider<FetchBlobMetadata> fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache,
Provider<MultipartUploadStrategy> multipartUploadStrategy) {
- super(context, blobUtils, defaultLocation, locations, sync, container2ResourceMd, container2ContainerListOptions,
- container2ResourceList, object2Blob, blob2Object, object2BlobMd, blob2ObjectGetOptions,
- fetchBlobMetadataProvider, multipartUploadStrategy);
+ super(userExecutor, context, blobUtils, defaultLocation, locations, sync, container2ResourceMd,
+ container2ContainerListOptions, container2ResourceList, object2Blob, blob2Object, object2BlobMd,
+ blob2ObjectGetOptions, fetchBlobMetadataProvider, multipartUploadStrategy);
this.enableCDNAndCache = enableCDNAndCache;
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/56a2a8bf/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java
index 0448909..1cda908 100644
--- a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java
+++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java
@@ -18,22 +18,23 @@ package org.jclouds.openstack.swift.blobstore;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.blobstore.util.BlobStoreUtils.createParentIfNeededAsync;
+import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import static org.jclouds.openstack.swift.options.ListContainerOptions.Builder.withPrefix;
import java.util.Set;
import javax.inject.Inject;
+import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;
-import com.google.common.annotations.VisibleForTesting;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.blobstore.domain.PageSet;
import org.jclouds.blobstore.domain.StorageMetadata;
import org.jclouds.blobstore.domain.internal.PageSetImpl;
+import org.jclouds.blobstore.functions.BlobName;
import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
import org.jclouds.blobstore.internal.BaseBlobStore;
import org.jclouds.blobstore.options.CreateContainerOptions;
@@ -56,13 +57,16 @@ import org.jclouds.openstack.swift.domain.ContainerMetadata;
import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata;
import org.jclouds.openstack.swift.domain.ObjectInfo;
+import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Strings;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
+import com.google.common.util.concurrent.ListeningExecutorService;
@Singleton
public class SwiftBlobStore extends BaseBlobStore {
+ private final ListeningExecutorService userExecutor;
private final CommonSwiftClient sync;
private final ContainerToResourceMetadata container2ResourceMd;
private final BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions;
@@ -75,7 +79,8 @@ public class SwiftBlobStore extends BaseBlobStore {
private final Provider<MultipartUploadStrategy> multipartUploadStrategy;
@Inject
- protected SwiftBlobStore(BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
+ protected SwiftBlobStore(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
+ BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
@Memoized Supplier<Set<? extends Location>> locations, CommonSwiftClient sync,
ContainerToResourceMetadata container2ResourceMd,
BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
@@ -84,6 +89,7 @@ public class SwiftBlobStore extends BaseBlobStore {
Provider<FetchBlobMetadata> fetchBlobMetadataProvider,
Provider<MultipartUploadStrategy> multipartUploadStrategy) {
super(context, blobUtils, defaultLocation, locations);
+ this.userExecutor = userExecutor;
this.sync = sync;
this.container2ResourceMd = container2ResourceMd;
this.container2ContainerListOptions = container2ContainerListOptions;
@@ -196,10 +202,30 @@ public class SwiftBlobStore extends BaseBlobStore {
*/
@Override
public String putBlob(String container, Blob blob) {
- createParentIfNeededAsync(context.getAsyncBlobStore(), container, blob);
+ createParentIfNeededAsync(container, blob);
return sync.putObject(container, blob2Object.apply(blob));
}
+ private static final BlobName blobName = new BlobName();
+
+ /** Legacy behavior which will not be carried forward in new blobstores. */
+ private void createParentIfNeededAsync(final String containerName, Blob blob) {
+ checkNotNull(containerName, "container");
+ checkNotNull(blob, "blob");
+ final String name = blobName.apply(blob);
+ if (name.indexOf('/') > 0) {
+ userExecutor.submit(new Runnable() {
+ @Override public void run() {
+ createDirectory(containerName, parseDirectoryFromPath(name));
+ }
+ });
+ }
+ }
+
+ private static String parseDirectoryFromPath(String path) {
+ return checkNotNull(path, "path").substring(0, path.lastIndexOf('/'));
+ }
+
/**
* This implementation invokes {@link CommonSwiftClient#putObject}
*
http://git-wip-us.apache.org/repos/asf/jclouds/blob/56a2a8bf/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FetchBlobMetadata.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FetchBlobMetadata.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FetchBlobMetadata.java
index 560a8f2..79f10a4 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FetchBlobMetadata.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FetchBlobMetadata.java
@@ -19,11 +19,13 @@ package org.jclouds.blobstore.strategy.internal;
import static com.google.common.base.Preconditions.checkState;
import static org.jclouds.concurrent.FutureIterables.transformParallel;
+import java.util.concurrent.Callable;
+
import javax.annotation.Resource;
import javax.inject.Named;
import org.jclouds.Constants;
-import org.jclouds.blobstore.AsyncBlobStore;
+import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.blobstore.domain.PageSet;
import org.jclouds.blobstore.domain.StorageMetadata;
@@ -49,7 +51,7 @@ import com.google.inject.Inject;
public class FetchBlobMetadata implements Function<PageSet<? extends StorageMetadata>, PageSet<? extends StorageMetadata>> {
protected final BackoffLimitedRetryHandler retryHandler;
- protected final AsyncBlobStore ablobstore;
+ protected final BlobStore blobstore;
protected final ListeningExecutorService userExecutor;
@Resource
@Named(BlobStoreConstants.BLOBSTORE_LOGGER)
@@ -64,10 +66,10 @@ public class FetchBlobMetadata implements Function<PageSet<? extends StorageMeta
protected Long maxTime;
@Inject
- FetchBlobMetadata(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, AsyncBlobStore ablobstore,
+ FetchBlobMetadata(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, BlobStore blobstore,
BackoffLimitedRetryHandler retryHandler) {
this.userExecutor = userExecutor;
- this.ablobstore = ablobstore;
+ this.blobstore = blobstore;
this.retryHandler = retryHandler;
}
@@ -89,8 +91,12 @@ public class FetchBlobMetadata implements Function<PageSet<? extends StorageMeta
}), new Function<StorageMetadata, ListenableFuture<? extends BlobMetadata>>() {
@Override
- public ListenableFuture<BlobMetadata> apply(StorageMetadata from) {
- return ablobstore.blobMetadata(container, from.getName());
+ public ListenableFuture<BlobMetadata> apply(final StorageMetadata from) {
+ return userExecutor.submit(new Callable<BlobMetadata>() {
+ @Override public BlobMetadata call() throws Exception {
+ return blobstore.blobMetadata(container, from.getName());
+ }
+ });
}
}, userExecutor, maxTime, logger, String.format("getting metadata from containerName: %s", container)));
http://git-wip-us.apache.org/repos/asf/jclouds/blob/56a2a8bf/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/GetAllBlobsInListAndRetryOnFailure.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/GetAllBlobsInListAndRetryOnFailure.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/GetAllBlobsInListAndRetryOnFailure.java
index b163f3e..158c390 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/GetAllBlobsInListAndRetryOnFailure.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/GetAllBlobsInListAndRetryOnFailure.java
@@ -18,12 +18,14 @@ package org.jclouds.blobstore.strategy.internal;
import static org.jclouds.concurrent.FutureIterables.transformParallel;
+import java.util.concurrent.Callable;
+
import javax.annotation.Resource;
import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.Constants;
-import org.jclouds.blobstore.AsyncBlobStore;
+import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.blobstore.options.ListContainerOptions;
@@ -47,7 +49,7 @@ public class GetAllBlobsInListAndRetryOnFailure implements GetBlobsInListStrateg
protected final ListBlobsInContainer getAllBlobMetadata;
protected final BackoffLimitedRetryHandler retryHandler;
- protected final AsyncBlobStore ablobstore;
+ protected final BlobStore blobstore;
protected final ListeningExecutorService userExecutor;
@Resource
@Named(BlobStoreConstants.BLOBSTORE_LOGGER)
@@ -61,9 +63,9 @@ public class GetAllBlobsInListAndRetryOnFailure implements GetBlobsInListStrateg
@Inject
GetAllBlobsInListAndRetryOnFailure(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- ListBlobsInContainer getAllBlobMetadata, AsyncBlobStore ablobstore, BackoffLimitedRetryHandler retryHandler) {
+ ListBlobsInContainer getAllBlobMetadata, BlobStore blobstore, BackoffLimitedRetryHandler retryHandler) {
this.userExecutor = userExecutor;
- this.ablobstore = ablobstore;
+ this.blobstore = blobstore;
this.getAllBlobMetadata = getAllBlobMetadata;
this.retryHandler = retryHandler;
}
@@ -73,8 +75,12 @@ public class GetAllBlobsInListAndRetryOnFailure implements GetBlobsInListStrateg
return transformParallel(list, new Function<BlobMetadata, ListenableFuture<? extends Blob>>() {
@Override
- public ListenableFuture<Blob> apply(BlobMetadata from) {
- return ablobstore.getBlob(container, from.getName());
+ public ListenableFuture<Blob> apply(final BlobMetadata from) {
+ return userExecutor.submit(new Callable<Blob>() {
+ @Override public Blob call() throws Exception {
+ return blobstore.getBlob(container, from.getName());
+ }
+ });
}
}, userExecutor, maxTime, logger, String.format("getting from containerName: %s", container), retryHandler, 3);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/56a2a8bf/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MarkersDeleteDirectoryStrategy.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MarkersDeleteDirectoryStrategy.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MarkersDeleteDirectoryStrategy.java
index 81a6a37..8495227 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MarkersDeleteDirectoryStrategy.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MarkersDeleteDirectoryStrategy.java
@@ -21,6 +21,7 @@ import static org.jclouds.concurrent.FutureIterables.awaitCompletion;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.Callable;
import java.util.concurrent.TimeoutException;
import javax.annotation.Resource;
@@ -28,7 +29,6 @@ import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.Constants;
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.internal.BlobRuntimeException;
import org.jclouds.blobstore.reference.BlobStoreConstants;
@@ -63,7 +63,6 @@ import com.google.inject.Inject;
@Singleton
public class MarkersDeleteDirectoryStrategy implements DeleteDirectoryStrategy {
- private final AsyncBlobStore ablobstore;
private final BlobStore blobstore;
private final ListeningExecutorService userExecutor;
@Resource
@@ -77,23 +76,26 @@ public class MarkersDeleteDirectoryStrategy implements DeleteDirectoryStrategy {
protected Long maxTime;
@Inject
- MarkersDeleteDirectoryStrategy(
- @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- AsyncBlobStore ablobstore, BlobStore blobstore) {
+ MarkersDeleteDirectoryStrategy(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
+ BlobStore blobstore) {
this.userExecutor = userExecutor;
- this.ablobstore = ablobstore;
this.blobstore = blobstore;
}
- public void execute(String containerName, String directory) {
+ public void execute(final String containerName, String directory) {
Set<String> names = Sets.newHashSet();
names.add(directory);
for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) {
names.add(directory + suffix);
}
Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
- for (String name : names) {
- responses.put(name, ablobstore.removeBlob(containerName, name));
+ for (final String name : names) {
+ responses.put(name, userExecutor.submit(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ blobstore.removeBlob(containerName, name);
+ return null;
+ }
+ }));
}
String message = String.format("deleting directory %s in containerName: %s", directory,
containerName);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/56a2a8bf/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/PutBlobsStrategyImpl.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/PutBlobsStrategyImpl.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/PutBlobsStrategyImpl.java
index 6cf457c..7a6cef2 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/PutBlobsStrategyImpl.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/PutBlobsStrategyImpl.java
@@ -20,6 +20,7 @@ import static com.google.common.base.Throwables.propagate;
import static org.jclouds.concurrent.FutureIterables.awaitCompletion;
import java.util.Map;
+import java.util.concurrent.Callable;
import java.util.concurrent.TimeoutException;
import javax.annotation.Resource;
@@ -27,7 +28,7 @@ import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.Constants;
-import org.jclouds.blobstore.AsyncBlobStore;
+import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.internal.BlobRuntimeException;
import org.jclouds.blobstore.reference.BlobStoreConstants;
@@ -42,7 +43,7 @@ import com.google.inject.Inject;
@Singleton
public class PutBlobsStrategyImpl implements PutBlobsStrategy {
- private final AsyncBlobStore ablobstore;
+ private final BlobStore blobstore;
private final ListeningExecutorService userExecutor;
@Resource
@Named(BlobStoreConstants.BLOBSTORE_LOGGER)
@@ -56,16 +57,20 @@ public class PutBlobsStrategyImpl implements PutBlobsStrategy {
@Inject
PutBlobsStrategyImpl(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- AsyncBlobStore ablobstore) {
+ BlobStore blobstore) {
this.userExecutor = userExecutor;
- this.ablobstore = ablobstore;
+ this.blobstore = blobstore;
}
@Override
- public void execute(String containerName, Iterable<? extends Blob> blobs) {
+ public void execute(final String containerName, Iterable<? extends Blob> blobs) {
Map<Blob, ListenableFuture<?>> responses = Maps.newLinkedHashMap();
- for (Blob blob : blobs) {
- responses.put(blob, ablobstore.putBlob(containerName, blob));
+ for (final Blob blob : blobs) {
+ responses.put(blob, userExecutor.submit(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ return blobstore.putBlob(containerName, blob);
+ }
+ }));
}
Map<Blob, Exception> exceptions;
try {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/56a2a8bf/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java b/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java
index e9f81ca..c2208cc 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java
@@ -23,18 +23,13 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.jclouds.blobstore.AsyncBlobStore;
-import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.MutableBlobMetadata;
import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl;
-import org.jclouds.blobstore.functions.BlobName;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpRequestFilter;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import com.google.common.collect.Maps;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
public class BlobStoreUtils {
public static <T> HttpRequest cleanRequest(HttpRequest returnVal) {
@@ -45,10 +40,6 @@ public class BlobStoreUtils {
.headers(returnVal.getHeaders()).payload(returnVal.getPayload()).build();
}
- public static String parseDirectoryFromPath(String path) {
- return checkNotNull(path, "path").substring(0, path.lastIndexOf('/'));
- }
-
private static Pattern keyFromContainer = Pattern.compile("/?[^/]+/(.*)");
public static String getNameFor(GeneratedHttpRequest request) {
@@ -70,21 +61,6 @@ public class BlobStoreUtils {
}
return objectKey;
}
-
- private static final BlobName blobName = new BlobName();
-
- public static ListenableFuture<Void> createParentIfNeededAsync(AsyncBlobStore asyncBlobStore, String container,
- Blob blob) {
- checkNotNull(asyncBlobStore, "asyncBlobStore");
- checkNotNull(container, "container");
-
- String name = blobName.apply(blob);
- if (name.indexOf('/') > 0) {
- return asyncBlobStore.createDirectory(container, parseDirectoryFromPath(name));
- } else {
- return Futures.immediateFuture(null);
- }
- }
public static MutableBlobMetadata copy(MutableBlobMetadata in) {
MutableBlobMetadata metadata = new MutableBlobMetadataImpl(in);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/56a2a8bf/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java
----------------------------------------------------------------------
diff --git a/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java b/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java
index d412e9d..30b399b 100644
--- a/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java
+++ b/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java
@@ -16,11 +16,6 @@
*/
package org.jclouds.blobstore.util;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.jclouds.blobstore.util.BlobStoreUtils.createParentIfNeededAsync;
import static org.jclouds.blobstore.util.BlobStoreUtils.getNameFor;
import static org.jclouds.reflect.Reflection2.method;
import static org.testng.Assert.assertEquals;
@@ -28,83 +23,16 @@ import static org.testng.Assert.assertEquals;
import java.net.URI;
import java.util.List;
-import org.jclouds.blobstore.AsyncBlobStore;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.MutableBlobMetadata;
import org.jclouds.reflect.Invocation;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.testng.annotations.Test;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
-/**
- * Tests behavior of {@code BlobStoreUtils}
- */
+
@Test(groups = "unit")
public class BlobStoreUtilsTest {
- public void testCreateParentIfNeededAsyncNoPath() {
- AsyncBlobStore asyncBlobStore = createMock(AsyncBlobStore.class);
- String container = "container";
- Blob blob = createMock(Blob.class);
- MutableBlobMetadata md = createMock(MutableBlobMetadata.class);
-
- expect(blob.getMetadata()).andReturn(md).atLeastOnce();
- expect(md.getName()).andReturn("hello").atLeastOnce();
-
- replay(asyncBlobStore);
- replay(blob);
- replay(md);
-
- createParentIfNeededAsync(asyncBlobStore, container, blob);
-
- verify(asyncBlobStore);
- verify(blob);
- verify(md);
- }
-
- public void testCreateParentIfNeededAsyncSinglePath() {
- AsyncBlobStore asyncBlobStore = createMock(AsyncBlobStore.class);
- String container = "container";
- Blob blob = createMock(Blob.class);
- MutableBlobMetadata md = createMock(MutableBlobMetadata.class);
-
- expect(blob.getMetadata()).andReturn(md).atLeastOnce();
- expect(md.getName()).andReturn("rootpath/hello").atLeastOnce();
- expect(asyncBlobStore.createDirectory("container", "rootpath")).andReturn(null);
-
- replay(asyncBlobStore);
- replay(blob);
- replay(md);
-
- createParentIfNeededAsync(asyncBlobStore, container, blob);
-
- verify(asyncBlobStore);
- verify(blob);
- verify(md);
- }
-
- public void testCreateParentIfNeededAsyncNestedPath() {
- AsyncBlobStore asyncBlobStore = createMock(AsyncBlobStore.class);
- String container = "container";
- Blob blob = createMock(Blob.class);
- MutableBlobMetadata md = createMock(MutableBlobMetadata.class);
-
- expect(blob.getMetadata()).andReturn(md).atLeastOnce();
- expect(md.getName()).andReturn("rootpath/subpath/hello").atLeastOnce();
- expect(asyncBlobStore.createDirectory("container", "rootpath/subpath")).andReturn(null);
-
- replay(asyncBlobStore);
- replay(blob);
- replay(md);
-
- createParentIfNeededAsync(asyncBlobStore, container, blob);
-
- verify(asyncBlobStore);
- verify(blob);
- verify(md);
- }
-
public void testGetKeyForAzureS3AndRackspace() {
GeneratedHttpRequest request = requestForEndpointAndArgs(
"https://jclouds.blob.core.windows.net/adriancole-blobstore0/five",
http://git-wip-us.apache.org/repos/asf/jclouds/blob/56a2a8bf/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java
index 865f42c..9545e75 100644
--- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java
+++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java
@@ -32,7 +32,6 @@ import java.util.UUID;
import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.s3.domain.DeleteResult;
-import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.KeyNotFoundException;
import org.jclouds.blobstore.domain.Blob;
@@ -146,20 +145,6 @@ public class AWSS3ClientLiveTest extends S3ClientLiveTest {
}
}
- public void testMultipartAsynchronouslySmallBlob() throws IOException, InterruptedException, Exception {
- String containerName = getContainerName();
-
- try {
- AsyncBlobStore asyncBlobStore = view.getAsyncBlobStore();
- asyncBlobStore.createContainerInLocation(null, containerName).get();
- Blob blob = asyncBlobStore.blobBuilder("small").payload("small").build();
- asyncBlobStore.putBlob(containerName, blob, PutOptions.Builder.multipart()).get();
-
- } finally {
- returnContainer(containerName);
- }
- }
-
public void testPutWithReducedRedundancyStorage() throws InterruptedException {
String containerName = getContainerName();
try {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/56a2a8bf/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java
----------------------------------------------------------------------
diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java
index 564adea..f7213d4 100644
--- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java
+++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java
@@ -16,9 +16,12 @@
*/
package org.jclouds.hpcloud.objectstorage.blobstore;
+import static org.jclouds.Constants.PROPERTY_USER_THREADS;
+
import java.util.Set;
import javax.inject.Inject;
+import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;
@@ -41,6 +44,7 @@ import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata;
import org.jclouds.openstack.swift.blobstore.strategy.internal.MultipartUploadStrategy;
import com.google.common.base.Supplier;
+import com.google.common.util.concurrent.ListeningExecutorService;
@Singleton
public class HPCloudObjectStorageBlobStore extends SwiftBlobStore {
@@ -48,17 +52,18 @@ public class HPCloudObjectStorageBlobStore extends SwiftBlobStore {
private EnableCDNAndCache enableCDNAndCache;
@Inject
- protected HPCloudObjectStorageBlobStore(BlobStoreContext context, BlobUtils blobUtils,
- Supplier<Location> defaultLocation, @Memoized Supplier<Set<? extends Location>> locations,
- HPCloudObjectStorageApi sync, ContainerToResourceMetadata container2ResourceMd,
- BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
- ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object,
- ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions,
- Provider<FetchBlobMetadata> fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache,
- Provider<MultipartUploadStrategy> multipartUploadStrategy) {
- super(context, blobUtils, defaultLocation, locations, sync, container2ResourceMd, container2ContainerListOptions,
- container2ResourceList, object2Blob, blob2Object, object2BlobMd, blob2ObjectGetOptions,
- fetchBlobMetadataProvider, multipartUploadStrategy);
+ protected HPCloudObjectStorageBlobStore(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
+ BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
+ @Memoized Supplier<Set<? extends Location>> locations, HPCloudObjectStorageApi sync,
+ ContainerToResourceMetadata container2ResourceMd,
+ BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
+ ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object,
+ ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions,
+ Provider<FetchBlobMetadata> fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache,
+ Provider<MultipartUploadStrategy> multipartUploadStrategy) {
+ super(userExecutor, context, blobUtils, defaultLocation, locations, sync, container2ResourceMd,
+ container2ContainerListOptions, container2ResourceList, object2Blob, blob2Object, object2BlobMd,
+ blob2ObjectGetOptions, fetchBlobMetadataProvider, multipartUploadStrategy);
this.enableCDNAndCache = enableCDNAndCache;
}