本文整理了Java中org.infinispan.query.dsl.Query.list
方法的一些代码示例,展示了Query.list
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.list
方法的具体详情如下:
包路径:org.infinispan.query.dsl.Query
类名称:Query
方法名:list
[英]Returns the results of a search as a list.
[中]以列表形式返回搜索结果。
代码示例来源:origin: org.infinispan/infinispan-query
public void testEqNonIndexedType() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(NotIndexed.class)
.having("notIndexedField").eq("testing 123")
.build();
List<NotIndexed> list = q.list();
assertEquals(1, list.size());
assertEquals("testing 123", list.get(0).notIndexedField);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testDuplicateBooleanProjection() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getTransactionImplClass())
.select("id", "isDebit", "isDebit")
.having("description").eq("Hotel")
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(3, list.get(0).length);
assertEquals(3, list.get(0)[0]);
assertEquals(true, list.get(0)[1]);
assertEquals(true, list.get(0)[2]);
}
代码示例来源:origin: org.infinispan/infinispan-query
@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "Aggregation SUM cannot be applied to property of type java.lang.String")
public void testGroupBy6() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.select(sum("name"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(2, list.get(0)[0]);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testEqInNested2() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.having("addresses.postCode").eq("Y12")
.build();
List<User> list = q.list();
assertEquals(1, list.size());
assertEquals(2, list.get(0).getAddresses().size());
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testInstant1() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.having("creationDate").eq(Instant.parse("2011-12-03T10:15:30Z"))
.build();
List<User> list = q.list();
assertEquals(3, list.size());
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testGlobalSum() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getTransactionImplClass())
.select(sum("amount"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(9693d, (Double) list.get(0)[0], 0.0001d);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testEmbeddedGlobalCount() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.select(count("accountIds"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(3L, list.get(0)[0]);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testEmbeddedGlobalAvg() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.select(avg("addresses.number"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(152d, (Double) list.get(0)[0], 0.0001d);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testGlobalMinDouble() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getTransactionImplClass())
.select(min("amount"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(5d, list.get(0)[0]);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testEmbeddedGlobalMax() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.select(max("addresses.number"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(312, list.get(0)[0]);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testCountNull() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.select(count("age"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(1L, list.get(0)[0]); // only non-null "age"s were counted
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testEqNonIndexedField() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.having("notes").eq("Lorem ipsum dolor sit amet")
.build();
List<User> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).getId());
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testEmbeddedGlobalMin() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.select(min("addresses.number"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(-12, list.get(0)[0]);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testGlobalAvg() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getTransactionImplClass())
.select(avg("amount"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(173.0892d, (Double) list.get(0)[0], 0.0001d);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testGlobalMinString() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.select(min("name"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals("John", list.get(0)[0]);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testGlobalMaxDouble() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getTransactionImplClass())
.select(max("amount"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(1800d, list.get(0)[0]);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testAvgNull() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.select(avg("age"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(22.0, list.get(0)[0]); // only non-null "age"s were used in the average
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testEmbeddedGlobalSum() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.select(sum("addresses.number"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(456L, list.get(0)[0]);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testGlobalCount() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getAccountImplClass())
.select(count("creationDate"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals(3L, list.get(0)[0]);
}
代码示例来源:origin: org.infinispan/infinispan-query
public void testGlobalMaxString() {
QueryFactory qf = getQueryFactory();
Query q = qf.from(getModelFactory().getUserImplClass())
.select(max("name"))
.build();
List<Object[]> list = q.list();
assertEquals(1, list.size());
assertEquals(1, list.get(0).length);
assertEquals("Spider", list.get(0)[0]);
}
内容来源于网络,如有侵权,请联系作者删除!