No change - update test only - TestHistoryOneToMany with wait for when run on windows

This commit is contained in:
Robin Bygrave
2021-01-20 17:11:07 +13:00
parent 9ccd1b1b27
commit 4408eb618a
@@ -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<HiTOne> list = Ebean.find(HiTOne.class)
List<HiTOne> list = DB.find(HiTOne.class)
.fetch("twos")
.fetch("twos.threes")
.where().ilike("name", "on%")
@@ -51,15 +52,14 @@ public class TestHistoryOneToMany extends BaseTestCase {
List<String> 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);
}
}