From 4408eb618aba6e71b679d198ad282bfb8f0b2a86 Mon Sep 17 00:00:00 2001 From: Robin Bygrave Date: Wed, 20 Jan 2021 17:11:07 +1300 Subject: [PATCH] No change - update test only - TestHistoryOneToMany with wait for when run on windows --- .../model/history/TestHistoryOneToMany.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ebean-core/src/test/java/org/tests/model/history/TestHistoryOneToMany.java b/ebean-core/src/test/java/org/tests/model/history/TestHistoryOneToMany.java index 604a5d5e9..75e0bc871 100644 --- a/ebean-core/src/test/java/org/tests/model/history/TestHistoryOneToMany.java +++ b/ebean-core/src/test/java/org/tests/model/history/TestHistoryOneToMany.java @@ -1,7 +1,7 @@ package org.tests.model.history; import io.ebean.BaseTestCase; -import io.ebean.Ebean; +import io.ebean.DB; import io.ebean.annotation.IgnorePlatform; import io.ebean.annotation.Platform; import org.ebeantest.LoggedSqlCollector; @@ -16,7 +16,7 @@ public class TestHistoryOneToMany extends BaseTestCase { @IgnorePlatform(Platform.ORACLE) @Test - public void test() { + public void test() throws InterruptedException { HiTOne one = new HiTOne("one"); @@ -37,11 +37,12 @@ public class TestHistoryOneToMany extends BaseTestCase { one.getTwos().add(_22); - Ebean.save(one); + DB.save(one); + Thread.sleep(20); LoggedSqlCollector.start(); - List list = Ebean.find(HiTOne.class) + List list = DB.find(HiTOne.class) .fetch("twos") .fetch("twos.threes") .where().ilike("name", "on%") @@ -51,15 +52,14 @@ public class TestHistoryOneToMany extends BaseTestCase { List sql = LoggedSqlCollector.stop(); + assertThat(list).hasSize(1); + assertThat(list.get(0).getTwos()).hasSize(2); + assertThat(list.get(0).getTwos().get(0).getThrees()).hasSize(3); + if (isH2()) { assertThat(sql).hasSize(2); assertSql(sql.get(0)).contains("from hi_tone_with_history t0 where (t0.sys_period_start <= ? and (t0.sys_period_end is null or t0.sys_period_end > ?)) and lower(t0.name) like ? escape'' limit 10"); assertSql(sql.get(1)).contains("from hi_ttwo_with_history t0 left join hi_tthree_with_history t1 on t1.hi_ttwo_id = t0.id and (t1.sys_period_start <= ? and (t1.sys_period_end is null or t1.sys_period_end > ?)) where (t0.sys_period_start <= ? and (t0.sys_period_end is null or t0.sys_period_end > ?)) and (t0.hi_tone_id) in (?)"); } - - assertThat(list).hasSize(1); - assertThat(list.get(0).getTwos()).hasSize(2); - assertThat(list.get(0).getTwos().get(0).getThrees()).hasSize(3); - } }