use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class MongoDbConfigurationTest method validateSucceedsWithIPv6Address.
@Test
public void validateSucceedsWithIPv6Address() throws Exception {
MongoDbConfiguration configuration = new MongoDbConfiguration();
final Map<String, String> properties = singletonMap("mongodb_uri", "mongodb://[2001:DB8::DEAD:BEEF:CAFE:BABE]:1234,127.0.0.1:5678/TEST");
new JadConfig(new InMemoryRepository(properties), configuration).process();
assertEquals("mongodb://[2001:DB8::DEAD:BEEF:CAFE:BABE]:1234,127.0.0.1:5678/TEST", configuration.getMongoClientURI().toString());
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class HttpConfigurationTest method tlsValidationFailsIfPrivateKeyIsUnreadable.
@Test
public void tlsValidationFailsIfPrivateKeyIsUnreadable() 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(privateKey.setReadable(false, false)).isTrue();
expectedException.expect(ValidationException.class);
expectedException.expectMessage("Unreadable or missing HTTP private key: ");
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 testHttpPublishUriIsRelativeURI.
@Test
public void testHttpPublishUriIsRelativeURI() throws RepositoryException, ValidationException {
expectedException.expect(ValidationException.class);
expectedException.expectMessage("Parameter http_publish_uri should be an absolute URI (found /foo)");
jadConfig.setRepository(new InMemoryRepository(ImmutableMap.of("http_publish_uri", "/foo"))).addConfigurationBean(configuration).process();
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class HttpConfigurationTest method testHttpBindAddressWithDefaultPort.
@Test
public void testHttpBindAddressWithDefaultPort() throws RepositoryException, ValidationException {
jadConfig.setRepository(new InMemoryRepository(ImmutableMap.of("http_bind_address", "example.com"))).addConfigurationBean(configuration).process();
assertThat(configuration.getHttpBindAddress()).isEqualTo(HostAndPort.fromParts("example.com", 9000));
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class HttpConfigurationTest method testHttpBindAddressIsInvalidIPv6Address.
@Test
@Ignore("Disabled test due to being unreliable (see https://github.com/Graylog2/graylog2-server/issues/4459)")
public void testHttpBindAddressIsInvalidIPv6Address() throws RepositoryException, ValidationException {
expectedException.expect(ValidationException.class);
expectedException.expectMessage("Possible bracketless IPv6 literal: ff$$::1");
jadConfig.setRepository(new InMemoryRepository(ImmutableMap.of("http_bind_address", "ff$$::1"))).addConfigurationBean(configuration).process();
}
Aggregations