public void testAddContainerWithoutRegisteredServices() throws ContainerConnectException { try { try { discoveryAdvertiser.registerService(serviceInfo); discoveryAdvertiser.unregisterService(serviceInfo); } catch (ECFRuntimeException e) { fail("Re-/Unregistering a service failed on a new IDCA"); } CompositeDiscoveryContainer cdc = (CompositeDiscoveryContainer) discoveryLocator; testDiscoveryContainer = new TestDiscoveryContainer(); assertTrue(cdc.addContainer(testDiscoveryContainer)); List registeredServices = testDiscoveryContainer.getRegisteredServices(); assertTrue(registeredServices.isEmpty()); } finally { CompositeDiscoveryContainer cdc = (CompositeDiscoveryContainer) discoveryLocator; cdc.removeContainer(testDiscoveryContainer); } }
/** * Check if * * @throws ContainerConnectException */ public void testAddContainerWithRegisteredServices() throws ContainerConnectException { try { try { discoveryAdvertiser.registerService(serviceInfo); } catch (ECFRuntimeException e) { fail("Registering a service failed on a new IDCA"); } CompositeDiscoveryContainer cdc = (CompositeDiscoveryContainer) discoveryLocator; testDiscoveryContainer = new TestDiscoveryContainer(); assertTrue(cdc.addContainer(testDiscoveryContainer)); List registeredServices = testDiscoveryContainer.getRegisteredServices(); assertEquals( "registerService(aService) wasn't called on TestDiscoveryContainer", serviceInfo, registeredServices.get(0)); } finally { CompositeDiscoveryContainer cdc = (CompositeDiscoveryContainer) discoveryLocator; cdc.removeContainer(testDiscoveryContainer); } }