Modify test TestQueryDefaultBatchSize to show use of ProfileLocation

This commit is contained in:
rbygrave committed 2021-06-10 22:11:45 +12:00
1 parent 441f51ed79
commit 8ba66af878
2 files changed
+11 -1

No files matched your search

@@ -2,6 +2,7 @@ package org.tests.query.lazy;
import io.ebean.BaseTestCase;
import io.ebean.Ebean;
import io.ebean.ProfileLocation;
import org.tests.model.basic.Customer;
import org.tests.model.basic.Order;
import org.tests.model.basic.OrderDetail;
@@ -13,12 +14,18 @@ import java.util.List;
public class TestQueryDefaultBatchSize extends BaseTestCase {
private static final ProfileLocation loc0 = ProfileLocation.create();
private static final ProfileLocation loc1 = ProfileLocation.create();
private static final ProfileLocation loc2 = ProfileLocation.create();
private static final ProfileLocation loc3 = ProfileLocation.create();
@Test
public void test_findEach() {
ResetBasicData.reset();
Ebean.find(Order.class)
.setProfileLocation(loc0)
.setLazyLoadBatchSize(2)
.findEach(bean -> doStuff(bean));
}
@@ -29,6 +36,7 @@ public class TestQueryDefaultBatchSize extends BaseTestCase {
ResetBasicData.reset();
Ebean.find(Order.class)
.setProfileLocation(loc1)
.fetch("details", "id")
.fetch("details.product", "sku")
.fetch("customer")
@@ -44,6 +52,7 @@ public class TestQueryDefaultBatchSize extends BaseTestCase {
List<Order> orders =
Ebean.find(Order.class)
.setProfileLocation(loc2)
.setLazyLoadBatchSize(2)
.findList();
@@ -59,6 +68,7 @@ public class TestQueryDefaultBatchSize extends BaseTestCase {
List<Order> orders =
Ebean.find(Order.class)
.setProfileLocation(loc3)
.fetch("details", "id")
.fetch("details.product", "sku")
.fetch("customer")
@@ -26,7 +26,7 @@ datasource.default=h2
#datasource.h2.capturestacktrace=true
ebean.dumpMetricsOnShutdown=true
ebean.dumpMetricsOptions=sql,hash
ebean.dumpMetricsOptions=sql,hash,loc
#ebean.queryPlan.thresholdMicros=1000
ebean.queryPlan.enable=true