Package org.apache.jackrabbit.oak.api

Examples of org.apache.jackrabbit.oak.api.Root.commit()


        r.getChild("N6").addChild("N7");
        root.commit();
        root.move("/root/N6/N7", "/root/N3/N12");
        r.getChild("N3").getChild("N12").remove();
        r.getChild("N6").remove();
        root.commit();
    }
   
    private static void checkEqual(Tree tree1, Tree tree2) {
        assertEquals(tree1.getChildrenCount(Long.MAX_VALUE), tree2.getChildrenCount(Long.MAX_VALUE));
        assertEquals(tree1.getPropertyCount(), tree2.getPropertyCount());
View Full Code Here


            String anonymousId = Strings.emptyToNull(params.getConfigValue(PARAM_ANONYMOUS_ID, DEFAULT_ANONYMOUS_ID, String.class));
            if (anonymousId != null && userManager.getAuthorizable(anonymousId) == null) {
                userManager.createUser(anonymousId, null);
            }
            if (root.hasPendingChanges()) {
                root.commit();
            }
        } catch (RepositoryException e) {
            log.error(errorMsg, e);
            throw new RuntimeException(e);
        } catch (CommitFailedException e) {
View Full Code Here

        testRoot.refresh();

        NodeUtil a = new NodeUtil(testRoot.getTree("/a"));
        NodeUtil test = a.addChild("referenceable2", NT_NAME);
        test.setString(JcrConstants.JCR_UUID, IdentifierManager.generateUUID());
        testRoot.commit();
    }

    /**
     * Creating a referenceable tree with an invalid jcr:uuid must fail.
     */
 
View Full Code Here

            testRoot.refresh();

            NodeUtil a = new NodeUtil(testRoot.getTree("/a"));
            NodeUtil test = a.addChild("referenceable2", NT_NAME);
            test.setString(JcrConstants.JCR_UUID, "not a uuid");
            testRoot.commit();
            fail("Creating a referenceable node with an invalid uuid must fail.");
        } catch (CommitFailedException e) {
            assertTrue(e.isConstraintViolation());
            assertEquals(12, e.getCode());
        }
View Full Code Here

            testRoot.refresh();

            NodeUtil a = new NodeUtil(testRoot.getTree("/a"));
            NodeUtil test = a.addChild("referenceable2", NT_NAME);
            test.setBoolean(JcrConstants.JCR_UUID, false);
            testRoot.commit();
            fail("Creating a referenceable node with an boolean uuid must fail.");
        } catch (CommitFailedException e) {
            assertTrue(e.isConstraintViolation());
        }
    }
View Full Code Here

        try {
            Root testRoot = getTestRoot();
            NodeUtil a = new NodeUtil(testRoot.getTree("/a"));
            a.setString(JCR_UUID, IdentifierManager.generateUUID());
            testRoot.commit();
            fail("Creating a jcr:uuid property for an unstructured node without ADD_PROPERTY permission must fail.");
        } catch (CommitFailedException e) {
            assertTrue(e.isAccessViolation());
        }
    }
View Full Code Here

        try {
            Root testRoot = getTestRoot();
            Tree test = testRoot.getTree(referenceablePath);
            test.setProperty(JCR_UUID, "anothervalue");
            testRoot.commit();
            fail("An attempt to change the jcr:uuid property must fail");
        } catch (CommitFailedException e) {
            assertTrue(e.isConstraintViolation());
            assertEquals(12, e.getCode());
        }
View Full Code Here

        try {
            Root testRoot = getTestRoot();
            a = new NodeUtil(testRoot.getTree("/a"));
            assertNotNull(a.getString(JCR_UUID, null));
            a.setString(JCR_UUID, IdentifierManager.generateUUID());
            testRoot.commit();
            fail("Modifying a jcr:uuid property for an unstructured node without MODIFY_PROPERTY permission must fail.");
        } catch (CommitFailedException e) {
            assertTrue(e.isAccessViolation());
        }
    }
View Full Code Here

        try {
            Root testRoot = getTestRoot();
            Tree test = testRoot.getTree(referenceablePath);
            test.removeProperty(JCR_UUID);
            testRoot.commit();
            fail("Removing the jcr:uuid property of a referenceable node must fail.");
        } catch (CommitFailedException e) {
            assertTrue(e.isConstraintViolation());
            assertEquals(22, e.getCode());
        }
View Full Code Here

        try {
            if (!moveRoot.move(srcPath, destPath)) {
                throw new RepositoryException("Cannot move node at " + srcPath + " to " + destPath);
            }
            if (!transientOp) {
                moveRoot.commit();
                refresh(true);
            }
        } catch (CommitFailedException e) {
            throw newRepositoryException(e);
        }
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.