use of com.torodb.stampede.CliConfig in project torodb by torodb.
the class ConfigTest method testParseWithWrongTypeParam.
@Test(expected = IllegalArgumentException.class)
public void testParseWithWrongTypeParam() throws Exception {
CliConfig cliConfig = new CliConfig() {
@Override
public List<String> getParams() {
String[] params = new String[] { "/logging/level=ALL" };
return Arrays.asList(params);
}
};
CliConfigUtils.readConfig(cliConfig);
}
use of com.torodb.stampede.CliConfig in project torodb by torodb.
the class ConfigTest method testParse.
@Test
public void testParse() throws Exception {
CliConfig cliConfig = new CliConfig();
CliConfigUtils.readConfig(cliConfig);
}
use of com.torodb.stampede.CliConfig in project torodb by torodb.
the class ConfigTest method testParseWithWrongYAML.
@Test(expected = IllegalArgumentException.class)
public void testParseWithWrongYAML() throws Exception {
CliConfig cliConfig = new CliConfig() {
@Override
public boolean hasConfFile() {
return true;
}
@Override
public InputStream getConfInputStream() {
return ConfigTest.class.getResourceAsStream("/test-parse-with-wrong-yaml.yml");
}
};
CliConfigUtils.readConfig(cliConfig);
}
use of com.torodb.stampede.CliConfig in project torodb by torodb.
the class ConfigTest method testParseWithYAMLUsingDoubleBackend.
@Test(expected = IllegalArgumentException.class)
public void testParseWithYAMLUsingDoubleBackend() throws Exception {
CliConfig cliConfig = new CliConfig() {
@Override
public boolean hasConfFile() {
return true;
}
@Override
public InputStream getConfInputStream() {
return ConfigTest.class.getResourceAsStream("/test-parse-with-yaml-using-double-backend.yml");
}
};
CliConfigUtils.readConfig(cliConfig);
}
use of com.torodb.stampede.CliConfig in project torodb by torodb.
the class ConfigTest method testReplicationFiltering.
@Test
public void testReplicationFiltering() throws Exception {
CliConfig cliConfig = new CliConfig() {
@Override
public boolean hasConfFile() {
return true;
}
@Override
public InputStream getConfInputStream() {
return ConfigTest.class.getResourceAsStream("/test-parse-with-yaml.yml");
}
@Override
public List<String> getParams() {
String[] params = new String[] { "/replication/include={torodb: [postgres, derby]}", "/replication/exclude={mongodb: {mmapv1, wiredtiger}}" };
return Arrays.asList(params);
}
};
Config config = CliConfigUtils.readConfig(cliConfig);
Assert.assertTrue("/logging not defined", config.getLogging() != null);
Assert.assertTrue("/logging/packages not defined", config.getLogging().getPackages() != null);
Assert.assertTrue("/logging/packages/com.torodb not defined", config.getLogging().getPackages().get("com.torodb") != null);
Assert.assertEquals("/logging/level has different value than that specified", LogLevel.NONE, config.getLogging().getLevel());
Assert.assertEquals("/logging/packages has not 1 entry", 1, config.getLogging().getPackages().size());
Assert.assertEquals("/logging/packages/com.torodb has different value than that specified", LogLevel.DEBUG, config.getLogging().getPackages().get("com.torodb"));
Assert.assertTrue("/replication not defined", config.getReplication() != null);
Assert.assertEquals("/replication/replSetName has different value than that specified", "rs1", config.getReplication().getReplSetName());
Assert.assertEquals("/replication/role has different value than that specified", Role.HIDDEN_SLAVE, config.getReplication().getRole());
Assert.assertEquals("/replication/syncSource has different value than that specified", "localhost:27017", config.getReplication().getSyncSource());
Assert.assertTrue("/replication/include not defined", config.getReplication().getInclude() != null);
Assert.assertTrue("/replication/include/torodb not defined", config.getReplication().getInclude().get("torodb") != null);
Assert.assertEquals("/replication/include/torodb has different value than that specified", ImmutableMap.of("postgres", ImmutableList.of(), "derby", ImmutableList.of()), config.getReplication().getInclude().get("torodb"));
Assert.assertTrue("/replication/exclude not defined", config.getReplication().getExclude() != null);
Assert.assertTrue("/replication/exclude/mongodb not defined", config.getReplication().getExclude().get("mongodb") != null);
Assert.assertEquals("/replication/exclude/mongodb has different value than that specified", ImmutableMap.of("mmapv1", ImmutableList.of(), "wiredtiger", ImmutableList.of()), config.getReplication().getExclude().get("mongodb"));
Assert.assertTrue("/backend not defined", config.getBackend() != null);
Assert.assertEquals("/backend/postgres not defined", Postgres.class, config.getBackend().getBackendImplementation().getClass());
Assert.assertTrue("/backend/postgres not identified as AbstractPostgres", config.getBackend().is(Postgres.class));
Assert.assertTrue("/backend/postgres not identified as AbstractPostgres Like", config.getBackend().isLike(Postgres.class));
Assert.assertEquals("/backend/postgres/host has different value than that specified", "localhost", config.getBackend().as(Postgres.class).getHost());
Assert.assertEquals("/backend/postgres/port has different value than that specified", Integer.valueOf(5432), config.getBackend().as(Postgres.class).getPort());
Assert.assertEquals("/backend/postgres/user has different value than that specified", "root", config.getBackend().as(Postgres.class).getUser());
Assert.assertEquals("/backend/postgres/password specified but should have not been read from parameters", null, config.getBackend().as(Postgres.class).getPassword());
}
Aggregations