use of org.infinispan.query.test.Person in project infinispan by infinispan.
the class ClusteredQueryMultipleCachesTest method prepareTestData.
@Override
protected void prepareTestData() {
super.prepareTestData();
Person person5 = new Person();
person5.setName("People In Another Cache");
person5.setBlurb("Also eats grass");
person5.setAge(5);
cacheBMachine2.put("anotherNewOne", person5);
}
use of org.infinispan.query.test.Person in project infinispan by infinispan.
the class ClusteredQueryTest method testNonIndexedBroadcastInfinispanQuery.
@Test
public void testNonIndexedBroadcastInfinispanQuery() {
QueryFactory queryFactory = Search.getQueryFactory(cacheAMachine2);
Query<Person> slowQuery = queryFactory.create("FROM " + Person.class.getName() + " WHERE nonIndexedField LIKE 'na%'");
assertEquals(NUM_ENTRIES, slowQuery.execute().list().size());
}
use of org.infinispan.query.test.Person in project infinispan by infinispan.
the class ClusteredQueryTest method testBroadcastSortedInfinispanQuery.
@Test
public void testBroadcastSortedInfinispanQuery() {
QueryFactory queryFactory = Search.getQueryFactory(cacheAMachine1);
Query<Person> sortedQuery = queryFactory.create("FROM " + Person.class.getName() + " p order by p.age desc");
List<Person> results = sortedQuery.execute().list();
assertEquals(NUM_ENTRIES, results.size());
assertEquals(NUM_ENTRIES - 1, results.iterator().next().getAge());
StaticTestingErrorHandler.assertAllGood(cacheAMachine1, cacheAMachine2);
}
use of org.infinispan.query.test.Person in project infinispan by infinispan.
the class ClusteredQueryTest method testPagination.
public void testPagination() {
Query<Person> cacheQuery = createSortedQuery();
cacheQuery.startOffset(2);
cacheQuery.maxResults(1);
QueryResult<Person> results = cacheQuery.execute();
List<Person> list = results.list();
assertEquals(1, list.size());
assertEquals(10, results.hitCount().orElse(-1));
Person result = list.get(0);
assertEquals(12, result.getAge());
StaticTestingErrorHandler.assertAllGood(cacheAMachine1, cacheAMachine2);
}
use of org.infinispan.query.test.Person in project infinispan by infinispan.
the class ContinuousQueryTest method testDisallowGroupingAndAggregation.
/**
* Using grouping and aggregation with continuous query is not allowed.
*/
@Test(expectedExceptions = ParsingException.class, expectedExceptionsMessageRegExp = ".*ISPN028509:.*")
public void testDisallowGroupingAndAggregation() {
QueryFactory qf = Search.getQueryFactory(cache());
Query<Object[]> query = qf.create("SELECT MAX(age) FROM org.infinispan.query.test.Person WHERE age >= 20");
ContinuousQuery<Integer, Person> cq = Search.getContinuousQuery(cache());
cq.addContinuousQueryListener(query, new CallCountingCQResultListener<>());
}
Aggregations