OPENJPA-855 proper XML entity cleanup between test runs

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@917567 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald Woods 2010-03-01 16:08:10 +00:00
parent ad4168b8d4
commit 4d25d3fa21
2 changed files with 12 additions and 13 deletions

View File

@ -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) {

View File

@ -322,6 +322,7 @@
<persistence-unit name="JPQLIndex">
<mapping-file>org/apache/openjpa/persistence/jpql/expressions/orm.xml</mapping-file>
<class>org.apache.openjpa.persistence.proxy.TreeNode</class>
<class>org.apache.openjpa.persistence.jpql.entities.OrderedElementEntity</class>
<class>org.apache.openjpa.persistence.jpql.entities.XMLOrderedElementEntity</class>
<class>org.apache.openjpa.persistence.jpql.entities.OrderedManyToManyEntity</class>