I have encountered a problem while working with events.
I have a process, in which there is an intermediate catching event for an event of type "turn-new". Then in jbpm test case I start the process and then signal an event to it. The first event is caught, but any others are not. I checked that the process is still in active state. It seems to me, like the listener was removed with first signal, or something like that.
I start the process via a drools rule, so in test case I just insert necessary facts to fire the rule, this rule then starts process and I get its id throught ksession.getProcessInstances(). Then I signal events by ksession.signalEvent("turn-new",null).
There is a code snippet from the test case:
FactHandle cityHandle = ksession.insert(city);
List<ProcessInstance> processes = (List<ProcessInstance>)ksession.getProcessInstances();
ArgumentCaptor<AfterActivationFiredEvent> aafe = ArgumentCaptor.forClass( AfterActivationFiredEvent.class );
verify( ael ,atLeastOnce()).afterActivationFired( aafe.capture() );
List<String> firedRules = getFiredRules(aafe.getAllValues()); // get names of rules fired
Assert.assertTrue(firedRules.contains("City Start Build Unit")); // rule which starts the process
Assert.assertTrue("One Process Should Be Active",processes.size()==1);
WorkflowProcessInstance p = (WorkflowProcessInstance)processes.get(0);
city.setResourcesSurplus(60); // alter city variable which is process variable within the process
assertProcessInstanceActive(p.getId(), ksession); // this one should fail, but passes
assertProcessInstanceCompleted(p.getId(), ksession); // this one should pass, but fails
In the Process Turn node I event write a hello message to check whether the node is triggered (together with registering an event listener), but nothing writes out.
Would it be problem of time interval between the events, or there happens something else?
Thanks for help