Package javax.jcr

Examples of javax.jcr.NodeIterator.skip()


            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

        query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
        result = query.execute();
        NodeIterator iter = result.getNodes();
        assertTrue(iter.hasNext());
        assertThat(iter.next(), is(notNullValue()));
        iter.skip(count - 2);
        assertTrue(iter.hasNext());
        assertThat(iter.next(), is(notNullValue()));
        // we're at the next one ...
        assertThat(iter.hasNext(), is(false));
        try {
View Full Code Here

        assertTrue(iter.hasNext());
        assertThat(iter.next(), is(notNullValue()));
        // we're at the next one ...
        assertThat(iter.hasNext(), is(false));
        try {
            iter.skip(3);
            fail("Expected NoSuchElementException if skipping past end");
        } catch (NoSuchElementException e) {
            // expected
        }
        // Do it again and skip past the end ...
View Full Code Here

        // Do it again and skip past the end ...
        query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
        result = query.execute();
        iter = result.getNodes();
        try {
            iter.skip(count + 1);
            fail("Expected NoSuchElementException if skipping past end");
        } catch (NoSuchElementException e) {
            // expected
        }
    }
View Full Code Here

            Node parentNode = session.getNode(parentPath);
            NodeIterator childIter = parentNode.getNodes();
            // Get the first iterator that starts at the 'nth' child (each thread starts at a different child) ...
            long numChildren = childIter.getSize();
            long offset = getOffset(numChildren);
            childIter.skip(offset);
            // Modify a set of children ...
            int childrenToUpdate = Math.min(this.childrenToUpdate, (int)numChildren);
            for (int i = 0; i != childrenToUpdate; ++i) {
                childIter = validateIterator(childIter, parentNode);
                Node child = childIter.nextNode();
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

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

    public void testOffsetAndLimitWithGetSize() throws Exception {
        query.setOffset(1);
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.