@Test public void testStop (){ DummyClass2 service = new DummyClass2(); Properties props = new Properties(); ServiceRegistration s = mock(ServiceRegistration.class); ServiceRegistration s2 = mock(ServiceRegistration.class); when(bc.registerService(eq(DummyInterface2.class.getName()), same(service), any(Dictionary.class))).thenReturn(s2); when(bc.registerService(eq(DummyInterface.class.getName()), same(service), any(Dictionary.class))).thenReturn(s); activator.registerAllServices(bc, service, props); assertTrue(activator.getServiceRegistrations().get(DummyInterface2.class).get(service).equals(s2)); assertTrue(activator.getServiceRegistrations().get(DummyInterface.class).get(service).equals(s)); activator.stop(bc); assertTrue(activator.getServiceRegistrations().isEmpty()); }
public final void stop(BundleContext bc) { shutDown(); for ( Map<Object,ServiceRegistration> registrations : serviceRegistrations.values() ) { for ( ServiceRegistration reg : registrations.values() ) reg.unregister(); registrations.clear(); } serviceRegistrations.clear(); for ( CyServiceListener listener : serviceListeners ) listener.close(); serviceListeners.clear(); for ( ServiceReference ref : gottenServices ) bc.ungetService(ref); gottenServices.clear(); }
AbstractCyActivator implements BundleActivator { public final void stop(BundleContext bc) { shutDown(); for ( Map<Object,ServiceRegistration> registrations : serviceRegistrations.values() ) { for ( ServiceRegistration reg : registrations.values() ) reg.unregister(); registrations.clear(); } serviceRegistrations.clear(); for ( CyServiceListener listener : serviceListeners ) listener.close(); serviceListeners.clear(); for ( ServiceReference ref : gottenServices ) bc.ungetService(ref); gottenServices.clear(); } }
AbstractCyActivator implements BundleActivator { public final void stop(BundleContext bc) { shutDown(); for ( Map<Object,ServiceRegistration> registrations : serviceRegistrations.values() ) { for ( ServiceRegistration reg : registrations.values() ) reg.unregister(); registrations.clear(); } serviceRegistrations.clear(); for ( CyServiceListener listener : serviceListeners ) listener.close(); serviceListeners.clear(); for ( ServiceReference ref : gottenServices ) bc.ungetService(ref); gottenServices.clear(); } AbstractCyActivator(); }
AbstractCyActivator implements BundleActivator { public final void stop(BundleContext bc) { shutDown(); for ( Map<Object,ServiceRegistration> registrations : serviceRegistrations.values() ) { for ( ServiceRegistration reg : registrations.values() ) reg.unregister(); registrations.clear(); } serviceRegistrations.clear(); for ( CyServiceListener listener : serviceListeners ) listener.close(); serviceListeners.clear(); for ( ServiceReference ref : gottenServices ) bc.ungetService(ref); gottenServices.clear(); } AbstractCyActivator(); final void stop(BundleContext bc); void shutDown(); }
AbstractCyActivator implements BundleActivator { public final void stop(BundleContext bc) { shutDown(); for ( Map<Object,ServiceRegistration> registrations : serviceRegistrations.values() ) { for ( ServiceRegistration reg : registrations.values() ) reg.unregister(); registrations.clear(); } serviceRegistrations.clear(); for ( CyServiceListener listener : serviceListeners ) listener.close(); serviceListeners.clear(); for ( ServiceReference ref : gottenServices ) bc.ungetService(ref); gottenServices.clear(); } AbstractCyActivator(); final void stop(BundleContext bc); void shutDown();  }