@Test(timeout=10000)
public void testUpdateTimer() throws Exception {

    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "IntermediateCatchEvent");
    assertNotNull(processInstanceId);
    long scheduleTime = System.currentTimeMillis();
    
    Collection<NodeInstanceDesc> activeNodes = processAdminService.getActiveNodeInstances(processInstanceId);
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    
    NodeInstanceDesc active = activeNodes.iterator().next();       
    assertEquals("timer", active.getName());
    
    Collection<TimerInstance> timers = processAdminService.getTimerInstances(processInstanceId);
    assertNotNull(timers);
    assertEquals(1, timers.size());
    
    TimerInstance timer = timers.iterator().next();
    assertNotNull(timer.getActivationTime());
    assertNotNull(timer.getDelay());
    assertNotNull(timer.getNextFireTime());
    assertNotNull(timer.getProcessInstanceId());
    assertNotNull(timer.getSessionId());
    assertNotNull(timer.getTimerId());
    assertNotNull(timer.getId());
    assertNotNull(timer.getTimerName());
    // thread sleep to test the different in the time timer spent after upgrade
    // not to wait for any job to be done
    Thread.sleep(1000);
    
    processAdminService.updateTimer(processInstanceId, timer.getId(), 3, 0, 0);
    
    CountDownListenerFactory.getExisting("processAdminService").waitTillCompleted();
    long fireTime = System.currentTimeMillis();        
    long expirationTime = fireTime - scheduleTime;
    //since the update of timer was including time already spent (thread sleep above) then it must wait less than 4 secs
    assertTrue(expirationTime < 4000);
   
    ProcessInstanceDesc pi = runtimeDataService.getProcessInstanceById(processInstanceId);
    assertEquals(ProcessInstance.STATE_COMPLETED, pi.getState().intValue());
    
    processInstanceId = null;
}