assertEquals(total, count);
}
@Test
public void testQueryFromStartWithGroupBy() throws Exception {
AbstractSqlPagingQueryProvider queryProvider = (AbstractSqlPagingQueryProvider) getPagingQueryProvider();
Map<String, Order> sortKeys = new LinkedHashMap<String, Order>();
sortKeys.put("NAME", Order.ASCENDING);
sortKeys.put("CODE", Order.DESCENDING);
queryProvider.setSortKeys(sortKeys);
queryProvider.setSelectClause("select NAME, CODE, sum(VALUE)");
queryProvider.setGroupClause("NAME, CODE");
int count = 0;
int total = 5;
List<Map<String, Object>> list = jdbcTemplate.queryForList(queryProvider.generateFirstPageQuery(pageSize));
logger.debug("First page result: " + list);
assertEquals(pageSize, list.size());
count += pageSize;
Map<String, Object> oldValues = null;
while (count < total) {
Map<String, Object> startAfterValues = getStartAfterValues(
queryProvider, list);
assertNotSame(oldValues, startAfterValues);
list = jdbcTemplate.queryForList(queryProvider.generateRemainingPagesQuery(pageSize), getParameterList(null, startAfterValues).toArray());
count += list.size();
if(list.size() < pageSize) {
assertEquals(1, list.size());
}