From 47a0f41e728acbe80b1f1b1f2e6631252a5bb711 Mon Sep 17 00:00:00 2001 From: Pinaki Poddar Date: Fri, 30 Jan 2009 05:33:42 +0000 Subject: [PATCH] Reuse EMF. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@739178 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/openjpa/conf/TestDynamicConfiguration.java | 4 ++-- .../apache/openjpa/persistence/test/PersistenceTestCase.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/conf/TestDynamicConfiguration.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/conf/TestDynamicConfiguration.java index e8949649b..ca70e0449 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/conf/TestDynamicConfiguration.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/conf/TestDynamicConfiguration.java @@ -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(); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java index 254eec714..c8cb7a9d1 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java @@ -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)