openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r1022198 - in /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity: TestMappedById.java TestMapsIdXml.java TestMultipleLevelDerivedIdentity.java TestMultipleLevelDerivedIdentity1.java
Date Wed, 13 Oct 2010 17:20:31 GMT
Author: dwoods
Date: Wed Oct 13 17:20:30 2010
New Revision: 1022198

URL: http://svn.apache.org/viewvc?rev=1022198&view=rev
Log:
make sure tests close EMs

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMappedById.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMapsIdXml.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMappedById.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMappedById.java?rev=1022198&r1=1022197&r2=1022198&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMappedById.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMappedById.java
Wed Oct 13 17:20:30 2010
@@ -259,6 +259,7 @@ public class TestMappedById extends Sing
             int count = (int)o.longValue();
             assertEquals(2, count);
         }
+        em.close();
     }
 
     public void createObj1() {
@@ -303,6 +304,7 @@ public class TestMappedById extends Sing
         assertEquals(numDependentsPerEmployee, ds.size());
         Employee1 e0 = emps1.get(1);
         assertEquals(e0, e);
+        em.close();
     }
 
     public void queryObj1() {
@@ -374,6 +376,7 @@ public class TestMappedById extends Sing
         assertEquals(numDependentsPerEmployee, ds.size());
         Employee2 e0 = emps2.get(1);
         assertEquals(e0, e);
+        em.close();
     }
 
     public void queryObj2() {
@@ -449,6 +452,7 @@ public class TestMappedById extends Sing
         Person1 p = em.find(Person1.class, pid);
         Person1 p0 = persons1.get(pid.getFirstName());
         assertEquals(p0, p);
+        em.close();
     }
 
     public void queryObj3() {
@@ -523,6 +527,7 @@ public class TestMappedById extends Sing
         Person2 p = em.find(Person2.class, ssn);
         Person2 p1 = p.getMedical().getPatient();
         assertEquals(p1, p);
+        em.close();
     }
 
     public void queryObj4() {
@@ -617,6 +622,7 @@ public class TestMappedById extends Sing
         Dependent3 d = em.find(Dependent3.class, dids3.get(1));
         Dependent3 d0 = depMap3.get(dids3.get(1));
         assertEquals(d0, d);
+        em.close();
     }
 
     public void queryObj5() {
@@ -688,6 +694,7 @@ public class TestMappedById extends Sing
         em.getTransaction().begin();
         em.remove(m);
         em.getTransaction().commit();
+        em.close();
     }
 
     public void queryObj6() { 
@@ -753,6 +760,7 @@ public class TestMappedById extends Sing
         MedicalHistory4 m = em.find(MedicalHistory4.class, new PersonId4("f_1", "l_1"));
         MedicalHistory4 m0 = medicals4.get("f_1");
         assertEquals(m, m0);
+        em.close();
     }
 
     public void queryObj7() {
@@ -873,5 +881,6 @@ public class TestMappedById extends Sing
         BeneContactId id1 = c.getId();
         BeneContact c1 = em.find(BeneContact.class, id1);
         assertEquals("email8", c1.getEmail());
+        em.close();
     }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMapsIdXml.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMapsIdXml.java?rev=1022198&r1=1022197&r2=1022198&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMapsIdXml.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMapsIdXml.java
Wed Oct 13 17:20:30 2010
@@ -99,6 +99,7 @@ public class TestMapsIdXml extends Singl
         assertEquals(numDependentsPerEmployee, ds.size());
         Employee1Xml e0 = emps1xml.get(1);
         assertEquals(e0, e);
+        em.close();
     }
 
     public void queryObj1Xml() {

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity.java?rev=1022198&r1=1022197&r2=1022198&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity.java
Wed Oct 13 17:20:30 2010
@@ -71,6 +71,7 @@ public class TestMultipleLevelDerivedIde
             e.printStackTrace();
             fail("Fail to merge twice: " + e.getMessage());
         }
+        em.close();
 	}
 	
 	public void testPersist() {
@@ -85,6 +86,7 @@ public class TestMultipleLevelDerivedIde
 		Library lib = (Library) list.get(0);
 		assertNotNull(lib.getBook(BOOK_NAME));
 		assertNotNull(lib.getBook(BOOK_NAME).getPage(1));
+		em.close();
 	}
 	
 	public void testQueryIntermediateLevel() {
@@ -101,6 +103,7 @@ public class TestMultipleLevelDerivedIde
 			assertEquals(lib, page.getBook().getLibrary());
             assertEquals(page, page.getBook().getPage(page.getNumber()));
 		}
+		em.close();
 	}
 	
 	public void testQueryLeafLevel() {
@@ -115,6 +118,7 @@ public class TestMultipleLevelDerivedIde
 			assertEquals(lib, page.getBook().getLibrary());
             assertEquals(page, page.getBook().getPage(page.getNumber()));
 		}
+		em.close();
 	}
 
 	public void testFindRootNode() {
@@ -123,6 +127,7 @@ public class TestMultipleLevelDerivedIde
 		assertNotNull(lib);
 		assertNotNull(lib.getBook(BOOK_NAME));
 		assertNotNull(lib.getBook(BOOK_NAME).getPage(1));
+		em.close();
 	}
 	
 	public void testFindIntermediateNode() {
@@ -133,6 +138,7 @@ public class TestMultipleLevelDerivedIde
 		bookId.setName(BOOK_NAME);
 		Book book = em.find(Book.class, bookId);
 		assertNotNull(book);
+		em.close();
 	}
 	
 	public void testFindLeafNode() {
@@ -146,6 +152,7 @@ public class TestMultipleLevelDerivedIde
 		pageId.setNumber(2);
 		Page page = em.find(Page.class, pageId);
 		assertNotNull(page);
+		em.close();
 	}
 	
 	public void testUpdate() {
@@ -158,6 +165,7 @@ public class TestMultipleLevelDerivedIde
 		assertNotNull(book);
 		book.setAuthor("modifiy Author");
 		em.getTransaction().commit();
+		em.close();
 	}
 	
 	public void testDeleteRoot() {
@@ -170,6 +178,7 @@ public class TestMultipleLevelDerivedIde
 	    assertEquals(0, count(Library.class));
 	    assertEquals(0, count(Book.class));
 	    assertEquals(0, count(Page.class));
+	    em.close();
 	}
 	
 	public void testDeleteLeafObtainedByQuery() {
@@ -184,6 +193,7 @@ public class TestMultipleLevelDerivedIde
 	    assertEquals(1, count(Library.class));
 	    assertEquals(1, count(Book.class));
 	    assertEquals(NUM_PAGES-1, count(Page.class));
+	    em.close();
 	}
 	
 	public void testDeleteLeafObtainedByFind() {
@@ -203,6 +213,7 @@ public class TestMultipleLevelDerivedIde
 	    assertEquals(1, count(Library.class));
 	    assertEquals(1, count(Book.class));
 	    assertEquals(NUM_PAGES-1, count(Page.class));
+	    em.close();
 	}
 
 	
@@ -232,5 +243,6 @@ public class TestMultipleLevelDerivedIde
 		em.getTransaction().commit();
 
 		em.clear();
+		em.close();
 	}
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java?rev=1022198&r1=1022197&r2=1022198&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java
Wed Oct 13 17:20:30 2010
@@ -64,6 +64,7 @@ public class TestMultipleLevelDerivedIde
 		
 		Page1 p = b.getPage(new PageId1(1, bid));
 		assertNotNull(p);
+		em.close();
 	}
 	
 	public void testQueryIntermediateLevel() {
@@ -83,6 +84,7 @@ public class TestMultipleLevelDerivedIde
 			assertEquals(page, page.getBook().getPage(
 				new PageId1(pid.getNumber(), book.getBid())));
 		}
+		em.close();
 	}
 	
 	public void testQueryLeafLevel() {
@@ -99,6 +101,7 @@ public class TestMultipleLevelDerivedIde
 			assertEquals(page, page.getBook().
 				getPage(page.getPid()));
 		}
+		em.close();
 	}
 
 	public void testFindRootNode() {
@@ -111,6 +114,7 @@ public class TestMultipleLevelDerivedIde
 		assertNotNull(b);
 		PageId1 pid = new PageId1(1, bid);
 		assertNotNull(b.getPage(pid));
+		em.close();
 	}
 	
 	public void testFindIntermediateNode() {
@@ -122,6 +126,7 @@ public class TestMultipleLevelDerivedIde
 		bookId.setName(BOOK_NAME);
 		Book1 book = em.find(Book1.class, bookId);
 		assertNotNull(book);
+		em.close();
 	}
 	
 	public void testFindLeafNode() {
@@ -136,6 +141,7 @@ public class TestMultipleLevelDerivedIde
 		pageId.setNumber(2);
 		Page1 page = em.find(Page1.class, pageId);
 		assertNotNull(page);
+		em.close();
 	}
 	
 	public void testUpdate() {
@@ -149,6 +155,7 @@ public class TestMultipleLevelDerivedIde
 		assertNotNull(book);
 		book.setAuthor("modifiy Author");
 		em.getTransaction().commit();
+		em.close();
 	}
 	
 	public void testDeleteRoot() {
@@ -162,6 +169,7 @@ public class TestMultipleLevelDerivedIde
 	    assertEquals(0, count(Library1.class));
 	    assertEquals(0, count(Book1.class));
 	    assertEquals(0, count(Page1.class));
+	    em.close();
 	}
 	
 	public void testDeleteLeafObtainedByQuery() {
@@ -178,6 +186,7 @@ public class TestMultipleLevelDerivedIde
 	    assertEquals(1, count(Library1.class));
 	    assertEquals(1, count(Book1.class));
 	    assertEquals(NUM_PAGES-1, count(Page1.class));
+	    em.close();
 	}
 	
 	public void testDeleteLeafObtainedByFind() {
@@ -198,6 +207,7 @@ public class TestMultipleLevelDerivedIde
 	    assertEquals(1, count(Library1.class));
 	    assertEquals(1, count(Book1.class));
 	    assertEquals(NUM_PAGES-1, count(Page1.class));
+	    em.close();
 	}
 
     public void testOrderBy() {
@@ -206,6 +216,7 @@ public class TestMultipleLevelDerivedIde
         Library1 lib = em.find(Library1.class, LIBRARY_NAME);
         assertNotNull(lib);
         assertSQLFragnments(sql, "ORDER BY t1.LIBRARY_NAME ASC, t1.BOOK_NAME ASC");
+        em.close();
     }
     
 	/**
@@ -249,6 +260,7 @@ public class TestMultipleLevelDerivedIde
         assertSQLFragnments(sql, "CREATE TABLE DI_BOOK1", "LIBRARY_NAME", "BOOK_NAME");
         assertSQLFragnments(sql, "CREATE TABLE DI_PAGE1", "LIBRARY_NAME", "BOOK_NAME", "PAGE_NUM");
         assertSQLFragnments(sql, "CREATE TABLE DI_LINE1", "LIBRARY_NAME", "BOOK_NAME", "PAGE_NUM",
"LINE_NUM");
+        em.close();
 	}
 
     void assertSQLFragnments(List<String> list, String... keys) {



Mime
View raw message