You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commonsrdf.apache.org by st...@apache.org on 2016/10/07 15:01:51 UTC
[48/50] incubator-commonsrdf git commit: Fail if more than 15 seconds
Fail if more than 15 seconds
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/af598ff3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/af598ff3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/af598ff3
Branch: refs/heads/master
Commit: af598ff3dcd37fdaf33d2211574444338936c163
Parents: 0f8ef7a
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri Oct 7 15:57:30 2016 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri Oct 7 15:58:26 2016 +0100
----------------------------------------------------------------------
.../commons/rdf/rdf4j/NativeStoreGraphTest.java | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/af598ff3/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGraphTest.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGraphTest.java b/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGraphTest.java
index aed763b..238122f 100644
--- a/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGraphTest.java
+++ b/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGraphTest.java
@@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Collections;
import java.util.Set;
+import java.util.concurrent.TimeUnit;
import org.apache.commons.rdf.api.AbstractGraphTest;
import org.apache.commons.rdf.api.BlankNodeOrIRI;
@@ -36,6 +37,7 @@ import org.eclipse.rdf4j.sail.nativerdf.NativeStore;
import org.junit.After;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
+import org.junit.rules.Timeout;
/**
@@ -90,7 +92,6 @@ public class NativeStoreGraphTest extends AbstractGraphTest {
private SailRepository repository;
public void createRepository() throws IOException {
- System.out.println("Oh");
Sail sail = new NativeStore(tempDir.newFolder());
repository = new SailRepository(sail);
repository.initialize();
@@ -107,13 +108,24 @@ public class NativeStoreGraphTest extends AbstractGraphTest {
return repository;
}
+ @Rule
+ /**
+ * A timeout of more than 15 seconds pr test indicates typically that
+ * shutdownAndDelete failed.
+ */
+ public Timeout globalTimeout = Timeout.seconds(15);
+
@After
public void shutdownAndDelete() throws IOException {
// must shutdown before we delete
if (repository != null) {
- System.out.println("Shutting down rdf4j repository " + repository);
+ System.out.print("Shutting down rdf4j repository " + repository + "...");
+ // NOTE:
+ // If this takes about 20 seconds it means the code forgot to close a
+ // RepositoryConnection or RespositoryResult
+ // e.g. missing a try-with-resources block
repository.shutDown();
- System.out.println("rdf4j repository shut down.");
+ System.out.println("OK");
}
}