Search in sources :

Example 1 with NodeTypeMountedNodeStoreChecker

use of org.apache.jackrabbit.oak.composite.checks.NodeTypeMountedNodeStoreChecker 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)

Aggregations

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