mirror of https://github.com/apache/openjpa.git
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:
parent
ad4168b8d4
commit
4d25d3fa21
|
@ -51,7 +51,6 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase;
|
||||||
*/
|
*/
|
||||||
public class TestIndex extends SingleEMFTestCase {
|
public class TestIndex extends SingleEMFTestCase {
|
||||||
|
|
||||||
private OpenJPAEntityManagerFactorySPI emf2 = null;
|
|
||||||
private Log log = null;
|
private Log log = null;
|
||||||
|
|
||||||
private enum JPQLIndexEntityClasses implements JPAEntityClassEnum {
|
private enum JPQLIndexEntityClasses implements JPAEntityClassEnum {
|
||||||
|
@ -91,6 +90,11 @@ public class TestIndex extends SingleEMFTestCase {
|
||||||
private static final String[] Element_Names = { "A_Element", "B_Element",
|
private static final String[] Element_Names = { "A_Element", "B_Element",
|
||||||
"C_Element", "D_Element", "E_Element", "F_Element", };
|
"C_Element", "D_Element", "E_Element", "F_Element", };
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPersistenceUnitName() {
|
||||||
|
return "JPQLIndex";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
super.setUp(CLEAR_TABLES, TreeNode.class,
|
super.setUp(CLEAR_TABLES, TreeNode.class,
|
||||||
|
@ -99,13 +103,7 @@ public class TestIndex extends SingleEMFTestCase {
|
||||||
// XMLOrderedOneToManyEntity.class, XMLOrderedManyToManyEntity.class,
|
// XMLOrderedOneToManyEntity.class, XMLOrderedManyToManyEntity.class,
|
||||||
// XMLOrderedElementEntity.class, XMLUnorderedNameEntity.class);
|
// XMLOrderedElementEntity.class, XMLUnorderedNameEntity.class);
|
||||||
|
|
||||||
// create our EMF
|
log = emf.getConfiguration().getLog("test");
|
||||||
emf2 = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory(
|
|
||||||
"JPQLIndex",
|
|
||||||
"org/apache/openjpa/persistence/jpql/expressions/persistence.xml");
|
|
||||||
assertNotNull(emf2);
|
|
||||||
|
|
||||||
log = emf2.getConfiguration().getLog("test");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testO2MTreeQueryIndex() {
|
public void testO2MTreeQueryIndex() {
|
||||||
|
@ -160,7 +158,7 @@ public class TestIndex extends SingleEMFTestCase {
|
||||||
root.createTree(original);
|
root.createTree(original);
|
||||||
assertArrayEquals(original, root.getFanOuts());
|
assertArrayEquals(original, root.getFanOuts());
|
||||||
|
|
||||||
EntityManager em = emf2.createEntityManager();
|
EntityManager em = emf.createEntityManager();
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
em.persist(root);
|
em.persist(root);
|
||||||
em.getTransaction().commit();
|
em.getTransaction().commit();
|
||||||
|
@ -222,7 +220,7 @@ public class TestIndex extends SingleEMFTestCase {
|
||||||
|
|
||||||
// add the entities
|
// add the entities
|
||||||
log.trace("Adding " + newElements.size() + " of " + elementClassName + " to " + entityClassName);
|
log.trace("Adding " + newElements.size() + " of " + elementClassName + " to " + entityClassName);
|
||||||
em = emf2.createEntityManager();
|
em = emf.createEntityManager();
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
for (INameEntity newElement : newElements)
|
for (INameEntity newElement : newElements)
|
||||||
{
|
{
|
||||||
|
@ -283,7 +281,7 @@ public class TestIndex extends SingleEMFTestCase {
|
||||||
}
|
}
|
||||||
newEntity.setListElements(namesList);
|
newEntity.setListElements(namesList);
|
||||||
// add the entity
|
// add the entity
|
||||||
em = emf2.createEntityManager();
|
em = emf.createEntityManager();
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
em.persist(newEntity);
|
em.persist(newEntity);
|
||||||
em.getTransaction().commit();
|
em.getTransaction().commit();
|
||||||
|
@ -345,7 +343,7 @@ public class TestIndex extends SingleEMFTestCase {
|
||||||
+ Arrays.toString(Element_Names));
|
+ Arrays.toString(Element_Names));
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityManager em = emf2.createEntityManager();
|
EntityManager em = emf.createEntityManager();
|
||||||
em.clear();
|
em.clear();
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (String expectedEntityName : Element_Names) {
|
for (String expectedEntityName : Element_Names) {
|
||||||
|
@ -388,7 +386,7 @@ public class TestIndex extends SingleEMFTestCase {
|
||||||
+ Arrays.toString(Element_Names));
|
+ Arrays.toString(Element_Names));
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityManager em = emf2.createEntityManager();
|
EntityManager em = emf.createEntityManager();
|
||||||
em.clear();
|
em.clear();
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (String expectedEntityName : Element_Names) {
|
for (String expectedEntityName : Element_Names) {
|
||||||
|
|
|
@ -322,6 +322,7 @@
|
||||||
<persistence-unit name="JPQLIndex">
|
<persistence-unit name="JPQLIndex">
|
||||||
<mapping-file>org/apache/openjpa/persistence/jpql/expressions/orm.xml</mapping-file>
|
<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.OrderedElementEntity</class>
|
||||||
<class>org.apache.openjpa.persistence.jpql.entities.XMLOrderedElementEntity</class>
|
<class>org.apache.openjpa.persistence.jpql.entities.XMLOrderedElementEntity</class>
|
||||||
<class>org.apache.openjpa.persistence.jpql.entities.OrderedManyToManyEntity</class>
|
<class>org.apache.openjpa.persistence.jpql.entities.OrderedManyToManyEntity</class>
|
||||||
|
|
Loading…
Reference in New Issue