CompositionContext { boolean shouldBeComposite(final String path) { boolean supportMounts = false; if (mip.getNonDefaultMounts().stream().anyMatch(m -> m.isSupportFragmentUnder(path))) { supportMounts = true; } else if (!mip.getMountsPlacedUnder(path).isEmpty()) { supportMounts = true; } return supportMounts && mip.getMountByPath(path).isDefault(); } CompositionContext(MountInfoProvider mip, NodeStore globalStore, List<MountedNodeStore> nonDefaultStores, CompositeNodeStoreMonitor nodeStateMonitor, CompositeNodeStoreMonitor nodeBuilderMonitor);   }
@Test public void testShouldBeComposite() { MountInfoProvider mip = Mounts.newBuilder() .mount("libs", true, Arrays.asList( "/oak:index/*$" ), Arrays.asList( "/apps", "/libs", "/jcr:system/rep:permissionStore/oak:mount-libs-crx.default") ) .build(); CompositionContext ctx = new CompositionContext(mip, null, Collections.emptyList(), CompositeNodeStoreMonitor.EMPTY_INSTANCE, CompositeNodeStoreMonitor.EMPTY_INSTANCE); assertTrue(ctx.shouldBeComposite("/")); assertTrue(ctx.shouldBeComposite("/oak:index")); assertTrue(ctx.shouldBeComposite("/oak:index/lucene")); assertTrue(ctx.shouldBeComposite("/jcr:system")); assertTrue(ctx.shouldBeComposite("/jcr:system/rep:permissionStore")); assertFalse(ctx.shouldBeComposite("/apps")); assertFalse(ctx.shouldBeComposite("/apps/acme")); assertFalse(ctx.shouldBeComposite("/libs")); assertFalse(ctx.shouldBeComposite("/libs/acme")); assertFalse(ctx.shouldBeComposite("/oak:index/lucene/:data")); assertFalse(ctx.shouldBeComposite("/oak:index/lucene/:oak:mount-libs-data")); assertFalse(ctx.shouldBeComposite("/jcr:system/rep:permissionStore/oak:mount-libs-crx.default")); assertFalse(ctx.shouldBeComposite("/jcr:system/rep:permissionStore/oak:mount-libs-crx.default/123")); assertFalse(ctx.shouldBeComposite("/jcr:system/rep:permissionStore/crx.default")); assertFalse(ctx.shouldBeComposite("/content")); assertFalse(ctx.shouldBeComposite("/jcr:system/rep:versionStorage")); }