cancel
Showing results for 
Search instead for 
Did you mean: 

How testing TimerBoundaryEvent

mlegnani
Champ in-the-making
Champ in-the-making
Hi all,
this is my fist post on the forum.
I'm trying to create a junit tests for the process of my application. I'm using spring integration for my application. I have troubles for the processes including a TimerBoundaryEvent: events are not fired.
I suppose this is because the JobExecutor cannot access uncommitted process data on the DB. I usually configure tests not to commit with @TransactionConfiguration(defaultRollback = true) but even if I change the configuration (defaultRollback = false) events are not fired.
Do you have a standard pattern to test processes that use TimerBoundaryEvent? How do you suggest to approach the problem?
Thanks in advance
Massimo
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
That's indeed a common problem when using Spring in Unit testing.
Spring starts a transaction for every test method, but this means that the job executor transactions can't see the data of course.

We test it by manually firing our timers using the managementService.executeJob() method.
Jobs (like timers) can be queried using the managementService.createJobQuery() operations.

mlegnani
Champ in-the-making
Champ in-the-making
Ok, I understand. I'll change my tests, manually firing  timers.
Thanks a lot,
Massimo