Search in sources :

Example 6 with MemoryStore

use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.

the class MergeTest method testSequentialMergeWithRebase.

@Test
public void testSequentialMergeWithRebase() throws CommitFailedException, IOException {
    NodeStore store = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
    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, CommitInfo.EMPTY);
    assertTrue(store.getRoot().hasProperty("foo"));
    assertFalse(store.getRoot().hasProperty("bar"));
    store.merge(b, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    assertTrue(store.getRoot().hasProperty("foo"));
    assertTrue(store.getRoot().hasProperty("bar"));
}
Also used : MemoryStore(org.apache.jackrabbit.oak.segment.memory.MemoryStore) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Test(org.junit.Test)

Example 7 with MemoryStore

use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.

the class OakSolrNodeStateConfigurationTest method setUp.

@Before
public void setUp() throws Exception {
    store = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
    NodeBuilder builder = store.getRoot().builder();
    builder.setProperty("a", 1).setProperty("b", 2).setProperty("c", 3);
    builder.setChildNode("x");
    builder.setChildNode("y");
    builder.setChildNode("z");
    builder.setChildNode("oak:index").setChildNode("solrIdx").setProperty("type", "solr").setProperty("rows", "100");
    store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
}
Also used : MemoryStore(org.apache.jackrabbit.oak.segment.memory.MemoryStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Before(org.junit.Before)

Example 8 with MemoryStore

use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.

the class NodeStateTestUtils method createNodeStoreWithContent.

public static NodeStore createNodeStoreWithContent(String... paths) throws CommitFailedException, IOException {
    final SegmentNodeStore store = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
    final NodeBuilder builder = store.getRoot().builder();
    for (String path : paths) {
        create(builder, path);
    }
    commit(store, builder);
    return store;
}
Also used : MemoryStore(org.apache.jackrabbit.oak.segment.memory.MemoryStore) SegmentNodeStore(org.apache.jackrabbit.oak.segment.SegmentNodeStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder)

Example 9 with MemoryStore

use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.

the class CompositeSegmentStoreFixture method createNodeStore.

@Override
public NodeStore createNodeStore() {
    try {
        MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("temp", MOUNT_PATH).build();
        NodeStore globalStore = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
        NodeStore tempMount = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
        return new CompositeNodeStore.Builder(mip, globalStore).addMount("temp", tempMount).build();
    } catch (IOException e) {
        throw new RuntimeException();
    }
}
Also used : MemoryStore(org.apache.jackrabbit.oak.segment.memory.MemoryStore) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) IOException(java.io.IOException) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)

Example 10 with MemoryStore

use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.

the class SegmentParserTest method setup.

@Before
public void setup() throws IOException {
    store = new MemoryStore();
    writer = segmentWriterBuilder("").build(store);
}
Also used : MemoryStore(org.apache.jackrabbit.oak.segment.memory.MemoryStore) Before(org.junit.Before)

Aggregations

MemoryStore (org.apache.jackrabbit.oak.segment.memory.MemoryStore)28 Test (org.junit.Test)15 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)9 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)9 Before (org.junit.Before)7 Oak (org.apache.jackrabbit.oak.Oak)6 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)6 SegmentNodeStore (org.apache.jackrabbit.oak.segment.SegmentNodeStore)4 Session (javax.jcr.Session)3 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStream (java.io.InputStream)2 Callable (java.util.concurrent.Callable)2 Semaphore (java.util.concurrent.Semaphore)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 Node (javax.jcr.Node)2 JackrabbitSession (org.apache.jackrabbit.api.JackrabbitSession)2 InitialContent (org.apache.jackrabbit.oak.InitialContent)2 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1