Search in sources :

Example 1 with YamlConfiguration

use of org.rx.core.YamlConfiguration in project rxlib by RockyLOMO.

the class CoreTester method yamlConf.

@Test
public void yamlConf() {
    System.out.println(FilenameUtils.getFullPath("b.txt"));
    System.out.println(FilenameUtils.getFullPath("c:\\a\\b.txt"));
    System.out.println(FilenameUtils.getFullPath("/a/b.txt"));
    YamlConfiguration conf = YamlConfiguration.RX_CONF;
    conf.enableWatch();
    sleep(60000);
}
Also used : YamlConfiguration(org.rx.core.YamlConfiguration) Test(org.junit.jupiter.api.Test)

Example 2 with YamlConfiguration

use of org.rx.core.YamlConfiguration in project rxlib by RockyLOMO.

the class CoreTester method rxConf.

// endregion
@Test
public void rxConf() {
    Iterable<Object> all = new Yaml().loadAll(Reflects.getResource("application.yml"));
    List<Object> list = IterableUtils.toList(all);
    YamlConfiguration conf = YamlConfiguration.RX_CONF;
    System.out.println(conf.getYaml());
    Map codeMap = conf.readAs("org.rx.test.CoreTester", Map.class);
    System.out.println(codeMap);
    String codeFormat = conf.readAs("org.rx.test.CoreTester.exceptionHandle<IllegalArgumentException>", String.class);
    System.out.println(codeFormat);
    assert eq(codeFormat, "Test IAException, value={0}");
    RxConfig rxConf = RxConfig.INSTANCE;
    assert rxConf.getId().equals("Rx");
    assert rxConf.getThreadPool().getReplicas() == 4;
    assert rxConf.getNet().getConnectTimeoutMillis() == 40000;
    assert rxConf.getLogTypeWhitelist().size() == 2;
    assert rxConf.getJsonSkipTypes().size() == 1;
}
Also used : YamlConfiguration(org.rx.core.YamlConfiguration) Yaml(org.yaml.snakeyaml.Yaml) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 YamlConfiguration (org.rx.core.YamlConfiguration)2 Yaml (org.yaml.snakeyaml.Yaml)1