@Test public void check() throws StorageException { configurationStorage.setRepository("localhost", 1099); String host = configurationStorage.getRepositoryConfig().getHost(); int port = configurationStorage.getRepositoryConfig().getPort(); assertThat(host, is(equalTo("localhost"))); assertThat(port, is(equalTo(1099))); }
@Test public void repositoryOnlySet() throws Exception { Properties properties = System.getProperties(); properties.remove(ConfigurationStorage.AGENT_NAME_PROPERTY); properties.put(ConfigurationStorage.REPOSITORY_PROPERTY, "localhost:8000"); configurationStorage.afterPropertiesSet(); assertThat(configurationStorage.getRepositoryConfig().getHost(), is("localhost")); assertThat(configurationStorage.getRepositoryConfig().getPort(), is(8000)); assertThat(configurationStorage.getAgentName(), is(not(nullValue()))); }
@Test public void repositoryAndAgentNameSet() throws Exception { String agentName = "agentName"; Properties properties = System.getProperties(); properties.put(ConfigurationStorage.REPOSITORY_PROPERTY, "localhost:8000"); properties.put(ConfigurationStorage.AGENT_NAME_PROPERTY, agentName); configurationStorage.afterPropertiesSet(); assertThat(configurationStorage.getRepositoryConfig().getHost(), is("localhost")); assertThat(configurationStorage.getRepositoryConfig().getPort(), is(8000)); assertThat(configurationStorage.getAgentName(), is(agentName)); }
@Test public void resetNotAllowed() throws StorageException { configurationStorage.setRepository("localhost", 1099); configurationStorage.setRepository("localhost1", 1200); String host = configurationStorage.getRepositoryConfig().getHost(); int port = configurationStorage.getRepositoryConfig().getPort(); assertThat(host, is(equalTo("localhost"))); assertThat(port, is(equalTo(1099))); } }