diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestIndex.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestIndex.java index d092b8313..1bef04b65 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestIndex.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestIndex.java @@ -51,7 +51,6 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase; */ public class TestIndex extends SingleEMFTestCase { - private OpenJPAEntityManagerFactorySPI emf2 = null; private Log log = null; private enum JPQLIndexEntityClasses implements JPAEntityClassEnum { @@ -91,6 +90,11 @@ public class TestIndex extends SingleEMFTestCase { private static final String[] Element_Names = { "A_Element", "B_Element", "C_Element", "D_Element", "E_Element", "F_Element", }; + @Override + protected String getPersistenceUnitName() { + return "JPQLIndex"; + } + @Override public void setUp() { super.setUp(CLEAR_TABLES, TreeNode.class, @@ -99,13 +103,7 @@ public class TestIndex extends SingleEMFTestCase { // XMLOrderedOneToManyEntity.class, XMLOrderedManyToManyEntity.class, // XMLOrderedElementEntity.class, XMLUnorderedNameEntity.class); - // create our EMF - emf2 = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory( - "JPQLIndex", - "org/apache/openjpa/persistence/jpql/expressions/persistence.xml"); - assertNotNull(emf2); - - log = emf2.getConfiguration().getLog("test"); + log = emf.getConfiguration().getLog("test"); } public void testO2MTreeQueryIndex() { @@ -160,7 +158,7 @@ public class TestIndex extends SingleEMFTestCase { root.createTree(original); assertArrayEquals(original, root.getFanOuts()); - EntityManager em = emf2.createEntityManager(); + EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); em.persist(root); em.getTransaction().commit(); @@ -222,7 +220,7 @@ public class TestIndex extends SingleEMFTestCase { // add the entities log.trace("Adding " + newElements.size() + " of " + elementClassName + " to " + entityClassName); - em = emf2.createEntityManager(); + em = emf.createEntityManager(); em.getTransaction().begin(); for (INameEntity newElement : newElements) { @@ -283,7 +281,7 @@ public class TestIndex extends SingleEMFTestCase { } newEntity.setListElements(namesList); // add the entity - em = emf2.createEntityManager(); + em = emf.createEntityManager(); em.getTransaction().begin(); em.persist(newEntity); em.getTransaction().commit(); @@ -345,7 +343,7 @@ public class TestIndex extends SingleEMFTestCase { + Arrays.toString(Element_Names)); } - EntityManager em = emf2.createEntityManager(); + EntityManager em = emf.createEntityManager(); em.clear(); int idx = 0; for (String expectedEntityName : Element_Names) { @@ -388,7 +386,7 @@ public class TestIndex extends SingleEMFTestCase { + Arrays.toString(Element_Names)); } - EntityManager em = emf2.createEntityManager(); + EntityManager em = emf.createEntityManager(); em.clear(); int idx = 0; for (String expectedEntityName : Element_Names) { diff --git a/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml b/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml index a4f25d669..afb8a90fd 100644 --- a/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml +++ b/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml @@ -322,6 +322,7 @@ org/apache/openjpa/persistence/jpql/expressions/orm.xml + org.apache.openjpa.persistence.proxy.TreeNode org.apache.openjpa.persistence.jpql.entities.OrderedElementEntity org.apache.openjpa.persistence.jpql.entities.XMLOrderedElementEntity org.apache.openjpa.persistence.jpql.entities.OrderedManyToManyEntity