@SuppressWarnings("unchecked") @Test public void testAddingService() throws Exception { Resource resource = new CoapResource("test"); ServiceReference<Resource> ref = mock(ServiceReference.class); when(bundleContext.getService(ref)).thenReturn(resource); managedServer.updated(null); Resource addedResource = managedServer.addingService(ref); assertEquals(resource, addedResource); verify(server).add(resource); }
@Override public Resource addingService(ServiceReference<Resource> reference) { Resource resource = context.getService(reference); LOGGER.debug("Adding resource [{}]", resource.getName()); if (resource != null) { managedServer.add(resource); } return resource; }
ManagedServer implements ManagedService, ServiceTrackerCustomizer<Resource, Resource>, ServerEndpointRegistry { @Override public Resource addingService(ServiceReference<Resource> reference) { Resource resource = context.getService(reference); LOGGER.debug("Adding resource [{}]", resource.getName()); if (resource != null) { managedServer.add(resource); } return resource; } }
ManagedServer implements ManagedService, ServiceTrackerCustomizer<Resource, Resource>, ServerEndpointRegistry { @Override public Resource addingService(ServiceReference<Resource> reference) { Resource resource = context.getService(reference); LOGGER.debug("Adding resource [{}]", resource.getName()); if (resource != null) { managedServer.add(resource); } return resource; } ManagedServer(BundleContext bundleContext, EndpointFactory endpointFactory);  ManagedServer(BundleContext bundleContext, ServerInterfaceFactory serverFactory,
			EndpointFactory endpointFactory); }
ManagedServer implements ManagedService, ServiceTrackerCustomizer<Resource, Resource>, ServerEndpointRegistry { @Override public Resource addingService(ServiceReference<Resource> reference) { Resource resource = context.getService(reference); LOGGER.debug("Adding resource [{}]", resource.getName()); if (resource != null) { managedServer.add(resource); } return resource; } ManagedServer(BundleContext bundleContext, EndpointFactory endpointFactory);  ManagedServer(BundleContext bundleContext, ServerInterfaceFactory serverFactory,
			EndpointFactory endpointFactory); @Override void updated(Dictionary<String, ?> properties); void stop(); @Override Resource addingService(ServiceReference<Resource> reference); @Override void removedService(ServiceReference<Resource> reference,
			Resource service); @Override void modifiedService(ServiceReference<Resource> reference,
			Resource service); @Override Endpoint getEndpoint(InetSocketAddress address); @Override Endpoint getEndpoint(int port); @Override Set<Endpoint> getAllEndpoints(); }
ManagedServer implements ManagedService, ServiceTrackerCustomizer<Resource, Resource>, ServerEndpointRegistry { @Override public Resource addingService(ServiceReference<Resource> reference) { Resource resource = context.getService(reference); LOGGER.debug("Adding resource [{}]", resource.getName()); if (resource != null) { managedServer.add(resource); } return resource; } ManagedServer(BundleContext bundleContext, EndpointFactory endpointFactory);  ManagedServer(BundleContext bundleContext, ServerInterfaceFactory serverFactory,
			EndpointFactory endpointFactory); @Override void updated(Dictionary<String, ?> properties); void stop(); @Override Resource addingService(ServiceReference<Resource> reference); @Override void removedService(ServiceReference<Resource> reference,
			Resource service); @Override void modifiedService(ServiceReference<Resource> reference,
			Resource service); @Override Endpoint getEndpoint(InetSocketAddress address); @Override Endpoint getEndpoint(int port); @Override Set<Endpoint> getAllEndpoints();  }