mirror of https://github.com/apache/openjpa.git
OPENJPA-2768 delete xmlstore test db between runs.
This did lead to errors when running the tests multiple times.
This commit is contained in:
parent
aae0a95f6c
commit
40d19ebc6c
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue