use of org.apache.jackrabbit.oak.composite.MountedNodeStore in project jackrabbit-oak by apache.
the class UniqueIndexNodeStoreCheckerTest method noConflict.
@Test
public void noConflict() throws Exception {
MemoryNodeStore globalStore = new MemoryNodeStore();
MemoryNodeStore mountedStore = new MemoryNodeStore();
populateStore(globalStore, b -> b.child("first").setProperty("foo", "baz"));
populateStore(mountedStore, b -> b.child("libs").child("first").setProperty("foo", "bar"));
UniqueIndexNodeStoreChecker checker = new UniqueIndexNodeStoreChecker();
Context ctx = checker.createContext(globalStore, mip);
ErrorHolder error = new ErrorHolder();
checker.check(new MountedNodeStore(mip.getMountByName("libs"), mountedStore), TreeFactory.createReadOnlyTree(mountedStore.getRoot()), error, ctx);
error.end();
}
use of org.apache.jackrabbit.oak.composite.MountedNodeStore in project jackrabbit-oak by apache.
the class UniqueIndexNodeStoreCheckerTest method noConflict_globalMountHasDuplicateOutsideOfPath.
/**
* Tests that if a mount has an index clash but the path does not belog to the global mount no error is reported
*/
@Test
public void noConflict_globalMountHasDuplicateOutsideOfPath() throws Exception {
MemoryNodeStore globalStore = new MemoryNodeStore();
MemoryNodeStore mountedStore = new MemoryNodeStore();
populateStore(globalStore, b -> b.child("libs").child("first").setProperty("foo", "bar"));
populateStore(mountedStore, b -> b.child("libs").child("second").setProperty("foo", "bar"));
UniqueIndexNodeStoreChecker checker = new UniqueIndexNodeStoreChecker();
Context ctx = checker.createContext(globalStore, mip);
ErrorHolder error = new ErrorHolder();
checker.check(new MountedNodeStore(mip.getMountByName("libs"), mountedStore), TreeFactory.createReadOnlyTree(mountedStore.getRoot()), error, ctx);
error.end();
}
use of org.apache.jackrabbit.oak.composite.MountedNodeStore in project jackrabbit-oak by apache.
the class UniqueIndexNodeStoreCheckerTest method noConflict_mountHasDuplicateOutsideOfPath.
/**
* Tests that if a mount has an index clash but the path does not belong to the mount no error is reported
*/
@Test
public void noConflict_mountHasDuplicateOutsideOfPath() throws Exception {
MemoryNodeStore globalStore = new MemoryNodeStore();
MemoryNodeStore mountedStore = new MemoryNodeStore();
populateStore(globalStore, b -> b.child("first").setProperty("foo", "bar"));
populateStore(mountedStore, b -> b.child("second").setProperty("foo", "bar"));
UniqueIndexNodeStoreChecker checker = new UniqueIndexNodeStoreChecker();
Context ctx = checker.createContext(globalStore, mip);
ErrorHolder error = new ErrorHolder();
checker.check(new MountedNodeStore(mip.getMountByName("libs"), mountedStore), TreeFactory.createReadOnlyTree(mountedStore.getRoot()), error, ctx);
error.end();
}
use of org.apache.jackrabbit.oak.composite.MountedNodeStore in project jackrabbit-oak by apache.
the class UniqueIndexNodeStoreCheckerTest method uuidConflict_twoStores.
@Test
public void uuidConflict_twoStores() throws Exception {
MemoryNodeStore globalStore = new MemoryNodeStore();
MemoryNodeStore mountedStore = new MemoryNodeStore();
populateStore(globalStore, b -> b.child("first").setProperty("foo", "bar"));
populateStore(mountedStore, b -> b.child("libs").child("first").setProperty("foo", "bar"));
UniqueIndexNodeStoreChecker checker = new UniqueIndexNodeStoreChecker();
Context ctx = checker.createContext(globalStore, mip);
exception.expect(IllegalRepositoryStateException.class);
exception.expectMessage("1 errors were found");
exception.expectMessage("clash for value bar: 'duplicate unique index entry'");
ErrorHolder error = new ErrorHolder();
checker.check(new MountedNodeStore(mip.getMountByName("libs"), mountedStore), TreeFactory.createReadOnlyTree(mountedStore.getRoot()), error, ctx);
error.end();
}
use of org.apache.jackrabbit.oak.composite.MountedNodeStore in project jackrabbit-oak by apache.
the class NamespacePrefixNodestoreCheckerTest method check.
private void check(String path) {
Tree tree = TreeUtil.getTree(TreeFactory.createReadOnlyTree(mount.getRoot()), path);
ErrorHolder errorHolder = new ErrorHolder();
checker.check(new MountedNodeStore(mip.getMountByName("first"), mount), tree, errorHolder, context);
errorHolder.end();
}
Aggregations