Merge pull request #1517 from jclouds/fix-java7-empty-put-test

Fixing S3ClientMockTest hanging on Java 7 since 843ed57
This commit is contained in:
Adrian Cole 2013-04-10 07:03:58 -07:00
commit ebc574d378
1 changed files with 4 additions and 2 deletions

View File

@ -70,14 +70,16 @@ public class S3ClientMockTest {
public void testZeroLengthPutHasContentLengthHeader() throws IOException, InterruptedException { public void testZeroLengthPutHasContentLengthHeader() throws IOException, InterruptedException {
MockWebServer server = new MockWebServer(); MockWebServer server = new MockWebServer();
server.enqueue(new MockResponse().setBody("").addHeader(ETAG, "ABCDEF")); server.enqueue(new MockResponse().addHeader(ETAG, "ABCDEF"));
// hangs on Java 7 without this additional response ?!?
server.enqueue(new MockResponse().addHeader(ETAG, "ABCDEF"));
server.play(); server.play();
S3Client client = getS3Client(server.getUrl("/")); S3Client client = getS3Client(server.getUrl("/"));
S3Object nada = client.newS3Object(); S3Object nada = client.newS3Object();
nada.getMetadata().setKey("object"); nada.getMetadata().setKey("object");
nada.setPayload(new byte[] {}); nada.setPayload(new byte[] {});
assertEquals(client.putObject("bucket", nada), "ABCDEF"); assertEquals(client.putObject("bucket", nada), "ABCDEF");
RecordedRequest request = server.takeRequest(); RecordedRequest request = server.takeRequest();