Search in sources :

Example 26 with JadConfig

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

the class ConfigurationTest method testApiListenerOnRootAndWebListenerOnSubPath.

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

Example 27 with JadConfig

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

the class ConfigurationTest method testPasswordSecretIsEmpty.

@Test
public void testPasswordSecretIsEmpty() throws ValidationException, RepositoryException {
    validProperties.put("password_secret", "");
    expectedException.expect(ValidationException.class);
    expectedException.expectMessage("Parameter password_secret should not be blank");
    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 28 with JadConfig

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

the class ConfigurationTest method testRestListenUriWithCustomPort.

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

Example 29 with JadConfig

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

the class ConfigurationTest method testWebListenUriWithHttpDefaultPort.

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

Example 30 with JadConfig

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

the class ConfigurationTest method testPasswordSecretIsNull.

@Test
public void testPasswordSecretIsNull() throws ValidationException, RepositoryException {
    validProperties.put("password_secret", null);
    expectedException.expect(ParameterException.class);
    expectedException.expectMessage("Required parameter \"password_secret\" not found.");
    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)66 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 PluginLoaderConfig (org.graylog2.plugin.PluginLoaderConfig)1