How to trigger ConditionalEvent when a Scenario waitsAtEventBasedGateway


#1

I want to write a test for a process which waits on an eventBasedGateway with a TimerEvent and a ConditionalEvent. How can I trigger the branch of the conditional event?
I saw in examples that an EventSubscriptionDelegate.receive() helps for MessageEvents, but it doesn’t seem to work for ConditionalEvents. Is there an example which covers my setup?


#2

You simply have to pass a variable with the according value to that process instance.
This can be done via RuntimeService.setVariable(executionId, varName, value);
respectively via Rest API. In a test scenario you would do that of course via Java API.
Each time the variable changes its value the engine checks if the condition is met or not.

Best, McAlm