@Test public void testRegisterService (){ DummyClass2 service = new DummyClass2(); Properties props = new Properties(); final String DUMMY_KEY = "dummyKey"; final String DUMMY_VALUE = "dummyValue"; props.put(DUMMY_KEY, DUMMY_VALUE); ServiceRegistration s2 = mock(ServiceRegistration.class); doAnswer(new Answer<ServiceRegistration>() { public ServiceRegistration answer(InvocationOnMock invocation) { Object[] args = invocation.getArguments(); assertTrue(args[2] instanceof Dictionary); Dictionary dictionary = (Dictionary) args[2]; assertEquals(1, dictionary.size()); assertEquals(DUMMY_VALUE, dictionary.get(DUMMY_KEY)); return s2; } }).when(bc).registerService(eq(DummyInterface2.class.getName()), same(service), any(Dictionary.class)); activator.registerService(bc, service, DummyInterface2.class, props); assertEquals(1, activator.getServiceRegistrations().size()); assertTrue(activator.getServiceRegistrations().get(DummyInterface2.class).get(service).equals(s2)); }
protected final void registerService(final BundleContext bc, final Object service, final Class<?> serviceClass, final Properties props) { ServiceUtil.registerService(bc, service, serviceClass, props, serviceRegistrations); }
AbstractCyActivator implements BundleActivator { protected final void registerService(final BundleContext bc, final Object service, final Class<?> serviceClass, final Properties props) { ServiceUtil.registerService(bc, service, serviceClass, props, serviceRegistrations); } }
AbstractCyActivator implements BundleActivator { protected final void registerService(final BundleContext bc, final Object service, final Class<?> serviceClass, final Properties props) { ServiceUtil.registerService(bc, service, serviceClass, props, serviceRegistrations); } AbstractCyActivator(); }
AbstractCyActivator implements BundleActivator { protected final void registerService(final BundleContext bc, final Object service, final Class<?> serviceClass, final Properties props) { ServiceUtil.registerService(bc, service, serviceClass, props, serviceRegistrations); } AbstractCyActivator(); final void stop(BundleContext bc); void shutDown(); }
AbstractCyActivator implements BundleActivator { protected final void registerService(final BundleContext bc, final Object service, final Class<?> serviceClass, final Properties props) { ServiceUtil.registerService(bc, service, serviceClass, props, serviceRegistrations); } AbstractCyActivator(); final void stop(BundleContext bc); void shutDown();  }