Search in sources :

Example 1 with NodeStoreChecksService

use of org.apache.jackrabbit.oak.composite.checks.NodeStoreChecksService in project jackrabbit-oak by apache.

the class CompositeNodeStoreServiceTest method bootstrap.

/**
 *  Verifies that a minimally-configured <tt>CompositeNodeStore</tt> can be registered successfully
 */
@Test
public void bootstrap() {
    MemoryNodeStore mount = new MemoryNodeStore();
    MemoryNodeStore global = new MemoryNodeStore();
    MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("libs", "/libs", "/apps").build();
    ctx.registerService(MountInfoProvider.class, mip);
    ctx.registerService(StatisticsProvider.class, StatisticsProvider.NOOP);
    ctx.registerService(NodeStoreProvider.class, new SimpleNodeStoreProvider(global), ImmutableMap.of("role", "composite-global", "registerDescriptors", Boolean.TRUE));
    ctx.registerService(NodeStoreProvider.class, new SimpleNodeStoreProvider(mount), ImmutableMap.of("role", "composite-mount-libs"));
    ctx.registerInjectActivateService(new NodeStoreChecksService());
    ctx.registerInjectActivateService(new CompositeNodeStoreService());
    assertThat("No NodeStore registered", ctx.getService(NodeStore.class), notNullValue());
}
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) NodeStoreChecksService(org.apache.jackrabbit.oak.composite.checks.NodeStoreChecksService) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Example 2 with NodeStoreChecksService

use of org.apache.jackrabbit.oak.composite.checks.NodeStoreChecksService in project jackrabbit-oak by apache.

the class CompositeNodeStoreBuilderTest method versionableNode.

@Test(expected = IllegalRepositoryStateException.class)
public void versionableNode() throws CommitFailedException {
    MemoryNodeStore root = new MemoryNodeStore();
    MemoryNodeStore mount = new MemoryNodeStore();
    // create a child node that is versionable
    // note that we won't cover all checks here, we are only interested in seeing that at least one check is triggered
    NodeBuilder rootBuilder = mount.getRoot().builder();
    NodeBuilder childNode = rootBuilder.setChildNode("readOnly").setChildNode("second").setChildNode("third");
    childNode.setProperty(JcrConstants.JCR_ISCHECKEDOUT, false);
    childNode.setProperty(PropertyStates.createProperty(JcrConstants.JCR_MIXINTYPES, Collections.singletonList(JcrConstants.MIX_VERSIONABLE), Type.NAMES));
    mount.merge(rootBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("readOnly", "/readOnly").build();
    new CompositeNodeStore.Builder(mip, root).addMount("readOnly", mount).with(new NodeStoreChecksService(mip, Collections.singletonList(new NodeTypeMountedNodeStoreChecker(JcrConstants.MIX_VERSIONABLE, "test error")))).build();
}
Also used : NodeTypeMountedNodeStoreChecker(org.apache.jackrabbit.oak.composite.checks.NodeTypeMountedNodeStoreChecker) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) NodeStoreChecksService(org.apache.jackrabbit.oak.composite.checks.NodeStoreChecksService) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Example 3 with NodeStoreChecksService

use of org.apache.jackrabbit.oak.composite.checks.NodeStoreChecksService in project jackrabbit-oak by apache.

the class CompositeNodeStoreServiceTest method bootstrap_missingMount.

/**
 * Verifies that a missing mount will result in the node store not being registered
 */
@Test
public void bootstrap_missingMount() {
    MemoryNodeStore mount = new MemoryNodeStore();
    MemoryNodeStore global = new MemoryNodeStore();
    MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("libs", "/libs", "/apps").readOnlyMount("missing", "/missing").build();
    ctx.registerService(MountInfoProvider.class, mip);
    ctx.registerService(StatisticsProvider.class, StatisticsProvider.NOOP);
    ctx.registerService(NodeStoreProvider.class, new SimpleNodeStoreProvider(global), ImmutableMap.of("role", "composite-global", "registerDescriptors", Boolean.TRUE));
    ctx.registerService(NodeStoreProvider.class, new SimpleNodeStoreProvider(mount), ImmutableMap.of("role", "composite-mount-libs"));
    ctx.registerInjectActivateService(new NodeStoreChecksService());
    ctx.registerInjectActivateService(new CompositeNodeStoreService());
    assertThat("NodeStore registered, but it should not have been", ctx.getService(NodeStore.class), nullValue());
}
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) NodeStoreChecksService(org.apache.jackrabbit.oak.composite.checks.NodeStoreChecksService) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Example 4 with NodeStoreChecksService

use of org.apache.jackrabbit.oak.composite.checks.NodeStoreChecksService in project jackrabbit-oak by apache.

the class CompositeNodeStoreServiceTest method bootstrap_missingGlobalMount.

/**
 *  Verifies that a missing global mount will result in the node store not being registered
 */
@Test
public void bootstrap_missingGlobalMount() {
    MemoryNodeStore mount = new MemoryNodeStore();
    MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("libs", "/libs", "/apps").build();
    ctx.registerService(MountInfoProvider.class, mip);
    ctx.registerService(StatisticsProvider.class, StatisticsProvider.NOOP);
    ctx.registerService(NodeStoreProvider.class, new SimpleNodeStoreProvider(mount), ImmutableMap.of("role", "composite-mount-libs"));
    ctx.registerInjectActivateService(new NodeStoreChecksService());
    ctx.registerInjectActivateService(new CompositeNodeStoreService());
    assertThat("NodeStore registered, but it should not have been", ctx.getService(NodeStore.class), nullValue());
}
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) NodeStoreChecksService(org.apache.jackrabbit.oak.composite.checks.NodeStoreChecksService) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Aggregations

NodeStoreChecksService (org.apache.jackrabbit.oak.composite.checks.NodeStoreChecksService)4 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)4 MountInfoProvider (org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)4 Test (org.junit.Test)4 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)3 NodeTypeMountedNodeStoreChecker (org.apache.jackrabbit.oak.composite.checks.NodeTypeMountedNodeStoreChecker)1 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)1