SecondaryStoreCacheService { @Activate private void activate(BundleContext context, Configuration config){ bundleContext = context; whiteboard = new OsgiWhiteboard(context); String[] includedPaths = config.includedPaths(); pathFilter = new PathFilter(asList(includedPaths), Collections.<String>emptyList()); SecondaryStoreBuilder builder = new SecondaryStoreBuilder(secondaryStoreProvider.getNodeStore()) .differ(differ) .metaPropNames(DocumentNodeStore.META_PROP_NAMES) .statisticsProvider(statisticsProvider) .pathFilter(pathFilter); SecondaryStoreCache cache = builder.buildCache(); SecondaryStoreObserver observer = builder.buildObserver(cache); registerObserver(observer, config); regs.add(bundleContext.registerService(DocumentNodeStateCache.class.getName(), cache, null)); }    }
@Test public void disableBackground() throws Exception{ Map<String, Object> config = new HashMap<>(); config.put("enableAsyncObserver", "false"); MockOsgi.activate(cacheService, context.bundleContext(), config); assertNotNull(context.getService(Observer.class)); assertNull(context.getService(BackgroundObserverMBean.class)); assertNotNull(context.getService(DocumentNodeStateCache.class)); }