From 78527fdaec7d1e25cb60142b3e6bac73d46f3df9 Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Wed, 19 Apr 2017 11:11:43 +0100 Subject: [PATCH] Add logging to failing test - Relates to #342 --- .../statemachine/recipes/TasksHandlerTests.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spring-statemachine-recipes/src/test/java/org/springframework/statemachine/recipes/TasksHandlerTests.java b/spring-statemachine-recipes/src/test/java/org/springframework/statemachine/recipes/TasksHandlerTests.java index c0228682..e1030702 100644 --- a/spring-statemachine-recipes/src/test/java/org/springframework/statemachine/recipes/TasksHandlerTests.java +++ b/spring-statemachine-recipes/src/test/java/org/springframework/statemachine/recipes/TasksHandlerTests.java @@ -25,6 +25,8 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.junit.Test; import org.springframework.statemachine.StateContext; import org.springframework.statemachine.StateMachine; @@ -38,6 +40,8 @@ import org.springframework.statemachine.transition.Transition; public class TasksHandlerTests { + private final static Log log = LogFactory.getLog(TasksHandlerTests.class); + @Test public void testRunOnceSimpleNoFailures() throws InterruptedException { TasksHandler handler = TasksHandler.builder() @@ -434,6 +438,7 @@ public class TasksHandlerTests { @Test public void testReset3() throws InterruptedException { + log.info("testReset3 start"); List> childs = new ArrayList>(); DefaultStateMachineContext context = new DefaultStateMachineContext(childs, "ERROR", null, null, null); TestStateMachinePersist persist = new TestStateMachinePersist(context); @@ -451,8 +456,10 @@ public class TasksHandlerTests { handler.resetFromPersistStore(); + log.info("testReset3 wait stateMachineStartedLatch"); assertThat(listener.stateMachineStartedLatch.await(1, TimeUnit.SECONDS), is(true)); + log.info("testReset3 wait stateChangedLatch"); assertThat(listener.stateChangedLatch.await(4, TimeUnit.SECONDS), is(true)); assertThat(listener.stateChangedCount, is(2)); assertThat(machine.getState().getIds(), contains(TasksHandler.STATE_READY)); @@ -536,6 +543,7 @@ public class TasksHandlerTests { @Override public void stateChanged(State from, State to) { synchronized (lock) { + TasksHandlerTests.log.info("stateChanged " + from + "::" + to); stateChangedCount++; stateChangedLatch.countDown(); }