Search in sources :

Example 36 with InMemoryRepository

use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.

the class ConfigurationTest method testWebListenUriWithCustomPort.

@Test
public void testWebListenUriWithCustomPort() throws RepositoryException, ValidationException {
    validProperties.put("web_listen_uri", "http://example.com:9000/");
    Configuration configuration = new Configuration();
    new JadConfig(new InMemoryRepository(validProperties), configuration).process();
    assertThat(configuration.getWebListenUri()).hasPort(9000);
}
Also used : JadConfig(com.github.joschi.jadconfig.JadConfig) InMemoryRepository(com.github.joschi.jadconfig.repositories.InMemoryRepository) Test(org.junit.Test)

Example 37 with InMemoryRepository

use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.

the class ConfigurationTest method testRestListenUriWithHttpDefaultPort.

@Test
public void testRestListenUriWithHttpDefaultPort() throws RepositoryException, ValidationException {
    validProperties.put("rest_listen_uri", "http://example.com/");
    Configuration configuration = new Configuration();
    new JadConfig(new InMemoryRepository(validProperties), configuration).process();
    assertThat(configuration.getRestListenUri()).hasPort(80);
}
Also used : JadConfig(com.github.joschi.jadconfig.JadConfig) InMemoryRepository(com.github.joschi.jadconfig.repositories.InMemoryRepository) Test(org.junit.Test)

Example 38 with InMemoryRepository

use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.

the class ConfigurationTest method testRestListenUriIsRelativeURI.

@Test
public void testRestListenUriIsRelativeURI() throws RepositoryException, ValidationException {
    validProperties.put("rest_listen_uri", "/foo");
    expectedException.expect(ValidationException.class);
    expectedException.expectMessage("Parameter rest_listen_uri should be an absolute URI (found /foo)");
    Configuration configuration = new Configuration();
    new JadConfig(new InMemoryRepository(validProperties), configuration).process();
}
Also used : JadConfig(com.github.joschi.jadconfig.JadConfig) InMemoryRepository(com.github.joschi.jadconfig.repositories.InMemoryRepository) Test(org.junit.Test)

Example 39 with InMemoryRepository

use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.

the class ConfigurationTest method testWebListenerOnRootAndApiListenerOnSubPath.

@Test
public void testWebListenerOnRootAndApiListenerOnSubPath() throws ValidationException, RepositoryException {
    validProperties.put("rest_listen_uri", "http://0.0.0.0:9000/api/");
    validProperties.put("web_listen_uri", "http://0.0.0.0:9000/");
    Configuration configuration = new Configuration();
    new JadConfig(new InMemoryRepository(validProperties), configuration).process();
    assertThat(configuration.getRestListenUri()).isEqualTo(URI.create("http://0.0.0.0:9000/api/"));
    assertThat(configuration.getWebListenUri()).isEqualTo(URI.create("http://0.0.0.0:9000/"));
}
Also used : JadConfig(com.github.joschi.jadconfig.JadConfig) InMemoryRepository(com.github.joschi.jadconfig.repositories.InMemoryRepository) Test(org.junit.Test)

Example 40 with InMemoryRepository

use of com.github.joschi.jadconfig.repositories.InMemoryRepository in project graylog2-server by Graylog2.

the class ConfigurationTest method testRestApiListeningOnWildcardOnSamePortAsWebInterface.

@Test
public void testRestApiListeningOnWildcardOnSamePortAsWebInterface() throws ValidationException, RepositoryException {
    validProperties.put("rest_listen_uri", "http://0.0.0.0:9000/api/");
    validProperties.put("web_listen_uri", "http://127.0.0.1:9000/");
    expectedException.expect(ValidationException.class);
    expectedException.expectMessage("Wildcard IP addresses cannot be used if the Graylog REST API and web interface listen on the same port.");
    Configuration configuration = new Configuration();
    new JadConfig(new InMemoryRepository(validProperties), configuration).process();
}
Also used : JadConfig(com.github.joschi.jadconfig.JadConfig) InMemoryRepository(com.github.joschi.jadconfig.repositories.InMemoryRepository) Test(org.junit.Test)

Aggregations

JadConfig (com.github.joschi.jadconfig.JadConfig)65 InMemoryRepository (com.github.joschi.jadconfig.repositories.InMemoryRepository)65 Test (org.junit.Test)64 File (java.io.File)19 ElasticsearchConfiguration (org.graylog2.configuration.ElasticsearchConfiguration)3 Settings (org.elasticsearch.common.settings.Settings)2 RepositoryException (com.github.joschi.jadconfig.RepositoryException)1 ValidationException (com.github.joschi.jadconfig.ValidationException)1 HashMap (java.util.HashMap)1