use of org.apache.jackrabbit.api.query.JackrabbitQueryResult in project jackrabbit by apache.
the class LimitAndOffsetTest method testOffsetAndLimitWithGetSize.
public void testOffsetAndLimitWithGetSize() throws Exception {
query.setOffset(1);
QueryResult result = query.execute();
NodeIterator nodes = result.getNodes();
assertEquals(2, nodes.getSize());
if (result instanceof JackrabbitQueryResult) {
assertEquals(3, ((JackrabbitQueryResult) result).getTotalSize());
}
// JCR-2684: offset higher than total result => size == 0
query.setOffset(10);
result = query.execute();
nodes = result.getNodes();
assertFalse(nodes.hasNext());
assertEquals(0, nodes.getSize());
if (result instanceof JackrabbitQueryResult) {
assertEquals(3, ((JackrabbitQueryResult) result).getTotalSize());
}
query.setOffset(1);
query.setLimit(1);
result = query.execute();
nodes = result.getNodes();
assertEquals(1, nodes.getSize());
}
Aggregations