final KijiDataRequest dataRequest = KijiDataRequest.builder()
.addColumns(ColumnsDef.create()
.withMaxVersions(HConstants.ALL_VERSIONS).withPageSize(pageSize).addFamily("jobs"))
.build();
final HBaseQualifierPager pager =
new HBaseQualifierPager(
eid, dataRequest, (HBaseKijiTable) mTable, KijiColumnName.create("jobs"));
try {
assertTrue(pager.hasNext());
final List<String> qualifiers = Lists.newArrayList();
int npage = 0;
while (pager.hasNext()) {
// Note: we cannot validate individual pages as their boundaries depend on HBase version.
final List<String> page = Lists.newArrayList(pager.next());
LOG.info("Page #{}: {}", npage, page);
assertTrue(page.size() <= pageSize);
qualifiers.addAll(page);
npage++;
}
final List<String> expected = Lists.newArrayList("j0", "j1", "j2", "j3", "j4");
assertTrue(npage >= 3); // at least 3 pages
assertEquals(expected, qualifiers);
assertFalse(pager.hasNext());
try {
pager.next();
Assert.fail("next() should throw NoSuchElementException");
} catch (NoSuchElementException nsee) {
// Expected
}
} finally {
pager.close();
}
}