Search in sources :

Example 51 with NodeStore

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

the class NodeStateCopierTest method shouldSkipNonMatchingIncludes.

@Test
public void shouldSkipNonMatchingIncludes() throws CommitFailedException, IOException {
    final NodeStore source = createNodeStoreWithContent();
    final NodeBuilder builder = source.getRoot().builder();
    create(builder, "/a", primaryType);
    create(builder, "/a/b", primaryType);
    create(builder, "/a/b/c", primaryType);
    commit(source, builder);
    final NodeStore target = createNodeStoreWithContent();
    builder().include("/a", "/z").copy(source, target);
    expectDifference().strict().verify(source.getRoot(), target.getRoot());
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Test(org.junit.Test)

Example 52 with NodeStore

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

the class NodeStateCopierTest method shouldDeleteExistingNodes.

@Test
public void shouldDeleteExistingNodes() throws CommitFailedException, IOException {
    final NodeStore source = createNodeStoreWithContent("/content/foo");
    final NodeStore target = createNodeStoreWithContent("/content/bar");
    final NodeState before = target.getRoot();
    builder().copy(source, target);
    final NodeState after = target.getRoot();
    expectDifference().strict().childNodeAdded("/content/foo").childNodeChanged("/content").childNodeDeleted("/content/bar").verify(before, after);
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) Test(org.junit.Test)

Example 53 with NodeStore

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

the class NodeStateCopierTest method shouldNotDeleteMergedExcludedPaths.

@Test
public void shouldNotDeleteMergedExcludedPaths() throws CommitFailedException, IOException {
    final NodeStore source = createNodeStoreWithContent("/content/foo/en", "/jcr:system");
    final NodeStore target = createNodeStoreWithContent("/jcr:system/jcr:versionStorage");
    final NodeState before = target.getRoot();
    builder().merge("/jcr:system").exclude("/jcr:system").copy(source, target);
    final NodeState after = target.getRoot();
    expectDifference().strict().childNodeAdded("/content", "/content/foo", "/content/foo/en").verify(before, after);
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) Test(org.junit.Test)

Example 54 with NodeStore

use of org.apache.jackrabbit.oak.spi.state.NodeStore 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 55 with NodeStore

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

the class CompositeMemoryStoreFixture method createNodeStore.

@Override
public NodeStore createNodeStore() {
    MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("temp", MOUNT_PATH).build();
    NodeStore globalStore = new MemoryNodeStore();
    NodeStore tempMount = new MemoryNodeStore();
    return new CompositeNodeStore.Builder(mip, globalStore).addMount("temp", tempMount).build();
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)

Aggregations

NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)141 Test (org.junit.Test)81 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)58 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)52 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)29 Blob (org.apache.jackrabbit.oak.api.Blob)24 Before (org.junit.Before)18 FileInputStream (java.io.FileInputStream)16 Hex.encodeHexString (org.apache.commons.codec.binary.Hex.encodeHexString)16 File (java.io.File)14 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)14 FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)14 ProxyNodeStore (org.apache.jackrabbit.oak.spi.state.ProxyNodeStore)13 Oak (org.apache.jackrabbit.oak.Oak)10 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)10 StandbyClientSync (org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync)10 StandbyServerSync (org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync)10 DocumentNodeStore (org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore)9 MemoryStore (org.apache.jackrabbit.oak.segment.memory.MemoryStore)9 MountInfoProvider (org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)9