diff --git a/apis/s3/pom.xml b/apis/s3/pom.xml index 50230203de..8aba6306ea 100644 --- a/apis/s3/pom.xml +++ b/apis/s3/pom.xml @@ -80,6 +80,12 @@ ${project.version} test + + org.apache.jclouds.driver + jclouds-okhttp + ${project.version} + test + log4j log4j 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 cf9c54da01..ef4e8ce643 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 modules = ImmutableSet. of( + private static final Set modules = ImmutableSet. of(new OkHttpCommandExecutorServiceModule(), new ExecutorServiceModule(sameThreadExecutor(), sameThreadExecutor())); 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();