Skip to content

Commit

Permalink
Improving test case for ACT-2179: unable to use Date process variable…
Browse files Browse the repository at this point in the history
… in timeDuration
  • Loading branch information
jbarrez committed Feb 19, 2015
1 parent c6a7722 commit 60d0abf
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public void testCatchingTimerEvent() throws Exception {

@Deployment
public void testTimerEventWithStartAndDuration() throws Exception {

Date testStartTime = new Date();
processEngineConfiguration.getClock().setCurrentTime(testStartTime);

ProcessInstance pi = runtimeService.startProcessInstanceByKey("timerEventWithStartAndDuration");
List<Task> tasks = taskService.createTaskQuery().list();
assertEquals(1, tasks.size());
Expand All @@ -60,15 +64,21 @@ public void testTimerEventWithStartAndDuration() throws Exception {
JobQuery jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
assertEquals(0, jobQuery.count());

runtimeService.setVariable(pi.getId(), "StartDate", new Date());
Date startDate = new Date();
runtimeService.setVariable(pi.getId(), "StartDate", startDate);
taskService.complete(task.getId());

jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
assertEquals(1, jobQuery.count());
Thread.sleep(7000);

processEngineConfiguration.getClock().setCurrentTime(new Date(startDate.getTime() + 7000L));

jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
assertEquals(1, jobQuery.count());
jobQuery = managementService.createJobQuery().processInstanceId(pi.getId()).executable();
assertEquals(0, jobQuery.count());

processEngineConfiguration.getClock().setCurrentTime(new Date(startDate.getTime() + 11000L));
waitForJobExecutorToProcessAllJobs(15000L, 25L);

jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
Expand Down

0 comments on commit 60d0abf

Please sign in to comment.