Search in sources :

Example 51 with NodeBuilder

use of org.apache.jackrabbit.oak.spi.state.NodeBuilder in project jackrabbit-oak by apache.

the class CommitRateLimiterTest method createAfter.

private static NodeState createAfter() {
    NodeBuilder builder = EMPTY_NODE.builder();
    builder.setChildNode("a");
    builder.setProperty("x", 42);
    return builder.getNodeState();
}
Also used : NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder)

Example 52 with NodeBuilder

use of org.apache.jackrabbit.oak.spi.state.NodeBuilder in project jackrabbit-oak by apache.

the class AnnotatingConflictHandler method addConflictMarker.

private static NodeBuilder addConflictMarker(NodeBuilder parent) {
    List<String> mixins = newArrayList(parent.getNames(JCR_MIXINTYPES));
    if (mixins.add(MIX_REP_MERGE_CONFLICT)) {
        parent.setProperty(JCR_MIXINTYPES, mixins, NAMES);
    }
    NodeBuilder repOurs = parent.child(REP_OURS);
    repOurs.setProperty(JCR_PRIMARYTYPE, NodeTypeConstants.NT_REP_UNSTRUCTURED, Type.NAME);
    return repOurs;
}
Also used : NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder)

Example 53 with NodeBuilder

use of org.apache.jackrabbit.oak.spi.state.NodeBuilder in project jackrabbit-oak by apache.

the class CompositeNodeStoreTest method resetOnGlobalStore.

@Test
public void resetOnGlobalStore() {
    NodeBuilder builder = store.getRoot().builder();
    builder.child("newChild");
    store.reset(builder);
    assertFalse("Newly added child should no longer be visible after reset", builder.hasChildNode("newChild"));
}
Also used : NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Test(org.junit.Test)

Example 54 with NodeBuilder

use of org.apache.jackrabbit.oak.spi.state.NodeBuilder in project jackrabbit-oak by apache.

the class CompositeNodeStoreTest method setPropertyOnRootStore.

@Test
public void setPropertyOnRootStore() throws Exception {
    NodeBuilder builder = store.getRoot().builder();
    builder.setProperty("newProp", "newValue");
    store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    assertThat("Property must be visible in composite store", store.getRoot().getProperty("newProp").getValue(Type.STRING), equalTo("newValue"));
    assertThat("Property must be visible in owning (root) store", globalStore.getRoot().getProperty("newProp").getValue(Type.STRING), equalTo("newValue"));
}
Also used : NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Test(org.junit.Test)

Example 55 with NodeBuilder

use of org.apache.jackrabbit.oak.spi.state.NodeBuilder in project jackrabbit-oak by apache.

the class CompositeNodeStoreTest method removePropertyFromRootStore.

@Test
public void removePropertyFromRootStore() throws Exception {
    NodeBuilder builder = store.getRoot().builder();
    builder.removeProperty("prop");
    store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    assertFalse("Property must be removed from composite store", store.getRoot().hasProperty("prop"));
    assertFalse("Property must be removed from owning (root) store", globalStore.getRoot().hasProperty("prop"));
}
Also used : NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Test(org.junit.Test)

Aggregations

NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)1190 Test (org.junit.Test)849 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)338 MemoryDocumentStore (org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore)96 FilterImpl (org.apache.jackrabbit.oak.query.index.FilterImpl)82 LuceneIndexHelper.newLuceneIndexDefinition (org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneIndexHelper.newLuceneIndexDefinition)80 LuceneIndexHelper.newLucenePropertyIndexDefinition (org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneIndexHelper.newLucenePropertyIndexDefinition)77 CommitFailedException (org.apache.jackrabbit.oak.api.CommitFailedException)75 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)73 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)69 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)64 EmptyNodeState (org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState)61 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)43 FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)40 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)38 Blob (org.apache.jackrabbit.oak.api.Blob)36 ArrayList (java.util.ArrayList)29 CommitInfo (org.apache.jackrabbit.oak.spi.commit.CommitInfo)29 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)28 Nonnull (javax.annotation.Nonnull)26