use of com.github.joschi.jadconfig.JadConfig in project graylog2-server by Graylog2.
the class BaseConfigurationTest method restTlsValidationFailsIfCertificateIsDirectory.
@Test
public void restTlsValidationFailsIfCertificateIsDirectory() throws Exception {
final File privateKey = temporaryFolder.newFile("graylog.key");
final File certificate = temporaryFolder.newFolder("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.isDirectory()).isTrue();
expectedException.expect(ValidationException.class);
expectedException.expectMessage("Unreadable or missing REST API X.509 certificate: ");
new JadConfig(new InMemoryRepository(validProperties), new Configuration()).process();
}
use of com.github.joschi.jadconfig.JadConfig in project graylog2-server by Graylog2.
the class BaseConfigurationTest method webTlsValidationFailsIfPrivateKeyIsDirectory.
@Test
public void webTlsValidationFailsIfPrivateKeyIsDirectory() throws Exception {
final File privateKey = temporaryFolder.newFolder("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.isDirectory()).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.JadConfig in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testRestTransportUriWildcardKeepsPath.
@Test
public void testRestTransportUriWildcardKeepsPath() throws RepositoryException, ValidationException {
validProperties.put("rest_listen_uri", "http://0.0.0.0:12900/api/");
validProperties.put("rest_transport_uri", "http://0.0.0.0:12900/api/");
Configuration configuration = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
Assert.assertNotEquals(URI.create("http://0.0.0.0:12900/api/"), configuration.getRestTransportUri());
Assert.assertEquals("/api/", configuration.getRestTransportUri().getPath());
}
use of com.github.joschi.jadconfig.JadConfig in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testRestTransportUriWithCustomPort.
@Test
public void testRestTransportUriWithCustomPort() throws RepositoryException, ValidationException {
validProperties.put("rest_transport_uri", "http://example.com:12900/");
org.graylog2.Configuration configuration = new org.graylog2.Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
assertThat(configuration.getRestTransportUri()).hasPort(12900);
}
use of com.github.joschi.jadconfig.JadConfig in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testRestListenUriWildcard.
@Test
public void testRestListenUriWildcard() throws RepositoryException, ValidationException {
validProperties.put("rest_listen_uri", "http://0.0.0.0:12900");
Configuration configuration = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
Assert.assertNotEquals("http://0.0.0.0:12900", configuration.getDefaultRestTransportUri().toString());
Assert.assertNotNull(configuration.getDefaultRestTransportUri());
}
Aggregations