use of io.nosqlbench.nb.api.config.standard.ConfigModel in project nosqlbench by nosqlbench.
the class StmtsDocList method getConfigModel.
public NBConfigModel getConfigModel() {
ConfigModel cfgmodel = ConfigModel.of(StmtsDocList.class);
getTemplateVariables().forEach((k, v) -> {
cfgmodel.add(Param.defaultTo(k, v, "template parameter found in the yaml workload"));
});
return cfgmodel.asReadOnly();
}
use of io.nosqlbench.nb.api.config.standard.ConfigModel in project nosqlbench by nosqlbench.
the class ConfigModelTest method testMultipleParams.
@Test
public void testMultipleParams() {
ConfigModel cm = ConfigModel.of(ConfigModelTest.class, Param.defaultTo(List.of("a", "b"), "value").setRequired(false), Param.required("c", int.class));
NBConfiguration cfg = cm.apply(Map.of("c", 232));
assertThat(cfg.getOptional("a")).isEmpty();
assertThat(cfg.get("c", int.class)).isEqualTo(232);
}
Aggregations