use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.
the class CompositeCompareTest method nodesOutsideTheMountsAreIgnored.
@Test
public void nodesOutsideTheMountsAreIgnored() throws CommitFailedException {
MountInfoProvider mip = Mounts.newBuilder().mount("libs", "/libs").build();
NodeStore globalStore = new MemoryNodeStore();
NodeStore libsStore = new MemoryNodeStore();
List<MountedNodeStore> mounts = Lists.newArrayList();
mounts.add(new MountedNodeStore(mip.getMountByName("libs"), libsStore));
CompositeNodeStore compositeNodeStore = new CompositeNodeStore(mip, globalStore, mounts);
NodeState empty = compositeNodeStore.getRoot();
NodeBuilder builder = globalStore.getRoot().builder();
builder.child("global-child-1");
builder.child("global-child-2");
globalStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
NodeBuilder libsBuilder = libsStore.getRoot().builder();
libsBuilder.child("libs");
libsBuilder.child("libs-child-1");
libsBuilder.child("libs-child-2");
libsStore.merge(libsBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
NodeState modified = compositeNodeStore.getRoot();
final Set<String> addedChildren = newHashSet();
modified.compareAgainstBaseState(empty, new DefaultNodeStateDiff() {
@Override
public boolean childNodeAdded(String name, NodeState after) {
addedChildren.add(name);
return true;
}
});
assertEquals(ImmutableSet.of("global-child-1", "global-child-2", "libs"), addedChildren);
}
use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project sling by apache.
the class TestOakSyncTokenService method setup.
@Before
public void setup() throws Exception {
logger.info("setup: start");
RepositoryTestHelper.resetRepo();
memoryNS = new MemoryNodeStore();
repository1 = RepositoryTestHelper.newOakRepository(memoryNS);
RepositoryTestHelper.initSlingNodeTypes(repository1);
repository2 = RepositoryTestHelper.newOakRepository(memoryNS);
factory1 = RepositoryTestHelper.mockResourceResolverFactory(repository1);
factory2 = RepositoryTestHelper.mockResourceResolverFactory(repository2);
slingId1 = UUID.randomUUID().toString();
idMapService1 = IdMapService.testConstructor(new SimpleCommonsConfig(), new DummySlingSettingsService(slingId1), factory1);
logger.info("setup: end");
}
Aggregations