You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2013/09/03 04:37:55 UTC
[1/2] git commit: Simplify testPutFileParallel
Updated Branches:
refs/heads/1.6.x 8e16ecb3e -> 0143a56fb
Simplify testPutFileParallel
Create only one temporary file and use explicit delete instead
finalization to remove it.
Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/commit/e2489f39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/tree/e2489f39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/diff/e2489f39
Branch: refs/heads/1.6.x
Commit: e2489f394278742ffbbde00160117d1107f8bb4b
Parents: 8e16ecb
Author: Andrew Gaul <ga...@apache.org>
Authored: Mon Aug 26 23:19:57 2013 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Mon Sep 2 19:36:15 2013 -0700
----------------------------------------------------------------------
.../integration/internal/BaseBlobIntegrationTest.java | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/e2489f39/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 fceeb85..f404806 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
@@ -127,8 +127,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
public void testPutFileParallel() throws InterruptedException, IOException, TimeoutException {
File payloadFile = File.createTempFile("testPutFileParallel", "png");
- Files.copy(createTestInput(), payloadFile);
- payloadFile.deleteOnExit();
+ Files.write(createTestInput(), payloadFile);
final Payload testPayload = Payloads.newFilePayload(payloadFile);
final byte[] md5 = md5Supplier(testPayload);
@@ -165,6 +164,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
assert exceptions.size() == 0 : exceptions;
} finally {
+ payloadFile.delete();
returnContainer(container);
}
}
@@ -604,13 +604,10 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
assertEquals(metadata.getContentMetadata().getContentMD5(), md5().hashString(TEST_STRING, UTF_8).asBytes());
}
- private File createTestInput() throws IOException {
- File file = File.createTempFile("testimg", "png");
- file.deleteOnExit();
+ private byte[] createTestInput() throws IOException {
Random random = new Random();
byte[] buffer = new byte[random.nextInt(2 * 1024 * 1024)];
random.nextBytes(buffer);
- Files.copy(ByteStreams.newInputStreamSupplier(buffer), file);
- return file;
+ return buffer;
}
}
[2/2] git commit: Reduce testPutFileParallel input size to ~160 KB
Posted by ga...@apache.org.
Reduce testPutFileParallel input size to ~160 KB
Previously this test uploaded ~10 MB in 30 seconds which failed on
slower connections, causing spurious test failures. The larger input
size provides no benefit.
Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/commit/0143a56f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/tree/0143a56f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/diff/0143a56f
Branch: refs/heads/1.6.x
Commit: 0143a56fb5800929e2180a86f787fc044fc61ad6
Parents: e2489f3
Author: Andrew Gaul <ga...@apache.org>
Authored: Mon Sep 2 14:51:20 2013 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Mon Sep 2 19:36:18 2013 -0700
----------------------------------------------------------------------
.../integration/internal/BaseBlobIntegrationTest.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/0143a56f/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 f404806..df05ca7 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
@@ -127,7 +127,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
public void testPutFileParallel() throws InterruptedException, IOException, TimeoutException {
File payloadFile = File.createTempFile("testPutFileParallel", "png");
- Files.write(createTestInput(), payloadFile);
+ Files.write(createTestInput(32 * 1024), payloadFile);
final Payload testPayload = Payloads.newFilePayload(payloadFile);
final byte[] md5 = md5Supplier(testPayload);
@@ -604,9 +604,9 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
assertEquals(metadata.getContentMetadata().getContentMD5(), md5().hashString(TEST_STRING, UTF_8).asBytes());
}
- private byte[] createTestInput() throws IOException {
+ private static byte[] createTestInput(int length) throws IOException {
Random random = new Random();
- byte[] buffer = new byte[random.nextInt(2 * 1024 * 1024)];
+ byte[] buffer = new byte[random.nextInt(length)];
random.nextBytes(buffer);
return buffer;
}