openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [openjpa] 02/02: fix more broken tests due to lazy Id generation
Date Sat, 03 Nov 2018 13:26:10 GMT
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git

commit eaecedf328038ea646c7b55063f71b40218f3a65
Author: Mark Struberg <struberg@apache.org>
AuthorDate: Sat Nov 3 14:25:23 2018 +0100

    fix more broken tests due to lazy Id generation
---
 .../image-gallery/src/test/resources/META-INF/persistence.xml      | 7 +++++++
 .../persistence/jdbc/maps/m2mmapex1/TestMany2ManyMapEx1.java       | 4 +++-
 .../jdbc/maps/spec_10_1_27_ex3/TestSpec10_1_27_Ex3.java            | 4 +++-
 .../jdbc/maps/spec_10_1_27_ex8/TestSpec10_1_27_Ex8.java            | 2 ++
 .../jdbc/maps/spec_10_1_29_ex1/TestSpec10_1_29_Ex1.java            | 5 ++++-
 5 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml b/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml
index 19716d3..2684c3a 100644
--- a/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml
+++ b/openjpa-examples/image-gallery/src/test/resources/META-INF/persistence.xml
@@ -32,10 +32,17 @@
         <exclude-unlisted-classes>true</exclude-unlisted-classes>
         <validation-mode>CALLBACK</validation-mode>
         <properties>
+            <!--
+                this is only needed when not passing in the connection via
+                either passing in via EntityManagerFactory or
+                environment variable.
+                In our case this is already properly setup in the
+                OpenJPA parent pom.
           <property name="openjpa.ConnectionDriverName"
               value="org.apache.derby.jdbc.EmbeddedDriver" />
           <property name="openjpa.ConnectionURL"
               value="jdbc:derby:target/database/ImageDB;create=true" />
+            -->
           <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
           <property name="openjpa.DynamicEnhancementAgent" value="false"/>
 
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex1/TestMany2ManyMapEx1.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex1/TestMany2ManyMapEx1.java
index 6872a78..6ced5ff 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex1/TestMany2ManyMapEx1.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/m2mmapex1/TestMany2ManyMapEx1.java
@@ -114,7 +114,9 @@ public class TestMany2ManyMapEx1 extends SQLListenerTestCase {
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        Division other = (Division) me.getKey();
+        assertEquals(d.getId(), other.getId());
+        assertEquals(d.getName(), other.getName());
 
         // test navigation thru KEY
         em.clear();
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex3/TestSpec10_1_27_Ex3.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex3/TestSpec10_1_27_Ex3.java
index f60e4e5..741c887 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex3/TestSpec10_1_27_Ex3.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex3/TestSpec10_1_27_Ex3.java
@@ -99,7 +99,9 @@ public class TestSpec10_1_27_Ex3 extends SQLListenerTestCase {
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
 
-        assertTrue(d.equals(me.getKey()));
+        Division other = (Division) me.getKey();
+        assertEquals(d.getId(), other.getId());
+        assertEquals(d.getName(), other.getName());
 
         em.clear();
         query = "select KEY(e) from Company c " +
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex8/TestSpec10_1_27_Ex8.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex8/TestSpec10_1_27_Ex8.java
index eb19c5b..d770e27 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex8/TestSpec10_1_27_Ex8.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex8/TestSpec10_1_27_Ex8.java
@@ -122,7 +122,9 @@ public class TestSpec10_1_27_Ex8 extends SQLListenerTestCase {
             setCandidate(q, Company.class);
         rs = q.getResultList();
         me = (Map.Entry) rs.get(0);
+
         assertTrue(d.equals(me.getKey()));
+
         assertEquals(v.getId(), ((VicePresident) me.getValue()).getId());
 
         em.close();
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex1/TestSpec10_1_29_Ex1.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex1/TestSpec10_1_29_Ex1.java
index 8c18752..ebc9cf3 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex1/TestSpec10_1_29_Ex1.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_29_ex1/TestSpec10_1_29_Ex1.java
@@ -125,7 +125,10 @@ public class TestSpec10_1_29_Ex1 extends SQLListenerTestCase {
             setCandidate(q, Company.class);
         rs = q.getResultList();
         me = (Map.Entry) rs.get(0);
-        assertTrue(d.equals(me.getKey()));
+        Division other = (Division) me.getKey();
+        assertEquals(d.getId(), other.getId());
+        assertEquals(d.getName(), other.getName());
+
         assertEquals(v.getId(), ((VicePresident) me.getValue()).getId());
 
         em.close();


Mime
View raw message