[openjpa] branch master updated (34c99b3 -> eaecedf)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[openjpa] branch master updated (34c99b3 -> eaecedf)

struberg
This is an automated email from the ASF dual-hosted git repository.

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


    from 34c99b3  OPENJPA-2554 fix TestSchemaGenerationProperties on MySQL
     new ba7b849  fix weird equals error.
     new eaecedf  fix more broken tests due to lazy Id generation

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../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_ex4/TestSpec10_1_27_Ex4.java            | 5 +++--
 .../jdbc/maps/spec_10_1_27_ex6/TestSpec10_1_27_Ex6.java            | 3 ++-
 .../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 ++++-
 7 files changed, 24 insertions(+), 6 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[openjpa] 01/02: fix weird equals error.

struberg
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 ba7b8493ca8dfe364a52b45939f43ec02c347b96
Author: Mark Struberg <[hidden email]>
AuthorDate: Sat Nov 3 12:19:36 2018 +0100

    fix weird equals error.
   
    most probably happens on subclassing when access to _id
    doesn't getnerate the sequence. Happened randomly though.
    So not 100% sure to have fixed it that way :(
---
 .../persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java  | 5 +++--
 .../persistence/jdbc/maps/spec_10_1_27_ex6/TestSpec10_1_27_Ex6.java  | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java
index 6c06725..aff3d49 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex4/TestSpec10_1_27_Ex4.java
@@ -77,7 +77,7 @@ public class TestSpec10_1_27_Ex4 extends SQLListenerTestCase {
             qi.setCandidateCollection(rsAllCompany);
     }
 
-    public void queryQualifiedId(boolean inMemory) throws Exception {
+    private void queryQualifiedId(boolean inMemory) throws Exception {
         EntityManager em = emf.createEntityManager();
 
         String query = "select KEY(e) from Company c, " +
@@ -96,7 +96,8 @@ public class TestSpec10_1_27_Ex4 extends SQLListenerTestCase {
             setCandidate(q, Company.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
-        assertEquals(d, me.getKey());
+        assertEquals(d.getId(), ((Division) me.getKey()).getId());
+        assertEquals(d.getName(), ((Division) me.getKey()).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_ex6/TestSpec10_1_27_Ex6.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex6/TestSpec10_1_27_Ex6.java
index eee5e24..67974e0 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex6/TestSpec10_1_27_Ex6.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/maps/spec_10_1_27_ex6/TestSpec10_1_27_Ex6.java
@@ -96,7 +96,8 @@ public class TestSpec10_1_27_Ex6 extends SQLListenerTestCase {
             setCandidate(q, Company.class);
         rs = q.getResultList();
         Map.Entry me = (Map.Entry) rs.get(0);
-        assertTrue(d.equals(me.getKey()));
+        assertEquals(d.getId(), ((Division) me.getKey()).getId());
+        assertEquals(d.getName(), ((Division) me.getKey()).getName());
 
         em.clear();
         query = "select KEY(e) from Company c " +

Reply | Threaded
Open this post in threaded view
|

[openjpa] 02/02: fix more broken tests due to lazy Id generation

struberg
In reply to this post by struberg
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 <[hidden email]>
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();