Search in sources :

Example 31 with InMemoryRepository

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

the class ConfigurationTest method testPasswordSecretIsTooShort.

@Test
public void testPasswordSecretIsTooShort() throws ValidationException, RepositoryException {
    validProperties.put("password_secret", "too short");
    expectedException.expect(ValidationException.class);
    expectedException.expectMessage("The minimum length for \"password_secret\" is 16 characters.");
    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 32 with InMemoryRepository

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

the class ConfigurationTest method testRestListenUriIsAbsoluteURI.

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

Example 33 with InMemoryRepository

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

the class ConfigurationTest method testWebInterfaceListeningOnWildcardOnSamePortAsRestApi.

@Test
public void testWebInterfaceListeningOnWildcardOnSamePortAsRestApi() throws ValidationException, RepositoryException {
    validProperties.put("rest_listen_uri", "http://127.0.0.1:9000/api/");
    validProperties.put("web_listen_uri", "http://0.0.0.0: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)

Example 34 with InMemoryRepository

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

the class ConfigurationTest method testWebListenUriIsRelativeURI.

@Test
public void testWebListenUriIsRelativeURI() throws RepositoryException, ValidationException {
    validProperties.put("web_listen_uri", "/foo");
    expectedException.expect(ValidationException.class);
    expectedException.expectMessage("Parameter web_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 35 with InMemoryRepository

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

the class ConfigurationTest method testPasswordSecretIsValid.

@Test
public void testPasswordSecretIsValid() throws ValidationException, RepositoryException {
    validProperties.put("password_secret", "abcdefghijklmnopqrstuvwxyz");
    Configuration configuration = new Configuration();
    new JadConfig(new InMemoryRepository(validProperties), configuration).process();
    assertThat(configuration.getPasswordSecret()).isEqualTo("abcdefghijklmnopqrstuvwxyz");
}
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