diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/ActivityExceptionHandler.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/activity/ActivityExceptionHandler.java
similarity index 87%
rename from engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/ActivityExceptionHandler.java
rename to engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/activity/ActivityExceptionHandler.java
index b088829f3..751c26cbf 100644
--- a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/ActivityExceptionHandler.java
+++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/activity/ActivityExceptionHandler.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.nosqlbench.engine.core.lifecycle;
+package io.nosqlbench.engine.core.lifecycle.activity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -23,9 +23,9 @@ public class ActivityExceptionHandler implements Thread.UncaughtExceptionHandler
private static final Logger logger = LogManager.getLogger(ActivityExceptionHandler.class);
- private final ActivityThreadsManager executor;
+ private final ActivityExecutor executor;
- public ActivityExceptionHandler(ActivityThreadsManager executor) {
+ public ActivityExceptionHandler(ActivityExecutor executor) {
this.executor = executor;
logger.debug(() -> "Activity exception handler starting up for executor '" + executor + "'");
}
@@ -33,7 +33,7 @@ public class ActivityExceptionHandler implements Thread.UncaughtExceptionHandler
@Override
public void uncaughtException(Thread t, Throwable e) {
- logger.error("Uncaught exception in thread '" + t.getName() + ", state[" + t.getState() + "], notifying executor '" + executor + "'");
+ logger.error("Uncaught exception in thread '" + t.getName() + ", state[" + t.getState() + "], notifying executor '" + executor + "': " + e);
executor.notifyException(t, e);
}
}
diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenarioController.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenarioController.java
index d7ab41ca1..bef6a8c2e 100644
--- a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenarioController.java
+++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenarioController.java
@@ -124,10 +124,10 @@ public class ScenarioController {
/**
* Synchronously run the defined activity with a timeout in seconds.
*
- * @param timeout seconds to await completion of the activity.
+ * @param timeoutMs seconds to await completion of the activity.
* @param activityDef A definition for an activity to run
*/
- public synchronized void run(int timeout, ActivityDef activityDef) {
+ public synchronized void run(ActivityDef activityDef, long timeoutMs) {
Annotators.recordAnnotation(Annotation.newBuilder()
.session(sessionId)
.now()
@@ -143,7 +143,7 @@ public class ScenarioController {
public synchronized void run(int timeout, String activityDefString) {
ActivityDef activityDef = ActivityDef.parseActivityDef(activityDefString);
- run(timeout, activityDef);
+ run(activityDef, timeout);
}
public synchronized void run(Map activityDefMap) {
@@ -156,7 +156,7 @@ public class ScenarioController {
public synchronized void run(ActivityDef activityDef) {
- run(Integer.MAX_VALUE, activityDef);
+ run(activityDef, Long.MAX_VALUE);
}
diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenariosExecutor.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenariosExecutor.java
index 8c45134b1..b644b84d1 100644
--- a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenariosExecutor.java
+++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenariosExecutor.java
@@ -52,7 +52,7 @@ public class ScenariosExecutor {
if (submitted.get(scenario.getScenarioName()) != null) {
throw new BasicError("Scenario " + scenario.getScenarioName() + " is already defined. Remove it first to reuse the name.");
}
- Future future = executor.submit(scenario);
+ Future future = executor.submit(scenario);
SubmittedScenario s = new SubmittedScenario(scenario, future);
submitted.put(s.getName(), s);
}
@@ -108,7 +108,7 @@ public class ScenariosExecutor {
throw new RuntimeException("executor still runningScenarios after awaiting all results for " + timeout
+ "ms. isTerminated:" + executor.isTerminated() + " isShutdown:" + executor.isShutdown());
}
- Map scenarioResultMap = new LinkedHashMap<>();
+ Map scenarioResultMap = new LinkedHashMap<>();
getAsyncResultStatus()
.entrySet()
.forEach(
@@ -135,26 +135,26 @@ public class ScenariosExecutor {
* All submitted scenarios are included. Those which are still pending
* are returned with an empty option.
*
- * Results may be exceptional. If {@link ExecMetricsResult#getException()} is present,
+ *
Results may be exceptional. If {@link ExecutionMetricsResult#getException()} is present,
* then the result did not complete normally.
*
* @return map of async results, with incomplete results as Optional.empty()
*/
- public Map> getAsyncResultStatus() {
+ public Map> getAsyncResultStatus() {
- Map> optResults = new LinkedHashMap<>();
+ Map> optResults = new LinkedHashMap<>();
for (SubmittedScenario submittedScenario : submitted.values()) {
- Future resultFuture = submittedScenario.getResultFuture();
+ Future resultFuture = submittedScenario.getResultFuture();
- Optional oResult = Optional.empty();
+ Optional oResult = Optional.empty();
if (resultFuture.isDone()) {
try {
oResult = Optional.of(resultFuture.get());
} catch (Exception e) {
long now = System.currentTimeMillis();
logger.debug("creating exceptional scenario result from getAsyncResultStatus");
- oResult = Optional.of(new ExecMetricsResult(now, now, "errored output", e));
+ oResult = Optional.of(new ExecutionMetricsResult(now, now, "errored output", e));
}
}
@@ -181,7 +181,7 @@ public class ScenariosExecutor {
* @param scenarioName the scenario name of interest
* @return an optional result
*/
- public Optional> getPendingResult(String scenarioName) {
+ public Optional> getPendingResult(String scenarioName) {
return Optional.ofNullable(submitted.get(scenarioName)).map(s -> s.resultFuture);
}
@@ -226,9 +226,9 @@ public class ScenariosExecutor {
private static class SubmittedScenario {
private final Scenario scenario;
- private final Future resultFuture;
+ private final Future resultFuture;
- SubmittedScenario(Scenario scenario, Future resultFuture) {
+ SubmittedScenario(Scenario scenario, Future resultFuture) {
this.scenario = scenario;
this.resultFuture = resultFuture;
}
@@ -237,7 +237,7 @@ public class ScenariosExecutor {
return scenario;
}
- Future getResultFuture() {
+ Future getResultFuture() {
return resultFuture;
}
diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenariosResults.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenariosResults.java
index 2d916e851..2cd5e763b 100644
--- a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenariosResults.java
+++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/ScenariosResults.java
@@ -27,14 +27,14 @@ public class ScenariosResults {
private static final Logger logger = LogManager.getLogger(ScenariosResults.class);
private final String scenariosExecutorName;
- private final Map scenarioResultMap = new LinkedHashMap<>();
+ private final Map scenarioResultMap = new LinkedHashMap<>();
public ScenariosResults(ScenariosExecutor scenariosExecutor) {
this.scenariosExecutorName = scenariosExecutor.getName();
}
- public ScenariosResults(ScenariosExecutor scenariosExecutor, Map map) {
+ public ScenariosResults(ScenariosExecutor scenariosExecutor, Map map) {
this.scenariosExecutorName = scenariosExecutor.getName();
scenarioResultMap.putAll(map);
}
@@ -46,7 +46,7 @@ public class ScenariosResults {
return sb;
}
- public ExecMetricsResult getOne() {
+ public ExecutionMetricsResult getOne() {
if (this.scenarioResultMap.size() != 1) {
throw new RuntimeException("getOne found " + this.scenarioResultMap.size() + " results instead of 1.");
}
@@ -55,9 +55,9 @@ public class ScenariosResults {
}
public void reportToLog() {
- for (Map.Entry entry : this.scenarioResultMap.entrySet()) {
+ for (Map.Entry entry : this.scenarioResultMap.entrySet()) {
Scenario scenario = entry.getKey();
- ExecMetricsResult oresult = entry.getValue();
+ ExecutionMetricsResult oresult = entry.getValue();
logger.info("results for scenario: " + scenario);
diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/script/NashornActivityBindings.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/script/bindings/ActivityBindings.java
similarity index 93%
rename from engine-core/src/main/java/io/nosqlbench/engine/core/script/NashornActivityBindings.java
rename to engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/script/bindings/ActivityBindings.java
index d069f594e..3b7b9c581 100644
--- a/engine-core/src/main/java/io/nosqlbench/engine/core/script/NashornActivityBindings.java
+++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/script/bindings/ActivityBindings.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.nosqlbench.engine.core.script;
+package io.nosqlbench.engine.core.lifecycle.scenario.script.bindings;
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
-import io.nosqlbench.engine.core.lifecycle.ScenarioController;
+import io.nosqlbench.engine.core.lifecycle.scenario.ScenarioController;
import org.graalvm.polyglot.Value;
import org.graalvm.polyglot.proxy.ProxyObject;
@@ -27,12 +27,12 @@ import java.util.stream.Collectors;
/**
* Provide a bindings wrapper around a ScenarioController,
*/
-public class NashornActivityBindings implements Bindings, ProxyObject {
+public class ActivityBindings implements Bindings, ProxyObject {
private final ScenarioController scenario;
private final Map elementMap = new HashMap();
- public NashornActivityBindings(ScenarioController scenarioController) {
+ public ActivityBindings(ScenarioController scenarioController) {
this.scenario = scenarioController;
}
diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/script/bindings/PolyglotScenarioController.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/script/bindings/PolyglotScenarioController.java
index b1c9ef12d..8d2504724 100644
--- a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/script/bindings/PolyglotScenarioController.java
+++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/scenario/script/bindings/PolyglotScenarioController.java
@@ -81,7 +81,7 @@ public class PolyglotScenarioController {
private synchronized void runValue(int timeout, Value spec) {
logger.debug("run(Value) called with:" + spec);
if (spec.isHostObject()) {
- controller.run(timeout, (ActivityDef) spec.asHostObject());
+ controller.run(spec.asHostObject(),timeout);
} else if (spec.isString()) {
controller.run(timeout, spec.asString());
} else if (spec.hasMembers()) {
@@ -89,7 +89,7 @@ public class PolyglotScenarioController {
} else if (spec.isHostObject()) {
Object o = spec.asHostObject();
if (o instanceof ActivityDef) {
- controller.run(timeout, (ActivityDef) o);
+ controller.run((ActivityDef) o, timeout);
} else {
throw new RuntimeException("unrecognized polyglot host object type for run: " + spec);
}
@@ -165,7 +165,7 @@ public class PolyglotScenarioController {
private synchronized void awaitValue(Value spec) {
if (spec.isHostObject()) {
- controller.await((ActivityDef) spec.asHostObject());
+ controller.await(spec.asHostObject(), Long.MAX_VALUE);
} else if (spec.hasMembers()) {
controller.await(spec.as(Map.class));
} else if (spec.isString()) {
diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/metadata/MarkdownDocInfo.java b/engine-core/src/main/java/io/nosqlbench/engine/core/metadata/MarkdownFinder.java
similarity index 89%
rename from engine-core/src/main/java/io/nosqlbench/engine/core/metadata/MarkdownDocInfo.java
rename to engine-core/src/main/java/io/nosqlbench/engine/core/metadata/MarkdownFinder.java
index 45dd25263..26f719f79 100644
--- a/engine-core/src/main/java/io/nosqlbench/engine/core/metadata/MarkdownDocInfo.java
+++ b/engine-core/src/main/java/io/nosqlbench/engine/core/metadata/MarkdownFinder.java
@@ -18,7 +18,7 @@ package io.nosqlbench.engine.core.metadata;
import io.nosqlbench.engine.api.activityapi.core.ActivityType;
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
-import io.nosqlbench.engine.core.lifecycle.ActivityTypeLoader;
+import io.nosqlbench.engine.core.lifecycle.activity.ActivityTypeLoader;
import io.nosqlbench.nb.annotations.Service;
import io.nosqlbench.api.content.Content;
import io.nosqlbench.api.content.NBIO;
@@ -28,20 +28,20 @@ import org.apache.logging.log4j.Logger;
import java.util.Optional;
-public class MarkdownDocInfo {
- private final static Logger logger = LogManager.getLogger(MarkdownDocInfo.class);
+public class MarkdownFinder {
+ private final static Logger logger = LogManager.getLogger(MarkdownFinder.class);
public static Optional forHelpTopic(String topic) {
String help = null;
try {
- help = new MarkdownDocInfo().forActivityInstance(topic);
+ help = new MarkdownFinder().forActivityInstance(topic);
return Optional.ofNullable(help);
} catch (Exception e) {
logger.debug("Did not find help topic for activity instance: " + topic);
}
try {
- help = new MarkdownDocInfo().forResourceMarkdown(topic, "docs/");
+ help = new MarkdownFinder().forResourceMarkdown(topic, "docs/");
return Optional.ofNullable(help);
} catch (Exception e) {
logger.debug("Did not find help topic for generic markdown file: " + topic + "(.md)");
diff --git a/engine-core/src/test/java/io/nosqlbench/engine/core/script/ScriptParamsTest.java b/engine-core/src/test/java/io/nosqlbench/engine/core/script/ScriptParamsTest.java
index ee5da9aa9..1778689b4 100644
--- a/engine-core/src/test/java/io/nosqlbench/engine/core/script/ScriptParamsTest.java
+++ b/engine-core/src/test/java/io/nosqlbench/engine/core/script/ScriptParamsTest.java
@@ -17,12 +17,12 @@
package io.nosqlbench.engine.core.script;
import io.nosqlbench.api.errors.BasicError;
+import io.nosqlbench.engine.core.lifecycle.scenario.script.ScriptParams;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
-import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class ScriptParamsTest {
diff --git a/engine-rest/src/main/java/io/nosqlbench/engine/rest/resources/ScenarioExecutorEndpoint.java b/engine-rest/src/main/java/io/nosqlbench/engine/rest/resources/ScenarioExecutorEndpoint.java
index 561354767..ba1e4b132 100644
--- a/engine-rest/src/main/java/io/nosqlbench/engine/rest/resources/ScenarioExecutorEndpoint.java
+++ b/engine-rest/src/main/java/io/nosqlbench/engine/rest/resources/ScenarioExecutorEndpoint.java
@@ -234,8 +234,8 @@ public class ScenarioExecutorEndpoint implements WebServiceObject {
Optional pendingScenario = executor.getPendingScenario(scenarioName);
if (pendingScenario.isPresent()) {
- Optional> pendingResult = executor.getPendingResult(scenarioName);
- Future scenarioResultFuture = pendingResult.get();
+ Optional> pendingResult = executor.getPendingResult(scenarioName);
+ Future scenarioResultFuture = pendingResult.get();
return new LiveScenarioView(pendingScenario.get());
} else {
throw new RuntimeException("Scenario name '" + scenarioName + "' not found.");
diff --git a/engine-rest/src/main/java/io/nosqlbench/engine/rest/transfertypes/ResultView.java b/engine-rest/src/main/java/io/nosqlbench/engine/rest/transfertypes/ResultView.java
index e84da8113..9bf85980f 100644
--- a/engine-rest/src/main/java/io/nosqlbench/engine/rest/transfertypes/ResultView.java
+++ b/engine-rest/src/main/java/io/nosqlbench/engine/rest/transfertypes/ResultView.java
@@ -16,18 +16,18 @@
package io.nosqlbench.engine.rest.transfertypes;
-import io.nosqlbench.engine.core.lifecycle.ExecMetricsResult;
+import io.nosqlbench.engine.core.lifecycle.ExecutionMetricsResult;
public class ResultView {
- private final ExecMetricsResult result;
+ private final ExecutionMetricsResult result;
- public ResultView(ExecMetricsResult result) {
+ public ResultView(ExecutionMetricsResult result) {
this.result = result;
}
public String getIOLog() {
- if (result!=null) {
+ if (result != null) {
return result.getIOLog();
} else {
return "";
@@ -35,8 +35,8 @@ public class ResultView {
}
public String getError() {
- if (result!=null && result.getException().isPresent()) {
- return result.getException().get().getMessage();
+ if (result != null && result.getException()!=null) {
+ return result.getException().getMessage();
}
return "";
}
diff --git a/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/ScriptExampleTests.java b/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/ScriptExampleTests.java
index a84a712b2..28988115e 100644
--- a/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/ScriptExampleTests.java
+++ b/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/ScriptExampleTests.java
@@ -16,10 +16,10 @@
package io.nosqlbench.nbr.examples;
-import io.nosqlbench.engine.core.lifecycle.ExecMetricsResult;
-import io.nosqlbench.engine.core.lifecycle.ScenariosResults;
-import io.nosqlbench.engine.core.script.Scenario;
-import io.nosqlbench.engine.core.script.ScenariosExecutor;
+import io.nosqlbench.engine.core.lifecycle.ExecutionMetricsResult;
+import io.nosqlbench.engine.core.lifecycle.scenario.ScenariosResults;
+import io.nosqlbench.engine.core.lifecycle.scenario.Scenario;
+import io.nosqlbench.engine.core.lifecycle.scenario.ScenariosExecutor;
import io.nosqlbench.nb.annotations.Maturity;
import org.apache.commons.compress.utils.IOUtils;
import org.assertj.core.data.Offset;
@@ -41,7 +41,7 @@ import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
public class ScriptExampleTests {
- public static ExecMetricsResult runScenario(String scriptname, String... params) {
+ public static ExecutionMetricsResult runScenario(String scriptname, String... params) {
if ((params.length % 2) != 0) {
throw new RuntimeException("params must be pairwise key, value, ...");
}
@@ -74,7 +74,7 @@ public class ScriptExampleTests {
// s.addScriptText("load('classpath:scripts/async/" + scriptname + ".js');");
executor.execute(s);
ScenariosResults scenariosResults = executor.awaitAllResults();
- ExecMetricsResult scenarioResult = scenariosResults.getOne();
+ ExecutionMetricsResult scenarioResult = scenariosResults.getOne();
executor.shutdownNow();
return scenarioResult;
}
@@ -86,7 +86,7 @@ public class ScriptExampleTests {
@Test
public void testLinkedInput() {
- ExecMetricsResult scenarioResult = runScenario("linkedinput");
+ ExecutionMetricsResult scenarioResult = runScenario("linkedinput");
Pattern p = Pattern.compile(".*started leader.*started follower.*stopped leader.*stopped follower.*",
Pattern.DOTALL);
assertThat(p.matcher(scenarioResult.getIOLog()).matches()).isTrue();
@@ -94,14 +94,14 @@ public class ScriptExampleTests {
@Test
public void testExceptionPropagationFromMotorThread() {
- ExecMetricsResult scenarioResult = runScenario("activityerror");
- assertThat(scenarioResult.getException()).isPresent();
- assertThat(scenarioResult.getException().get().getMessage()).contains("For input string: \"unparsable\"");
+ ExecutionMetricsResult scenarioResult = runScenario("activityerror");
+ assertThat(scenarioResult.getException()).isNotNull();
+ assertThat(scenarioResult.getException().getMessage()).contains("For input string: \"unparsable\"");
}
@Test
public void testCycleRate() {
- ExecMetricsResult scenarioResult = runScenario("cycle_rate");
+ ExecutionMetricsResult scenarioResult = runScenario("cycle_rate");
String iolog = scenarioResult.getIOLog();
System.out.println("iolog\n" + iolog);
Pattern p = Pattern.compile(".*mean cycle rate = (\\d[.\\d]+).*", Pattern.DOTALL);
@@ -116,13 +116,13 @@ public class ScriptExampleTests {
@Test
public void testExtensionPoint() {
- ExecMetricsResult scenarioResult = runScenario("extensions");
+ ExecutionMetricsResult scenarioResult = runScenario("extensions");
assertThat(scenarioResult.getIOLog()).contains("sum is 46");
}
@Test
public void testOptimo() {
- ExecMetricsResult scenarioResult = runScenario("optimo");
+ ExecutionMetricsResult scenarioResult = runScenario("optimo");
String iolog = scenarioResult.getIOLog();
System.out.println("iolog\n" + iolog);
assertThat(iolog).contains("map of result was");
@@ -130,14 +130,14 @@ public class ScriptExampleTests {
@Test
public void testExtensionCsvLogger() {
- ExecMetricsResult scenarioResult = runScenario("extension_csvmetrics");
+ ExecutionMetricsResult scenarioResult = runScenario("extension_csvmetrics");
assertThat(scenarioResult.getIOLog()).contains("started new " +
"csvlogger: logs/csvmetricstestdir");
}
@Test
public void testScriptParamsVariable() {
- ExecMetricsResult scenarioResult = runScenario("params_variable", "one", "two", "three", "four");
+ ExecutionMetricsResult scenarioResult = runScenario("params_variable", "one", "two", "three", "four");
assertThat(scenarioResult.getIOLog()).contains("params[\"one\"]='two'");
assertThat(scenarioResult.getIOLog()).contains("params[\"three\"]='four'");
assertThat(scenarioResult.getIOLog()).contains("overridden[\"three\"] [overridden-three-five]='five'");
@@ -146,7 +146,7 @@ public class ScriptExampleTests {
@Test
public void testScriptParamsUndefVariableWithOverride() {
- ExecMetricsResult scenarioResult = runScenario("undef_param", "one", "two", "three", "four");
+ ExecutionMetricsResult scenarioResult = runScenario("undef_param", "one", "two", "three", "four");
assertThat(scenarioResult.getIOLog()).contains("before: params[\"three\"]:four");
assertThat(scenarioResult.getIOLog()).contains("before: params.three:four");
assertThat(scenarioResult.getIOLog()).contains("after: params[\"three\"]:undefined");
@@ -155,7 +155,7 @@ public class ScriptExampleTests {
@Test
public void testExtensionHistoStatsLogger() throws IOException {
- ExecMetricsResult scenarioResult = runScenario("extension_histostatslogger");
+ ExecutionMetricsResult scenarioResult = runScenario("extension_histostatslogger");
assertThat(scenarioResult.getIOLog()).contains("stdout started " +
"logging to logs/histostats.csv");
List strings = Files.readAllLines(Paths.get(
@@ -167,7 +167,7 @@ public class ScriptExampleTests {
@Test
public void testExtensionCsvOutput() throws IOException {
- ExecMetricsResult scenarioResult = runScenario("extension_csvoutput");
+ ExecutionMetricsResult scenarioResult = runScenario("extension_csvoutput");
List strings = Files.readAllLines(Paths.get(
"logs/csvoutputtestfile.csv"));
String logdata = strings.stream().collect(Collectors.joining("\n"));
@@ -177,7 +177,7 @@ public class ScriptExampleTests {
@Test
public void testExtensionHistogramLogger() throws IOException {
- ExecMetricsResult scenarioResult = runScenario("extension_histologger");
+ ExecutionMetricsResult scenarioResult = runScenario("extension_histologger");
assertThat(scenarioResult.getIOLog()).contains("stdout started logging to hdrhistodata.log");
List strings = Files.readAllLines(Paths.get("hdrhistodata.log"));
String logdata = strings.stream().collect(Collectors.joining("\n"));
@@ -187,7 +187,7 @@ public class ScriptExampleTests {
@Test
public void testBlockingRun() {
- ExecMetricsResult scenarioResult = runScenario("blockingrun");
+ ExecutionMetricsResult scenarioResult = runScenario("blockingrun");
int a1end = scenarioResult.getIOLog().indexOf("blockingactivity1 finished");
int a2start = scenarioResult.getIOLog().indexOf("running blockingactivity2");
assertThat(a1end).isLessThan(a2start);
@@ -195,12 +195,12 @@ public class ScriptExampleTests {
@Test
public void testAwaitFinished() {
- ExecMetricsResult scenarioResult = runScenario("awaitfinished");
+ ExecutionMetricsResult scenarioResult = runScenario("awaitfinished");
}
@Test
public void testStartStop() {
- ExecMetricsResult scenarioResult = runScenario("startstopdiag");
+ ExecutionMetricsResult scenarioResult = runScenario("startstopdiag");
int startedAt = scenarioResult.getIOLog().indexOf("starting activity teststartstopdiag");
int stoppedAt = scenarioResult.getIOLog().indexOf("stopped activity teststartstopdiag");
assertThat(startedAt).isGreaterThan(0);
@@ -210,7 +210,7 @@ public class ScriptExampleTests {
// TODO: find out why this causes a long delay after stop is called.
@Test
public void testThreadChange() {
- ExecMetricsResult scenarioResult = runScenario("threadchange");
+ ExecutionMetricsResult scenarioResult = runScenario("threadchange");
int changedTo1At = scenarioResult.getIOLog().indexOf("threads now 1");
int changedTo5At = scenarioResult.getIOLog().indexOf("threads now 5");
System.out.println("IOLOG:\n"+scenarioResult.getIOLog());
@@ -220,13 +220,13 @@ public class ScriptExampleTests {
@Test
public void testReadMetric() {
- ExecMetricsResult scenarioResult = runScenario("readmetrics");
+ ExecutionMetricsResult scenarioResult = runScenario("readmetrics");
assertThat(scenarioResult.getIOLog()).contains("count: ");
}
@Test
public void testShutdownHook() {
- ExecMetricsResult scenarioResult = runScenario("extension_shutdown_hook");
+ ExecutionMetricsResult scenarioResult = runScenario("extension_shutdown_hook");
assertThat(scenarioResult.getIOLog()).doesNotContain("shutdown hook running").describedAs(
"shutdown hooks should not run in the same IO context as the main scenario"
);
@@ -234,15 +234,15 @@ public class ScriptExampleTests {
@Test
public void testExceptionPropagationFromActivityInit() {
- ExecMetricsResult scenarioResult = runScenario("activityiniterror");
- assertThat(scenarioResult.getException()).isPresent();
- assertThat(scenarioResult.getException().get().getMessage()).contains("Unable to convert end cycle from invalid");
+ ExecutionMetricsResult scenarioResult = runScenario("activityiniterror");
+ assertThat(scenarioResult.getException()).isNotNull();
+ assertThat(scenarioResult.getException().getMessage()).contains("Unable to convert end cycle from invalid");
assertThat(scenarioResult.getException()).isNotNull();
}
@Test
public void testReportedCoDelayBursty() {
- ExecMetricsResult scenarioResult = runScenario("cocycledelay_bursty");
+ ExecutionMetricsResult scenarioResult = runScenario("cocycledelay_bursty");
assertThat(scenarioResult.getIOLog()).contains("step1 metrics.waittime=");
assertThat(scenarioResult.getIOLog()).contains("step2 metrics.waittime=");
String iolog = scenarioResult.getIOLog();
@@ -252,7 +252,7 @@ public class ScriptExampleTests {
@Test
public void testReportedCoDelayStrict() {
- ExecMetricsResult scenarioResult = runScenario("cocycledelay_strict");
+ ExecutionMetricsResult scenarioResult = runScenario("cocycledelay_strict");
assertThat(scenarioResult.getIOLog()).contains("step1 cycles.waittime=");
assertThat(scenarioResult.getIOLog()).contains("step2 cycles.waittime=");
String iolog = scenarioResult.getIOLog();
@@ -263,14 +263,14 @@ public class ScriptExampleTests {
@Test
public void testCycleRateChangeNewMetrics() {
- ExecMetricsResult scenarioResult = runScenario("cycle_rate_change");
+ ExecutionMetricsResult scenarioResult = runScenario("cycle_rate_change");
String ioLog = scenarioResult.getIOLog();
assertThat(ioLog).contains("cycles adjusted, exiting on iteration");
}
@Test
public void testExitLogic() {
- ExecMetricsResult scenarioResult = runScenario(
+ ExecutionMetricsResult scenarioResult = runScenario(
"basicdiag",
"type", "diag", "cyclerate", "5", "erroroncycle", "10", "cycles", "2000"
);
diff --git a/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/SpeedCheckIntegrationTests.java b/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/SpeedCheckIntegrationTests.java
index b750530d6..f4b230c55 100644
--- a/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/SpeedCheckIntegrationTests.java
+++ b/nbr-examples/src/test/java/io/nosqlbench/nbr/examples/SpeedCheckIntegrationTests.java
@@ -15,7 +15,7 @@
*/
package io.nosqlbench.nbr.examples;
-import io.nosqlbench.engine.core.lifecycle.ExecMetricsResult;
+import io.nosqlbench.engine.core.lifecycle.ExecutionMetricsResult;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@@ -30,14 +30,14 @@ public class SpeedCheckIntegrationTests {
@Disabled
// Verified as working
public void testSpeedSanity() {
- ExecMetricsResult scenarioResult = ScriptExampleTests.runScenario("speedcheck");
+ ExecutionMetricsResult scenarioResult = ScriptExampleTests.runScenario("speedcheck");
}
@Test
@Disabled
// This seems incomplete
public void testThreadSpeeds() {
- ExecMetricsResult scenarioResult = ScriptExampleTests.runScenario("threadspeeds");
+ ExecutionMetricsResult scenarioResult = ScriptExampleTests.runScenario("threadspeeds");
}