naming updates

This commit is contained in:
Jonathan Shook 2020-03-16 13:30:04 -05:00
parent c632f9e3fe
commit ef76201c08
9 changed files with 71 additions and 71 deletions

View File

@ -10,7 +10,7 @@ import io.nosqlbench.activitytype.cql.api.ErrorResponse;
import io.nosqlbench.activitytype.cql.api.ResultSetCycleOperator;
import io.nosqlbench.activitytype.cql.api.RowCycleOperator;
import io.nosqlbench.activitytype.cql.api.StatementFilter;
import io.nosqlbench.activitytype.cql.errorhandling.EbdseCycleErrorHandler;
import io.nosqlbench.activitytype.cql.errorhandling.NBCycleErrorHandler;
import io.nosqlbench.activitytype.cql.errorhandling.HashedCQLErrorHandler;
import io.nosqlbench.activitytype.cql.statements.binders.CqlBinderTypes;
import io.nosqlbench.activitytype.cql.statements.core.*;
@ -505,7 +505,7 @@ public class CqlActivity extends SimpleActivity implements Activity, ActivityDef
if (keyval.length == 1) {
String verb = keyval[0];
newerrorHandler.setDefaultHandler(
new EbdseCycleErrorHandler(
new NBCycleErrorHandler(
ErrorResponse.valueOf(verb),
exceptionCountMetrics,
exceptionHistoMetrics,
@ -516,8 +516,8 @@ public class CqlActivity extends SimpleActivity implements Activity, ActivityDef
String pattern = keyval[0];
String verb = keyval[1];
if (newerrorHandler.getGroupNames().contains(pattern)) {
EbdseCycleErrorHandler handler =
new EbdseCycleErrorHandler(
NBCycleErrorHandler handler =
new NBCycleErrorHandler(
ErrorResponse.valueOf(verb),
exceptionCountMetrics,
exceptionHistoMetrics,
@ -526,7 +526,7 @@ public class CqlActivity extends SimpleActivity implements Activity, ActivityDef
logger.info("Handling error group '" + pattern + "' with handler:" + handler);
newerrorHandler.setHandlerForGroup(pattern, handler);
} else {
EbdseCycleErrorHandler handler = new EbdseCycleErrorHandler(
NBCycleErrorHandler handler = new NBCycleErrorHandler(
ErrorResponse.valueOf(keyval[1]),
exceptionCountMetrics,
exceptionHistoMetrics,

View File

@ -40,16 +40,16 @@ import org.slf4j.LoggerFactory;
* simply a no-op that allows you to specify it as the minimum case.
*/
@SuppressWarnings("Duplicates")
public class EbdseCycleErrorHandler implements CycleErrorHandler<Throwable, ErrorStatus> {
public class NBCycleErrorHandler implements CycleErrorHandler<Throwable, ErrorStatus> {
private static final Logger logger = LoggerFactory.getLogger(EbdseCycleErrorHandler.class);
private static final Logger logger = LoggerFactory.getLogger(NBCycleErrorHandler.class);
private ErrorResponse errorResponse;
private ExceptionCountMetrics exceptionCountMetrics;
private final ExceptionHistoMetrics exceptionHistoMetrics;
private boolean throwExceptionOnStop=false;
public EbdseCycleErrorHandler(
public NBCycleErrorHandler(
ErrorResponse errorResponse,
ExceptionCountMetrics exceptionCountMetrics,
ExceptionHistoMetrics exceptionHistoMetrics,

View File

@ -53,7 +53,7 @@ public class NBCLI {
System.exit(0);
}
EBCLIOptions options = new EBCLIOptions(args);
NBCLIOptions options = new NBCLIOptions(args);
if (options.wantsBasicHelp()) {
System.out.println(loadHelpFile("commandline.md"));
@ -161,13 +161,13 @@ public class NBCLI {
}
}
for (EBCLIOptions.LoggerConfig histoLogger : options.getHistoLoggerConfigs()) {
for (NBCLIOptions.LoggerConfig histoLogger : options.getHistoLoggerConfigs()) {
ActivityMetrics.addHistoLogger(sessionName, histoLogger.pattern, histoLogger.file, histoLogger.interval);
}
for (EBCLIOptions.LoggerConfig statsLogger : options.getStatsLoggerConfigs()) {
for (NBCLIOptions.LoggerConfig statsLogger : options.getStatsLoggerConfigs()) {
ActivityMetrics.addStatsLogger(sessionName, statsLogger.pattern, statsLogger.file, statsLogger.interval);
}
for (EBCLIOptions.LoggerConfig classicConfigs : options.getClassicHistoConfigs()) {
for (NBCLIOptions.LoggerConfig classicConfigs : options.getClassicHistoConfigs()) {
ActivityMetrics.addClassicHistos(sessionName, classicConfigs.pattern, classicConfigs.file, classicConfigs.interval);
}
@ -183,7 +183,7 @@ public class NBCLI {
ScenariosExecutor executor = new ScenariosExecutor("executor-" + sessionName, 1);
Scenario scenario = new Scenario(sessionName, options.getProgressSpec());
EBCLIScriptAssembly.ScriptData scriptData = EBCLIScriptAssembly.assembleScript(options);
NBCLIScriptAssembly.ScriptData scriptData = NBCLIScriptAssembly.assembleScript(options);
if (options.wantsShowScript()) {
System.out.println("// Rendered Script");
System.out.println(scriptData.getScriptParamsAndText());

View File

@ -16,10 +16,10 @@ import java.util.stream.Collectors;
* No CLI parser lib is useful for command structures, it seems. So we have this instead, which is good enough.
* If something better is needed later, this can be replaced.
*/
public class EBCLIOptions {
public class NBCLIOptions {
public static final String docoptFileName = "commandline.md";
private final static Logger logger = LoggerFactory.getLogger(EBCLIOptions.class);
private final static Logger logger = LoggerFactory.getLogger(NBCLIOptions.class);
// Discovery
private static final String HELP = "--help";
@ -108,7 +108,7 @@ public class EBCLIOptions {
private boolean enableChart = false;
private boolean dockerMetrics = false;
public EBCLIOptions(String[] args) {
public NBCLIOptions(String[] args) {
parse(args);
}

View File

@ -11,15 +11,15 @@ import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
public class EBCLIScriptAssembly {
private final static Logger logger = LoggerFactory.getLogger(EBCLIScriptAssembly.class);
public class NBCLIScriptAssembly {
private final static Logger logger = LoggerFactory.getLogger(NBCLIScriptAssembly.class);
public static ScriptData assembleScript(EBCLIOptions options) {
public static ScriptData assembleScript(NBCLIOptions options) {
StringBuilder sb = new StringBuilder();
Map<String,String> params = new HashMap<>();
for (EBCLIOptions.Cmd cmd : options.getCommands()) {
for (NBCLIOptions.Cmd cmd : options.getCommands()) {
String cmdSpec = cmd.getCmdSpec();
EBCLIOptions.CmdType cmdType = cmd.getCmdType();
NBCLIOptions.CmdType cmdType = cmd.getCmdType();
ActivityDef activityDef;
switch (cmd.getCmdType()) {
case script:
@ -71,7 +71,7 @@ public class EBCLIScriptAssembly {
return new ScriptData(sb.toString(), params);
}
private static ScriptData loadScript(EBCLIOptions.Cmd cmd) {
private static ScriptData loadScript(NBCLIOptions.Cmd cmd) {
String scriptData;
try {

View File

@ -27,19 +27,19 @@ public class NBCLIScriptAssemblyTest {
@Test
public void testScriptParamsSingle() {
EBCLIOptions opts = new EBCLIOptions(new String[] {
NBCLIOptions opts = new NBCLIOptions(new String[] {
"script",
"testscripts/printscript.js",
"param1=value1"
});
EBCLIScriptAssembly.ScriptData sd = EBCLIScriptAssembly.assembleScript(opts);
NBCLIScriptAssembly.ScriptData sd = NBCLIScriptAssembly.assembleScript(opts);
String assembledScript = sd.getScriptTextIgnoringParams();
assertThat(assembledScript).matches("(?s).*a single line.*");
}
@Test
public void testScriptParamsMulti() {
EBCLIOptions opts = new EBCLIOptions(new String[] {
NBCLIOptions opts = new NBCLIOptions(new String[] {
"script",
"testscripts/printscript.js",
"param1=value1",
@ -48,7 +48,7 @@ public class NBCLIScriptAssemblyTest {
"paramname=another",
"param2=andanother"
});
EBCLIScriptAssembly.ScriptData sd = EBCLIScriptAssembly.assembleScript(opts);
NBCLIScriptAssembly.ScriptData sd = NBCLIScriptAssembly.assembleScript(opts);
String assembledScript = sd.getScriptTextIgnoringParams();
assertThat(assembledScript).matches("(?s).*a single line.*");
}

View File

@ -12,7 +12,7 @@ public class TestNBCLIOptions {
@Test
public void shouldRecognizeActivities() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"start", "foo=wan", "start", "bar=lan"});
NBCLIOptions opts = new NBCLIOptions(new String[]{"start", "foo=wan", "start", "bar=lan"});
assertThat(opts.getCommands()).isNotNull();
assertThat(opts.getCommands().size()).isEqualTo(2);
assertThat(opts.getCommands().get(0).getCmdSpec()).isEqualTo("foo=wan;");
@ -21,7 +21,7 @@ public class TestNBCLIOptions {
@Test
public void shouldParseLongActivityForm() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"start", "param1=param2", "param3=param4",
NBCLIOptions opts = new NBCLIOptions(new String[]{"start", "param1=param2", "param3=param4",
"--report-graphite-to", "woot", "--report-interval", "23"});
assertThat(opts.getCommands().size()).isEqualTo(1);
assertThat(opts.getCommands().get(0).getCmdSpec()).isEqualTo("param1=param2;param3=param4;");
@ -31,64 +31,64 @@ public class TestNBCLIOptions {
@Test
public void shouldRecognizeShortVersion() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"--version"});
NBCLIOptions opts = new NBCLIOptions(new String[]{"--version"});
assertThat(opts.isWantsVersionShort()).isTrue();
assertThat(opts.wantsVersionCoords()).isFalse();
}
@Test
public void shouldRecognizeVersion() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"--version-coords"});
NBCLIOptions opts = new NBCLIOptions(new String[]{"--version-coords"});
assertThat(opts.isWantsVersionShort()).isFalse();
assertThat(opts.wantsVersionCoords()).isTrue();
}
@Test
public void shouldRecognizeScripts() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"script", "ascriptaone", "script", "ascriptatwo"});
NBCLIOptions opts = new NBCLIOptions(new String[]{"script", "ascriptaone", "script", "ascriptatwo"});
assertThat(opts.getCommands()).isNotNull();
assertThat(opts.getCommands().size()).isEqualTo(2);
assertThat(opts.getCommands().get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.script);
assertThat(opts.getCommands().get(0).getCmdType()).isEqualTo(NBCLIOptions.CmdType.script);
assertThat(opts.getCommands().get(0).getCmdSpec()).isEqualTo("ascriptaone");
assertThat(opts.getCommands().get(1).getCmdType()).isEqualTo(EBCLIOptions.CmdType.script);
assertThat(opts.getCommands().get(1).getCmdType()).isEqualTo(NBCLIOptions.CmdType.script);
assertThat(opts.getCommands().get(1).getCmdSpec()).isEqualTo("ascriptatwo");
}
@Test
public void shouldRecognizeWantsActivityTypes() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"--list-activity-types"});
NBCLIOptions opts = new NBCLIOptions(new String[]{"--list-activity-types"});
assertThat(opts.wantsActivityTypes()).isTrue();
opts = new EBCLIOptions(new String[]{"--version"});
opts = new NBCLIOptions(new String[]{"--version"});
assertThat(opts.wantsActivityTypes()).isFalse();
}
@Test
public void shouldRecognizeWantsBasicHelp() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"--help"});
NBCLIOptions opts = new NBCLIOptions(new String[]{"--help"});
assertThat(opts.wantsBasicHelp()).isTrue();
opts = new EBCLIOptions(new String[]{"--version"});
opts = new NBCLIOptions(new String[]{"--version"});
assertThat(opts.wantsTopicalHelp()).isFalse();
}
@Test
public void shouldRecognizeWantsActivityHelp() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"--help", "foo"});
NBCLIOptions opts = new NBCLIOptions(new String[]{"--help", "foo"});
assertThat(opts.wantsTopicalHelp()).isTrue();
assertThat(opts.wantsTopicalHelpFor()).isEqualTo("foo");
opts = new EBCLIOptions(new String[]{"--version"});
opts = new NBCLIOptions(new String[]{"--version"});
assertThat(opts.wantsTopicalHelp()).isFalse();
}
@Test(expectedExceptions = {InvalidParameterException.class}, expectedExceptionsMessageRegExp = ".*unrecognized option.*")
public void shouldErrorSanelyWhenNoMatch() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"unrecognizable command"});
NBCLIOptions opts = new NBCLIOptions(new String[]{"unrecognizable command"});
}
@Test
public void testShouldRecognizeScriptParams() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"script", "ascript", "param1=value1"});
NBCLIOptions opts = new NBCLIOptions(new String[]{"script", "ascript", "param1=value1"});
assertThat(opts.getCommands().size()).isEqualTo(1);
EBCLIOptions.Cmd cmd = opts.getCommands().get(0);
NBCLIOptions.Cmd cmd = opts.getCommands().get(0);
assertThat(cmd.getCmdArgs().size()).isEqualTo(1);
assertThat(cmd.getCmdArgs()).containsKey("param1");
assertThat(cmd.getCmdArgs().get("param1")).isEqualTo("value1");
@ -97,93 +97,93 @@ public class TestNBCLIOptions {
@Test(expectedExceptions = {InvalidParameterException.class},
expectedExceptionsMessageRegExp = ".*script name must precede.*")
public void testShouldErrorSanelyWhenScriptNameSkipped() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"script", "param1=value1"});
NBCLIOptions opts = new NBCLIOptions(new String[]{"script", "param1=value1"});
}
@Test(expectedExceptions = {InvalidParameterException.class},
expectedExceptionsMessageRegExp = ".*script name not found.*")
public void testShouldErrorForMissingScriptName() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"script"});
NBCLIOptions opts = new NBCLIOptions(new String[]{"script"});
}
@Test
public void testScriptInterpolation() {
EBCLIOptions opts = new EBCLIOptions(new String[]{"script", "script_to_interpolate", "parameter1=replaced"});
EBCLIScriptAssembly.ScriptData s = EBCLIScriptAssembly.assembleScript(opts);
NBCLIOptions opts = new NBCLIOptions(new String[]{"script", "script_to_interpolate", "parameter1=replaced"});
NBCLIScriptAssembly.ScriptData s = NBCLIScriptAssembly.assembleScript(opts);
assertThat(s.getScriptTextIgnoringParams()).contains("var foo=replaced;");
assertThat(s.getScriptTextIgnoringParams()).contains("var bar=UNSET:parameter2");
}
@Test
public void testAutoScriptCommand() {
EBCLIOptions opts = new EBCLIOptions(new String[]{ "acommand" });
EBCLIScriptAssembly.ScriptData s = EBCLIScriptAssembly.assembleScript(opts);
NBCLIOptions opts = new NBCLIOptions(new String[]{ "acommand" });
NBCLIScriptAssembly.ScriptData s = NBCLIScriptAssembly.assembleScript(opts);
assertThat(s.getScriptTextIgnoringParams()).contains("acommand script text");
}
@Test
public void shouldRecognizeStartActivityCmd() {
EBCLIOptions opts = new EBCLIOptions(new String[]{ "start", "type=woot" });
List<EBCLIOptions.Cmd> cmds = opts.getCommands();
NBCLIOptions opts = new NBCLIOptions(new String[]{ "start", "type=woot" });
List<NBCLIOptions.Cmd> cmds = opts.getCommands();
assertThat(cmds).hasSize(1);
assertThat(cmds.get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.start);
assertThat(cmds.get(0).getCmdType()).isEqualTo(NBCLIOptions.CmdType.start);
}
@Test
public void shouldRecognizeRunActivityCmd() {
EBCLIOptions opts = new EBCLIOptions(new String[]{ "run", "type=runwoot" });
List<EBCLIOptions.Cmd> cmds = opts.getCommands();
NBCLIOptions opts = new NBCLIOptions(new String[]{ "run", "type=runwoot" });
List<NBCLIOptions.Cmd> cmds = opts.getCommands();
assertThat(cmds).hasSize(1);
assertThat(cmds.get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.run);
assertThat(cmds.get(0).getCmdType()).isEqualTo(NBCLIOptions.CmdType.run);
}
@Test
public void shouldRecognizeStopActivityCmd() {
EBCLIOptions opts = new EBCLIOptions(new String[]{ "stop", "woah" });
List<EBCLIOptions.Cmd> cmds = opts.getCommands();
NBCLIOptions opts = new NBCLIOptions(new String[]{ "stop", "woah" });
List<NBCLIOptions.Cmd> cmds = opts.getCommands();
assertThat(cmds).hasSize(1);
assertThat(cmds.get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.stop);
assertThat(cmds.get(0).getCmdType()).isEqualTo(NBCLIOptions.CmdType.stop);
assertThat(cmds.get(0).getCmdSpec()).isEqualTo("woah");
}
@Test(expectedExceptions = InvalidParameterException.class)
public void shouldThrowErrorForInvalidStopActivity() {
EBCLIOptions opts = new EBCLIOptions(new String[]{ "stop", "woah=woah" });
List<EBCLIOptions.Cmd> cmds = opts.getCommands();
NBCLIOptions opts = new NBCLIOptions(new String[]{ "stop", "woah=woah" });
List<NBCLIOptions.Cmd> cmds = opts.getCommands();
}
@Test
public void shouldRecognizeAwaitActivityCmd() {
EBCLIOptions opts = new EBCLIOptions(new String[]{ "await", "awaitme" });
List<EBCLIOptions.Cmd> cmds = opts.getCommands();
assertThat(cmds.get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.await);
NBCLIOptions opts = new NBCLIOptions(new String[]{ "await", "awaitme" });
List<NBCLIOptions.Cmd> cmds = opts.getCommands();
assertThat(cmds.get(0).getCmdType()).isEqualTo(NBCLIOptions.CmdType.await);
assertThat(cmds.get(0).getCmdSpec()).isEqualTo("awaitme");
}
@Test(expectedExceptions = InvalidParameterException.class)
public void shouldThrowErrorForInvalidAwaitActivity() {
EBCLIOptions opts = new EBCLIOptions(new String[]{ "await", "awaitme=notvalid" });
List<EBCLIOptions.Cmd> cmds = opts.getCommands();
NBCLIOptions opts = new NBCLIOptions(new String[]{ "await", "awaitme=notvalid" });
List<NBCLIOptions.Cmd> cmds = opts.getCommands();
}
@Test
public void shouldRecognizewaitMillisCmd() {
EBCLIOptions opts = new EBCLIOptions(new String[]{ "waitmillis", "23234" });
List<EBCLIOptions.Cmd> cmds = opts.getCommands();
assertThat(cmds.get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.waitmillis);
NBCLIOptions opts = new NBCLIOptions(new String[]{ "waitmillis", "23234" });
List<NBCLIOptions.Cmd> cmds = opts.getCommands();
assertThat(cmds.get(0).getCmdType()).isEqualTo(NBCLIOptions.CmdType.waitmillis);
assertThat(cmds.get(0).getCmdSpec()).isEqualTo("23234");
}
@Test(expectedExceptions = NumberFormatException.class)
public void shouldThrowErrorForInvalidWaitMillisOperand() {
EBCLIOptions opts = new EBCLIOptions(new String[]{ "waitmillis", "noway" });
List<EBCLIOptions.Cmd> cmds = opts.getCommands();
NBCLIOptions opts = new NBCLIOptions(new String[]{ "waitmillis", "noway" });
List<NBCLIOptions.Cmd> cmds = opts.getCommands();
}

View File

@ -27,7 +27,7 @@ public class MetricsContext implements MetricRegistryService {
private static MetricsContext instance;
private MetricReporters metricReporters = MetricReporters.getInstance();
private MetricRegistry metrics = new EBMetricsRegistry();
private MetricRegistry metrics = new NBMetricsRegistry();
public static MetricsContext getInstance() {
synchronized (MetricsContext.class) {

View File

@ -23,7 +23,7 @@ import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer;
import org.mpierce.metrics.reservoir.hdrhistogram.HdrHistogramReservoir;
public class EBMetricsRegistry extends MetricRegistry {
public class NBMetricsRegistry extends MetricRegistry {
@Override
public Timer timer(String name) {