DynamicFederatedServiceCollectionImpl extends
    AbstractFederatedServiceCollectionWrapperImpl { @PreDestroy public void stop() { _log.debug("stop"); _executor.shutdown(); }  void setRegistry(FederatedServiceRegistry registry); void setUpdateFrequency(int updateFrequencyInSeconds); void setServiceInterface(Class<?> serviceInterface); void setQueryProperties(Map<String, String> queryProperties); @PostConstruct void start(); @PreDestroy void stop();  }
@Test public void test() throws Exception { Set<FederatedService> services = _collection.getAllServices(); assertTrue(services.isEmpty()); _registry.addService("http: SimpleFederatedService.class.getName(), new HashMap<String, String>()); Thread.sleep(TIMEOUT); services = _collection.getAllServices(); assertEquals(1, services.size()); SimpleFederatedService service = (SimpleFederatedService) _collection.getServiceForAgencyId("A"); assertEquals("A", service.getValueForId("")); _registry.addService("http: SimpleFederatedService.class.getName(), new HashMap<String, String>()); Thread.sleep(TIMEOUT); services = _collection.getAllServices(); assertEquals(2, services.size()); service = (SimpleFederatedService) _collection.getServiceForAgencyId("A"); assertEquals("A", service.getValueForId("")); service = (SimpleFederatedService) _collection.getServiceForAgencyId("B"); assertEquals("B", service.getValueForId("")); _server.stop(); _server = null; Thread.sleep(TIMEOUT); services = _collection.getAllServices(); assertTrue(services.isEmpty()); }