AnsweredAssumed Answered

Timer Duration seems not to be working

Question asked by victorbos on Mar 1, 2016
Latest reply on Mar 1, 2016 by jbarrez
Hi all,

First of all let me say that I'm new to activiti and therefore might do something silly :-)
The thing is that I'm creating a unit test against a bpmn diagram that starts with a Timer start event in which i set the duration to 1 hour (PT1H). So I expect the process to wait for an hour before it continues. But instead of that I see that it progresses immediately. There must be something wrong in my setup I guess…..
Hope you can help!


This is the simple flow that I created to test the timer start event. It has a script with a counter and a gateway that will loop back to the start event five times. In the output I see that it hits the script without the hour delay that I expect:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="" xmlns:xsi="" xmlns:xsd="" xmlns:activiti="" xmlns:bpmndi="" xmlns:omgdc="" xmlns:omgdi="" typeLanguage="" expressionLanguage="" targetNamespace="">
   <process id="TestTimer" name="TestTimer" isExecutable="true">
      <startEvent id="timerstartevent1" name="Timer start">
      <endEvent id="endevent1" name="End"></endEvent>
      <scriptTask id="scripttask1" name="Script Task" scriptFormat="groovy">
         <script>def count = execution.getVariable("count") ?: 0
            count ++
            execution.setVariable("count", count)
            println("&gt;&gt;&gt;" + new Date() + " count=" + count)
      <sequenceFlow id="flow1" sourceRef="timerstartevent1" targetRef="scripttask1"></sequenceFlow>
      <sequenceFlow id="flow2" sourceRef="scripttask1" targetRef="exclusivegateway1"></sequenceFlow>
      <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
      <sequenceFlow id="flow3" sourceRef="exclusivegateway1" targetRef="timerstartevent1">
         <conditionExpression xsi:type="tFormalExpression"><![CDATA[${count<5}]]></conditionExpression>
      <sequenceFlow id="flow4" sourceRef="exclusivegateway1" targetRef="endevent1">
         <conditionExpression xsi:type="tFormalExpression"><![CDATA[${count>=5}]]></conditionExpression>

And the corresponding unit test:
public class TestTimer {
   ProcessEngine processEngine;
   ActivitiRule activitiRule;

   public void setup(){
      processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().buildProcessEngine();
      activitiRule = new ActivitiRule(processEngine);

   public void testTimer(){
      Deployment deployment = processEngine.getRepositoryService().createDeployment().addClasspathResource("diagrams/TestTimer.bpmn").deploy();