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

Examples of org.apache.jackrabbit.oak.spi.state.NodeState.compareAgainstBaseState()


        checkArgument(builder instanceof SegmentNodeBuilder);
        NodeState oldBase = builder.getBaseState();
        if (!SegmentNodeState.fastEquals(oldBase, newBase)) {
            NodeState head = builder.getNodeState();
            ((SegmentNodeBuilder) builder).reset(newBase);
            head.compareAgainstBaseState(oldBase, new ConflictAnnotatingRebaseDiff(builder));
        }
        return builder.getNodeState();
    }

    @Override @Nonnull
View Full Code Here


            throws MicroKernelException {
        NodeState before = getNode(fromRevisionId, path);
        NodeState after = getNode(toRevisionId, path);

        JsopDiff diff = new JsopDiff(path, depth);
        after.compareAgainstBaseState(before, diff);
        return diff.toString();
    }

    @Override
    public boolean nodeExists(String path, String revisionId)
View Full Code Here

        NodeStore store = new MemoryNodeStore(base);
        BuiltInNodeTypes.register(new SystemRoot(store, new EditorHook(
                new CompositeEditorProvider(new NamespaceEditorProvider(),
                        new RegistrationEditorProvider()))));
        NodeState target = store.getRoot();
        target.compareAgainstBaseState(base, new ApplyDiff(builder));
    }

}
View Full Code Here

        builder.child("foo").child(":bar").child("quz").setProperty("p", "v");
        store.merge(builder, EmptyHook.INSTANCE, null);

        NodeState after = store.getRoot();
        Diff diff = new Diff();
        after.compareAgainstBaseState(before, diff);

        assertEquals(0, diff.removed.size());
        assertEquals(childNodeCount + 1, diff.added.size());
        assertEquals(0, diff.addedProperties.size());
    }
View Full Code Here

    public void testSameState() {
        NodeState node = persist(builder);

        replay(diff);

        node.compareAgainstBaseState(node, diff);
        verify(diff);
    }

    @Test
    public void testEqualState() {
View Full Code Here

        NodeState before = persist(builder);
        NodeState after = persist(before.builder());

        replay(diff);

        after.compareAgainstBaseState(before, diff);
        verify(diff);
    }

    @Test
    public void testPropertyAdded() {
View Full Code Here

        NodeState after = persist(builder);

        expect(diff.propertyAdded(after.getProperty("test"))).andReturn(true);
        replay(diff);

        after.compareAgainstBaseState(before, diff);
        verify(diff);
    }

    @Test
    public void testPropertyChanged() {
View Full Code Here

        expect(diff.propertyChanged(
                before.getProperty("foo"), after.getProperty("foo"))).andReturn(true);
        replay(diff);

        after.compareAgainstBaseState(before, diff);
        verify(diff);
    }

    @Test
    public void testPropertyDeleted() {
View Full Code Here

            mergeLock.lock();
            try {
                rebase();
                NodeState toCommit = checkNotNull(hook).processCommit(base, head);
                JsopDiff diff = new JsopDiff(store);
                toCommit.compareAgainstBaseState(base, diff);
                NodeState newHead = store.commit(diff.toString(), base);
                committed.contentChanged(base, newHead);
                branchState = new Merged(base);
                return newHead;
            } catch (MicroKernelException e) {
View Full Code Here

                    committed.contentChanged(base, base);
                    branchState = new Merged(base);
                    return base;
                } else {
                    JsopDiff diff = new JsopDiff(store);
                    toCommit.compareAgainstBaseState(head, diff);
                    commit(diff.toString());
                    NodeState newRoot = store.merge(head);
                    committed.contentChanged(base, newRoot);
                    branchState = new Merged(base);
                    return newRoot;
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.