public void queryWithPagination() {
database.open("admin", "admin");
final OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>("select from Profile LIMIT 3");
ORID last = new ORecordId();
for (List<ODocument> resultset = database.query(query); !resultset.isEmpty(); resultset = query.execute()) {
Assert.assertTrue(resultset.size() <= 3);
for (ODocument d : resultset)
Assert.assertTrue(d.getIdentity().getClusterId() >= last.getClusterId()
&& d.getIdentity().getClusterPosition() > last.getClusterPosition());
last = resultset.get(resultset.size() - 1).getIdentity();
}
database.close();