mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-30 12:34:01 -06:00
Stopped to Starting
This commit is contained in:
parent
f650d2e9be
commit
03e7021b3a
@ -48,6 +48,7 @@ public enum RunState {
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
case Uninitialized: // A motor was just created. This is its initial state.
|
case Uninitialized: // A motor was just created. This is its initial state.
|
||||||
|
case Stopped:
|
||||||
switch (to) {
|
switch (to) {
|
||||||
case Starting: // a motor has been reserved for an execution command
|
case Starting: // a motor has been reserved for an execution command
|
||||||
return true;
|
return true;
|
||||||
@ -76,14 +77,7 @@ public enum RunState {
|
|||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}// A motor was restarted after being stopped
|
||||||
case Stopped:
|
|
||||||
switch (to) {
|
|
||||||
case Running: // A motor was restarted after being stopped
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
case Finished:
|
case Finished:
|
||||||
switch (to) {
|
switch (to) {
|
||||||
case Running: // A motor was restarted?
|
case Running: // A motor was restarted?
|
||||||
|
@ -38,6 +38,30 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
public class ActivityExecutorTest {
|
public class ActivityExecutorTest {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ActivityExecutorTest.class);
|
private static final Logger logger = LoggerFactory.getLogger(ActivityExecutorTest.class);
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRestart() {
|
||||||
|
ActivityDef ad = ActivityDef.parseActivityDef("driver=diag;alias=test;cycles=1000;initdelay=5000;");
|
||||||
|
Optional<ActivityType> activityType = ActivityType.FINDER.get(ad.getActivityType());
|
||||||
|
Activity a = new DelayedInitActivity(ad);
|
||||||
|
InputDispenser idisp = new CoreInputDispenser(a);
|
||||||
|
ActionDispenser adisp = new CoreActionDispenser(a);
|
||||||
|
OutputDispenser tdisp = CoreServices.getOutputDispenser(a).orElse(null);
|
||||||
|
MotorDispenser<?> mdisp = new CoreMotorDispenser(a, idisp, adisp, tdisp);
|
||||||
|
a.setActionDispenserDelegate(adisp);
|
||||||
|
a.setOutputDispenserDelegate(tdisp);
|
||||||
|
a.setInputDispenserDelegate(idisp);
|
||||||
|
a.setMotorDispenserDelegate(mdisp);
|
||||||
|
|
||||||
|
ActivityExecutor ae = new ActivityExecutor(a);
|
||||||
|
ad.setThreads(1);
|
||||||
|
ae.startActivity();
|
||||||
|
ae.stopActivity();
|
||||||
|
ae.startActivity();
|
||||||
|
ae.awaitCompletion(15000);
|
||||||
|
assertThat(idisp.getInput(10).getInputSegment(3)).isNull();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDelayedStartSanity() {
|
public void testDelayedStartSanity() {
|
||||||
ActivityDef ad = ActivityDef.parseActivityDef("driver=diag;alias=test;cycles=1000;initdelay=5000;");
|
ActivityDef ad = ActivityDef.parseActivityDef("driver=diag;alias=test;cycles=1000;initdelay=5000;");
|
||||||
|
Loading…
Reference in New Issue
Block a user