/** * @see javax.jcr.RangeIterator#getPosition() */ public long getPosition() { return nodeIterator.getPosition(); } }
/** * Get the position in the result set. */ public long getPosition() { return it.getPosition(); }
/** * Get the position in the result set. */ public long getPosition() { return it.getPosition(); }
/** * @see javax.jcr.RangeIterator#getPosition() */ public long getPosition() { return nodeIterator.getPosition(); } }
@Override public long getPosition() { return iterator.getPosition(); }
public long getPosition() { return this.nodeIterator.getPosition(); }
public long getPosition() { return nodeIterator.getPosition(); }
public long getPosition() { return nodeIterator.getPosition(); }
public long getPosition() { return nodeIterator.getPosition(); }
/** * Tests if {@link javax.jcr.NodeIterator#getPosition()} return correct values. */ public void testGetPos() throws RepositoryException { NodeIterator iter = testRootNode.getNodes(); assertEquals("Initial call to getPos() must return zero", 0, iter.getPosition()); int index = 0; while (iter.hasNext()) { iter.nextNode(); assertEquals("Wrong position returned by getPos()", ++index, iter.getPosition()); } }
public long getPosition() { return getDelegate().getPosition(); } }
/** * Tests the <code>position()</code> function. * <p> * For configuration description see {@link XPathDocOrderTest}. */ public void testDocOrderPositionFunction() throws Exception { String xpath = xpathRoot + "/*[position()=2]"; String resultPath = ""; for (NodeIterator nodes = testRootNode.getNodes(); nodes.hasNext() && nodes.getPosition() < 2;) { resultPath = nodes.nextNode().getPath(); } docOrderTest(new Statement(xpath, qsXPATH), resultPath); }
/** * Tests if position index and document order on child axis returns the * correct node. * <p> * For configuration description see {@link XPathDocOrderTest}. */ public void testDocOrderPositionIndex() throws Exception { String xpath = xpathRoot + "/*[2]"; String resultPath = ""; for (NodeIterator nodes = testRootNode.getNodes(); nodes.hasNext() && nodes.getPosition() < 2;) { resultPath = nodes.nextNode().getPath(); } docOrderTest(new Statement(xpath, qsXPATH), resultPath); }
/** * Tests the method <code>NodeIterator.getPosition()</code>. */ public void testGetPosition() throws RepositoryException, NotExecutableException { QueryResult rs = execute(xpathRoot + "//*", qsXPATH); // getPosition initially returns 0 NodeIterator it = rs.getNodes(); assertEquals("Initial call to getPosition() must return 0.", 0, it.getPosition()); // check getPosition while iterating int index = 0; while (it.hasNext()) { it.nextNode(); assertEquals("Wrong position returned by getPosition()", ++index, it.getPosition()); } }
public PagedResult page(long skip, long maxResult) throws RepositoryException { long endPosition = skip + maxResult; final List<Node> res = new ArrayList<Node>(); final NodeIterator nodeIterator = queryResult.getNodes(); final long total = nodeIterator.getSize(); nodeIterator.skip(skip); while (nodeIterator.hasNext()) { final Node node = nodeIterator.nextNode(); res.add(node); if (nodeIterator.getPosition() >= endPosition) { break; } } return new PagedResult(res, total); } }
/** * Tests the method <code>NodeIterator.getPosition()</code> on an empty * <code>NodeIterator</code>. * @throws NotExecutableException */ public void testGetPositionEmptyIterator() throws RepositoryException, NotExecutableException { QueryResult rs = execute(xpathRoot + "/" + nodeName4, qsXPATH); NodeIterator it = rs.getNodes(); assertFalse("NodeIterator must be empty.", it.hasNext()); assertEquals("Empty NodeIterator must return 0 on getPosition()", 0, it.getPosition()); }
@Test public void shouldStartWithPositionOfZero() { assertThat(iter.getPosition(), is(0L)); }
@Test public void shouldHavePositionOfZero() { assertThat(iter.getPosition(), is(0L)); }
@Test public void shouldProperlyDetermineHasNext() { Iterator<AbstractJcrNode> nodeIter = children.iterator(); long position = 0L; assertThat(iter.getPosition(), is(position)); while (iter.hasNext()) { assertThat(nodeIter.hasNext(), is(true)); Node actual = (Node)iter.next(); Node expected = nodeIter.next(); assertThat(iter.getPosition(), is(++position)); assertThat(iter.getPosition(), is(position)); // call twice assertThat(actual, is(sameInstance(expected))); } assertThat(iter.hasNext(), is(false)); assertThat(nodeIter.hasNext(), is(false)); }
public void testPositionEmptyResult() throws RepositoryException { QueryManager qm = superuser.getWorkspace().getQueryManager(); String stmt = testPath + "/*[@" + propertyName1 + " > 1000]"; QueryResult result = qm.createQuery(stmt, Query.XPATH).execute(); assertEquals("Wrong position", 0, result.getNodes().getPosition()); assertEquals("Wrong position", 0, result.getRows().getPosition()); stmt += " order by jcr:score()"; result = qm.createQuery(stmt, Query.XPATH).execute(); assertEquals("Wrong position", 0, result.getNodes().getPosition()); assertEquals("Wrong position", 0, result.getRows().getPosition()); } }