Search in sources :

Example 1 with Context

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

the class NodeTypeMountedNodeStoreCheckerTest method referenceableNodeInWhitelistIsSkipped.

@Test
public void referenceableNodeInWhitelistIsSkipped() throws CommitFailedException {
    MemoryNodeStore root = new MemoryNodeStore();
    MemoryNodeStore mount = new MemoryNodeStore();
    NodeBuilder builder = mount.getRoot().builder();
    builder.child("first").setProperty(PropertyStates.createProperty(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_RESOURCE, Type.NAME)).setProperty(PropertyStates.createProperty(JcrConstants.JCR_MIXINTYPES, Collections.singletonList(JcrConstants.MIX_REFERENCEABLE), Type.NAMES)).setProperty(JcrConstants.JCR_UUID, UUID.randomUUID().toString());
    mount.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("first", "/first").build();
    NodeTypeMountedNodeStoreChecker checker = new NodeTypeMountedNodeStoreChecker(JcrConstants.MIX_REFERENCEABLE, "test error", JcrConstants.NT_RESOURCE);
    Context context = checker.createContext(root, mip);
    ErrorHolder errorHolder = new ErrorHolder();
    checker.check(new MountedNodeStore(mip.getMountByName("first"), mount), TreeFactory.createReadOnlyTree(mount.getRoot()).getChild("first"), errorHolder, context);
    errorHolder.end();
}
Also used : Context(org.apache.jackrabbit.oak.composite.checks.NodeTypeMountedNodeStoreChecker.Context) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MountedNodeStore(org.apache.jackrabbit.oak.composite.MountedNodeStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Example 2 with Context

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

the class NodeTypeMountedNodeStoreCheckerTest method referenceableNodeIsDetected.

@Test(expected = IllegalRepositoryStateException.class)
public void referenceableNodeIsDetected() throws CommitFailedException {
    MemoryNodeStore root = new MemoryNodeStore();
    MemoryNodeStore mount = new MemoryNodeStore();
    NodeBuilder builder = mount.getRoot().builder();
    builder.child("first").setProperty(PropertyStates.createProperty(JcrConstants.JCR_MIXINTYPES, Collections.singletonList(JcrConstants.MIX_REFERENCEABLE), Type.NAMES)).setProperty(JcrConstants.JCR_UUID, UUID.randomUUID().toString());
    mount.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("first", "/first").build();
    NodeTypeMountedNodeStoreChecker checker = new NodeTypeMountedNodeStoreChecker(JcrConstants.MIX_REFERENCEABLE, "test error");
    Context context = checker.createContext(root, mip);
    ErrorHolder errorHolder = new ErrorHolder();
    checker.check(new MountedNodeStore(mip.getMountByName("first"), mount), TreeFactory.createReadOnlyTree(mount.getRoot()).getChild("first"), errorHolder, context);
    errorHolder.end();
}
Also used : Context(org.apache.jackrabbit.oak.composite.checks.NodeTypeMountedNodeStoreChecker.Context) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MountedNodeStore(org.apache.jackrabbit.oak.composite.MountedNodeStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Aggregations

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