Fix EventDeferTests

- Change testDeferWithSubsThreadExecutor to use
  more threads if that is a culprint for this
  failure.
- Relates to #343
This commit is contained in:
Janne Valkealahti
2017-05-07 09:05:29 +01:00
parent 3884d48fef
commit b1d708e241

View File

@@ -121,7 +121,7 @@ public class EventDeferTests extends AbstractStateMachineTests {
@Test
public void testDeferWithSubsThreadExecutor() throws Exception {
context.register(Config1.class, ExecutorConfig.class);
context.register(Config1.class, ExecutorConfig2.class);
context.refresh();
@SuppressWarnings("unchecked")
StateMachine<String, String> machine = context.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, StateMachine.class);
@@ -555,6 +555,19 @@ public class EventDeferTests extends AbstractStateMachineTests {
}
@Configuration
static class ExecutorConfig2 {
@Bean(name=StateMachineSystemConstants.TASK_EXECUTOR_BEAN_NAME)
public TaskExecutor taskExecutor() {
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
taskExecutor.setCorePoolSize(1);
taskExecutor.setMaxPoolSize(4);
return taskExecutor;
}
}
static class TestListener extends StateMachineListenerAdapter<String, String> {
volatile CountDownLatch stateChangedLatch = new CountDownLatch(1);