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());
}
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();
}
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());
}
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());
}
Aggregations