use of com.vaticle.typedb.core.server.parameters.CoreConfigParser in project grakn by graknlabs.
the class CoreConfigTest method minimal_config_with_absolute_paths_is_read.
@Test
public void minimal_config_with_absolute_paths_is_read() {
Path configMinimalAbsPaths = Util.getTypedbDir().resolve("server/test/config/config-minimal-abs-path.yml");
CoreConfig config = CoreConfigFactory.config(configMinimalAbsPaths, new HashSet<>(), new CoreConfigParser());
assertTrue(config.storage().dataDir().isAbsolute());
assertEquals(new InetSocketAddress("0.0.0.0", 1730), config.server().address());
assertEquals(200 * Bytes.MB, config.storage().databaseCache().dataSize());
assertEquals(700 * Bytes.MB, config.storage().databaseCache().indexSize());
assertFalse(config.vaticleFactory().enable());
assertTrue(config.log().output().outputs().containsKey("stdout"));
assertTrue(config.log().output().outputs().containsKey("file"));
assertTrue(config.log().output().outputs().get("file").asFile().path().isAbsolute());
assertEquals(50 * Bytes.MB, config.log().output().outputs().get("file").asFile().fileSizeCap());
assertEquals(1 * Bytes.GB, config.log().output().outputs().get("file").asFile().archivesSizeCap());
assertNotNull(config.log().logger().defaultLogger());
assertFalse(config.log().logger().defaultLogger().outputs().isEmpty());
assertEquals("warn", config.log().logger().defaultLogger().level());
assertFalse(config.log().debugger().reasoner().isEnabled());
}
use of com.vaticle.typedb.core.server.parameters.CoreConfigParser in project grakn by graknlabs.
the class CoreConfigTest method config_file_is_read.
@Test
public void config_file_is_read() {
CoreConfig config = CoreConfigFactory.config(new CoreConfigParser());
assertTrue(config.storage().dataDir().toString().endsWith("server/data"));
assertEquals(new InetSocketAddress("0.0.0.0", 1729), config.server().address());
assertEquals(500 * Bytes.MB, config.storage().databaseCache().dataSize());
assertEquals(500 * Bytes.MB, config.storage().databaseCache().indexSize());
assertFalse(config.vaticleFactory().enable());
assertTrue(config.log().output().outputs().containsKey("stdout"));
assertTrue(config.log().output().outputs().containsKey("file"));
assertTrue(config.log().output().outputs().get("file").asFile().path().toString().endsWith("server/logs"));
assertEquals(50 * Bytes.MB, config.log().output().outputs().get("file").asFile().fileSizeCap());
assertEquals(1 * Bytes.GB, config.log().output().outputs().get("file").asFile().archivesSizeCap());
assertNotNull(config.log().logger().defaultLogger());
assertFalse(config.log().logger().defaultLogger().outputs().isEmpty());
assertEquals("warn", config.log().logger().defaultLogger().level());
assertFalse(config.log().debugger().reasoner().isEnabled());
}
use of com.vaticle.typedb.core.server.parameters.CoreConfigParser in project grakn by graknlabs.
the class CoreConfigTest method config_file_accepts_overrides.
@Test
public void config_file_accepts_overrides() {
CoreConfig config = CoreConfigFactory.config(set(new Option("storage.data", "server/alt-data"), new Option("server.address", "0.0.0.0:1730"), new Option("log.output.file.directory", "server/alt-logs"), new Option("log.logger.default.level", "info"), new Option("log.logger.typedb.output", "[file]")), new CoreConfigParser());
assertTrue(config.storage().dataDir().toString().endsWith("server/alt-data"));
assertEquals(new InetSocketAddress("0.0.0.0", 1730), config.server().address());
assertFalse(config.vaticleFactory().enable());
assertTrue(config.log().output().outputs().containsKey("stdout"));
assertTrue(config.log().output().outputs().containsKey("file"));
assertTrue(config.log().output().outputs().get("file").asFile().path().toString().endsWith("server/alt-logs"));
assertEquals(50 * Bytes.MB, config.log().output().outputs().get("file").asFile().fileSizeCap());
assertEquals(1 * Bytes.GB, config.log().output().outputs().get("file").asFile().archivesSizeCap());
assertNotNull(config.log().logger().defaultLogger());
assertFalse(config.log().logger().defaultLogger().outputs().isEmpty());
assertEquals("info", config.log().logger().defaultLogger().level());
assertEquals(list("file"), config.log().logger().filteredLoggers().get("typedb").outputs());
assertFalse(config.log().debugger().reasoner().isEnabled());
}
use of com.vaticle.typedb.core.server.parameters.CoreConfigParser in project grakn by graknlabs.
the class CoreConfigTest method config_file_wrong_path_type_throws.
@Test
public void config_file_wrong_path_type_throws() {
Path configInvalidPathType = Util.getTypedbDir().resolve("server/test/config/config-wrong-path-type.yml");
try {
CoreConfigFactory.config(configInvalidPathType, new HashSet<>(), new CoreConfigParser());
fail();
} catch (TypeDBException e) {
assert e.code().isPresent();
assertEquals(CONFIG_UNEXPECTED_VALUE.code(), e.code().get());
assertEquals(CONFIG_UNEXPECTED_VALUE.message("storage.data", "123456[int]", YAMLParser.Value.Primitive.PATH.help()), e.getMessage());
}
}
use of com.vaticle.typedb.core.server.parameters.CoreConfigParser in project grakn by graknlabs.
the class CoreConfigTest method config_file_unrecognised_option.
@Test
public void config_file_unrecognised_option() {
Path configUnrecognisedOption = Util.getTypedbDir().resolve("server/test/config/config-unrecognised-option.yml");
try {
CoreConfigFactory.config(configUnrecognisedOption, new HashSet<>(), new CoreConfigParser());
fail();
} catch (TypeDBException e) {
assert e.code().isPresent();
assertEquals(UNRECOGNISED_CONFIGURATION_OPTIONS.code(), e.code().get());
assertEquals(UNRECOGNISED_CONFIGURATION_OPTIONS.message(list("log.custom-logger-invalid")), e.getMessage());
}
}
Aggregations