mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Merge remote-tracking branch 'ebean/master' into ebean-new
# Conflicts: # ebean-api/pom.xml # ebean-autotune/pom.xml # ebean-bom/pom.xml # ebean-core-type/pom.xml # ebean-core/pom.xml # ebean-ddl-generator/pom.xml # ebean-externalmapping-api/pom.xml # ebean-externalmapping-xml/pom.xml # ebean-postgis/pom.xml # ebean-querybean/pom.xml # ebean-redis/pom.xml # ebean-test/pom.xml # ebean/pom.xml # kotlin-querybean-generator/pom.xml # pom.xml # querybean-generator/pom.xml
This commit is contained in:
@@ -22,7 +22,6 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class TestPersistenceContext extends BaseTestCase {
|
||||
|
||||
|
||||
@Test
|
||||
void testReload() {
|
||||
ResetBasicData.reset();
|
||||
@@ -34,7 +33,7 @@ class TestPersistenceContext extends BaseTestCase {
|
||||
assertThat(notes.get(0).getTitle()).isEqualTo("FooBar");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void test() {
|
||||
ResetBasicData.reset();
|
||||
@@ -191,4 +190,30 @@ class TestPersistenceContext extends BaseTestCase {
|
||||
assertThat(pc.toString()).contains("Customer=size:200 (0 weak)");
|
||||
}
|
||||
}
|
||||
|
||||
@Disabled // run manually
|
||||
@Test
|
||||
void testPcScopes_with_findEachFindList() {
|
||||
for (int i = 0; i < 5000; i++) {
|
||||
Customer c = new Customer();
|
||||
c.setName("Customer #" + i);
|
||||
DB.save(c);
|
||||
Order o = new Order();
|
||||
o.setCustomer(c);
|
||||
DB.save(o);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
try (Transaction txn = DB.beginTransaction()) {
|
||||
List<Customer> customers = new ArrayList<>();
|
||||
DB.find(Customer.class).select("id").findEach(customers::add);
|
||||
SpiPersistenceContext pc = ((SpiTransaction) txn).getPersistenceContext();
|
||||
assertThat(pc.toString()).contains("Customer=size:5000 (5000 weak)");
|
||||
customers.clear();
|
||||
customers = DB.find(Customer.class).select("id").findList();
|
||||
|
||||
assertThat(pc.toString()).contains("Customer=size:5000"); // We expect ALWAYS 5000 entries in the PC
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,16 +10,16 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class TestExtraScalarTypes extends BaseTestCase {
|
||||
class TestExtraScalarTypes extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
|
||||
Locale locale = Locale.getDefault();
|
||||
Currency currency = Currency.getInstance(locale);
|
||||
Locale locale = Locale.ENGLISH;
|
||||
Currency currency = Currency.getInstance(Locale.US);
|
||||
TimeZone tz = TimeZone.getDefault();
|
||||
|
||||
ESomeType e = new ESomeType();
|
||||
@@ -29,20 +29,20 @@ public class TestExtraScalarTypes extends BaseTestCase {
|
||||
|
||||
DB.save(e);
|
||||
|
||||
ESomeType e2 = DB.find(ESomeType.class).setAutoTune(false).setId(e.getId()).findOne();
|
||||
ESomeType e2 = DB.find(ESomeType.class).setId(e.getId()).findOne();
|
||||
|
||||
assertNotNull(e2.getCurrency());
|
||||
assertNotNull(e2.getLocale());
|
||||
assertNotNull(e2.getTimeZone());
|
||||
|
||||
List<ESomeType> list = DB.find(ESomeType.class)
|
||||
.setAutoTune(false).where()
|
||||
.where()
|
||||
.eq("locale", locale)
|
||||
.eq("timeZone", tz.getID())
|
||||
.eq("currency", currency)
|
||||
.findList();
|
||||
|
||||
assertTrue(!list.isEmpty());
|
||||
assertThat(list).isNotEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user