use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class EsNodeProviderTest method singletonListZenUnicastHostsWorks.
@Test
public void singletonListZenUnicastHostsWorks() 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");
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");
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method webTlsValidationFailsIfCertificateIsUnreadable.
@Test
public void webTlsValidationFailsIfCertificateIsUnreadable() throws Exception {
final File privateKey = temporaryFolder.newFile("graylog.key");
final File certificate = temporaryFolder.newFile("graylog.crt");
validProperties.put("web_enable_tls", "true");
validProperties.put("web_tls_key_file", privateKey.getAbsolutePath());
validProperties.put("web_tls_cert_file", certificate.getAbsolutePath());
assertThat(certificate.setReadable(false, false)).isTrue();
expectedException.expect(ValidationException.class);
expectedException.expectMessage("Unreadable or missing web interface X.509 certificate: ");
new JadConfig(new InMemoryRepository(validProperties), new Configuration()).process();
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testRestTransportUriIsAbsoluteURI.
@Test
public void testRestTransportUriIsAbsoluteURI() throws RepositoryException, ValidationException {
validProperties.put("rest_transport_uri", "http://www.example.com:12900/foo");
Configuration configuration = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
assertEquals(URI.create("http://www.example.com:12900/foo/"), configuration.getRestTransportUri());
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method restTlsValidationFailsIfPrivateKeyIsDirectory.
@Test
public void restTlsValidationFailsIfPrivateKeyIsDirectory() throws Exception {
final File privateKey = temporaryFolder.newFolder("graylog.key");
final File certificate = temporaryFolder.newFile("graylog.crt");
validProperties.put("rest_enable_tls", "true");
validProperties.put("rest_tls_key_file", privateKey.getAbsolutePath());
validProperties.put("rest_tls_cert_file", certificate.getAbsolutePath());
assertThat(privateKey.isDirectory()).isTrue();
expectedException.expect(ValidationException.class);
expectedException.expectMessage("Unreadable or missing REST API private key: ");
new JadConfig(new InMemoryRepository(validProperties), new Configuration()).process();
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testRestTransportUriIsRelativeURI.
@Test
public void testRestTransportUriIsRelativeURI() throws RepositoryException, ValidationException {
validProperties.put("rest_transport_uri", "/foo");
expectedException.expect(ValidationException.class);
expectedException.expectMessage("Parameter rest_transport_uri should be an absolute URI (found /foo)");
Configuration configuration = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
}
Aggregations