use of com.github.joschi.jadconfig.JadConfig in project graylog2-server by Graylog2.
the class BaseConfigurationTest method restTlsValidationFailsIfPrivateKeyIsUnreadable.
@Test
public void restTlsValidationFailsIfPrivateKeyIsUnreadable() 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(privateKey.setReadable(false, false)).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.JadConfig in project graylog2-server by Graylog2.
the class BaseConfigurationTest method webTlsValidationFailsIfCertificateIsMissing.
@Test
public void webTlsValidationFailsIfCertificateIsMissing() 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.delete()).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.JadConfig in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testWebEndpointUriIsAbsoluteURI.
@Test
public void testWebEndpointUriIsAbsoluteURI() throws RepositoryException, ValidationException {
validProperties.put("web_endpoint_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.getWebEndpointUri());
}
use of com.github.joschi.jadconfig.JadConfig in project graylog2-server by Graylog2.
the class BaseConfigurationTest method webTlsValidationFailsIfCertificateIsDirectory.
@Test
public void webTlsValidationFailsIfCertificateIsDirectory() throws Exception {
final File privateKey = temporaryFolder.newFile("graylog.key");
final File certificate = temporaryFolder.newFolder("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.isDirectory()).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.JadConfig in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testRestTransportUriWithCustomScheme.
@Test
public void testRestTransportUriWithCustomScheme() throws RepositoryException, ValidationException {
validProperties.put("rest_transport_uri", "https://example.com:12900/");
validProperties.put("rest_enable_tls", "false");
org.graylog2.Configuration configuration = new org.graylog2.Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
assertThat(configuration.getRestTransportUri()).hasScheme("https");
}
Aggregations