Examples of itemExists()


Examples of javax.jcr.Session.itemExists()

        final ResourceResolver resolver = cleanupResolverFactory.getAdministrativeResourceResolver(null);
        final Session session = resolver.adaptTo(Session.class);
       
        try {
            for(String path : toDelete) {
                if(session.itemExists(path)) {
                    session.getItem(path).remove();
                }
            }
            toDelete.clear();
            session.save();
View Full Code Here

Examples of javax.jcr.Session.itemExists()

    }

    @Test(expected = RepositoryException.class)
    public void testExceptionThrownForInvalidPath() throws RepositoryException {
        Session session = getAdminSession();
        session.itemExists("//jcr:content");
    }

    @Test
    @Ignore("OAK-1174"// FIXME OAK-1174
    public void testInvalidName() throws RepositoryException {
View Full Code Here

Examples of javax.jcr.Session.itemExists()

    public void testInvalidName() throws RepositoryException {
        Session session = getAdminSession();

        RepositoryException exception = null;
        try {
            session.itemExists("/jcr:cont]ent");
        } catch (RepositoryException e) {
            exception = e;
        }

        session.setNamespacePrefix("foo", "http://foo.bar");
View Full Code Here

Examples of javax.jcr.Session.itemExists()

            exception = e;
        }

        session.setNamespacePrefix("foo", "http://foo.bar");
        try {
            session.itemExists("/jcr:cont]ent");
            assertNull(exception);
        } catch (RepositoryException e) {
            assertNotNull(exception);
        }
    }
View Full Code Here

Examples of javax.jcr.Session.itemExists()

        testSession.getNode(childNPath2);
        // ... and props of path
        assertTrue(n.getProperties().hasNext());

        //testSession must not have access to 'childNPath'
        assertFalse(testSession.itemExists(childNPath));
        try {
            testSession.getNode(childNPath);
            fail("Read access has been denied -> cannot retrieve child node.");
        } catch (PathNotFoundException e) {
            // ok.
View Full Code Here

Examples of javax.jcr.Session.itemExists()

            // ok.
        }
        /*
        -> must not have access to subtree below 'childNPath'
        */
        assertFalse(testSession.itemExists(childchildPPath));
        try {
            testSession.getItem(childchildPPath);
            fail("Read access has been denied -> cannot retrieve prop below child node.");
        } catch (PathNotFoundException e) {
            // ok.
View Full Code Here

Examples of javax.jcr.Session.itemExists()

        /*
         Testuser must still have READ-only access only and must not be
         allowed to view the acl-node that has been created.
        */
        assertFalse(testAcMgr.hasPrivileges(path, privilegesFromName(Privilege.JCR_READ_ACCESS_CONTROL)));
        assertFalse(testSession.itemExists(path + "/rep:policy"));

        Node n = testSession.getNode(tmpl.getPath());
        assertFalse(n.hasNode("rep:policy"));
        try {
            n.getNode("rep:policy");
View Full Code Here

Examples of javax.jcr.Session.itemExists()

        */

        // make sure the 'rep:policy' node has been created.
        assertTrue(superuser.itemExists(tmpl.getPath() + "/rep:policy"));
        // the policy node however must not be visible to the test-user
        assertFalse(testSession.itemExists(tmpl.getPath() + "/rep:policy"));
        try {
            testAcMgr.getPolicies(tmpl.getPath());
            fail("test user must not have READ_AC privilege.");
        } catch (AccessDeniedException e) {
            // success
View Full Code Here

Examples of javax.jcr.Session.itemExists()

        // test if login as testuser -> item at path must not exist.
        Session s = null;
        try {
            s = getHelper().getRepository().login(creds);
            assertFalse(s.itemExists(path));
        } finally {
            if (s != null) {
                s.logout();
            }
        }
View Full Code Here

Examples of javax.jcr.Session.itemExists()

     */
    public void removeMember(DavResource member) throws DavException {
        Session session = getRepositorySession();
        try {
            String itemPath = member.getLocator().getRepositoryPath();
            if (!exists() || !session.itemExists(itemPath)) {
                throw new DavException(DavServletResponse.SC_NOT_FOUND);
            }
            if (!getResourcePath().equals(Text.getRelativeParent(member.getResourcePath(), 1))) {
                throw new DavException(DavServletResponse.SC_CONFLICT, member.getResourcePath() + "is not member of this resource (" + getResourcePath() + ")");
            }
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.