fix more broken tests due to lazy Id generation

This commit is contained in:
Mark Struberg 2018-11-03 14:25:23 +01:00
parent ba7b8493ca
commit eaecedf328
5 changed files with 19 additions and 3 deletions

View File

@ -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"/>

View File

@ -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();

View File

@ -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 " +

View File

@ -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();

View File

@ -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();