Package javax.jcr

Examples of javax.jcr.NodeIterator.skip()


            count++;
        }
        if (count > 0) {
            // re-aquire iterator
            iter = testRootNode.getNodes();
            iter.skip(count);
            try {
                iter.nextNode();
                fail("nextNode() must throw a NoSuchElementException when no nodes are available");
            } catch (NoSuchElementException e) {
                // success
View Full Code Here


            }

            // re-aquire iterator
            iter = testRootNode.getNodes();
            try {
                iter.skip(count + 1);
                fail("skip() must throw a NoSuchElementException if one tries to skip past the end of the iterator");
            } catch (NoSuchElementException e) {
                // success
            }
        }
View Full Code Here

    public void testOffsetAndSkip() throws Exception {
        query.setOffset(1);
        QueryResult result = query.execute();
        NodeIterator nodes = result.getNodes();
        nodes.skip(1);
        assertTrue(node3.isSame(nodes.nextNode()));
    }

    public void testOffsetAndLimitWithGetSize() throws Exception {
        query.setOffset(1);
View Full Code Here

            String stmt = testPath + "/*[@" + propertyName1 + " < 1000]";
            QueryResult result = qm.createQuery(stmt, Query.XPATH).execute();
            for (int j = 0; j < INITIAL_NODE_NUM - i; j++) {
                // skip to each node in the result
                NodeIterator it = result.getNodes();
                it.skip(j);
                long propValue = it.nextNode().getProperty(propertyName1).getLong();
                // expected = number of skipped nodes + number of deleted nodes
                long expected = j + i;
                assertEquals("Wrong node after skip()", expected, propValue);
            }
View Full Code Here

                long expected = j + i;
                assertEquals("Wrong node after skip()", expected, propValue);
            }
            try {
                NodeIterator it = result.getNodes();
                it.skip(it.getSize() + 1);
                fail("must throw NoSuchElementException");
            } catch (NoSuchElementException e) {
                // correct
            }
            // remove node for the next iteration
View Full Code Here

                    " < 1000] order by @" + propertyName1;
            QueryResult result = qm.createQuery(stmt, Query.XPATH).execute();
            for (int j = 0; j < INITIAL_NODE_NUM - i; j++) {
                // skip to each node in the result
                NodeIterator it = result.getNodes();
                it.skip(j);
                long propValue = it.nextNode().getProperty(propertyName1).getLong();
                // expected = number of skipped nodes + number of deleted nodes
                long expected = j + i;
                assertEquals("Wrong node after skip()", expected, propValue);
            }
View Full Code Here

                long expected = j + i;
                assertEquals("Wrong node after skip()", expected, propValue);
            }
            try {
                NodeIterator it = result.getNodes();
                it.skip(it.getSize() + 1);
                fail("must throw NoSuchElementException");
            } catch (NoSuchElementException e) {
                // correct
            }
            // remove node for the next iteration
View Full Code Here

            String stmt = testPath + "/*[@" + propertyName1 + " < 1000]";
            QueryResult result = qm.createQuery(stmt, Query.XPATH).execute();
            for (int j = 0; j < INITIAL_NODE_NUM - i; j++) {
                // skip to each node in the result
                NodeIterator it = result.getNodes();
                it.skip(j);
                long propValue = it.nextNode().getProperty(propertyName1).getLong();
                // expected = number of skipped nodes + number of deleted nodes
                long expected = j + i;
                assertEquals("Wrong node after skip()", expected, propValue);
            }
View Full Code Here

                long expected = j + i;
                assertEquals("Wrong node after skip()", expected, propValue);
            }
            try {
                NodeIterator it = result.getNodes();
                it.skip(it.getSize() + 1);
                fail("must throw NoSuchElementException");
            } catch (NoSuchElementException e) {
                // correct
            }
            // remove node for the next iteration
View Full Code Here

                    " < 1000] order by @" + propertyName1;
            QueryResult result = qm.createQuery(stmt, Query.XPATH).execute();
            for (int j = 0; j < INITIAL_NODE_NUM - i; j++) {
                // skip to each node in the result
                NodeIterator it = result.getNodes();
                it.skip(j);
                long propValue = it.nextNode().getProperty(propertyName1).getLong();
                // expected = number of skipped nodes + number of deleted nodes
                long expected = j + i;
                assertEquals("Wrong node after skip()", expected, propValue);
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.