Reuse EMF.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@739178 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2009-01-30 05:33:42 +00:00
parent 3c85ec758a
commit 47a0f41e72
2 changed files with 3 additions and 3 deletions

View File

@ -40,11 +40,11 @@ public class TestDynamicConfiguration extends SingleEMFTestCase {
}
public void testConfigurationIsEqualByValueAndHashCode() {
OpenJPAEntityManagerFactorySPI emf1 = createEMF();
OpenJPAEntityManagerFactorySPI emf1 = createEMF(FRESH_EMF);
assertNotNull(emf1);
OpenJPAConfiguration conf1 = emf1.getConfiguration();
OpenJPAEntityManagerFactorySPI emf2 = createEMF();
OpenJPAEntityManagerFactorySPI emf2 = createEMF(FRESH_EMF);
assertNotNull(emf2);
OpenJPAConfiguration conf2 = emf2.getConfiguration();

View File

@ -149,7 +149,7 @@ public abstract class PersistenceTestCase
}
EMFKey key = new EMFKey(pu, map);
OpenJPAEntityManagerFactorySPI oemf = _emfs.get(key);
if (fresh || oemf == null) {
if (fresh || oemf == null || !oemf.isOpen()) {
Map config = new HashMap(System.getProperties());
config.putAll(map);
oemf = (OpenJPAEntityManagerFactorySPI)