@Test public void testGetResourceBundles() throws Exception { MockBundleContext mockBundleContext = new MockBundleContext(); MockBundle startedBundle = new MockBundle(); startedBundle.setState(Bundle.ACTIVE); startedBundle.setBundleId(1); startedBundle.setBundleContext(mockBundleContext); mockBundleContext.installBundle(startedBundle); OSGIServiceLoader instance = new OSGIServiceLoader(mockBundleContext); Set<Bundle> result = instance.getResourceBundles(); assertThat(result).isNotEmpty(); }
public Set<Bundle> getResourceBundles() { synchronized (resourceBundles) { return new HashSet<>(resourceBundles); } }
OSGIServiceLoader implements BundleListener { public Set<Bundle> getResourceBundles() { synchronized (resourceBundles) { return new HashSet<>(resourceBundles); } } }
OSGIServiceLoader implements BundleListener { public Set<Bundle> getResourceBundles() { synchronized (resourceBundles) { return new HashSet<>(resourceBundles); } } OSGIServiceLoader(BundleContext context); }
OSGIServiceLoader implements BundleListener { public Set<Bundle> getResourceBundles() { synchronized (resourceBundles) { return new HashSet<>(resourceBundles); } } OSGIServiceLoader(BundleContext context); BundleContext getBundleContext(); Set<Bundle> getResourceBundles(); @Override void bundleChanged(BundleEvent bundleEvent); }
OSGIServiceLoader implements BundleListener { public Set<Bundle> getResourceBundles() { synchronized (resourceBundles) { return new HashSet<>(resourceBundles); } } OSGIServiceLoader(BundleContext context); BundleContext getBundleContext(); Set<Bundle> getResourceBundles(); @Override void bundleChanged(BundleEvent bundleEvent);  }