diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestAdvAnnot.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestAdvAnnot.java index 5f938874f..ea86cc7f3 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestAdvAnnot.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestAdvAnnot.java @@ -27,8 +27,10 @@ import javax.persistence.*; import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.*; import org.apache.openjpa.persistence.common.utils.*; +import org.apache.openjpa.persistence.test.AllowFailure; import org.apache.openjpa.persistence.OpenJPAEntityManager; +@AllowFailure(message="excluded") public class TestAdvAnnot extends AnnotationTestCase { public TestAdvAnnot(String name) @@ -36,8 +38,7 @@ public class TestAdvAnnot extends AnnotationTestCase super(name, "annotationcactusapp"); } - public void setUp() - { + public void setUp() { deleteAll(Schedule.class); deleteAll(FlightSchedule.class); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestAnnotationBasics.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestAnnotationBasics.java index 0971962ab..b0d461ca1 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestAnnotationBasics.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestAnnotationBasics.java @@ -46,6 +46,7 @@ public class TestAnnotationBasics extends AnnotationTestCase { ClassMetaData.ID_APPLICATION == meta.getIdentityType()); assertTrue("Entity1 should use single-field identity", meta.isOpenJPAIdentity()); + endEm(em); } /* public void testVersionField() { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestDDCallbackMethods.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestDDCallbackMethods.java index 7c2982bd9..7d572193e 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestDDCallbackMethods.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestDDCallbackMethods.java @@ -24,9 +24,11 @@ import junit.framework.*; import javax.persistence.*; import org.apache.openjpa.persistence.common.utils.*; +import org.apache.openjpa.persistence.test.AllowFailure; import org.apache.openjpa.persistence.annotations.common.apps.annotApp.ddtype.*; import org.apache.openjpa.persistence.OpenJPAEntityManager; +@AllowFailure(message="excluded") public class TestDDCallbackMethods extends AnnotationTestCase { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEJBEmbedded.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEJBEmbedded.java index cc5d95203..d71e5aa46 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEJBEmbedded.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEJBEmbedded.java @@ -33,6 +33,7 @@ import org.apache.openjpa.persistence.OpenJPAEntityManager; import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.*; import org.apache.openjpa.persistence.common.utils.*; +import org.apache.openjpa.persistence.test.AllowFailure; import junit.framework.*; @@ -41,6 +42,7 @@ import junit.framework.*; * * @author Steve Kim */ +@AllowFailure(message="excluded") public class TestEJBEmbedded extends AnnotationTestCase { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEntityListenerAnnot.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEntityListenerAnnot.java index 22b08274d..7c918d7b0 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEntityListenerAnnot.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEntityListenerAnnot.java @@ -24,11 +24,13 @@ import javax.persistence.*; import junit.framework.*; import org.apache.openjpa.persistence.common.utils.*; +import org.apache.openjpa.persistence.test.AllowFailure; import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.*; import org.apache.openjpa.persistence.OpenJPAEntityManager; +@AllowFailure(message="excluded") public class TestEntityListenerAnnot extends AnnotationTestCase { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEntityOrderBy.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEntityOrderBy.java index 970f419ee..0db67eeb2 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEntityOrderBy.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestEntityOrderBy.java @@ -27,6 +27,7 @@ import org.apache.openjpa.persistence.OpenJPAEntityManager; import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.*; import org.apache.openjpa.persistence.common.utils.*; +import org.apache.openjpa.persistence.test.AllowFailure; import junit.framework.*; @@ -35,6 +36,7 @@ import junit.framework.*; * * @author Abe White */ +@AllowFailure(message="excluded") public class TestEntityOrderBy extends AnnotationTestCase { diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestPersistentCollection.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestPersistentCollection.java index a50d73cc5..d551babe8 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestPersistentCollection.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestPersistentCollection.java @@ -41,9 +41,8 @@ public class TestPersistentCollection extends SingleEMFTestCase { @SuppressWarnings("unchecked") public void testPersistentCollectionOfEmbeddables() { + EntityManager em = emf.createEntityManager(); try { - EntityManager em = emf.createEntityManager(); - em.getTransaction().begin(); PColl_EntityC c = new PColl_EntityC(); @@ -59,6 +58,7 @@ public class TestPersistentCollection extends SingleEMFTestCase { em.persist(a); em.getTransaction().commit(); em.close(); + em = null; em = emf.createEntityManager(); Query q = em.createQuery("SELECT o FROM PColl_EntityA o"); @@ -73,16 +73,19 @@ public class TestPersistentCollection extends SingleEMFTestCase { assertEquals(101, c1.getId()); assertEquals(1, d1.getId()); em.close(); + em = null; } catch (Throwable t) { fail(t.getMessage()); + } finally { + if (em != null) + em.close(); } } @SuppressWarnings("unchecked") public void testPersistentCollectionOfEntities() { + EntityManager em = emf.createEntityManager(); try { - EntityManager em = emf.createEntityManager(); - em.getTransaction().begin(); PColl_EntityC c = new PColl_EntityC(); @@ -98,6 +101,7 @@ public class TestPersistentCollection extends SingleEMFTestCase { em.persist(a); em.getTransaction().commit(); em.close(); + em = null; em = emf.createEntityManager(); Query q = em.createQuery("SELECT o FROM PColl_EntityA1 o"); @@ -113,15 +117,18 @@ public class TestPersistentCollection extends SingleEMFTestCase { assertEquals(101, c1.getId()); assertEquals(1, a1.getId()); em.close(); + em = null; } catch (Throwable t) { fail(t.getMessage()); + } finally { + if (em != null) + em.close(); } } public void testPersistentCollectionStringsLazy() { + EntityManager em = emf.createEntityManager(); try { - EntityManager em = emf.createEntityManager(); - em.getTransaction().begin(); PColl_EntityStringLazy a = new PColl_EntityStringLazy(); @@ -130,6 +137,7 @@ public class TestPersistentCollection extends SingleEMFTestCase { em.persist(a); em.getTransaction().commit(); em.close(); + em = null; em = emf.createEntityManager(); Query q = em.createQuery("SELECT o FROM PColl_EntityStringLazy o"); @@ -139,15 +147,18 @@ public class TestPersistentCollection extends SingleEMFTestCase { assertEquals("one", a1.getCollectionOfStrings().toArray()[0]); assertEquals(1, a1.getId()); em.close(); + em = null; } catch (Throwable t) { fail(t.getMessage()); + } finally { + if (em != null) + em.close(); } } public void testPersistentCollectionStringsEager() { + EntityManager em = emf.createEntityManager(); try { - EntityManager em = emf.createEntityManager(); - em.getTransaction().begin(); PColl_EntityStringEager a = new PColl_EntityStringEager(); @@ -156,6 +167,7 @@ public class TestPersistentCollection extends SingleEMFTestCase { em.persist(a); em.getTransaction().commit(); em.close(); + em = null; em = emf.createEntityManager(); Query q = em.createQuery("SELECT o FROM PColl_EntityStringEager o"); @@ -165,8 +177,12 @@ public class TestPersistentCollection extends SingleEMFTestCase { assertEquals("one", a1.getCollectionOfStrings().toArray()[0]); assertEquals(1, a1.getId()); em.close(); + em = null; } catch (Throwable t) { fail(t.getMessage()); + } finally { + if (em != null) + em.close(); } } } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestPropertyAccess.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestPropertyAccess.java index ede5f1711..3df5818cb 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestPropertyAccess.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestPropertyAccess.java @@ -28,9 +28,9 @@ import import junit.framework.*; import org.apache.openjpa.persistence.common.utils.*; +import org.apache.openjpa.persistence.test.AllowFailure; - - +@AllowFailure(message="excluded") public class TestPropertyAccess extends AnnotationTestCase { public TestPropertyAccess(String name) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestTablePerClassInheritance.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestTablePerClassInheritance.java index 361e5dd93..3c34c30ff 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestTablePerClassInheritance.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestTablePerClassInheritance.java @@ -79,7 +79,7 @@ public class TestTablePerClassInheritance extends AnnotationTestCase deleteAll(TablePerClass1.class); OpenJPAEntityManager em = (OpenJPAEntityManager) currentEntityManager(); - startTx(em); + startTx(em); TablePerClass1 tpc1 = new TablePerClass1(); tpc1.setBasic(1); EmbedValue ev = new EmbedValue(); @@ -92,7 +92,7 @@ public class TestTablePerClassInheritance extends AnnotationTestCase ev.setBasic("22"); tpc2.setEmbed(ev); em.persistAll(tpc1, tpc2); - endTx(em); + endTx(em); int id1 = tpc1.getPk(); int id2 = tpc2.getPk(); endEm(em); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestVersion.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestVersion.java index 6815f764c..a2e4effc6 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestVersion.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/annotations/TestVersion.java @@ -26,6 +26,7 @@ import org.apache.openjpa.jdbc.meta.strats.* ; import org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.*; +import org.apache.openjpa.persistence.test.AllowFailure; import org.apache.openjpa.persistence.OpenJPAEntityManager; import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI; @@ -36,6 +37,7 @@ import org.apache.openjpa.persistence.OpenJPAPersistence; @author Steve Kim */ +@AllowFailure(message="excluded") public class TestVersion extends AnnotationTestCase { private Object oid;