예제 #1
0
  @Test
  public void testRunTwice() throws InterruptedException {
    listener.reset(9, 0, 0);
    tasks.run();
    assertThat(listener.stateChangedLatch.await(6, TimeUnit.SECONDS), is(true));
    assertThat(machine.getState().getIds(), contains(States.READY));

    Map<Object, Object> variables = machine.getExtendedState().getVariables();
    assertThat(variables.size(), is(3));

    listener.reset(9, 0, 0);
    tasks.run();
    assertThat(listener.stateChangedLatch.await(6, TimeUnit.SECONDS), is(true));
    assertThat(machine.getState().getIds(), contains(States.READY));

    variables = machine.getExtendedState().getVariables();
    assertThat(variables.size(), is(3));
  }
예제 #2
0
 @Test
 public void testFailAutomaticFix() throws InterruptedException {
   listener.reset(11, 0, 0);
   tasks.fail("T1");
   tasks.run();
   assertThat(listener.stateChangedLatch.await(6, TimeUnit.SECONDS), is(true));
   assertThat(listener.stateChangedCount, is(11));
   assertThat(machine.getState().getIds(), contains(States.READY));
 }
예제 #3
0
  @Test
  public void testFailManualFix() throws InterruptedException {
    listener.reset(11, 0, 0);
    tasks.fail("T2");
    tasks.run();
    assertThat(listener.stateChangedLatch.await(6, TimeUnit.SECONDS), is(true));

    Map<Object, Object> variables = machine.getExtendedState().getVariables();
    assertThat(variables.size(), is(3));

    assertThat(machine.getState().getIds(), contains(States.ERROR, States.MANUAL));
    listener.reset(1, 0, 0);
    tasks.fix();
    assertThat(listener.stateChangedLatch.await(6, TimeUnit.SECONDS), is(true));
    assertThat(machine.getState().getIds(), contains(States.READY));
  }