jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [01/10] jena git commit: JENA-1406 use JUnit temp folder rule to create DB dir
Date Fri, 27 Oct 2017 19:42:09 GMT
Repository: jena
Updated Branches:
  refs/heads/master 48e0521c5 -> 92c793b67


JENA-1406 use JUnit temp folder rule to create DB dir


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/8587fb58
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/8587fb58
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/8587fb58

Branch: refs/heads/master
Commit: 8587fb58a5d22c0b081eb5a167f06945c2d194ed
Parents: 8b9f587
Author: Bruno P. Kinoshita <brunodepaulak@yahoo.com.br>
Authored: Thu Oct 26 21:22:54 2017 +1300
Committer: Bruno P. Kinoshita <brunodepaulak@yahoo.com.br>
Committed: Thu Oct 26 21:22:54 2017 +1300

----------------------------------------------------------------------
 .../apache/jena/tdb2/sys/TestDatabaseOps.java   | 24 ++++++++++++--------
 1 file changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/8587fb58/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/sys/TestDatabaseOps.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/sys/TestDatabaseOps.java
b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/sys/TestDatabaseOps.java
index 9956257..56a3fb0 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/sys/TestDatabaseOps.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/sys/TestDatabaseOps.java
@@ -33,7 +33,6 @@ import org.apache.jena.riot.RDFDataMgr ;
 import org.apache.jena.sparql.core.DatasetGraph ;
 import org.apache.jena.sparql.core.Quad ;
 import org.apache.jena.sparql.sse.SSE ;
-import org.apache.jena.tdb2.ConfigTest;
 import org.apache.jena.tdb2.DatabaseMgr;
 import org.apache.jena.tdb2.store.DatasetGraphSwitchable;
 import org.apache.jena.tdb2.store.DatasetGraphTDB;
@@ -42,12 +41,16 @@ import org.apache.jena.tdb2.sys.StoreConnection;
 import org.apache.jena.tdb2.sys.TDBInternal;
 import org.junit.After ;
 import org.junit.Before ;
+import org.junit.Rule;
 import org.junit.Test ;
+import org.junit.rules.TemporaryFolder;
 
 public class TestDatabaseOps
 {
-    static String DIRx = ConfigTest.getCleanDir() ;
-    static Location DIR = Location.create(DIRx);
+    @Rule
+    public TemporaryFolder tempFolder = new TemporaryFolder();
+
+    private Location dir = null;
     
     static Quad quad1 = SSE.parseQuad("(_ <s> <p> 1)") ;
     static Quad quad2 = SSE.parseQuad("(_ _:a <p> 2)") ;
@@ -57,18 +60,19 @@ public class TestDatabaseOps
     
     @Before
     public void before() {
-        FileUtils.deleteQuietly(IOX.asFile(DIR));
-        FileOps.ensureDir(DIR.getDirectoryPath());
+        dir = Location.create(tempFolder.toString());
+        FileUtils.deleteQuietly(IOX.asFile(dir));
+        FileOps.ensureDir(dir.getDirectoryPath());
     }
 
     @After  
     public void after() {
         TDBInternal.reset();
-        FileUtils.deleteQuietly(IOX.asFile(DIR));
+        FileUtils.deleteQuietly(IOX.asFile(dir));
     }
 
     @Test public void compact_dsg_1() {
-        DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(DIR);
+        DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(dir);
         DatasetGraphSwitchable dsgs = (DatasetGraphSwitchable)dsg;
         DatasetGraph dsg1 = dsgs.get();
         Location loc1 = ((DatasetGraphTDB)dsg1).getLocation();
@@ -102,7 +106,7 @@ public class TestDatabaseOps
 
     @Test public void compact_graph_2() {
         // graphs across compaction.
-        DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(DIR);
+        DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(dir);
         Graph g = dsg.getDefaultGraph();
         
         DatasetGraphSwitchable dsgs = (DatasetGraphSwitchable)dsg;
@@ -131,7 +135,7 @@ public class TestDatabaseOps
     
     @Test public void compact_prefixes_3() {
         // prefixes axcross compaction.
-        DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(DIR);
+        DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(dir);
         Graph g = dsg.getDefaultGraph();
         Txn.executeWrite(dsg, ()-> g.getPrefixMapping().setNsPrefix("ex", "http://example/")
);
         
@@ -157,7 +161,7 @@ public class TestDatabaseOps
     }
 
     @Test public void backup_1() {
-        DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(DIR);
+        DatasetGraph dsg = DatabaseMgr.connectDatasetGraph(dir);
         Txn.executeWrite(dsg, ()-> {
             dsg.add(quad2) ;
             dsg.add(quad1) ;


Mime
View raw message