Examples of NodeStore


Examples of org.apache.jackrabbit.oak.spi.state.NodeStore

public class MergeTest {

    @Test
    public void testSequentialMerge() throws CommitFailedException {
        NodeStore store = new SegmentNodeStore(new MemoryStore());

        assertFalse(store.getRoot().hasProperty("foo"));
        assertFalse(store.getRoot().hasProperty("bar"));

        NodeBuilder a = store.getRoot().builder();
        a.setProperty("foo", "abc");
        store.merge(a, EmptyHook.INSTANCE, null);

        assertTrue(store.getRoot().hasProperty("foo"));
        assertFalse(store.getRoot().hasProperty("bar"));

        NodeBuilder b = store.getRoot().builder();
        b.setProperty("bar", "xyz");
        store.merge(b, EmptyHook.INSTANCE, null);

        assertTrue(store.getRoot().hasProperty("foo"));
        assertTrue(store.getRoot().hasProperty("bar"));
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.state.NodeStore

        assertTrue(store.getRoot().hasProperty("bar"));
    }

    @Test
    public void testOptimisticMerge() throws CommitFailedException {
        NodeStore store = new SegmentNodeStore(new MemoryStore());

        NodeBuilder a = store.getRoot().builder();
        a.setProperty("foo", "abc");

        NodeBuilder b = store.getRoot().builder();
        b.setProperty("bar", "xyz");

        assertFalse(store.getRoot().hasProperty("foo"));
        assertFalse(store.getRoot().hasProperty("bar"));

        store.merge(a, EmptyHook.INSTANCE, null);

        assertTrue(store.getRoot().hasProperty("foo"));
        assertFalse(store.getRoot().hasProperty("bar"));

        store.merge(b, EmptyHook.INSTANCE, null);

        assertTrue(store.getRoot().hasProperty("foo"));
        assertTrue(store.getRoot().hasProperty("bar"));
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.state.NodeStore

        }
    }

    @Test
    public void oak965() throws CommitFailedException {
        NodeStore store1 = init(fixture.createNodeStore());
        NodeStore store2 = init(fixture.createNodeStore());
        try {
            NodeState tree1 = store1.getRoot();
            NodeState tree2 = store2.getRoot();
            tree1.equals(tree2);
        } finally {
            fixture.dispose(store1);
            fixture.dispose(store2);
        }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.state.NodeStore

        MongoMK mk1 = createMK(1, 1000, ds, bs);
        MongoMK mk2 = createMK(2, 1000, ds, bs);

        try {
            NodeStore ns1 = new KernelNodeStore(mk1);
            NodeStore ns2 = new KernelNodeStore(mk2);

            NodeBuilder builder1 = ns1.getRoot().builder();
            builder1.child("bar");

            NodeBuilder builder2 = ns2.getRoot().builder();
            builder2.child("qux");

            ns1.merge(builder1, HOOK, null);
            ns2.merge(builder2, HOOK, null);
        } finally {
            mk1.dispose();
            mk2.dispose();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.state.NodeStore

        MongoMK mk1 = createMK(1, 1000, ds, bs);
        MongoMK mk2 = createMK(2, 1000, ds, bs);

        try {
            NodeStore ns1 = new KernelNodeStore(mk1);
            NodeStore ns2 = new KernelNodeStore(mk2);

            NodeBuilder builder1 = ns1.getRoot().builder();
            createTree(builder1.child("bar"), 2);

            NodeBuilder builder2 = ns2.getRoot().builder();
            createTree(builder2.child("qux"), 2);

            ns1.merge(builder1, HOOK, null);
            ns2.merge(builder2, HOOK, null);
        } finally {
            mk1.dispose();
            mk2.dispose();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.state.NodeStore

        }
    }

    @Test
    public void oak965() throws CommitFailedException {
        NodeStore store1 = init(fixture.createNodeStore());
        NodeStore store2 = init(fixture.createNodeStore());
        try {
            NodeState tree1 = store1.getRoot();
            NodeState tree2 = store2.getRoot();
            tree1.equals(tree2);
        } finally {
            fixture.dispose(store1);
            fixture.dispose(store2);
        }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.state.NodeStore

        logger.info("Connected to database {}", mongoDB);

        registerJMXBeans(mk.getNodeStore(), context);

        NodeStore store;
        if (useMK) {
            KernelNodeStore kns = new KernelNodeStore(mk);
            store = kns;
            observerTracker = new ObserverTracker(kns);
        } else {
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.state.NodeStore

        }

        @Override
        public boolean isAvailable() {
            // FIXME is there a better way to check whether MongoDB is available?
            NodeStore nodeStore = createNodeStore(uri);
            if (nodeStore == null) {
                return false;
            } else {
                dispose(nodeStore);
                return true;
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.state.NodeStore

     * </ul>
     *
     */
    @Test
    public void testAsync() throws Exception {
        NodeStore store = new MemoryNodeStore();
        IndexEditorProvider provider = new PropertyIndexEditorProvider();

        NodeBuilder builder = store.getRoot().builder();
        createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME),
                "rootIndex", true, false, ImmutableSet.of("foo"), null)
                .setProperty(ASYNC_PROPERTY_NAME, "async");
        builder.child("testRoot").setProperty("foo", "abc");

        // merge it back in
        store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);

        AsyncIndexUpdate async = new AsyncIndexUpdate("async", store, provider);
        async.run();
        NodeState root = store.getRoot();

        // first check that the index content nodes exist
        checkPathExists(root, INDEX_DEFINITIONS_NAME, "rootIndex",
                INDEX_CONTENT_NODE_NAME);
        assertFalse(root.getChildNode(INDEX_DEFINITIONS_NAME).hasChildNode(
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.state.NodeStore

     * </ul>
     *
     */
    @Test
    public void testAsyncDouble() throws Exception {
        NodeStore store = new MemoryNodeStore();
        IndexEditorProvider provider = new PropertyIndexEditorProvider();

        NodeBuilder builder = store.getRoot().builder();
        createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME),
                "rootIndex", true, false, ImmutableSet.of("foo"), null)
                .setProperty(ASYNC_PROPERTY_NAME, "async");
        createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME),
                "rootIndexSecond", true, false, ImmutableSet.of("bar"), null)
                .setProperty(ASYNC_PROPERTY_NAME, "async");

        builder.child("testRoot").setProperty("foo", "abc")
                .setProperty("bar", "def");
        builder.child("testSecond").setProperty("bar", "ghi");

        // merge it back in
        store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);

        AsyncIndexUpdate async = new AsyncIndexUpdate("async", store, provider);
        async.run();
        NodeState root = store.getRoot();

        // first check that the index content nodes exist
        checkPathExists(root, INDEX_DEFINITIONS_NAME, "rootIndex",
                INDEX_CONTENT_NODE_NAME);
        checkPathExists(root, INDEX_DEFINITIONS_NAME, "rootIndexSecond",
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.