diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/CMD_error.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/CMD_error.java new file mode 100644 index 000000000..a352f1e3c --- /dev/null +++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/CMD_error.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 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.commands.fortesting; + +import io.nosqlbench.engine.core.lifecycle.scenario.container.ContainerActivitiesController; +import io.nosqlbench.engine.core.lifecycle.scenario.container.NBBufferedContainer; +import io.nosqlbench.engine.core.lifecycle.scenario.container.NBCommandParams; +import io.nosqlbench.engine.core.lifecycle.scenario.execution.NBBaseCommand; + +import java.io.PrintWriter; +import java.io.Reader; + +public class CMD_error extends NBBaseCommand { + + + public CMD_error(NBBufferedContainer parentComponent, String stepName, String targetScenario) { + super(parentComponent, stepName, targetScenario); + } + + @Override + public Object invoke(NBCommandParams params, PrintWriter stdout, PrintWriter stderr, Reader stdin, ContainerActivitiesController controller) { + throw new RuntimeException("Command '" + this + "' throws ERROR."); + } +} diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/CMD_ok.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/CMD_ok.java new file mode 100644 index 000000000..88c8af3bf --- /dev/null +++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/CMD_ok.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 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.commands.fortesting; + +import io.nosqlbench.engine.core.lifecycle.scenario.container.ContainerActivitiesController; +import io.nosqlbench.engine.core.lifecycle.scenario.container.NBBufferedContainer; +import io.nosqlbench.engine.core.lifecycle.scenario.container.NBCommandParams; +import io.nosqlbench.engine.core.lifecycle.scenario.execution.NBBaseCommand; +import io.nosqlbench.engine.core.lifecycle.scenario.execution.NBInvokableCommand; +import io.nosqlbench.nb.api.labels.NBLabels; + +import java.io.PrintWriter; +import java.io.Reader; + +public class CMD_ok extends NBBaseCommand { + + public CMD_ok(NBBufferedContainer parentComponent, String stepName, String targetScenario) { + super(parentComponent, stepName, targetScenario); + } + + @Override + public Object invoke(NBCommandParams params, PrintWriter stdout, PrintWriter stderr, Reader stdin, ContainerActivitiesController controller) { + stdout.write("Command '" + this.toString() + "' says OK and exits with no object or exception."); + for (String pkey : params.keySet()) { + stdout.println("diagnostic 'ok' command setting key '" + pkey + " to " + params.get(pkey)); + } + return params; + } +} diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/INFO_error.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/INFO_error.java new file mode 100644 index 000000000..816f8bfdf --- /dev/null +++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/INFO_error.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024 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.commands.fortesting; + +import io.nosqlbench.engine.core.lifecycle.scenario.execution.NBCommandInfo; +import io.nosqlbench.engine.core.lifecycle.scenario.execution.NBInvokableCommand; +import io.nosqlbench.nb.annotations.Service; + +@Service(value = NBCommandInfo.class,selector = "test_error") +public class INFO_error extends NBCommandInfo { + @Override + public Class getType() { + return CMD_error.class; + } +} diff --git a/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/INFO_test_ok.java b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/INFO_test_ok.java new file mode 100644 index 000000000..4b0079f77 --- /dev/null +++ b/engine-core/src/main/java/io/nosqlbench/engine/core/lifecycle/commands/fortesting/INFO_test_ok.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024 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.commands.fortesting; + +import io.nosqlbench.engine.core.lifecycle.scenario.execution.NBCommandInfo; +import io.nosqlbench.engine.core.lifecycle.scenario.execution.NBInvokableCommand; +import io.nosqlbench.nb.annotations.Service; + +@Service(value = NBCommandInfo.class,selector = "test_ok") +public class INFO_test_ok extends NBCommandInfo { + @Override + public Class getType() { + return CMD_ok.class; + } +}