Merge branch 'master' into releases

This commit is contained in:
Jonathan Shook 2020-03-16 23:16:10 -05:00
commit 1e6876145f
13 changed files with 80 additions and 80 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

@ -1,9 +1,9 @@
<!doctype html>
<html>
<head>
<title>guidebooknosqlbench docs</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="description" name="description" content="Docs App for NoSQLBench"><link data-n-head="1" rel="icon" type="image/x-icon" href="/favicon.ico"><link data-n-head="1" rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap"><link data-n-head="1" rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"><link rel="preload" href="/_nuxt/71d233994867b9ff16c0.js" as="script"><link rel="preload" href="/_nuxt/ba3d87d913919f4a90b7.js" as="script"><link rel="preload" href="/_nuxt/b731eebc22dad37c5c4f.js" as="script"><link rel="preload" href="/_nuxt/4f2a13032e26b25bda78.js" as="script">
<title>guidebooknosqlbench docs</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="description" name="description" content="Docs App for NoSQLBench"><link data-n-head="1" rel="icon" type="image/x-icon" href="/favicon.ico"><link data-n-head="1" rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap"><link data-n-head="1" rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"><link rel="preload" href="/_nuxt/bbbb289c471766021bc7.js" as="script"><link rel="preload" href="/_nuxt/ba3d87d913919f4a90b7.js" as="script"><link rel="preload" href="/_nuxt/b731eebc22dad37c5c4f.js" as="script"><link rel="preload" href="/_nuxt/4f2a13032e26b25bda78.js" as="script">
</head>
<body>
<div id="__nuxt"><style>#nuxt-loading{visibility:hidden;opacity:0;position:absolute;left:0;right:0;top:0;bottom:0;display:flex;justify-content:center;align-items:center;flex-direction:column;animation:nuxtLoadingIn 10s ease;-webkit-animation:nuxtLoadingIn 10s ease;animation-fill-mode:forwards;overflow:hidden}@keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}@-webkit-keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}#nuxt-loading>div,#nuxt-loading>div:after{border-radius:50%;width:5rem;height:5rem}#nuxt-loading>div{font-size:10px;position:relative;text-indent:-9999em;border:.5rem solid #f5f5f5;border-left:.5rem solid #fff;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:nuxtLoading 1.1s infinite linear;animation:nuxtLoading 1.1s infinite linear}#nuxt-loading.error>div{border-left:.5rem solid #ff4500;animation-duration:5s}@-webkit-keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}</style><script>window.addEventListener("error",function(){var e=document.getElementById("nuxt-loading");e&&(e.className+=" error")})</script><div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div></div>
<script type="text/javascript" src="/_nuxt/71d233994867b9ff16c0.js"></script><script type="text/javascript" src="/_nuxt/ba3d87d913919f4a90b7.js"></script><script type="text/javascript" src="/_nuxt/b731eebc22dad37c5c4f.js"></script><script type="text/javascript" src="/_nuxt/4f2a13032e26b25bda78.js"></script></body>
<script type="text/javascript" src="/_nuxt/bbbb289c471766021bc7.js"></script><script type="text/javascript" src="/_nuxt/ba3d87d913919f4a90b7.js"></script><script type="text/javascript" src="/_nuxt/b731eebc22dad37c5c4f.js"></script><script type="text/javascript" src="/_nuxt/4f2a13032e26b25bda78.js"></script></body>
</html>

View File

@ -1 +1 @@
!function(e){function r(data){for(var r,n,f=data[0],l=data[1],d=data[2],i=0,h=[];i<f.length;i++)n=f[i],Object.prototype.hasOwnProperty.call(o,n)&&o[n]&&h.push(o[n][0]),o[n]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(v&&v(data);h.length;)h.shift()();return c.push.apply(c,d||[]),t()}function t(){for(var e,i=0;i<c.length;i++){for(var r=c[i],t=!0,n=1;n<r.length;n++){var l=r[n];0!==o[l]&&(t=!1)}t&&(c.splice(i--,1),e=f(f.s=r[0]))}return e}var n={},o={8:0},c=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var c,script=document.createElement("script");script.charset="utf-8",script.timeout=120,f.nc&&script.setAttribute("nonce",f.nc),script.src=function(e){return f.p+""+{0:"55bb9a1be83797eee63f",1:"b8a47e05eded23bac7ed",4:"c28caf599093f6fe5786",5:"09eb2af0af9c15c6d621",6:"428c6c33fdbc344a773a",7:"59759ea4aa8651f70220"}[e]+".js"}(e);var l=new Error;c=function(r){script.onerror=script.onload=null,clearTimeout(d);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;l.message="Loading chunk "+e+" failed.\n("+n+": "+c+")",l.name="ChunkLoadError",l.type=n,l.request=c,t[1](l)}o[e]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:script})}),12e4);script.onerror=script.onload=c,document.head.appendChild(script)}return Promise.all(r)},f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(object,e){return Object.prototype.hasOwnProperty.call(object,e)},f.p="/_nuxt/",f.oe=function(e){throw console.error(e),e};var l=window.webpackJsonp=window.webpackJsonp||[],d=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var v=d;t()}([]);
!function(e){function r(data){for(var r,n,f=data[0],l=data[1],d=data[2],i=0,h=[];i<f.length;i++)n=f[i],Object.prototype.hasOwnProperty.call(o,n)&&o[n]&&h.push(o[n][0]),o[n]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(v&&v(data);h.length;)h.shift()();return c.push.apply(c,d||[]),t()}function t(){for(var e,i=0;i<c.length;i++){for(var r=c[i],t=!0,n=1;n<r.length;n++){var l=r[n];0!==o[l]&&(t=!1)}t&&(c.splice(i--,1),e=f(f.s=r[0]))}return e}var n={},o={8:0},c=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var c,script=document.createElement("script");script.charset="utf-8",script.timeout=120,f.nc&&script.setAttribute("nonce",f.nc),script.src=function(e){return f.p+""+{0:"55bb9a1be83797eee63f",1:"b8a47e05eded23bac7ed",4:"c28caf599093f6fe5786",5:"09eb2af0af9c15c6d621",6:"428c6c33fdbc344a773a",7:"ecd4a42f2cc80fb75abd"}[e]+".js"}(e);var l=new Error;c=function(r){script.onerror=script.onload=null,clearTimeout(d);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;l.message="Loading chunk "+e+" failed.\n("+n+": "+c+")",l.name="ChunkLoadError",l.type=n,l.request=c,t[1](l)}o[e]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:script})}),12e4);script.onerror=script.onload=c,document.head.appendChild(script)}return Promise.all(r)},f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(object,e){return Object.prototype.hasOwnProperty.call(object,e)},f.p="/_nuxt/",f.oe=function(e){throw console.error(e),e};var l=window.webpackJsonp=window.webpackJsonp||[],d=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var v=d;t()}([]);

View File

@ -1,9 +1,9 @@
<!doctype html>
<html>
<head>
<title>guidebooknosqlbench docs</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="description" name="description" content="Docs App for NoSQLBench"><link data-n-head="1" rel="icon" type="image/x-icon" href="/favicon.ico"><link data-n-head="1" rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap"><link data-n-head="1" rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"><link rel="preload" href="/_nuxt/71d233994867b9ff16c0.js" as="script"><link rel="preload" href="/_nuxt/ba3d87d913919f4a90b7.js" as="script"><link rel="preload" href="/_nuxt/b731eebc22dad37c5c4f.js" as="script"><link rel="preload" href="/_nuxt/4f2a13032e26b25bda78.js" as="script">
<title>guidebooknosqlbench docs</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="description" name="description" content="Docs App for NoSQLBench"><link data-n-head="1" rel="icon" type="image/x-icon" href="/favicon.ico"><link data-n-head="1" rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap"><link data-n-head="1" rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"><link rel="preload" href="/_nuxt/bbbb289c471766021bc7.js" as="script"><link rel="preload" href="/_nuxt/ba3d87d913919f4a90b7.js" as="script"><link rel="preload" href="/_nuxt/b731eebc22dad37c5c4f.js" as="script"><link rel="preload" href="/_nuxt/4f2a13032e26b25bda78.js" as="script">
</head>
<body>
<div id="__nuxt"><style>#nuxt-loading{visibility:hidden;opacity:0;position:absolute;left:0;right:0;top:0;bottom:0;display:flex;justify-content:center;align-items:center;flex-direction:column;animation:nuxtLoadingIn 10s ease;-webkit-animation:nuxtLoadingIn 10s ease;animation-fill-mode:forwards;overflow:hidden}@keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}@-webkit-keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}#nuxt-loading>div,#nuxt-loading>div:after{border-radius:50%;width:5rem;height:5rem}#nuxt-loading>div{font-size:10px;position:relative;text-indent:-9999em;border:.5rem solid #f5f5f5;border-left:.5rem solid #fff;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:nuxtLoading 1.1s infinite linear;animation:nuxtLoading 1.1s infinite linear}#nuxt-loading.error>div{border-left:.5rem solid #ff4500;animation-duration:5s}@-webkit-keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}</style><script>window.addEventListener("error",function(){var e=document.getElementById("nuxt-loading");e&&(e.className+=" error")})</script><div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div></div>
<script type="text/javascript" src="/_nuxt/71d233994867b9ff16c0.js"></script><script type="text/javascript" src="/_nuxt/ba3d87d913919f4a90b7.js"></script><script type="text/javascript" src="/_nuxt/b731eebc22dad37c5c4f.js"></script><script type="text/javascript" src="/_nuxt/4f2a13032e26b25bda78.js"></script></body>
<script type="text/javascript" src="/_nuxt/bbbb289c471766021bc7.js"></script><script type="text/javascript" src="/_nuxt/ba3d87d913919f4a90b7.js"></script><script type="text/javascript" src="/_nuxt/b731eebc22dad37c5c4f.js"></script><script type="text/javascript" src="/_nuxt/4f2a13032e26b25bda78.js"></script></body>
</html>

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

@ -18,8 +18,8 @@
package io.nosqlbench.engine.cli;
import io.nosqlbench.engine.cli.EBCLIOptions;
import io.nosqlbench.engine.cli.EBCLIScriptAssembly;
import io.nosqlbench.engine.cli.NBCLIOptions;
import io.nosqlbench.engine.cli.NBCLIScriptAssembly;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.assertThat;
@ -28,19 +28,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",
@ -49,9 +49,9 @@ 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) {