Package org.apache.jackrabbit.oak.api

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


        a.setProperty("aProp", "aValue1");
        assertNotNull(a.getProperty("aProp"));
        assertTrue(a.hasProperty("aProp"));

        // after commit() normal access control again takes over!
        testRoot.commit(); // does not fail since only read access is denied
        assertNull(a.getProperty("aProp"));
        assertFalse(a.hasProperty("aProp"));
    }

    @Test
View Full Code Here


        a.setProperty("aProp", "aValue");
        assertNotNull(a.getProperty("aProp"));
        assertTrue(a.hasProperty("aProp"));

        // after commit() normal access control again takes over
        testRoot.commit(); // does not fail since no changes are detected, even when write access is denied
        assertNull(a.getProperty("aProp"));
        assertFalse(a.hasProperty("aProp"));
    }

    @Test @Ignore("OAK-1247")
View Full Code Here

        new NodeUtil(a).addChild("b", JcrConstants.NT_UNSTRUCTURED);
        assertTrue(a.getChild("b").exists());
        assertFalse(a.getChild("b").getChild("c").exists()); // now shadowed

        // since we have write access, the old content gets replaced
        testRoot.commit(); // note that also the deny-read ACL gets replaced

        assertTrue(a.getChild("b").exists());
        assertFalse(a.getChild("b").getChild("c").exists());
    }
View Full Code Here

    @Test
    public void testSolrQueryEngine() throws Exception {
        Root root = createRoot();
        Tree tree = root.getTree("/");
        tree.addChild("somenode").setProperty("foo", "bar");
        root.commit();

        QueryIndex index = new SolrQueryIndex("solr", server, configuration);
        FilterImpl filter = new FilterImpl(null, null);
        filter.restrictPath("/somenode", Filter.PathRestriction.EXACT);
        filter.restrictProperty("foo", Operator.EQUAL, PropertyValues.newString("bar"));
View Full Code Here

                setProperty("text", "it hits hot hats");
        r.getTree("/").getChild("a").getChild("b").addChild("doc3").
                setProperty("text", "tattoos hate hot hits");
        r.getTree("/").getChild("a").getChild("b").addChild("doc4").
                setProperty("text", "hats tattoos hit hot");
        r.commit();

        SolrQuery query = new SolrQuery();
        query.setQuery("*:*");
        QueryResponse queryResponse = server.query(query);
        assertTrue("no documents were indexed", queryResponse.getResults().size() > 0);
View Full Code Here

    public void testRemoveNode() throws Exception {
        Root r = createRoot();

        // Add a node
        r.getTree("/").addChild("testRemoveNode").setProperty("foo", "bar");
        r.commit();

        // check the node is not in Solr anymore
        SolrQuery query = new SolrQuery();
        query.setQuery("path_exact:\\/testRemoveNode\\/");
        assertTrue("item with id:testRemoveNode was not found in the index",
View Full Code Here

        assertTrue("item with id:testRemoveNode was not found in the index",
                server.query(query).getResults().size() > 0);

        // remove the node in oak
        r.getTree("/").getChild("testRemoveNode").remove();
        r.commit();

        // check the node is not in Solr anymore
        assertTrue("item with id:testRemoveNode was found in the index",
                server.query(query).getResults().size() == 0);
    }
View Full Code Here

        assertTrue(testRoot.getTree(childPath).exists());
        assertFalse(testRoot.getTree(childPath + "/rep:policy").exists());

        testRoot.getTree(childPath).remove();
        testRoot.commit();
        testSession.close();

        root.refresh();
        assertFalse(root.getTree(testPath).hasChild("childNode"));
        assertFalse(root.getTree(childPath + "/rep:policy").exists());
View Full Code Here

        Tree x = tree.addChild("x");
        x.addChild("xx");
        x.setProperty("xa", "value");
        tree.addChild("y");
        tree.addChild("z");
        root.commit();
    }

    @After
    public void tearDown() {
        session = null;
View Full Code Here

        assertTrue(root.hasPendingChanges());
        assertFalse(tree.hasChild("x"));
        assertTrue(y.hasChild("xx"));
        assertEquals("/y/xx", x.getPath());

        root.commit();
        assertFalse(root.hasPendingChanges());

        assertFalse(tree.hasChild("x"));
        assertTrue(tree.hasChild("y"));
        assertTrue(tree.getChild("y").hasChild("xx"));
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.