use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class HttpConfigurationTest method tlsValidationFailsIfCertificateIsUnreadable.
@Test
public void tlsValidationFailsIfCertificateIsUnreadable() throws Exception {
final File privateKey = temporaryFolder.newFile("graylog.key");
final File certificate = temporaryFolder.newFile("graylog.crt");
final Map<String, String> properties = ImmutableMap.of("http_enable_tls", "true", "http_tls_key_file", privateKey.getAbsolutePath(), "http_tls_cert_file", certificate.getAbsolutePath());
assertThat(certificate.setReadable(false, false)).isTrue();
expectedException.expect(ValidationException.class);
expectedException.expectMessage("Unreadable or missing HTTP X.509 certificate: ");
jadConfig.setRepository(new InMemoryRepository(properties)).addConfigurationBean(configuration).process();
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class HttpConfigurationTest method testHttpBindAddressIsIPv6Address.
@Test
public void testHttpBindAddressIsIPv6Address() throws RepositoryException, ValidationException {
jadConfig.setRepository(new InMemoryRepository(ImmutableMap.of("http_bind_address", "[2001:db8::1]:9000"))).addConfigurationBean(configuration).process();
assertThat(configuration.getHttpBindAddress()).isEqualTo(HostAndPort.fromParts("[2001:db8::1]", 9000));
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class HttpConfigurationTest method testHttpBindAddressWildcard.
@Test
public void testHttpBindAddressWildcard() throws RepositoryException, ValidationException {
jadConfig.setRepository(new InMemoryRepository(ImmutableMap.of("http_bind_address", "0.0.0.0:9000"))).addConfigurationBean(configuration).process();
assertThat(configuration.getDefaultHttpUri()).isNotNull().isNotEqualTo(URI.create("http://0.0.0.0:9000"));
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class HttpConfigurationTest method testHttpBindAddressIsInvalidHostName.
@Test
@Ignore("Disabled test due to being unreliable (see https://github.com/Graylog2/graylog2-server/issues/4459)")
public void testHttpBindAddressIsInvalidHostName() throws RepositoryException, ValidationException {
expectedException.expect(ValidationException.class);
expectedException.expectMessage("this-does-not-exist-42: ");
jadConfig.setRepository(new InMemoryRepository(ImmutableMap.of("http_bind_address", "this-does-not-exist-42"))).addConfigurationBean(configuration).process();
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class HttpConfigurationTest method testHttpPublishUriWithMissingTrailingSlash.
@Test
public void testHttpPublishUriWithMissingTrailingSlash() throws RepositoryException, ValidationException {
jadConfig.setRepository(new InMemoryRepository(ImmutableMap.of("http_publish_uri", "http://www.example.com:12900/foo"))).addConfigurationBean(configuration).process();
assertThat(configuration.getHttpPublishUri()).isEqualTo(URI.create("http://www.example.com:12900/foo/"));
}
Aggregations