I have written integration tests to test the execution of several boundary events for an application which is using Activiti as the workflow engine. While running the Spring Boot application regularly, all boundary events get executed correctly.
The integration test class uses the following annotations:
@Transactional
@RunWith(SpringRunner.class)
@ActiveProfiles("it")
@SpringBootTest(webEnvironment=SpringBootTest.WebEnvironment.RANDOM_PORT)
While starting the integration test, the log indicates that the async hob executor gets started:
[INFO ] 2018-04-26 09:58:44 [main] -- Starting up the default async job executor [org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor].
[INFO ] 2018-04-26 09:58:44 [main] -- Creating thread pool queue of size 100
[INFO ] 2018-04-26 09:58:44 [main] -- Creating executor service with corePoolSize 2, maxPoolSize 10 and keepAliveTime 5000
The integration tests fetches the current tasks for a given process and completes several user tasks using Activiti's taskService.complete(..)
method, until it reaches the boundary timer event.
The timer due date gets correctly set, then the log indicates the event has been started and the timer has been scheduled:
[DEBUG] 2018-04-26 09:58:55 [main] -- Setting workflow variable dueDate to Thu Apr 26 09:59:25 CEST 2018 for process 17
[DEBUG] 2018-04-26 09:58:55 [main] -- Activiti Event received: TIMER_SCHEDULED for process instance 17
But the timer never fires (TIMER_FIRED
doesn't get triggered).
Running the application in the same profile as the test (it
) works fine, the timer behaves as expected.
Do I miss any needed test class annotation to enable Activiti's async job executor?
Which version are you using? Why do you have @Transactional annotation in there? That's an integration test, meaning that the spring boot app is going to run and you test will be a client, there are no transactional thing happening in there right? Unless I'm missing something from your setup.