use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method webTlsValidationFailsIfPrivateKeyIsUnreadable.
@Test
public void webTlsValidationFailsIfPrivateKeyIsUnreadable() 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(privateKey.setReadable(false, false)).isTrue();
expectedException.expect(ValidationException.class);
expectedException.expectMessage("Unreadable or missing web interface 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 testGetWebUriScheme.
@Test
public void testGetWebUriScheme() throws RepositoryException, ValidationException, IOException {
validProperties.put("web_enable_tls", "false");
final Configuration configWithoutTls = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configWithoutTls).process();
validProperties.put("web_enable_tls", "true");
validProperties.put("web_tls_key_file", temporaryFolder.newFile("graylog.key").getAbsolutePath());
validProperties.put("web_tls_cert_file", temporaryFolder.newFile("graylog.crt").getAbsolutePath());
final Configuration configWithTls = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configWithTls).process();
assertEquals("http", configWithoutTls.getWebUriScheme());
assertEquals("https", configWithTls.getWebUriScheme());
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testRestTransportUriCustom.
@Test
public void testRestTransportUriCustom() throws RepositoryException, ValidationException {
validProperties.put("rest_listen_uri", "http://10.0.0.1:12900");
Configuration configuration = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
Assert.assertEquals("http://10.0.0.1:12900", configuration.getDefaultRestTransportUri().toString());
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testRestTransportUriWildcard.
@Test
public void testRestTransportUriWildcard() throws RepositoryException, ValidationException {
validProperties.put("rest_listen_uri", "http://0.0.0.0:12900");
validProperties.put("rest_transport_uri", "http://0.0.0.0:12900");
Configuration configuration = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
Assert.assertNotEquals(URI.create("http://0.0.0.0:12900"), configuration.getRestTransportUri());
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method restTlsValidationFailsIfCertificateIsUnreadable.
@Test
public void restTlsValidationFailsIfCertificateIsUnreadable() throws Exception {
final File privateKey = temporaryFolder.newFile("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(certificate.setReadable(false, false)).isTrue();
expectedException.expect(ValidationException.class);
expectedException.expectMessage("Unreadable or missing REST API X.509 certificate: ");
new JadConfig(new InMemoryRepository(validProperties), new Configuration()).process();
}
Aggregations