Search in sources :

Example 1 with ConfigModel

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();
}
Also used : NBConfigModel(io.nosqlbench.nb.api.config.standard.NBConfigModel) ConfigModel(io.nosqlbench.nb.api.config.standard.ConfigModel)

Example 2 with ConfigModel

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);
}
Also used : ConfigModel(io.nosqlbench.nb.api.config.standard.ConfigModel) NBConfiguration(io.nosqlbench.nb.api.config.standard.NBConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

ConfigModel (io.nosqlbench.nb.api.config.standard.ConfigModel)2 NBConfigModel (io.nosqlbench.nb.api.config.standard.NBConfigModel)1 NBConfiguration (io.nosqlbench.nb.api.config.standard.NBConfiguration)1 Test (org.junit.jupiter.api.Test)1