mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
Moved the verify logic to NBCli
This commit is contained in:
parent
7656b2518d
commit
4c17d22ae3
@ -18,7 +18,9 @@ package io.nosqlbench.engine.cli;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapters.api.activityconfig.rawyaml.RawOpsLoader;
|
||||
import io.nosqlbench.engine.cmdstream.Cmd;
|
||||
import io.nosqlbench.engine.cmdstream.CmdType;
|
||||
import io.nosqlbench.nb.api.annotations.Annotation;
|
||||
import io.nosqlbench.nb.api.annotations.Layer;
|
||||
@ -218,6 +220,19 @@ public class NBCLI implements Function<String[], Integer>, NBLabeledElement {
|
||||
}
|
||||
|
||||
final NBCLIOptions options = new NBCLIOptions(args, Mode.ParseAllOptions);
|
||||
|
||||
for (Cmd cmd : options.getCommands()) {
|
||||
Map<String, String> cmdArgMap = cmd.getArgMap();
|
||||
if (cmdArgMap.containsKey("driver")) {
|
||||
String driverName = cmdArgMap.get("driver");
|
||||
Optional<? extends DriverAdapterLoader> driverAdapter =
|
||||
ServiceSelector.of(driverName, ServiceLoader.load(DriverAdapterLoader.class)).get();
|
||||
if (driverAdapter.isEmpty()) {
|
||||
throw new BasicError("Unable to load default driver adapter '" + driverName + '\'');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NBCLI.logger = LogManager.getLogger("NBCLI");
|
||||
|
||||
NBIO.addGlobalIncludes(options.wantsIncludes());
|
||||
|
@ -73,13 +73,6 @@ public class CmdParser {
|
||||
cmdstructs.removeFirst();
|
||||
Map<String,CmdArg> params = new LinkedHashMap<>();
|
||||
while (cmdstructs.peekFirst() instanceof parameter param) {
|
||||
if (Objects.equals(param.name(), "driver")) {
|
||||
Optional<? extends DriverAdapterLoader> driverAdapter =
|
||||
ServiceSelector.of(param.value(), ServiceLoader.load(DriverAdapterLoader.class)).get();
|
||||
if (driverAdapter.isEmpty()) {
|
||||
throw new BasicError("Unable to load default driver adapter '" + param.value() + '\'');
|
||||
}
|
||||
}
|
||||
cmdstructs.removeFirst();
|
||||
if (params.containsKey(param.name())) {
|
||||
throw new BasicError("Duplicate occurrence of option: " + param.name());
|
||||
|
Loading…
Reference in New Issue
Block a user