use of io.engineblock.activityapi.core.Action in project engineblock by engineblock.
the class DiagActivityTypeTest method testDiagActivity.
@Test
public void testDiagActivity() {
DiagActivityType da = new DiagActivityType();
da.getName();
ActivityDef ad = ActivityDef.parseActivityDef("type=diag;");
DiagActivity a = da.getActivity(ad);
a.initActivity();
ActionDispenser actionDispenser = da.getActionDispenser(a);
Action action = actionDispenser.getAction(1);
action.runCycle(1L);
}
use of io.engineblock.activityapi.core.Action 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);
}
use of io.engineblock.activityapi.core.Action in project engineblock by engineblock.
the class CoreMotorTest method testIteratorStride.
@Test
public void testIteratorStride() {
BlockingSegmentInput lockstepper = new BlockingSegmentInput();
Motor cm1 = new CoreMotor(new SimpleActivity("stride=3"), 1L, lockstepper);
AtomicLongArray ary = new AtomicLongArray(10);
Action a1 = getTestArrayConsumer(ary);
cm1.setAction(a1);
cm1.getSlotStateTracker().enterState(RunState.Starting);
Thread t1 = new Thread(cm1);
t1.setName("cm1");
t1.start();
try {
// allow action time to be waiting in monitor for test fixture
Thread.sleep(500);
} catch (InterruptedException ignored) {
}
lockstepper.publishSegment(11L, 12L, 13L);
boolean result = awaitAryCondition(ala -> (ala.get(2) == 13L), ary, 5000, 100);
assertThat(ary.get(0)).isEqualTo(11L);
assertThat(ary.get(1)).isEqualTo(12L);
assertThat(ary.get(2)).isEqualTo(13L);
assertThat(ary.get(3)).isEqualTo(0L);
}
Aggregations