use of org.apache.jackrabbit.oak.composite.MountedNodeStore 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();
}
use of org.apache.jackrabbit.oak.composite.MountedNodeStore in project jackrabbit-oak by apache.
the class UniqueIndexNodeStoreChecker method createContext.
@Override
public Context createContext(NodeStore globalStore, MountInfoProvider mip) {
Context ctx = new Context(mip);
// read definitions from oak:index, and pick all unique indexes
NodeState indexDefs = globalStore.getRoot().getChildNode(INDEX_DEFINITIONS_NAME);
for (ChildNodeEntry indexDef : indexDefs.getChildNodeEntries()) {
if (indexDef.getNodeState().hasProperty(UNIQUE_PROPERTY_NAME) && indexDef.getNodeState().getBoolean(UNIQUE_PROPERTY_NAME)) {
ctx.add(indexDef, mip.getDefaultMount(), indexDefs);
ctx.track(new MountedNodeStore(mip.getDefaultMount(), globalStore));
}
}
return ctx;
}
Aggregations