cancel
Showing results for 
Search instead for 
Did you mean: 

Timers not working with unit tests on 5.12

zidia
Champ in-the-making
Champ in-the-making
Hi everybody,
I created a simple example process with a Timer Start Event set to R1/PT10S.

I modified the activiti.cfg.xml as follows:

<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
      <property name="databaseSchemaUpdate" value="true"/>
      <property name="jobExecutorActivate" value="true" />
</bean>


But it doesn't start. And also other timers are not working when testing processes with unit tests. In activiti 5.9 they was working fine.

What I'm doing wrong?

thanks
3 REPLIES 3

trademak
Star Contributor
Star Contributor
It's a bit difficult to tell if you don't include your unit test code.
In our Activiti test suite we're testing timers a lot, so it's still working.

Best regards,

zidia
Champ in-the-making
Champ in-the-making
Hi Tijs,
I was testing the processes using a Java main class instead of unit tests and in particular using these lines of code to create the process engine, deploy it and run it.

<java>
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
repositoryService.createDeployment().addInputStream("myProcess.bpmn20.xml",new FileInputStream(filename)).deploy();
RuntimeService runtimeService = processEngine.getRuntimeService();
Map<String, Object> variableMap = new HashMap<String, Object>();
variableMap.put("name", "Activiti");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess", variableMap);
</java>

This was working fine with 5.9 since (as I understood) the ProcessEngine was using the external running Activiti instance and external DB by default. By external I mean the one started by the ant script.

I tested now the process with automatically generated unit tests (after changing the activiti.cfg.xml file and running the H2 database) and the timers are working properly.


thanks,
jovan

jbarrez
Star Contributor
Star Contributor
Probably the default process engine doesn't have the job executor enabled anymore.