@Test public void testReloadFromRepository() { Configuration config = new Configuration(); config.addContainerHost("container1", "http: config.addContainerHost("container2", "http: config.addServerHost("server1", "http: config.addServerHost("server2", "http: ContainerInfo containerInfo = new ContainerInfo("test1.0", "test", "org.kie:test:1.0"); config.addContainerInfo(containerInfo); assertEquals(2, config.getHostsPerContainer().size()); assertEquals(2, config.getHostsPerServer().size()); assertEquals(1, config.getHostsPerContainer().get("container1").size()); assertEquals(1, config.getHostsPerContainer().get("container2").size()); assertEquals(1, config.getHostsPerServer().get("server1").size()); assertEquals(1, config.getHostsPerServer().get("server2").size()); config.reloadFromRepository(new ConfigRepository() { @Override public void persist(Configuration configuration) { } @Override public Configuration load() { return new Configuration(); } @Override public void clean() { } }); assertEquals(0, config.getHostsPerContainer().size()); assertEquals(0, config.getHostsPerServer().size()); }
public synchronized void reloadFromRepository(ConfigRepository repository) { Configuration loaded = repository.load(); this.containerInfosPerContainer = loaded.getContainerInfosPerContainer(); this.hostsPerContainer = loaded.getHostsPerContainer(); this.hostsPerServer = loaded.getHostsPerServer(); }
Configuration { public synchronized void reloadFromRepository(ConfigRepository repository) { Configuration loaded = repository.load(); this.containerInfosPerContainer = loaded.getContainerInfosPerContainer(); this.hostsPerContainer = loaded.getHostsPerContainer(); this.hostsPerServer = loaded.getHostsPerServer(); } }
Configuration { public synchronized void reloadFromRepository(ConfigRepository repository) { Configuration loaded = repository.load(); this.containerInfosPerContainer = loaded.getContainerInfosPerContainer(); this.hostsPerContainer = loaded.getHostsPerContainer(); this.hostsPerServer = loaded.getHostsPerServer(); }  }
Configuration { public synchronized void reloadFromRepository(ConfigRepository repository) { Configuration loaded = repository.load(); this.containerInfosPerContainer = loaded.getContainerInfosPerContainer(); this.hostsPerContainer = loaded.getHostsPerContainer(); this.hostsPerServer = loaded.getHostsPerServer(); }  Map<String, List<String>> getHostsPerServer(); Map<String, List<String>> getHostsPerContainer(); Map<String, List<ContainerInfo>> getContainerInfosPerContainer(); void addContainerHost(String containerId, String serverUrl); void addServerHost(String serverId, String serverUrl); void addContainerInfo(ContainerInfo containerInfo); void removeContainerHost(String containerId, String serverUrl); void removeServerHost(String serverId, String serverUrl); void removeContainerInfo(ContainerInfo containerInfo); synchronized FailedHostInfo removeUnavailableServer(String requestURL); void addListener(ConfigurationListener listener); void removeListener(ConfigurationListener listener); @Override String toString(); void addEmptyContainerHost(String containerId); void addEmptyServerHost(String serverId); synchronized void reloadFrom(Configuration updated); synchronized void reloadFromRepository(ConfigRepository repository); }
Configuration { public synchronized void reloadFromRepository(ConfigRepository repository) { Configuration loaded = repository.load(); this.containerInfosPerContainer = loaded.getContainerInfosPerContainer(); this.hostsPerContainer = loaded.getHostsPerContainer(); this.hostsPerServer = loaded.getHostsPerServer(); }  Map<String, List<String>> getHostsPerServer(); Map<String, List<String>> getHostsPerContainer(); Map<String, List<ContainerInfo>> getContainerInfosPerContainer(); void addContainerHost(String containerId, String serverUrl); void addServerHost(String serverId, String serverUrl); void addContainerInfo(ContainerInfo containerInfo); void removeContainerHost(String containerId, String serverUrl); void removeServerHost(String serverId, String serverUrl); void removeContainerInfo(ContainerInfo containerInfo); synchronized FailedHostInfo removeUnavailableServer(String requestURL); void addListener(ConfigurationListener listener); void removeListener(ConfigurationListener listener); @Override String toString(); void addEmptyContainerHost(String containerId); void addEmptyServerHost(String serverId); synchronized void reloadFrom(Configuration updated); synchronized void reloadFromRepository(ConfigRepository repository);  }