Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.Path.subPath()


            fail("Path.subPath with from == -1 to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            p.subPath(1, p.getLength()+1);
            fail("Path.subPath with to > length to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
    }


        for (JcrPath test : tests) {
            if (test.isValid() && test.isNormalized()) {
                Path p = resolver.getQPath(test.path);

                // subpath between 0 and length -> equal path
                assertEquals(p, p.subPath(0, p.getLength()));

                // subpath a single element
                if (p.getLength() > 2) {
                    Path expected = factory.create(new Path.Element[]{p.getElements()[1]});
                    assertEquals(expected, p.subPath(1, 2));

    public void testSubPathInvalid() throws RepositoryException {
        Path p = resolver.getQPath("/a/b/c/d/e");

        try {
            p.subPath(2,2);
            fail("Path.subPath with identical from/to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {

            fail("Path.subPath with identical from/to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            p.subPath(3,2);
            fail("Path.subPath with from > to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {

            fail("Path.subPath with from > to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            p.subPath(-1, 2);
            fail("Path.subPath with from == -1 to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {

            fail("Path.subPath with from == -1 to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            p.subPath(1, p.getLength()+1);
            fail("Path.subPath with to > length to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
    }

        for (int i = 0; i < tests.length; i++) {
            if (tests[i].isValid() && tests[i].isNormalized()) {
                Path p = resolver.getQPath(tests[i].path);

                // subpath between 0 and length -> equal path
                assertEquals(p, p.subPath(0, p.getLength()));

                // subpath a single element
                if (p.getLength() > 2) {
                    Path expected = factory.create(new Path.Element[] {p.getElements()[1]});
                    assertEquals(expected, p.subPath(1,2));

    public void testSubPathInvalid() throws RepositoryException {
        Path p = resolver.getQPath("/a/b/c/d/e");

        try {
            p.subPath(2,2);
            fail("Path.subPath with identical from/to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {

            fail("Path.subPath with identical from/to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            p.subPath(3,2);
            fail("Path.subPath with from > to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {

            fail("Path.subPath with from > to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            p.subPath(-1, 2);
            fail("Path.subPath with from == -1 to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {

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.