From e68daeab353c7a60ac4adba7416aeb2722c317e7 Mon Sep 17 00:00:00 2001 From: Andy Seaborne Date: Thu, 26 Oct 2017 13:15:07 +0100 Subject: [PATCH 1/2] Make surefire run TC_* --- jena-db/jena-dboe-base/pom.xml | 12 ++++++++++++ jena-db/jena-dboe-trans-data/pom.xml | 15 ++++++++++++++- jena-db/jena-tdb2/pom.xml | 15 +++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/jena-db/jena-dboe-base/pom.xml b/jena-db/jena-dboe-base/pom.xml index 9204635f57e..e97d17194c8 100644 --- a/jena-db/jena-dboe-base/pom.xml +++ b/jena-db/jena-dboe-base/pom.xml @@ -50,6 +50,17 @@ + + + org.apache.maven.plugins + maven-surefire-report-plugin + + + **/TC_*.java + + + + org.apache.maven.plugins maven-jar-plugin @@ -61,6 +72,7 @@ + diff --git a/jena-db/jena-dboe-trans-data/pom.xml b/jena-db/jena-dboe-trans-data/pom.xml index f38c489b113..21dd7bed336 100644 --- a/jena-db/jena-dboe-trans-data/pom.xml +++ b/jena-db/jena-dboe-trans-data/pom.xml @@ -57,8 +57,21 @@ tests test - + + + + org.apache.maven.plugins + maven-surefire-report-plugin + + + **/TC_*.java + + + + + + diff --git a/jena-db/jena-tdb2/pom.xml b/jena-db/jena-tdb2/pom.xml index 833702ccd3d..f996db6b944 100644 --- a/jena-db/jena-tdb2/pom.xml +++ b/jena-db/jena-tdb2/pom.xml @@ -65,4 +65,19 @@ + + + + org.apache.maven.plugins + maven-surefire-report-plugin + + + **/TC_*.java + + + + + + + From 10441d7f819f9dc9b4ed5191e28821e04a1e0cb1 Mon Sep 17 00:00:00 2001 From: Andy Seaborne Date: Thu, 26 Oct 2017 13:15:10 +0100 Subject: [PATCH 2/2] Check .delete() in beforeTest --- .../dboe/base/file/TestProcessFileLock.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/jena-db/jena-dboe-base/src/test/java/org/apache/jena/dboe/base/file/TestProcessFileLock.java b/jena-db/jena-dboe-base/src/test/java/org/apache/jena/dboe/base/file/TestProcessFileLock.java index 9c72c71dd02..d434a89ee3b 100644 --- a/jena-db/jena-dboe-base/src/test/java/org/apache/jena/dboe/base/file/TestProcessFileLock.java +++ b/jena-db/jena-dboe-base/src/test/java/org/apache/jena/dboe/base/file/TestProcessFileLock.java @@ -18,17 +18,18 @@ package org.apache.jena.dboe.base.file; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; +import org.apache.jena.atlas.RuntimeIOException; +import org.apache.jena.atlas.io.IO; import org.apache.jena.atlas.lib.FileOps; -import org.apache.jena.dboe.base.file.AlreadyLocked; -import org.apache.jena.dboe.base.file.ProcessFileLock; import org.apache.jena.dboe.sys.Names; import org.junit.Before; import org.junit.BeforeClass; @@ -40,7 +41,6 @@ public class TestProcessFileLock { private static final String DIR = "target/locktest"; private static final String lockfile = DIR+"/"+Names.TDB_LOCK_FILE; - @BeforeClass public static void beforeClass() { FileOps.ensureDir(DIR); } @@ -48,12 +48,14 @@ public class TestProcessFileLock { @Before public void beforeTest() { File f = new File(lockfile); try { - f.delete(); + if ( FileOps.exists(lockfile) ) { + boolean b = f.delete(); + if ( !b ) + throw new RuntimeIOException("Failed to delete "+lockfile); + } f.createNewFile(); } - catch (IOException e) { - e.printStackTrace(); - } + catch (IOException e) { IO.exception(e); } } @Test public void process_lock_1() {