OPENJPA-2768 delete xmlstore test db between runs.

This did lead to errors when running the tests multiple times.
This commit is contained in:
Mark Struberg 2019-01-14 09:02:44 +01:00
parent aae0a95f6c
commit 40d19ebc6c
2 changed files with 19 additions and 1 deletions

View File

@ -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 {

View File

@ -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>