Package org.apache.jackrabbit.mk.api

Examples of org.apache.jackrabbit.mk.api.MicroKernel.commit()


    @Before
    public void setUp() throws Exception {
        MicroKernel microKernel = new MicroKernelImpl();
        String jsop = "^\"a\":1 ^\"b\":2 ^\"c\":3 +\"x\":{} +\"y\":{} +\"z\":{} " +
                "+\"oak:index\":{\"solrIdx\":{\"coreName\":\"cn\", \"solrHome\":\"sh\", \"solrConfig\":\"sc\"}} ";
        microKernel.commit("/", jsop, microKernel.getHeadRevision(), "test data");
        store = new KernelNodeStore(microKernel);
    }

    @Test
    public void testExistingPath() throws Exception {
View Full Code Here


                @Override
                public String call() throws Exception {
                    // commit all statements, one at a time
                    String r = null;
                    for (String stmt : stmts) {
                        r = mk.commit("/", stmt, null, "msg");
                    }
                    return r;
                }
            };
            cs.add(c);
View Full Code Here

        ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
        final MicroKernel mk = this.mk;
        ScheduledFuture<String> future = executorService.schedule(new Callable<String>(){
            @Override
            public String call() throws Exception {
                return mk.commit("/", "+\"b\" : {}", revisionId, null);
            }
        }, delay, TimeUnit.MILLISECONDS);
        executorService.shutdown();
        return future;
    }
View Full Code Here

        }

        // persist transient changes first
        persistTransientHead();

        headRevision = kernel.commit("", jsop, headRevision, null);
        head = store.getRootState(headRevision);
    }

    private void persistTransientHead() {
        KernelNodeState oldBase = base;
View Full Code Here

                    head.compareAgainstBaseState(branchHead, diff);
                }
            }
            // if we get here we have something to persist
            // and a branch exists
            headRevision = kernel.commit("", diff.toString(), headRevision, null);
            head = store.getRootState(headRevision);
            success = true;
        } finally {
            // revert to old state if unsuccessful
            if (!success) {
View Full Code Here

        String oldHead = head;

        Assert.assertEquals(null, index.getPath("1", head));

        head = mk.commit("/", "+\"test\" : {\"id\":\"1\"}", head, null);
        head = mk.commit("/", "+\"test2\" : {\"id\":\"2\"}", head, null);

        Assert.assertEquals("/test", index.getPath("1", head));
        Assert.assertEquals("/test2", index.getPath("2", head));
View Full Code Here

        String oldHead = head;

        Assert.assertEquals(null, index.getPath("1", head));

        head = mk.commit("/", "+\"test\" : {\"id\":\"1\"}", head, null);
        head = mk.commit("/", "+\"test2\" : {\"id\":\"2\"}", head, null);

        Assert.assertEquals("/test", index.getPath("1", head));
        Assert.assertEquals("/test2", index.getPath("2", head));

        Assert.assertEquals("/test", index.getPath("1", oldHead));
View Full Code Here

        Assert.assertEquals("/test2", index.getPath("2", oldHead));

        Assert.assertEquals("/test", index.getPath("1", head));
        Assert.assertEquals("/test2", index.getPath("2", head));

        head = mk.commit("/", "-\"test2\"", head, null);
        head = mk.commit("/test", "+\"test\" : {\"id\":\"3\"}", head, null);

        Assert.assertEquals("/test/test", index.getPath("3", head));

        // Recreate the indexer
View Full Code Here

    private static void test(String url) throws ParseException {
        MicroKernel mk = MicroKernelFactory.getInstance(url);
        System.out.println(url);
        String head = mk.getHeadRevision();
        head = mk.commit("/", "+ \"hello\" : {}", head, null);
        String move = "> \"hello\": \"world\" ";
        String set = "^ \"world/x\": 1 ";
        try {
            head = mk.commit("/", move + set, head, null);
            System.out.println("move & set worked");
View Full Code Here

        Assert.assertEquals("/test", index.getPath("1", head));
        Assert.assertEquals("/test2", index.getPath("2", head));

        head = mk.commit("/", "-\"test2\"", head, null);
        head = mk.commit("/test", "+\"test\" : {\"id\":\"3\"}", head, null);

        Assert.assertEquals("/test/test", index.getPath("3", head));

        // Recreate the indexer
        indexer = new Indexer(mk);
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.