OsgiServiceScanner { public Collection<Class<?>> findResources(String bundleNameFilter, String basePackage) { BundleFinder bundleFinder = new BundleFinder(new BundleInfo(bundleNameFilter, basePackage), bundleContext); BundleClassesFinder classFinder = new BundleClassesFinder(basePackage); classFinder.addFilter(new ClassFilter() { @Override public boolean accepts(ClassReader classReader) { return true; } }); LOG.info("Searching for @OsgiServices, packages:{}, bundles:{}" + basePackage, bundleNameFilter); Collection<Class<?>> classes = classFinder.traverseBundlesForOsgiServices(bundleFinder.findBundles()); LOG.info("Found {} OsgiService classes. Switch to debug logging level to see them all.", classes.size()); return classes; } OsgiServiceScanner(BundleContext bundleContext); Collection<Class<?>> findResources(String bundleNameFilter, String basePackage);  }
@Test public void testFindResources() { Collection<Class<?>> classes = osgiServiceScanner.findResources("filterName", "test"); Assert.assertEquals(1, classes.size()); Assert.assertEquals("Long", new ArrayList<Class<?>>(classes).get(0).getSimpleName()); }