jbpmContext.close();
}
}
public void testCreateTimerAction() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
" <start-state>" +
" <transition to='catch crooks' />" +
" </start-state>" +
" <state name='catch crooks'>" +
" <event type='node-enter'>" +
" <create-timer name='reminder' " +
" duedate='3 business hours' " +
" repeat='10 business minutes'" +
" transition='time-out-transition' >" +
" <action class='the-remainder-action-class-name' />" +
" </create-timer>" +
" </event>" +
" <transition to='end'/>" +
" </state>" +
" <end-state name='end'/>" +
"</process-definition>"
);
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try {
TestSchedulerService testSchedulerService = (TestSchedulerService) jbpmContext.getServices().getSchedulerService();
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
assertEquals(1, testSchedulerService.createdTimers.size());
Timer scheduledTimer = (Timer) testSchedulerService.createdTimers.get(0);
assertEquals("reminder", scheduledTimer.name);
assertEquals(processDefinition.getNode("catch crooks"), scheduledTimer.graphElement);
System.out.println("due date: "+scheduledTimer.dueDate);
assertNotNull(scheduledTimer.dueDate);
assertEquals("10 business minutes", scheduledTimer.repeat);
assertEquals("the-remainder-action-class-name", scheduledTimer.action.getActionDelegation().getClassName());
assertSame(processInstance.getRootToken(), scheduledTimer.token);