use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testWebEndpointUriIsRelativeURI.
@Test
public void testWebEndpointUriIsRelativeURI() throws RepositoryException, ValidationException {
validProperties.put("web_endpoint_uri", "/foo");
Configuration configuration = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
assertEquals(URI.create("/foo"), configuration.getWebEndpointUri());
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testRestTransportUriLocalhost.
@Test
public void testRestTransportUriLocalhost() throws RepositoryException, ValidationException {
validProperties.put("rest_listen_uri", "http://127.0.0.1:12900");
Configuration configuration = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
Assert.assertEquals("http://127.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 testGetRestUriScheme.
@Test
public void testGetRestUriScheme() throws RepositoryException, ValidationException, IOException {
validProperties.put("rest_enable_tls", "false");
final Configuration configWithoutTls = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configWithoutTls).process();
validProperties.put("rest_enable_tls", "true");
validProperties.put("rest_tls_key_file", temporaryFolder.newFile("graylog.key").getAbsolutePath());
validProperties.put("rest_tls_cert_file", temporaryFolder.newFile("graylog.crt").getAbsolutePath());
final Configuration configWithTls = new Configuration();
new JadConfig(new InMemoryRepository(validProperties), configWithTls).process();
assertEquals("http", configWithoutTls.getRestUriScheme());
assertEquals("https", configWithTls.getRestUriScheme());
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testRestListenUriAndWebListenUriWithSameScheme.
@Test
public void testRestListenUriAndWebListenUriWithSameScheme() throws Exception {
final File privateKey = temporaryFolder.newFile("graylog.key");
final File certificate = temporaryFolder.newFile("graylog.crt");
validProperties.put("rest_listen_uri", "https://127.0.0.1:8000/api");
validProperties.put("rest_transport_uri", "https://127.0.0.1:8000/api");
validProperties.put("rest_enable_tls", "true");
validProperties.put("rest_tls_key_file", privateKey.getAbsolutePath());
validProperties.put("rest_tls_cert_file", certificate.getAbsolutePath());
validProperties.put("web_listen_uri", "https://127.0.0.1:8000/");
validProperties.put("web_enable_tls", "true");
org.graylog2.Configuration configuration = new org.graylog2.Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
assertThat(configuration.getRestListenUri()).hasScheme("https");
assertThat(configuration.getRestTransportUri()).hasScheme("https");
assertThat(configuration.getWebListenUri()).hasScheme("https");
}
use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.
the class BaseConfigurationTest method testRestTransportUriWithHttpDefaultPort.
@Test
public void testRestTransportUriWithHttpDefaultPort() throws RepositoryException, ValidationException {
validProperties.put("rest_transport_uri", "http://example.com/");
org.graylog2.Configuration configuration = new org.graylog2.Configuration();
new JadConfig(new InMemoryRepository(validProperties), configuration).process();
assertThat(configuration.getRestTransportUri()).hasPort(80);
}
Aggregations