Search in sources :

Example 1 with StmtsBlock

use of io.nosqlbench.engine.api.activityconfig.yaml.StmtsBlock in project nosqlbench by nosqlbench.

the class OpDefTest method testListOfNamedMap.

@Test
public void testListOfNamedMap() {
    StmtsDocList all = StatementsLoader.loadPath(logger, "testdocs/statement_variants.yaml");
    List<StmtsDoc> docs = all.getStmtDocs();
    StmtsDoc doc2 = docs.get(2);
    assertThat(doc2.getName()).isEqualTo("list-of-named-map");
    assertThat(doc2.getBlocks()).hasSize(1);
    StmtsBlock block1 = doc2.getBlocks().get(0);
    assertThat(block1.getOps()).hasSize(1);
    OpTemplate op0 = block1.getOps().get(0);
    System.out.println(op0.getParams());
    assertThat(op0.getName()).isEqualTo("list-of-named-map--block1--s1");
    assertThat(op0.getOp()).contains(Map.of("p1", "v1", "p2", "v2"));
// System.out.println("here");
// TODO: This needs to be clarified and the logic made less ambiguous
// assertThat(op0.getParams()).hasSize(1);
// assertThat(op0.getParams()).containsExactlyEntriesOf(Map.of("p1", "v2", "p2", "v2", "p3", "v3"));
}
Also used : StmtsDoc(io.nosqlbench.engine.api.activityconfig.yaml.StmtsDoc) OpTemplate(io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate) StmtsBlock(io.nosqlbench.engine.api.activityconfig.yaml.StmtsBlock) StmtsDocList(io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList) Test(org.junit.jupiter.api.Test)

Example 2 with StmtsBlock

use of io.nosqlbench.engine.api.activityconfig.yaml.StmtsBlock in project nosqlbench by nosqlbench.

the class OpDefTest method testLayering.

@Test
public void testLayering() {
    StmtsDocList all = StatementsLoader.loadPath(logger, "testdocs/docs_blocks_stmts.yaml");
    assertThat(all).isNotNull();
    assertThat(all.getStmtDocs()).hasSize(2);
    StmtsDoc doc1 = all.getStmtDocs().get(0);
    assertThat(doc1.getName()).isEqualTo("doc1");
    assertThat(doc1.getBlocks()).hasSize(1);
    StmtsDoc doc2 = all.getStmtDocs().get(1);
    assertThat(doc2.getBlocks()).hasSize(2);
    StmtsBlock block1 = doc1.getBlocks().get(0);
    assertThat(block1.getBindings()).hasSize(2);
    assertThat(block1.getName()).isEqualTo("doc1--block0");
    assertThat(block1.getTags()).hasSize(1);
    StmtsBlock block21 = doc2.getBlocks().get(0);
    StmtsBlock block22 = doc2.getBlocks().get(1);
    assertThat(block21.getName()).isEqualTo("doc2--block1");
    assertThat(block21.getTags()).hasSize(3);
    assertThat(block22.getName()).isEqualTo("doc2--block2");
    assertThat(block22.getTags()).hasSize(2);
    assertThat(block22.getTags().get("root1")).isEqualTo("value23");
}
Also used : StmtsDoc(io.nosqlbench.engine.api.activityconfig.yaml.StmtsDoc) StmtsBlock(io.nosqlbench.engine.api.activityconfig.yaml.StmtsBlock) StmtsDocList(io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList) Test(org.junit.jupiter.api.Test)

Example 3 with StmtsBlock

use of io.nosqlbench.engine.api.activityconfig.yaml.StmtsBlock in project nosqlbench by nosqlbench.

the class OpDefTest method testStatementRendering.

@Test
public void testStatementRendering() {
    StmtsDocList all = StatementsLoader.loadPath(logger, "testdocs/docs_blocks_stmts.yaml");
    assertThat(all).isNotNull();
    assertThat(all.getStmtDocs()).hasSize(2);
    StmtsDoc doc1 = all.getStmtDocs().get(0);
    StmtsBlock block1 = doc1.getBlocks().get(0);
    assertThat(block1.getName()).isEqualTo("doc1--block0");
    List<OpTemplate> ops = block1.getOps();
    assertThat(ops).hasSize(2);
    OpTemplate sdef1 = ops.get(0);
    assertThat(sdef1.getName()).isEqualTo("doc1--block0--stmt1");
    assertThat(ops.get(0).getOp()).contains(Map.of("stmt", "s1"));
}
Also used : StmtsDoc(io.nosqlbench.engine.api.activityconfig.yaml.StmtsDoc) OpTemplate(io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate) StmtsBlock(io.nosqlbench.engine.api.activityconfig.yaml.StmtsBlock) StmtsDocList(io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList) Test(org.junit.jupiter.api.Test)

Example 4 with StmtsBlock

use of io.nosqlbench.engine.api.activityconfig.yaml.StmtsBlock in project nosqlbench by nosqlbench.

the class OpDefTest method testMapOfMaps.

@Test
public void testMapOfMaps() {
    StmtsDocList all = StatementsLoader.loadPath(logger, "testdocs/statement_variants.yaml");
    List<StmtsDoc> docs = all.getStmtDocs();
    StmtsDoc doc0 = docs.get(0);
    assertThat(doc0.getName()).isEqualTo("map-of-maps");
    assertThat(doc0.getBlocks()).hasSize(1);
    StmtsBlock block1 = doc0.getBlocks().get(0);
    assertThat(block1.getName()).isEqualTo("map-of-maps--block0");
    assertThat(block1.getOps()).hasSize(2);
    OpTemplate op0 = block1.getOps().get(0);
    assertThat(op0.getName()).isEqualTo("map-of-maps--block0--s3");
    assertThat(op0.getOp()).contains(Map.of("p1", "v7", "p2", "v8"));
    assertThat(op0.getParams()).hasSize(0);
    assertThat(op0.getParams()).hasSize(0);
    OpTemplate op1 = block1.getOps().get(1);
    assertThat(op1.getParams()).containsAllEntriesOf(Map.of());
    assertThat(op1.getName()).isEqualTo("map-of-maps--block0--s2");
    assertThat(op1.getOp()).contains(Map.of("stmt", "statement2"));
}
Also used : StmtsDoc(io.nosqlbench.engine.api.activityconfig.yaml.StmtsDoc) OpTemplate(io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate) StmtsBlock(io.nosqlbench.engine.api.activityconfig.yaml.StmtsBlock) StmtsDocList(io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList) Test(org.junit.jupiter.api.Test)

Example 5 with StmtsBlock

use of io.nosqlbench.engine.api.activityconfig.yaml.StmtsBlock in project nosqlbench by nosqlbench.

the class OpDefTest method testBasicStringStmt.

@Test
public void testBasicStringStmt() {
    StmtsDocList all = StatementsLoader.loadPath(logger, "testdocs/statement_variants.yaml");
    List<StmtsDoc> docs = all.getStmtDocs();
    StmtsDoc doc1 = docs.get(1);
    assertThat(doc1.getName()).isEqualTo("string-statement");
    assertThat(doc1.getBlocks()).hasSize(1);
    StmtsBlock block1 = doc1.getBlocks().get(0);
    assertThat(block1.getName()).isEqualTo("string-statement--block0");
    assertThat(block1.getOps()).hasSize(1);
    OpTemplate op0 = block1.getOps().get(0);
    assertThat(op0.getName()).isEqualTo("string-statement--block0--stmt1");
    assertThat(op0.getOp()).contains(Map.of("stmt", "test statement"));
}
Also used : StmtsDoc(io.nosqlbench.engine.api.activityconfig.yaml.StmtsDoc) OpTemplate(io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate) StmtsBlock(io.nosqlbench.engine.api.activityconfig.yaml.StmtsBlock) StmtsDocList(io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList) Test(org.junit.jupiter.api.Test)

Aggregations

StmtsBlock (io.nosqlbench.engine.api.activityconfig.yaml.StmtsBlock)5 StmtsDoc (io.nosqlbench.engine.api.activityconfig.yaml.StmtsDoc)5 StmtsDocList (io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList)5 Test (org.junit.jupiter.api.Test)5 OpTemplate (io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate)4