Search in sources :

Example 6 with ActivityDef

use of io.engineblock.activityimpl.ActivityDef in project engineblock by engineblock.

the class StdoutActivityTypeTest method testDiagActivity.

@Test
public void testDiagActivity() {
    StdoutActivityType stdoutAt = new StdoutActivityType();
    String atname = stdoutAt.getName();
    assertThat(atname.equals("stdout"));
    ActivityDef ad = ActivityDef.parseActivityDef("type=stdout; yaml=stdout-test;");
    StdoutActivity stdoutActivity = stdoutAt.getActivity(ad);
    ActionDispenser actionDispenser = stdoutAt.getActionDispenser(stdoutActivity);
    Action action = actionDispenser.getAction(1);
}
Also used : Action(io.engineblock.activityapi.core.Action) ActionDispenser(io.engineblock.activityapi.core.ActionDispenser) ActivityDef(io.engineblock.activityimpl.ActivityDef) Test(org.testng.annotations.Test)

Example 7 with ActivityDef

use of io.engineblock.activityimpl.ActivityDef in project engineblock by engineblock.

the class ActivityExecutorTest method getActivityMotorFactory.

private MotorDispenser getActivityMotorFactory(final ActivityDef ad, Action lc, final Input ls) {
    MotorDispenser cmf = new MotorDispenser() {

        @Override
        public Motor getMotor(ActivityDef activityDef, int slotId) {
            Activity activity = new SimpleActivity(activityDef);
            Motor cm = new CoreMotor(activity, slotId, ls);
            cm.setAction(lc);
            return cm;
        }
    };
    return cmf;
}
Also used : CoreMotor(io.engineblock.activityimpl.motor.CoreMotor) SimpleActivity(io.engineblock.activityimpl.SimpleActivity) CoreMotorDispenser(io.engineblock.activityimpl.motor.CoreMotorDispenser) SimpleActivity(io.engineblock.activityimpl.SimpleActivity) ActivityDef(io.engineblock.activityimpl.ActivityDef) CoreMotor(io.engineblock.activityimpl.motor.CoreMotor)

Example 8 with ActivityDef

use of io.engineblock.activityimpl.ActivityDef in project engineblock by engineblock.

the class MetricsIntegrationTest method testHistogramLogger.

@Test
public void testHistogramLogger() {
    ActivityDef ad = ActivityDef.parseActivityDef("alias=foo;type=diag");
    Histogram testhistogram = ActivityMetrics.histogram(ad, "testhistogram");
    ActivityMetrics.addHistoLogger("testsession", ".*", "testhisto.log", "1s");
    testhistogram.update(400);
    testhistogram.getSnapshot();
    File logfile = new File("testhisto.log");
    assertThat(logfile).exists();
    assertThat(logfile.lastModified()).isGreaterThan(System.currentTimeMillis() - 10000);
}
Also used : Histogram(com.codahale.metrics.Histogram) ActivityDef(io.engineblock.activityimpl.ActivityDef) File(java.io.File) Test(org.testng.annotations.Test)

Example 9 with ActivityDef

use of io.engineblock.activityimpl.ActivityDef in project engineblock by engineblock.

the class ScenarioController method run.

public synchronized void run(int timeout, String activityDefString) {
    ActivityDef activityDef = ActivityDef.parseActivityDef(activityDefString);
    run(timeout, activityDef);
}
Also used : ActivityDef(io.engineblock.activityimpl.ActivityDef)

Example 10 with ActivityDef

use of io.engineblock.activityimpl.ActivityDef in project engineblock by engineblock.

the class ScenarioController method start.

/**
 * Start an activity, given a map which holds the activity definition for it. The activity will be known in
 * the scenario by the alias parameter.
 *
 * @param activityDefMap A map containing the activity definition
 */
public synchronized void start(Map<String, String> activityDefMap) {
    ActivityDef ad = new ActivityDef(new ParameterMap(activityDefMap));
    start(ad);
}
Also used : ActivityDef(io.engineblock.activityimpl.ActivityDef) ParameterMap(io.engineblock.activityimpl.ParameterMap)

Aggregations

ActivityDef (io.engineblock.activityimpl.ActivityDef)15 Test (org.testng.annotations.Test)5 ParameterMap (io.engineblock.activityimpl.ParameterMap)3 SimpleActivity (io.engineblock.activityimpl.SimpleActivity)3 CoreMotorDispenser (io.engineblock.activityimpl.motor.CoreMotorDispenser)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 Histogram (com.codahale.metrics.Histogram)2 Action (io.engineblock.activityapi.core.Action)2 ActionDispenser (io.engineblock.activityapi.core.ActionDispenser)2 InputDispenser (io.engineblock.activityapi.input.InputDispenser)2 OutputDispenser (io.engineblock.activityapi.output.OutputDispenser)2 CoreActionDispenser (io.engineblock.activityimpl.action.CoreActionDispenser)2 CoreInputDispenser (io.engineblock.activityimpl.input.CoreInputDispenser)2 com.codahale.metrics (com.codahale.metrics)1 Counter (com.codahale.metrics.Counter)1 Meter (com.codahale.metrics.Meter)1 Activity (io.engineblock.activityapi.core.Activity)1 ActivityType (io.engineblock.activityapi.core.ActivityType)1 Input (io.engineblock.activityapi.input.Input)1 TargetRateInput (io.engineblock.activityimpl.input.TargetRateInput)1