From bed307049568278d8402507af65af4efe4da65b0 Mon Sep 17 00:00:00 2001 From: Jonathan Shook Date: Fri, 6 Oct 2023 18:40:05 -0500 Subject: [PATCH] fixed empty runScenario method and made it final --- .../scenario/context/NBSceneBuffer.java | 8 ++--- .../scenario/direct/NBBaseScenario.java | 34 ------------------- .../scenario/execution/ScenarioResult.java | 17 ++++++++++ .../examples/injava/SC_activity_error.java | 17 +--------- 4 files changed, 22 insertions(+), 54 deletions(-) delete mode 100644 engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/direct/NBBaseScenario.java diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/context/NBSceneBuffer.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/context/NBSceneBuffer.java index cb0a718a7..92889db5c 100644 --- a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/context/NBSceneBuffer.java +++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/context/NBSceneBuffer.java @@ -94,8 +94,8 @@ public class NBSceneBuffer implements NBSceneFixtures { return (NBSceneFixtures) this; } -// public static NBSceneBuffer init(String name) { -// TestComponent root = new TestComponent("scene", "self"); -// return new NBSceneBuffer(NBDefaultSceneFixtures.ofDefault(name)); -// } + public static NBSceneBuffer init(String name) { + TestComponent root = new TestComponent("scene", "self"); + return new NBSceneBuffer(NBDefaultSceneFixtures.ofDefault(name)); + } } diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/direct/NBBaseScenario.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/direct/NBBaseScenario.java deleted file mode 100644 index 4e4aa558a..000000000 --- a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/direct/NBBaseScenario.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2023 nosqlbench - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.nosqlbench.engine.core.lifecycle.scenario.direct; - -import io.nosqlbench.components.NBComponent; -import io.nosqlbench.engine.core.lifecycle.scenario.context.NBSceneFixtures; -import io.nosqlbench.engine.core.lifecycle.scenario.execution.NBScenario; - -import java.util.Map; - -public abstract class NBBaseScenario extends NBScenario { - - public NBBaseScenario(NBComponent parentComponent, String scenarioName, Map params, String progressInterval) { - super(parentComponent, scenarioName); - } - - @Override - protected void runScenario(NBSceneFixtures sctx) { - } -} diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/execution/ScenarioResult.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/execution/ScenarioResult.java index 8ff7038b5..ecf44549d 100644 --- a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/execution/ScenarioResult.java +++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/execution/ScenarioResult.java @@ -54,4 +54,21 @@ public class ScenarioResult { public String getIOLog() { return fixtures.getIOLog(); } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ScenarioResult [") + .append(this.endedAt - this.startedAt) + .append("ms]"); + if (exception==null) { + sb.append(" OK "); + } else { + sb.append(" ERROR ").append(exception); + } + String iolog = getIOLog(); + if (!iolog.isEmpty()) { + sb.append(" IO{\n").append("}\n").append(iolog); + } + return sb.toString(); + } } diff --git a/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/injava/SC_activity_error.java b/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/injava/SC_activity_error.java index 8bfa405fa..dca852d0d 100644 --- a/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/injava/SC_activity_error.java +++ b/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/injava/SC_activity_error.java @@ -27,21 +27,6 @@ public class SC_activity_error extends SCBaseScenario { super(parentComponent, scenarioName); } - @Override - protected void runScenario(NBSceneFixtures shell) { - -// HdrHistoLogPluginData hdrHistoLogPluginData = new HdrHistoLogPluginData(); -// HdrHistoLogPlugin histologplugin = hdrHistoLogPluginData.getExtensionObject(...); -// histologplugin.logHistoIntervals(...); - -// HdrHistoLogPlugin logplugin = shell.extensions().get("histologger",HdrHistoLogPlugin.class); - -// var serviceojbect = extensions.get("histologger"); - -// AttachedMetricsSummaryReporter reporter = shell.runtime().create().summaryReporter(5, "labelname", "labelvalue"); - - } - /** * Equivalent to javascript form: *
{@code
@@ -73,7 +58,7 @@ public class SC_activity_error extends SCBaseScenario {
         );
         stdout.write("starting activity activity_error");
         controller.start(activitydef1);
-        controller.waitMillis(2000);
+        controller.waitMillis(500);
         controller.getActivityDef("activity_error").getParams().set("threads","unparsable"); // forced error
         controller.awaitActivity("activity_error", Long.MAX_VALUE);
     }