Search in sources :

Example 16 with Config

use of com.torodb.standalone.config.model.Config in project torodb by torodb.

the class ConfigTest method testParseWithLogPackagesParam.

@Test
public void testParseWithLogPackagesParam() throws Exception {
    final String logPackage = "com.torodb";
    final LogLevel logLevel = LogLevel.NONE;
    CliConfig cliConfig = new CliConfig() {

        @Override
        public List<String> getParams() {
            String[] params = new String[] { "/generic/logPackages/" + logPackage + "=" + logLevel.name() };
            return Arrays.asList(params);
        }
    };
    Config config = CliConfigUtils.readConfig(cliConfig);
    Assert.assertTrue("/generic/logPackages not defined", config.getGeneric().getLogPackages() != null);
    Assert.assertTrue("/generic/logPackages/" + logPackage + " not defined", config.getGeneric().getLogPackages().get(logPackage) != null);
    Assert.assertEquals("/generic/logPackages has not 1 entry", 1, config.getGeneric().getLogPackages().size());
    Assert.assertEquals("/generic/logPackages/" + logPackage + " has different value than that specified", logLevel, config.getGeneric().getLogPackages().get(logPackage));
}
Also used : Config(com.torodb.standalone.config.model.Config) CliConfig(com.torodb.standalone.CliConfig) CliConfig(com.torodb.standalone.CliConfig) LogLevel(com.torodb.packaging.config.model.generic.LogLevel) Test(org.junit.Test)

Aggregations

Config (com.torodb.standalone.config.model.Config)16 CliConfig (com.torodb.standalone.CliConfig)12 Test (org.junit.Test)12 Postgres (com.torodb.standalone.config.model.backend.postgres.Postgres)5 Derby (com.torodb.standalone.config.model.backend.derby.Derby)3 InputStream (java.io.InputStream)2 JCommander (com.beust.jcommander.JCommander)1 Console (com.beust.jcommander.internal.Console)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 YAMLMapper (com.fasterxml.jackson.dataformat.yaml.YAMLMapper)1 Charsets (com.google.common.base.Charsets)1 Throwables (com.google.common.base.Throwables)1 HostAndPort (com.google.common.net.HostAndPort)1 Service (com.google.common.util.concurrent.Service)1 CreationException (com.google.inject.CreationException)1 ConcurrentModule (com.torodb.concurrent.guice.ConcurrentModule)1 SystemException (com.torodb.core.exceptions.SystemException)1 CoreModule (com.torodb.core.guice.CoreModule)1 MetricsModule (com.torodb.core.metrics.guice.MetricsModule)1