Hello everybody, i am facing a problem unittesting a boundary timer event and i am hoping for some hints about what i do wrong.
What do i want to achieve
I have a case where a process has to be aborted when a certain usertask is not finished within a period. When the usertask is finished in time, the process should go on.
This is how we modeled it:
![]()
I am developing the test first and the process test perfectly walks through all previous steps.
At this point i want to assert that the process is waiting at the user task. To assure this i configured the timer in a way it shouldn't be fired:
![]()
Ususally there should be a period like P10D that - if i understood correctly - would fire the event
after 10 Days. From Day 1 - 10 the Process should be providing the Usertask in my expectation.
I also tried the period (in the Duration section)...that also didn't work.
What happens
Somehow the timer-event is fired and the process instance is not alive anymore when i try to assert that is waiting on the user task.
When i query the engine there is no active process instance.
I debugged that for a while now and have no clue why that happens.
One important information. We deactivated the job executor for our unittests to be able to handle asynchronous tasks or events.
Here is our Spring config for that:
@Bean
public ProcessEngineConfigurationImpl springProcessEngineConfiguration() {
StandaloneInMemProcessEngineConfiguration config = new StandaloneInMemProcessEngineConfiguration();
config.setJdbcUrl("jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000");
config.setJdbcDriver("org.h2.Driver");
config.setJdbcUsername("sa");
config.setJdbcPassword("");
config.setDatabaseSchemaUpdate("true");
config.setMailServerPort(5025);
// mache asynchrone Jobs synchron und damit testbar
config.setJobExecutorActivate(false);
return config;
}
Any idea what i do wrong ?
Thanks for helping.