Join state should not be entered

- Fix join pseudostate to be transient.
- Fix tests which uses wrong concepts.
- Fixes #222
This commit is contained in:
Janne Valkealahti
2016-05-06 17:24:54 +01:00
parent 2836902635
commit 12137222a8
9 changed files with 79 additions and 39 deletions

View File

@@ -61,7 +61,7 @@ public class TasksTests {
@Test
public void testRunOnce() throws InterruptedException {
listener.reset(9, 0, 0);
listener.reset(8, 0, 0);
tasks.run();
assertThat(listener.stateChangedLatch.await(8, TimeUnit.SECONDS), is(true));
assertThat(machine.getState().getIds(), contains(States.READY));
@@ -71,7 +71,7 @@ public class TasksTests {
@Test
public void testRunTwice() throws InterruptedException {
listener.reset(9, 0, 0);
listener.reset(8, 0, 0);
tasks.run();
assertThat(listener.stateChangedLatch.await(8, TimeUnit.SECONDS), is(true));
assertThat(machine.getState().getIds(), contains(States.READY));
@@ -79,7 +79,7 @@ public class TasksTests {
Map<Object, Object> variables = machine.getExtendedState().getVariables();
assertThat(variables.size(), is(3));
listener.reset(9, 0, 0);
listener.reset(8, 0, 0);
tasks.run();
assertThat(listener.stateChangedLatch.await(8, TimeUnit.SECONDS), is(true));
assertThat(machine.getState().getIds(), contains(States.READY));
@@ -90,17 +90,17 @@ public class TasksTests {
@Test
public void testFailAutomaticFix() throws InterruptedException {
listener.reset(11, 0, 0);
listener.reset(10, 0, 0);
tasks.fail("T1");
tasks.run();
assertThat(listener.stateChangedLatch.await(6, TimeUnit.SECONDS), is(true));
assertThat(listener.stateChangedCount, is(11));
assertThat(listener.stateChangedCount, is(10));
assertThat(machine.getState().getIds(), contains(States.READY));
}
@Test
public void testFailManualFix() throws InterruptedException {
listener.reset(11, 0, 0);
listener.reset(10, 0, 0);
tasks.fail("T2");
tasks.run();
assertThat(listener.stateChangedLatch.await(6, TimeUnit.SECONDS), is(true));