use of org.apache.jackrabbit.oak.composite.MountedNodeStore in project jackrabbit-oak by apache.
the class UniqueIndexNodeStoreCheckerTest method uuidConflict_threeStores.
@Test
public void uuidConflict_threeStores() throws Exception {
MemoryNodeStore globalStore = new MemoryNodeStore();
MemoryNodeStore mountedStore = new MemoryNodeStore();
MemoryNodeStore mountedStore2 = new MemoryNodeStore();
populateStore(globalStore, b -> b.child("first").setProperty("foo", "bar"));
populateStore(globalStore, b -> b.child("second").setProperty("foo", "baz"));
populateStore(mountedStore, b -> b.child("libs").child("first").setProperty("foo", "bar"));
populateStore(mountedStore2, b -> b.child("apps").child("first").setProperty("foo", "baz"));
UniqueIndexNodeStoreChecker checker = new UniqueIndexNodeStoreChecker();
Context ctx = checker.createContext(globalStore, mip);
exception.expect(IllegalRepositoryStateException.class);
exception.expectMessage("2 errors were found");
exception.expectMessage("clash for value bar: 'duplicate unique index entry'");
exception.expectMessage("clash for value baz: 'duplicate unique index entry'");
ErrorHolder error = new ErrorHolder();
checker.check(new MountedNodeStore(mip.getMountByName("libs"), mountedStore), TreeFactory.createReadOnlyTree(mountedStore.getRoot()), error, ctx);
checker.check(new MountedNodeStore(mip.getMountByName("apps"), mountedStore2), TreeFactory.createReadOnlyTree(mountedStore.getRoot()), error, ctx);
error.end();
}
use of org.apache.jackrabbit.oak.composite.MountedNodeStore in project jackrabbit-oak by apache.
the class NodeStoreChecksServiceTest method failOnNodeCoveredByMount.
@Test(expected = IllegalRepositoryStateException.class)
public void failOnNodeCoveredByMount() {
NodeStoreChecksService checks = new NodeStoreChecksService(defaultMountInfoProvider(), Arrays.asList(new FailOnTreeNameChecker("third")));
checks.check(globalStore, new MountedNodeStore(mount, mountedStore));
}
use of org.apache.jackrabbit.oak.composite.MountedNodeStore in project jackrabbit-oak by apache.
the class NodeStoreChecksServiceTest method doNotFailOnNodeNotCoveredByMount.
@Test
public void doNotFailOnNodeNotCoveredByMount() {
NodeStoreChecksService checks = new NodeStoreChecksService(defaultMountInfoProvider(), Arrays.asList(new FailOnTreeNameChecker("not-covered")));
checks.check(globalStore, new MountedNodeStore(mount, mountedStore));
}
use of org.apache.jackrabbit.oak.composite.MountedNodeStore in project jackrabbit-oak by apache.
the class NodeStoreChecksServiceTest method noCheckers.
@Test
public void noCheckers() throws CommitFailedException {
NodeStoreChecksService checks = new NodeStoreChecksService();
checks.check(globalStore, new MountedNodeStore(mount, mountedStore));
}
use of org.apache.jackrabbit.oak.composite.MountedNodeStore 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();
}
Aggregations