mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
add description field in yaml
This commit is contained in:
@@ -24,11 +24,23 @@ import java.util.Map;
|
||||
public class BlockParams extends Tags {
|
||||
|
||||
private String name = "";
|
||||
private String desc = "";
|
||||
private Map<String, String> bindings = new LinkedHashMap<>();
|
||||
private Map<String, String> params = new LinkedHashMap<>();
|
||||
|
||||
public BlockParams() {}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
public void setDescription(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -39,10 +39,14 @@ public class RawStmtDef extends BlockParams {
|
||||
Optional.ofNullable((String) map.remove("stmt")).ifPresent(this::setStmt);
|
||||
Optional.ofNullable((String) map.remove("statement")).ifPresent(this::setStmt);
|
||||
Optional.ofNullable((String) map.remove("name")).ifPresent(this::setName);
|
||||
Optional.ofNullable((String) map.remove("desc")).ifPresent(this::setDesc);
|
||||
Optional.ofNullable((String) map.remove("description")).ifPresent(this::setDesc);
|
||||
|
||||
Optional.ofNullable((Map<String, String>) map.remove("tags")).ifPresent(this::setTags);
|
||||
Optional.ofNullable((Map<String, String>) map.remove("bindings")).ifPresent(this::setBindings);
|
||||
Optional.ofNullable((Map<String, String>) map.remove("params")).ifPresent(this::setParams);
|
||||
|
||||
|
||||
// Depends on order stability, relying on LinkedHashMap -- Needs stability unit tests
|
||||
if (this.statement == null) {
|
||||
Iterator<Map.Entry<String, Object>> iterator = map.entrySet().iterator();
|
||||
@@ -79,7 +83,7 @@ public class RawStmtDef extends BlockParams {
|
||||
private void setStmt(String statement) {
|
||||
this.statement = statement;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return getParams().getOrDefault("name", super.getName());
|
||||
}
|
||||
|
||||
@@ -67,4 +67,8 @@ public class StmtDef implements Tagged {
|
||||
public ParsedStmt getParsed() {
|
||||
return new ParsedStmt(this);
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return rawStmtDef.getDesc();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,9 @@ public class RawYamlStatementLoaderTest {
|
||||
assertThat(rawStmtsDocs).hasSize(2);
|
||||
RawStmtsDoc rawStmtsDoc = rawStmtsDocs.get(0);
|
||||
List<RawStmtsBlock> blocks = rawStmtsDoc.getBlocks();
|
||||
assertThat(rawStmtsDoc.getDesc()).isEqualTo("a quintessential" +
|
||||
" description");
|
||||
|
||||
RawScenarios rawScenarios = rawStmtsDoc.getRawScenarios();
|
||||
assertThat(rawScenarios.getScenarioNames()).containsExactly("default", "schema-only");
|
||||
List<String> defaultScenario = rawScenarios.getNamedScenario("default");
|
||||
@@ -75,6 +78,7 @@ public class RawYamlStatementLoaderTest {
|
||||
RawStmtsBlock rawStmtsBlock = blocks.get(0);
|
||||
assertThat(rawStmtsBlock.getName()).isEqualTo("block0");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
description: a quintessential description
|
||||
|
||||
scenarios:
|
||||
default:
|
||||
- run driver=stdout alias=step1
|
||||
|
||||
Reference in New Issue
Block a user