Package org.apache.jackrabbit.oak.spi.state

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


        }
    }

    @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

        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

        }

        @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

     * </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

     * </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

     * </ul>
     *
     */
    @Test
    public void testAsyncDoubleSubtree() 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("newchild").child("other")
                        .child(INDEX_DEFINITIONS_NAME), "subIndex", true,
                false, ImmutableSet.of("foo"), null)
                .setProperty(ASYNC_PROPERTY_NAME, "async");

        builder.child("testRoot").setProperty("foo", "abc");
        builder.child("newchild").child("other").child("testChild")
                .setProperty("foo", "xyz");

        // 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, "newchild", "other", INDEX_DEFINITIONS_NAME,
View Full Code Here

    @Test
    public void testBackup() throws Exception {
        FileStore source = new FileStore(src, 256, false);

        NodeStore store = new SegmentNodeStore(source);
        init(store);

        // initial content
        FileStoreBackup.backup(store, destination);
View Full Code Here

    @Test
    public void testRestore() throws Exception {
        FileStore source = new FileStore(src, 256, false);

        NodeStore store = new SegmentNodeStore(source);
        init(store);

        // initial content
        FileStoreBackup.backup(store, destination);
View Full Code Here

    @Test @Ignore("OAK-1159 duplicate content")
    public void testSharedContent() throws Exception {
        FileStore source = new FileStore(src, 256, false);

        NodeStore store = new SegmentNodeStore(source);

        // ~100k
        Blob blob = store.createBlob(new ByteArrayInputStream(new byte[100000]));

        NodeBuilder builder = store.getRoot().builder();
        NodeBuilder c1 = builder.child("test-backup");
        c1.setProperty("blob", blob);
        NodeBuilder c2 = builder.child("test-backup2");
        c2.setProperty("blob", blob);
        store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);

        FileStoreBackup.backup(store, destination);
        compare(store, destination);
        source.close();
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.state.NodeStore

Copyright © 2018 www.massapicom. 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.