use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class MongoDbConfigurationTest method validateSucceedsIfUriIsMissing.
@Test
public void validateSucceedsIfUriIsMissing() throws RepositoryException, ValidationException {
MongoDbConfiguration configuration = new MongoDbConfiguration();
new JadConfig(new InMemoryRepository(Collections.emptyMap()), configuration).process();
assertEquals("mongodb://localhost/graylog", configuration.getUri());
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class MongoDbConfigurationTest method validateFailsIfUriIsInvalid.
@Test(expected = ValidationException.class)
public void validateFailsIfUriIsInvalid() throws RepositoryException, ValidationException {
MongoDbConfiguration configuration = new MongoDbConfiguration();
new JadConfig(new InMemoryRepository(singletonMap("mongodb_uri", "Boom")), configuration).process();
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class EsNodeProviderTest method zenUnicastHostsAreTrimmed.
@Test
public void zenUnicastHostsAreTrimmed() throws IOException, ValidationException, RepositoryException {
Map<String, String> settings = ImmutableMap.of("password_secret", "thisisatest", "retention_strategy", "delete", "root_password_sha2", "thisisatest", "elasticsearch_discovery_zen_ping_unicast_hosts", " example.com, example.net ");
final ElasticsearchConfiguration config = new ElasticsearchConfiguration();
new JadConfig(new InMemoryRepository(settings), config).process();
final Settings nodeSettings = EsNodeProvider.readNodeSettings(config, nodeId);
assertThat(nodeSettings.getAsArray("discovery.zen.ping.unicast.hosts")).contains("example.com", "example.net");
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class EsNodeProviderTest method setupConfig.
private ElasticsearchConfiguration setupConfig(Map<String, String> settings) {
// required params we don't care about in this test, so we set them to dummy values for all test cases
settings.put("retention_strategy", "delete");
ElasticsearchConfiguration configuration = new ElasticsearchConfiguration();
try {
new JadConfig(new InMemoryRepository(settings), configuration).process();
} catch (ValidationException | RepositoryException e) {
fail(e.getMessage());
}
return configuration;
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class ConfigurationTest method testWebListenUriIsAbsoluteURI.
@Test
public void testWebListenUriIsAbsoluteURI() throws RepositoryException, ValidationException {
validProperties.put("web_listen_uri", "http://www.example.com:12900/web");
Configuration configuration = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
assertThat(configuration.getWebListenUri()).isEqualTo(URI.create("http://www.example.com:12900/web/"));
}
Aggregations