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/08/28 08:06:42 UTC
git commit: Simplify testPutFileParallel
Updated Branches:
refs/heads/master 4ca531aa9 -> 607b178c6
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/607b178c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/tree/607b178c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/diff/607b178c
Branch: refs/heads/master
Commit: 607b178c6b344aabebdb209034761e1e05ecd33b
Parents: 4ca531a
Author: Andrew Gaul <ga...@apache.org>
Authored: Mon Aug 26 23:19:57 2013 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Tue Aug 27 23:06:18 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/607b178c/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 19ec3f5..2c80bb1 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
@@ -134,8 +134,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);
@@ -172,6 +171,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
assert exceptions.size() == 0 : exceptions;
} finally {
+ payloadFile.delete();
returnContainer(container);
}
}
@@ -611,13 +611,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;
}
}