openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r1024016 - in /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps: spec_10_1_27_ex0/ spec_10_1_27_ex4/
Date Mon, 18 Oct 2010 21:39:26 GMT
Author: mikedd
Date: Mon Oct 18 21:39:26 2010
New Revision: 1024016

URL: http://svn.apache.org/viewvc?rev=1024016&view=rev
Log:
Ensure consistent order of SQL statements when populating the database in section 10_1_27
testcases.

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/Division.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/TestSpec10_1_27.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/VicePresident.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/Division.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/VicePresident.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/Division.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/Division.java?rev=1024016&r1=1024015&r2=1024016&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/Division.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/Division.java
Mon Oct 18 21:39:26 2010
@@ -18,6 +18,7 @@
  */
 package org.apache.openjpa.persistence.jdbc.maps.spec_10_1_27_ex0;
 
+import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;
@@ -28,9 +29,9 @@ public class Division {
     @Id
     int id;
 
+    @Column(length=8)
     String name;
 
-
     public int getId() {
         return id;
     }
@@ -61,4 +62,10 @@ public class Division {
         ret = ret *31 + id;
         return ret;
     }
+
+    @Override
+    public String toString() {
+        return "Division@ " + hashCode() + " [id=" + id + ", name=" + name + "]";
+    }
+    
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/TestSpec10_1_27.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/TestSpec10_1_27.java?rev=1024016&r1=1024015&r2=1024016&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/TestSpec10_1_27.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/TestSpec10_1_27.java
Mon Oct 18 21:39:26 2010
@@ -114,7 +114,7 @@ public class TestSpec10_1_27 extends SQL
         rs = q.getResultList();
         me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d, me.getKey());
         
         // new tests for element collection
         em.clear();
@@ -155,15 +155,23 @@ public class TestSpec10_1_27 extends SQL
     public void createObj(EntityManagerFactory emf) {
         EntityManager em = emf.createEntityManager();
         EntityTransaction tran = em.getTransaction();
-        for (int i = 0; i < numItems; i++)
+        tran.begin();
+        for (int i = 0; i < numItems; i++) {
             createItem1(em, itemId++);
-        for (int i = 0; i < numItems; i++)
+            em.flush();
+        }
+        for (int i = 0; i < numItems; i++) {
             createItem2(em, itemId++);
-        for (int i = 0; i < numCompany; i++)
+            em.flush();
+        }
+        for (int i = 0; i < numCompany; i++) {
             createCompany1(em, compId++);
-        for (int i = 0; i < numCompany; i++)
+            em.flush();
+        }
+        for (int i = 0; i < numCompany; i++) {
             createCompany2(em, compId++);
-        tran.begin();
+            em.flush();
+        }
         em.flush();
         tran.commit();
         em.close();

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/VicePresident.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/VicePresident.java?rev=1024016&r1=1024015&r2=1024016&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/VicePresident.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex0/VicePresident.java
Mon Oct 18 21:39:26 2010
@@ -26,6 +26,7 @@ public class VicePresident {
     @Id
     int id;
     
+    @Column(length=8)
     String name;
   
     @ManyToOne

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/Division.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/Division.java?rev=1024016&r1=1024015&r2=1024016&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/Division.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/Division.java
Mon Oct 18 21:39:26 2010
@@ -18,6 +18,7 @@
  */
 package org.apache.openjpa.persistence.jdbc.maps.spec_10_1_27_ex4;
 
+import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;
@@ -28,6 +29,7 @@ public class Division {
     @Id
     int id;
 
+    @Column(length=8)
     String name;
 
     public int getId() {

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java?rev=1024016&r1=1024015&r2=1024016&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java
Mon Oct 18 21:39:26 2010
@@ -122,10 +122,11 @@ public class TestSpec10_1_27_Ex4 extends
     public void createObj(EntityManagerFactory emf) {
         EntityManager em = emf.createEntityManager();
         EntityTransaction tran = em.getTransaction();
-        for (int i = 0; i < numCompany; i++)
-            createCompany(em, compId++);
         tran.begin();
-        em.flush();
+        for (int i = 0; i < numCompany; i++) {
+            createCompany(em, compId++);
+            em.flush();
+        }
         tran.commit();
         em.close();
     }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/VicePresident.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/VicePresident.java?rev=1024016&r1=1024015&r2=1024016&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/VicePresident.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/VicePresident.java
Mon Oct 18 21:39:26 2010
@@ -26,6 +26,7 @@ public class VicePresident {
     @Id
     int id;
 
+    @Column(length=8)
     String name;
 
     @ManyToOne



Mime
View raw message