This commit is contained in:
Redkale
2016-07-26 09:58:37 +08:00
parent 7a11b7887c
commit 3c667d88aa
7 changed files with 27 additions and 23 deletions

View File

@@ -20,11 +20,11 @@ public class FilterNodeTest {
public static void main(String[] args) throws Exception {
final Properties props = new Properties();
final Function<Class, List> fullloader = (Class t) -> new ArrayList();
final Function<Class, EntityInfo> func = (Class t) -> EntityInfo.load(t, 0, false, props, fullloader);
final EntityInfo<CarTestTable> carEntity = EntityInfo.load(CarTestTable.class, 0, false, props, (t) -> CarTestTable.createList());
final EntityInfo<UserTestTable> userEntity = EntityInfo.load(UserTestTable.class, 0, false, props, (t) -> UserTestTable.createList());
final EntityInfo<CarTypeTestTable> typeEntity = EntityInfo.load(CarTypeTestTable.class, 0, false, props, (t) -> CarTypeTestTable.createList());
final BiFunction<DataSource, Class, List> fullloader = (s, t) -> new ArrayList();
final Function<Class, EntityInfo> func = (Class t) -> EntityInfo.load(t, 0, false, props, null, fullloader);
final EntityInfo<CarTestTable> carEntity = EntityInfo.load(CarTestTable.class, 0, false, props, null, (s, t) -> CarTestTable.createList());
final EntityInfo<UserTestTable> userEntity = EntityInfo.load(UserTestTable.class, 0, false, props, null, (s, t) -> UserTestTable.createList());
final EntityInfo<CarTypeTestTable> typeEntity = EntityInfo.load(CarTypeTestTable.class, 0, false, props, null, (s, t) -> CarTypeTestTable.createList());
final CarTestBean bean = new CarTestBean();
bean.carid = 70002;
@@ -32,7 +32,7 @@ public class FilterNodeTest {
bean.createtime = 500;
bean.typename = "法拉利";
FilterNode joinNode1 = FilterJoinNode.create(UserTestTable.class, new String[]{"userid", "username"}, "username", LIKE, bean.username)
.or(FilterJoinNode.create(UserTestTable.class, new String[]{"userid", "username"}, "createtime", GREATERTHAN, bean.createtime));
.or(FilterJoinNode.create(UserTestTable.class, new String[]{"userid", "username"}, "createtime", GREATERTHAN, bean.createtime));
FilterNode joinNode2 = FilterJoinNode.create(CarTypeTestTable.class, "cartype", "typename", LIKE, bean.typename);
FilterNode node = CarTestBean.caridTransient() ? (joinNode2.or(joinNode1)) : FilterNode.create("carid", GREATERTHAN, bean.carid).and(joinNode1).or(joinNode2);
FilterNode beanNode = FilterNodeBean.createFilterNode(bean);

View File

@@ -6,7 +6,7 @@
package org.redkale.test.source;
import java.util.*;
import java.util.function.Function;
import java.util.function.BiFunction;
import javax.persistence.Id;
import org.redkale.source.*;
import org.redkale.util.Attribute;
@@ -33,8 +33,8 @@ public class CacheTestBean {
Attribute idattr = Attribute.create(CacheTestBean.class, "pkgid");
Attribute nameattr = Attribute.create(CacheTestBean.class, "name");
Attribute priceattr = Attribute.create(CacheTestBean.class, "price");
Function<Class, List> fullloader = (z) -> list;
EntityCache<CacheTestBean> cache = new EntityCache(EntityInfo.load(CacheTestBean.class, 0, true,new Properties(), fullloader));
BiFunction<DataSource, Class, List> fullloader = (s, z) -> list;
EntityCache<CacheTestBean> cache = new EntityCache(EntityInfo.load(CacheTestBean.class, 0, true, new Properties(), null, fullloader));
cache.fullLoad();
System.out.println(cache.queryColumnMap("pkgid", FilterFunc.COUNT, "name", null));

View File

@@ -40,7 +40,7 @@ public class TestSourceCache {
}
public static void main(String[] args) throws Exception {
final EntityInfo<TestEntity> info = EntityInfo.load(TestEntity.class, 0, false,new Properties(), null);
final EntityInfo<TestEntity> info = EntityInfo.load(TestEntity.class, 0, false, new Properties(), null, null);
TestEntity[] entitys = new TestEntity[10_0000];
for (int i = 0; i < entitys.length; i++) {
entitys[i] = new TestEntity(i + 1, "用户_" + (i + 1));