mirror of https://github.com/apache/openjpa.git
more testcase comments about what gets cleaned up and print err msg if an EM or EMF cannot be closed.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1022698 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c479f35f68
commit
db1ce09390
|
@ -234,7 +234,9 @@ public abstract class AbstractPersistenceTestCase extends TestCase {
|
||||||
} finally {
|
} finally {
|
||||||
emf.close();
|
emf.close();
|
||||||
brc = !emf.isOpen();
|
brc = !emf.isOpen();
|
||||||
emf = null;
|
if (!brc) {
|
||||||
|
System.err.println("AbstractPersistenceTestCase().closeEMF() - EMF is still open.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return brc;
|
return brc;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +255,11 @@ public abstract class AbstractPersistenceTestCase extends TestCase {
|
||||||
em.getTransaction().rollback();
|
em.getTransaction().rollback();
|
||||||
}
|
}
|
||||||
em.close();
|
em.close();
|
||||||
return true;
|
boolean brc = !em.isOpen();
|
||||||
|
if (!brc) {
|
||||||
|
System.err.println("AbstractPersistenceTestCase().closeEM() - EM is still open.");
|
||||||
|
}
|
||||||
|
return brc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,7 +31,8 @@ import org.apache.openjpa.lib.jdbc.JDBCListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for tests that need to check generated SQL.
|
* Base class for tests that need to check generated SQL.
|
||||||
* Extends SingleEMFTestCase, which will cleanup the EMF it provides.
|
* Extends SingleEMFTestCase, which will cleanup the EMF it provides,
|
||||||
|
* along with any EMs generated by that EMF.
|
||||||
*
|
*
|
||||||
* @author Patrick Linskey
|
* @author Patrick Linskey
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -38,8 +38,8 @@ import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
|
||||||
* OpenJPA-extended SPI interface <code>OpenJPAEntityManagerFactorySPI</code>
|
* OpenJPA-extended SPI interface <code>OpenJPAEntityManagerFactorySPI</code>
|
||||||
* so that derived classes can access internal mapping/metadata/configuration
|
* so that derived classes can access internal mapping/metadata/configuration
|
||||||
* and other structures.
|
* and other structures.
|
||||||
* Extends AbstractCachedEMFTestCase, which extends AbstractPersistenceTestCase
|
* Extends AbstractCachedEMFTestCase, which extends AbstractPersistenceTestCase.
|
||||||
* and cleans up the EMF it provides in tearDown().
|
* Cleans up the EMF it provides and any EMs created from it in tearDown().
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class SingleEMFTestCase
|
public abstract class SingleEMFTestCase
|
||||||
|
|
|
@ -59,8 +59,8 @@ public abstract class SingleEMTestCase
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
rollback();
|
closeEM(em);
|
||||||
close();
|
em = null;
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue