Search in sources :

Example 61 with JadConfig

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

the class ElasticsearchConfigurationTest method throwValidationExceptionIfDataPathIsNotADirectory.

@Test(expected = ValidationException.class)
public void throwValidationExceptionIfDataPathIsNotADirectory() throws Exception {
    final File path = temporaryFolder.newFile("elasticsearch-data");
    final ElasticsearchConfiguration configuration = new ElasticsearchConfiguration() {

        @Override
        public String getPathData() {
            return path.getAbsolutePath();
        }
    };
    new JadConfig(new InMemoryRepository(), configuration).process();
}
Also used : JadConfig(com.github.joschi.jadconfig.JadConfig) InMemoryRepository(com.github.joschi.jadconfig.repositories.InMemoryRepository) File(java.io.File) Test(org.junit.Test)

Example 62 with JadConfig

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

the class ElasticsearchConfigurationTest method throwValidationExceptionIfDataPathIsNotReadable.

@Test(expected = ValidationException.class)
public void throwValidationExceptionIfDataPathIsNotReadable() throws Exception {
    final File path = temporaryFolder.newFolder("elasticsearch-data");
    assumeTrue(path.setReadable(false));
    final ElasticsearchConfiguration configuration = new ElasticsearchConfiguration() {

        @Override
        public String getPathData() {
            return path.getAbsolutePath();
        }
    };
    new JadConfig(new InMemoryRepository(), configuration).process();
}
Also used : JadConfig(com.github.joschi.jadconfig.JadConfig) InMemoryRepository(com.github.joschi.jadconfig.repositories.InMemoryRepository) File(java.io.File) Test(org.junit.Test)

Example 63 with JadConfig

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

the class MongoDbConfigurationTest method testGetMaximumMongoDBConnectionsDefault.

@Test
public void testGetMaximumMongoDBConnectionsDefault() throws RepositoryException, ValidationException {
    MongoDbConfiguration configuration = new MongoDbConfiguration();
    new JadConfig(new InMemoryRepository(), configuration).process();
    assertEquals(1000, configuration.getMaxConnections());
}
Also used : JadConfig(com.github.joschi.jadconfig.JadConfig) InMemoryRepository(com.github.joschi.jadconfig.repositories.InMemoryRepository) Test(org.junit.Test)

Example 64 with JadConfig

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

the class MongoDbConfigurationTest method validateSucceedsWithIPv6Address.

@Test
public void validateSucceedsWithIPv6Address() throws Exception {
    MongoDbConfiguration configuration = new MongoDbConfiguration();
    final Map<String, String> properties = singletonMap("mongodb_uri", "mongodb://[2001:DB8::DEAD:BEEF:CAFE:BABE]:1234,127.0.0.1:5678/TEST");
    new JadConfig(new InMemoryRepository(properties), configuration).process();
    assertEquals("mongodb://[2001:DB8::DEAD:BEEF:CAFE:BABE]:1234,127.0.0.1:5678/TEST", configuration.getMongoClientURI().toString());
}
Also used : JadConfig(com.github.joschi.jadconfig.JadConfig) InMemoryRepository(com.github.joschi.jadconfig.repositories.InMemoryRepository) Test(org.junit.Test)

Example 65 with JadConfig

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

the class MongoDbConfigurationTest method testGetThreadsAllowedToBlockMultiplierDefault.

@Test
public void testGetThreadsAllowedToBlockMultiplierDefault() throws RepositoryException, ValidationException {
    MongoDbConfiguration configuration = new MongoDbConfiguration();
    new JadConfig(new InMemoryRepository(), configuration).process();
    assertEquals(5, configuration.getThreadsAllowedToBlockMultiplier());
}
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