use of io.engineblock.activityimpl.ActivityDef in project engineblock by engineblock.
the class ScenarioController method run.
public synchronized void run(int timeout, Map<String, String> activityDefMap) {
ActivityDef ad = new ActivityDef(new ParameterMap(activityDefMap));
run(timeout, ad);
}
use of io.engineblock.activityimpl.ActivityDef in project engineblock by engineblock.
the class EBCLIScriptAssembly method assembleScript.
public static String assembleScript(EBCLIOptions options) {
StringBuilder sb = new StringBuilder();
for (EBCLIOptions.Cmd cmd : options.getCommands()) {
switch(cmd.cmdType) {
case script:
String scriptData = loadScript(cmd);
sb.append("// from CLI as ").append(cmd).append("\n");
sb.append(scriptData);
break;
// start activity
case start:
case // run activity
run:
// Sanity check that this can parse before using it
ActivityDef activityDef = ActivityDef.parseActivityDef(cmd.cmdSpec);
sb.append("// from CLI as ").append(cmd).append("\n").append("scenario.").append(cmd.cmdType.toString()).append("(\"").append(cmd.cmdSpec).append("\");\n");
break;
case // await activity
await:
sb.append("// from CLI as ").append(cmd).append("\n");
sb.append("scenario.awaitActivity(\"").append(cmd.cmdSpec).append("\");\n");
break;
case // stop activity
stop:
sb.append("// from CLI as ").append(cmd).append("\n");
sb.append("scenario.stop(\"").append(cmd.cmdSpec).append("\");\n");
break;
case waitmillis:
sb.append("// from CLI as ").append(cmd).append("\n");
sb.append("scenario.waitMillis(").append(cmd.cmdSpec).append(");\n");
break;
}
}
return sb.toString();
}
use of io.engineblock.activityimpl.ActivityDef in project engineblock by engineblock.
the class ExceptionCountMetrics method count.
public void count(Throwable e) {
Counter c = counters.get(e.getClass());
if (c == null) {
synchronized (counters) {
c = counters.computeIfAbsent(e.getClass(), k -> ActivityMetrics.counter(activityDef, "errorcounts." + e.getClass().getSimpleName()));
}
}
c.inc();
}
use of io.engineblock.activityimpl.ActivityDef in project engineblock by engineblock.
the class ExceptionHistoMetrics method update.
public void update(Throwable e, long magnitude) {
Histogram h = counters.get(e.getClass());
if (h == null) {
synchronized (counters) {
h = counters.computeIfAbsent(e.getClass(), k -> ActivityMetrics.histogram(activityDef, "errorhistos." + e.getClass().getSimpleName()));
}
}
h.update(magnitude);
}
use of io.engineblock.activityimpl.ActivityDef in project engineblock by engineblock.
the class ExceptionMeterMetrics method count.
public void count(Exception e) {
Meter c = meters.get(e.getClass());
if (c == null) {
synchronized (meters) {
c = meters.computeIfAbsent(e.getClass(), k -> ActivityMetrics.meter(activityDef, "exceptions." + e.getClass().getSimpleName()));
}
}
c.mark();
}
Aggregations