// we need this to be sure about objects order in the iterator test
query.addOrderByAscending("title");
ObjectContentManager ocm = this.getObjectContentManager();
long start = System.currentTimeMillis();
ObjectIterator iterator = (ObjectIterator) ocm.getObjectIterator(query);
log.info("getObjectIterator takes : " + (System.currentTimeMillis() - start));
start = System.currentTimeMillis();
Collection result = ocm.getObjects(query);
log.info("getObject takes : " + (System.currentTimeMillis() - start));
start = System.currentTimeMillis();
iterator = (ObjectIterator) ocm.getObjectIterator(query);
log.info("getObjectIterator takes : " + (System.currentTimeMillis() - start));
assertEquals("wrong results count", 4, iterator.getSize());
assertEquals("wrong initial position", 0, iterator.getPosition());
assertTrue("no objects returned", iterator.hasNext());
Page page = (Page) iterator.next();
assertEquals("wrong first result", "Page 1 Title", page.getTitle());
iterator.skip(1);
assertEquals("wrong position after skip", 2, iterator.getPosition());
page = (Page) iterator.next();
assertEquals("wrong third result", "Page 3 Title", page.getTitle());
}
catch (Exception e)
{
e.printStackTrace();