From a667f95e56af5d19f49df57b842f73033b314ce2 Mon Sep 17 00:00:00 2001 From: Jonathan Shook Date: Mon, 24 May 2021 10:48:39 -0500 Subject: [PATCH] incremental updates --- .../resources/workload_definition/README.md | 0 .../workload_definition/rendered_command.md | 0 .../templated_operations.md | 0 .../templated_workloads.md | 0 .../workload_definition/workload_api.md | 0 .../api/activityconfig/rawyaml/TestSet.java | 28 +++++++++++++++++-- .../rawyaml/UniformYamlRawReaderTest.java | 13 +++++---- .../engine/clients/grafana/GrafanaClient.java | 2 +- 8 files changed, 34 insertions(+), 9 deletions(-) rename engine-api/src/{test => main}/resources/workload_definition/README.md (100%) rename engine-api/src/{test => main}/resources/workload_definition/rendered_command.md (100%) rename engine-api/src/{test => main}/resources/workload_definition/templated_operations.md (100%) rename engine-api/src/{test => main}/resources/workload_definition/templated_workloads.md (100%) rename engine-api/src/{test => main}/resources/workload_definition/workload_api.md (100%) diff --git a/engine-api/src/test/resources/workload_definition/README.md b/engine-api/src/main/resources/workload_definition/README.md similarity index 100% rename from engine-api/src/test/resources/workload_definition/README.md rename to engine-api/src/main/resources/workload_definition/README.md diff --git a/engine-api/src/test/resources/workload_definition/rendered_command.md b/engine-api/src/main/resources/workload_definition/rendered_command.md similarity index 100% rename from engine-api/src/test/resources/workload_definition/rendered_command.md rename to engine-api/src/main/resources/workload_definition/rendered_command.md diff --git a/engine-api/src/test/resources/workload_definition/templated_operations.md b/engine-api/src/main/resources/workload_definition/templated_operations.md similarity index 100% rename from engine-api/src/test/resources/workload_definition/templated_operations.md rename to engine-api/src/main/resources/workload_definition/templated_operations.md diff --git a/engine-api/src/test/resources/workload_definition/templated_workloads.md b/engine-api/src/main/resources/workload_definition/templated_workloads.md similarity index 100% rename from engine-api/src/test/resources/workload_definition/templated_workloads.md rename to engine-api/src/main/resources/workload_definition/templated_workloads.md diff --git a/engine-api/src/test/resources/workload_definition/workload_api.md b/engine-api/src/main/resources/workload_definition/workload_api.md similarity index 100% rename from engine-api/src/test/resources/workload_definition/workload_api.md rename to engine-api/src/main/resources/workload_definition/workload_api.md diff --git a/engine-api/src/test/java/io/nosqlbench/engine/api/activityconfig/rawyaml/TestSet.java b/engine-api/src/test/java/io/nosqlbench/engine/api/activityconfig/rawyaml/TestSet.java index ba6f1d924..5351c8022 100644 --- a/engine-api/src/test/java/io/nosqlbench/engine/api/activityconfig/rawyaml/TestSet.java +++ b/engine-api/src/test/java/io/nosqlbench/engine/api/activityconfig/rawyaml/TestSet.java @@ -1,27 +1,51 @@ package io.nosqlbench.engine.api.activityconfig.rawyaml; import com.vladsch.flexmark.ast.FencedCodeBlock; +import com.vladsch.flexmark.util.ast.Node; +import java.nio.file.Path; import java.util.Objects; final class TestSet { private final String desc; + private final Path path; + private final int line; public CharSequence info; public CharSequence text; - public TestSet(String description, CharSequence info, CharSequence text) { + public TestSet(String desc, Node infoNode, Node dataNode, Path path) { + this.desc = desc; + this.info = infoNode.getChars(); + this.text = dataNode.getFirstChild().getChars(); + this.line = dataNode.getFirstChild().getLineNumber(); + this.path = path; + } + + public TestSet(String description, CharSequence info, CharSequence text, Path path, int line) { this.desc = description; this.info = info; this.text = text; + this.path = path; + this.line = line; } - public TestSet(String description, FencedCodeBlock node) { + public TestSet(String description, FencedCodeBlock node, Path path) { this.desc = description; this.info = node.getInfo(); text = Objects.requireNonNull(node.getFirstChild()).getChars(); + this.path = path; + this.line = node.getLineNumber(); } public String getDesc() { return desc; } + + public Path getPath() { + return path; + } + + public int getLine() { + return line; + } } diff --git a/engine-api/src/test/java/io/nosqlbench/engine/api/activityconfig/rawyaml/UniformYamlRawReaderTest.java b/engine-api/src/test/java/io/nosqlbench/engine/api/activityconfig/rawyaml/UniformYamlRawReaderTest.java index 915a5e41a..de50b65df 100644 --- a/engine-api/src/test/java/io/nosqlbench/engine/api/activityconfig/rawyaml/UniformYamlRawReaderTest.java +++ b/engine-api/src/test/java/io/nosqlbench/engine/api/activityconfig/rawyaml/UniformYamlRawReaderTest.java @@ -77,7 +77,7 @@ public class UniformYamlRawReaderTest { LinkedList tests = new LinkedList<>(); - List> yaml = NBIO.fs().prefix("target/test-classes/workload_definition/").name("templated_workloads").extension("md").list(); + List> yaml = NBIO.fs().prefix("target/classes/workload_definition/").name("templated_workloads").extension("md").list(); Pattern emphasis = Pattern.compile("\\*(.*?)\\*\n"); Class fcbclass = FencedCodeBlock.class; @@ -98,14 +98,15 @@ public class UniformYamlRawReaderTest { node = node.getNext(); index=0; } + if (p.test(node)) { List found = p.get(); // System.out.println(summarize(found)); String label = heading + String.format("-%02d", (++index)); testblocks.add(new TestBlock( - new TestSet(label,found.get(0).getChars(),found.get(1).getFirstChild().getChars()), - new TestSet(label,found.get(2).getChars(),found.get(3).getFirstChild().getChars()), - new TestSet(label,found.get(4).getChars(),found.get(5).getFirstChild().getChars()) + new TestSet(label,found.get(0),found.get(1),content.asPath()), + new TestSet(label,found.get(2),found.get(3),content.asPath()), + new TestSet(label,found.get(4),found.get(5),content.asPath()) )); node=found.get(found.size()-1); } @@ -285,12 +286,12 @@ public class UniformYamlRawReaderTest { */ private void validateYamlWithJson(String desc, String yaml, String json) { System.out.format("%-40s","- checking yaml->json"); - List> docmaps = new RawYamlLoader().loadString(logger, yaml); - StmtsDocList stmts = StatementsLoader.loadString(yaml); +// StmtsDocList stmts = StatementsLoader.loadString(yaml); JsonParser parser = new JsonParser(); try { + List> docmaps = new RawYamlLoader().loadString(logger, yaml); JsonElement elem = parser.parse(json); if (elem.isJsonArray()) { Type type = new TypeToken>>() { diff --git a/engine-clients/src/main/java/io/nosqlbench/engine/clients/grafana/GrafanaClient.java b/engine-clients/src/main/java/io/nosqlbench/engine/clients/grafana/GrafanaClient.java index ceb8311f3..b549aa4bd 100644 --- a/engine-clients/src/main/java/io/nosqlbench/engine/clients/grafana/GrafanaClient.java +++ b/engine-clients/src/main/java/io/nosqlbench/engine/clients/grafana/GrafanaClient.java @@ -500,7 +500,7 @@ public class GrafanaClient { try { response = client.send(rq, HttpResponse.BodyHandlers.ofString()); } catch (Exception e) { - if (e.getMessage().contains("WWW-Authenticate header missing")) { + if (e.getMessage()!=null && e.getMessage().contains("WWW-Authenticate header missing")) { throw new RuntimeException("Java HttpClient was not authorized, and it saw no WWW-Authenticate header" + " in the response, so this is probably Grafana telling you that the auth scheme failed. Normally " + "this error would be thrown by Java HttpClient:" + e.getMessage());