Package org.apache.jackrabbit.oak.api

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


                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

        Root root = session.getLatestRoot();
        Tree tree = root.getTree("/");
        Tree x = tree.addChild("x");
        Tree y = x.addChild("y");
        Tree z = y.addChild("z");
        root.commit();

        // Acquire a fresh new root to avoid problems from lingering state
        this.root = new ImmutableRoot(session.getLatestRoot(), TreeTypeProvider.EMPTY);
    }
View Full Code Here

        this.treeAPath = treeA.getPath();
        Tree treeB = tree.addChild("tree-b");
        this.treeBPath = treeB.getPath();

        createNodes(treeA, 10, 5)// 111111 nodes in treeA
        root.commit();
    }

    private static void createNodes(Tree tree, int count, int depth) {
        for (int c = 0; c < count; c++) {
            Tree child = tree.addChild("n-" + depth + '-' + c);
View Full Code Here

        Root root1 = session.getLatestRoot();

        // Concurrent changes to trunk: enforce rebase
        Root root2 = session.getLatestRoot();
        root2.getTree("/").addChild("any");
        root2.commit();

        root1.move(treeAPath, PathUtils.concat(treeBPath, "tree-a-moved"));
        root1.commit();
    }
View Full Code Here

            ObjectMapper mapper = new ObjectMapper();
            JsonNode node = mapper.readTree(request.getInputStream());
            if (node.isObject()) {
                post(node, tree);
                root.commit();
                doGet(request, response);
            } else {
                response.sendError(HttpServletResponse.SC_BAD_REQUEST);
            }
        } catch (CommitFailedException e) {
View Full Code Here

                Tree parent = tree.getParent();
                Tree child = parent.getChild(tree.getName());
                if (child.exists()) {
                    child.remove();
                }
                root.commit();
                response.sendError(HttpServletResponse.SC_OK);
            } else {
                // Can't remove the root node
                response.sendError(HttpServletResponse.SC_FORBIDDEN);
            }
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.