openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [openjpa] branch master updated: OPENJPA-2768 delete xmlstore test db between runs.
Date Mon, 14 Jan 2019 08:05:00 GMT
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git


The following commit(s) were added to refs/heads/master by this push:
     new 40d19eb  OPENJPA-2768 delete xmlstore test db between runs.
40d19eb is described below

commit 40d19ebc6cf56ab60e6adaf22044162bbed5c8a6
Author: Mark Struberg <struberg@apache.org>
AuthorDate: Mon Jan 14 09:02:44 2019 +0100

    OPENJPA-2768 delete xmlstore test db between runs.
    
    This did lead to errors when running the tests multiple times.
---
 .../openjpa/xmlstore/simple/TestPersistence.java       | 18 ++++++++++++++++++
 pom.xml                                                |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/openjpa-xmlstore/src/test/java/org/apache/openjpa/xmlstore/simple/TestPersistence.java
b/openjpa-xmlstore/src/test/java/org/apache/openjpa/xmlstore/simple/TestPersistence.java
index 3e4f3c7..d1a5f98 100644
--- a/openjpa-xmlstore/src/test/java/org/apache/openjpa/xmlstore/simple/TestPersistence.java
+++ b/openjpa-xmlstore/src/test/java/org/apache/openjpa/xmlstore/simple/TestPersistence.java
@@ -18,6 +18,11 @@
  */
 package org.apache.openjpa.xmlstore.simple;
 
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
 import javax.persistence.EntityManager;
 import javax.persistence.EntityTransaction;
 
@@ -30,6 +35,19 @@ import org.apache.openjpa.persistence.test.AbstractPersistenceTestCase;
  */
 public class TestPersistence extends AbstractPersistenceTestCase {
 
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        // delete previous DB
+        Path dbDir = Paths.get("target/openjpa-xmlstore-db");
+        if (dbDir.toFile().exists()) {
+            Files.walk(dbDir)
+                    .map(Path::toFile)
+                    .forEach(File::delete);
+        }
+    }
+
     public void testCreateEntityManager() {
         OpenJPAEntityManagerFactorySPI emf = createNamedEMF("xmlstore-simple");
         try {
diff --git a/pom.xml b/pom.xml
index c1cc1ad..2de3e79 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,7 +42,7 @@
         <java.class.version>1.8</java.class.version>
         <java.testclass.version>1.8</java.testclass.version>
 
-	<doclint>none</doclint>
+        <doclint>none</doclint>
 
         <openjpa.version>${project.version}</openjpa.version>
         <openjpa.Log>DefaultLevel=INFO</openjpa.Log>


Mime
View raw message