Package org.apache.jackrabbit.oak.api

Examples of org.apache.jackrabbit.oak.api.Tree.removeProperty()


    public void removeProperty() throws CommitFailedException {
        RootImpl root = new RootImpl(store, "test");
        Tree tree = root.getTree("/");

        assertTrue(tree.hasProperty("a"));
        tree.removeProperty("a");
        assertFalse(tree.hasProperty("a"));

        root.commit();
        tree = root.getTree("/");
View Full Code Here


        CoreValue value = valueFactory.createValue("foo");
        tree.setProperty("a", value);
        assertEquals(3, tree.getPropertyCount());

        tree.removeProperty("a");
        assertEquals(2, tree.getPropertyCount());

        tree.setProperty("x", value);
        assertEquals(3, tree.getPropertyCount());
View Full Code Here

        tree.setProperty("P0", valueFactory.createValue("V1"));
        root.commit();
        tree = root.getTree("/");
        assertTrue(tree.hasProperty("P0"));

        tree.removeProperty("P0");
        root.commit();
        tree = root.getTree("/");
        assertFalse(tree.hasProperty("P0"));
    }
View Full Code Here

        assertEquals(Status.MODIFIED, tree.getPropertyStatus("new"));
        root.commit();

        tree = root.getTree("/");
        assertEquals(Status.EXISTING, tree.getPropertyStatus("new"));
        tree.removeProperty("new");
        assertEquals(Status.REMOVED, tree.getPropertyStatus("new"));
        root.commit();

        tree = root.getTree("/");
        assertNull(tree.getPropertyStatus("new"));
View Full Code Here

     */
    public void unregisterNamespace(String prefix)
            throws CommitFailedException {
        Root root = session.getCurrentRoot();
        Tree namespaces = getNamespaces(root, true);
        namespaces.removeProperty(prefix);
        root.commit();
    }

    private static Tree getNamespaces(Root root, boolean create) {
        Tree tree = root.getTree("/");
View Full Code Here

        setupPermission("/a", testPrincipal, true, PrivilegeConstants.JCR_READ);

        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) {
            assertEquals(CommitFailedException.CONSTRAINT, e.getType());
            assertEquals(22, e.getCode());
View Full Code Here

            restrictions.setProperty(entry.getKey());

            RestrictionPattern pattern = provider.getPattern("/testPath", restrictions);
            assertEquals(entry.getValue(), pattern);

            restrictions.removeProperty(entry.getKey().getName());
        }

        // test combination on multiple restrictions
        for (Map.Entry<PropertyState, RestrictionPattern> entry : map.entrySet()) {
            restrictions.setProperty(entry.getKey());
View Full Code Here

    @Test
    public void removeProperty() throws CommitFailedException {
        Tree tree = root.getTree("/");

        assertTrue(tree.hasProperty("a"));
        tree.removeProperty("a");
        assertFalse(tree.hasProperty("a"));

        root.commit();

        assertFalse(tree.hasProperty("a"));
View Full Code Here

        assertEquals(3, tree.getPropertyCount());

        tree.setProperty("a", "foo");
        assertEquals(3, tree.getPropertyCount());

        tree.removeProperty("a");
        assertEquals(2, tree.getPropertyCount());

        tree.setProperty("x", "foo");
        assertEquals(3, tree.getPropertyCount());
View Full Code Here

        tree.setProperty("P0", "V1");
        root.commit();

        assertTrue(tree.hasProperty("P0"));

        tree.removeProperty("P0");
        root.commit();

        assertFalse(tree.hasProperty("P0"));
    }
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.