mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
allow pre-use verification of command availability
This commit is contained in:
@@ -53,5 +53,15 @@ public class NBAutoScriptResolver implements NBInvokableResolver {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verify(Cmd cmd) {
|
||||
return NBIO.local()
|
||||
.searchPrefixes("scripts/auto")
|
||||
.pathname(cmd.getArgValue("_impl"))
|
||||
.extensionSet("js")
|
||||
.first()
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,16 @@ public class NBCoreInvokableResolver implements NBInvokableResolver {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verify(Cmd cmd) {
|
||||
for (NBInvokableResolver resolver : getResolvers().values()) {
|
||||
if (resolver.verify(cmd)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private SequencedMap<String, NBInvokableResolver> getResolvers() {
|
||||
if (this.resolvers == null || this.resolvers.isEmpty()) {
|
||||
SequencedMap<String,NBInvokableResolver> resolverMap = new LinkedHashMap<>();
|
||||
|
||||
@@ -21,6 +21,8 @@ import io.nosqlbench.engine.core.lifecycle.scenario.container.NBBufferedContaine
|
||||
import io.nosqlbench.engine.core.lifecycle.scenario.execution.NBInvokableCommand;
|
||||
|
||||
public interface NBInvokableResolver {
|
||||
NBInvokableCommand resolve(Cmd cmd, NBBufferedContainer parent, String phaseName);
|
||||
NBInvokableCommand resolve(Cmd cmd, NBBufferedContainer parent, String stepname);
|
||||
|
||||
boolean verify(Cmd cmd);
|
||||
|
||||
}
|
||||
|
||||
@@ -37,5 +37,8 @@ public class NBScriptCommandResolver implements NBInvokableResolver {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean verify(Cmd cmd) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user