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 2014/07/19 14:25:38 UTC
git commit: Close streams in integration tests
Repository: jclouds
Updated Branches:
refs/heads/master 0c005f809 -> dd3dc9790
Close streams in integration tests
Also remove bogus delete workaround. Previously unclosed
FileInputStream caused test failures on Windows which cannot delete
open files. Found with Kohsuke's file-leak-detector.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/dd3dc979
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/dd3dc979
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/dd3dc979
Branch: refs/heads/master
Commit: dd3dc9790e470271e1f29a8e046465c5f243d452
Parents: 0c005f8
Author: Andrew Gaul <ga...@apache.org>
Authored: Fri Jul 18 15:36:47 2014 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Sat Jul 19 05:25:20 2014 -0700
----------------------------------------------------------------------
.../src/main/java/org/jclouds/filesystem/util/Utils.java | 9 +--------
.../internal/BaseBlobStoreIntegrationTest.java | 10 +---------
2 files changed, 2 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd3dc979/apis/filesystem/src/main/java/org/jclouds/filesystem/util/Utils.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/main/java/org/jclouds/filesystem/util/Utils.java b/apis/filesystem/src/main/java/org/jclouds/filesystem/util/Utils.java
index bb174fc..6a3bbf9 100644
--- a/apis/filesystem/src/main/java/org/jclouds/filesystem/util/Utils.java
+++ b/apis/filesystem/src/main/java/org/jclouds/filesystem/util/Utils.java
@@ -18,9 +18,6 @@ package org.jclouds.filesystem.util;
import java.io.File;
import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-import com.google.common.util.concurrent.Uninterruptibles;
/**
* Utilities for the filesystem blobstore.
@@ -42,11 +39,7 @@ public class Utils {
}
}
if (!file.delete()) {
- // On windows, often the directory does not register as empty right away.
- Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);
- if (!file.delete()) {
- throw new IOException("Could not delete: " + file);
- }
+ throw new IOException("Could not delete: " + file);
}
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd3dc979/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobStoreIntegrationTest.java
----------------------------------------------------------------------
diff --git a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobStoreIntegrationTest.java b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobStoreIntegrationTest.java
index c7344e9..2173efb 100644
--- a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobStoreIntegrationTest.java
+++ b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobStoreIntegrationTest.java
@@ -22,7 +22,6 @@ import static org.jclouds.reflect.Reflection2.typeToken;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
-import java.io.InputStream;
import java.security.SecureRandom;
import java.util.Date;
import java.util.Map;
@@ -516,14 +515,7 @@ public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreCont
public static String getContentAsStringOrNullAndClose(Blob blob) throws IOException {
checkNotNull(blob, "blob");
checkNotNull(blob.getPayload(), "blob.payload");
- if (blob.getPayload().getInput() == null)
- return null;
- Object o = blob.getPayload().getInput();
- if (o instanceof InputStream) {
- return Strings2.toStringAndClose((InputStream) o);
- } else {
- throw new IllegalArgumentException("Object type not supported: " + o.getClass().getName());
- }
+ return Strings2.toStringAndClose(blob.getPayload().openStream());
}
protected Module createHttpModule() {
return new JavaUrlHttpCommandExecutorServiceModule();