@Test public void registerNonExistingScriptEngine() { Bundle bundle = mock(Bundle.class); when(bundle.findEntries(any(String.class), any(String.class), anyBoolean())).thenReturn(Collections.enumeration(Collections.<URL> emptyList())); ScriptEngineBundleScanner customizer = new ScriptEngineBundleScanner(); ArrayList<BundleScriptEngineResolver> resolvers = new ArrayList<BundleScriptEngineResolver>(0); customizer.registerScriptEngines(bundle, resolvers); assertThat(resolvers.isEmpty(), is(true)); }
protected void registerScriptEngines(Bundle bundle, List<BundleScriptEngineResolver> resolvers) { Enumeration<URL> scriptEnginesUrls = bundle.findEntries(META_INF_SERVICES_DIR, SCRIPT_ENGINE_SERVICE_FILE, false); if (scriptEnginesUrls == null) { return; } for (URL configURL : Collections.list(scriptEnginesUrls)) { LOGGER.info("Found ScriptEngineFactory in " + bundle.getSymbolicName()); resolvers.add(new BundleScriptEngineResolver(bundle, configURL)); } }
ScriptEngineBundleScanner { protected void registerScriptEngines(Bundle bundle, List<BundleScriptEngineResolver> resolvers) { Enumeration<URL> scriptEnginesUrls = bundle.findEntries(META_INF_SERVICES_DIR, SCRIPT_ENGINE_SERVICE_FILE, false); if (scriptEnginesUrls == null) { return; } for (URL configURL : Collections.list(scriptEnginesUrls)) { LOGGER.info("Found ScriptEngineFactory in " + bundle.getSymbolicName()); resolvers.add(new BundleScriptEngineResolver(bundle, configURL)); } } }
ScriptEngineBundleScanner { protected void registerScriptEngines(Bundle bundle, List<BundleScriptEngineResolver> resolvers) { Enumeration<URL> scriptEnginesUrls = bundle.findEntries(META_INF_SERVICES_DIR, SCRIPT_ENGINE_SERVICE_FILE, false); if (scriptEnginesUrls == null) { return; } for (URL configURL : Collections.list(scriptEnginesUrls)) { LOGGER.info("Found ScriptEngineFactory in " + bundle.getSymbolicName()); resolvers.add(new BundleScriptEngineResolver(bundle, configURL)); } } ScriptEngineBundleScanner(); }
ScriptEngineBundleScanner { protected void registerScriptEngines(Bundle bundle, List<BundleScriptEngineResolver> resolvers) { Enumeration<URL> scriptEnginesUrls = bundle.findEntries(META_INF_SERVICES_DIR, SCRIPT_ENGINE_SERVICE_FILE, false); if (scriptEnginesUrls == null) { return; } for (URL configURL : Collections.list(scriptEnginesUrls)) { LOGGER.info("Found ScriptEngineFactory in " + bundle.getSymbolicName()); resolvers.add(new BundleScriptEngineResolver(bundle, configURL)); } } ScriptEngineBundleScanner(); Bundle addBundle(Bundle bundle); @SuppressWarnings("unused") void modifiedBundle(Bundle bundle); void removedBundle(Bundle bundle); Map<Long, List<BundleScriptEngineResolver>> getResolvers(); }
ScriptEngineBundleScanner { protected void registerScriptEngines(Bundle bundle, List<BundleScriptEngineResolver> resolvers) { Enumeration<URL> scriptEnginesUrls = bundle.findEntries(META_INF_SERVICES_DIR, SCRIPT_ENGINE_SERVICE_FILE, false); if (scriptEnginesUrls == null) { return; } for (URL configURL : Collections.list(scriptEnginesUrls)) { LOGGER.info("Found ScriptEngineFactory in " + bundle.getSymbolicName()); resolvers.add(new BundleScriptEngineResolver(bundle, configURL)); } } ScriptEngineBundleScanner(); Bundle addBundle(Bundle bundle); @SuppressWarnings("unused") void modifiedBundle(Bundle bundle); void removedBundle(Bundle bundle); Map<Long, List<BundleScriptEngineResolver>> getResolvers();  }