@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)); sri.registerService(service, DummyInterface2.class, props); assertEquals(1, sri.getServiceRegistrations().size()); assertTrue(sri.getServiceRegistrations().get(DummyInterface2.class).get(service).equals(s2)); }
public void registerService(Object service, Class serviceClass, Properties props) { ServiceUtil.registerService(bc, service, serviceClass, props, serviceRegistrations); }
CyServiceRegistrarImpl implements CyServiceRegistrar { public void registerService(Object service, Class serviceClass, Properties props) { ServiceUtil.registerService(bc, service, serviceClass, props, serviceRegistrations); } }
CyServiceRegistrarImpl implements CyServiceRegistrar { public void registerService(Object service, Class serviceClass, Properties props) { ServiceUtil.registerService(bc, service, serviceClass, props, serviceRegistrations); } CyServiceRegistrarImpl(BundleContext bc); }
CyServiceRegistrarImpl implements CyServiceRegistrar { public void registerService(Object service, Class serviceClass, Properties props) { ServiceUtil.registerService(bc, service, serviceClass, props, serviceRegistrations); } CyServiceRegistrarImpl(BundleContext bc); void registerAllServices(Object service, Properties props); void registerService(Object service, Class serviceClass, Properties props); void unregisterAllServices(Object o); void unregisterService(Object o, Class c); @Override S getService(Class<S> serviceClass); @Override S getService(Class<S> serviceClass, String filter); @Override void registerServiceListener(Object listener,
		String registerMethodName, String unregisterMethodName,
			Class<?> serviceClass, Class<?> methodClass, String additionalFilter); @Override void registerServiceListener(Object listener,
			String registerMethodName, String unregisterMethodName,
			Class<?> serviceClass); @Override void registerServiceListener(Object listener,
			String registerMethodName, String unregisterMethodName,
			Class<?> serviceClass, String additionalFilter); @Override void registerServiceListener(Object listener,
			String registerMethodName, String unregisterMethodName,
			Class<?> serviceClass, Class<?> methodClass); }
CyServiceRegistrarImpl implements CyServiceRegistrar { public void registerService(Object service, Class serviceClass, Properties props) { ServiceUtil.registerService(bc, service, serviceClass, props, serviceRegistrations); } CyServiceRegistrarImpl(BundleContext bc); void registerAllServices(Object service, Properties props); void registerService(Object service, Class serviceClass, Properties props); void unregisterAllServices(Object o); void unregisterService(Object o, Class c); @Override S getService(Class<S> serviceClass); @Override S getService(Class<S> serviceClass, String filter); @Override void registerServiceListener(Object listener,
		String registerMethodName, String unregisterMethodName,
			Class<?> serviceClass, Class<?> methodClass, String additionalFilter); @Override void registerServiceListener(Object listener,
			String registerMethodName, String unregisterMethodName,
			Class<?> serviceClass); @Override void registerServiceListener(Object listener,
			String registerMethodName, String unregisterMethodName,
			Class<?> serviceClass, String additionalFilter); @Override void registerServiceListener(Object listener,
			String registerMethodName, String unregisterMethodName,
			Class<?> serviceClass, Class<?> methodClass);  }