package org.jbpm.scheduler.exe;
import org.jbpm.db.AbstractDbTestCase;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.scheduler.impl.SchedulerThread;
public class SchedulerAndAsyncDbTest extends AbstractDbTestCase {
public void testTimerInCombinationWithAsyncNode() throws Exception {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
" <start-state name='start'>" +
" <transition to='timed'/>" +
" </start-state>" +
" <state name='timed'>" +
" <timer name='reminder' " +
" duedate='0 seconds' " +
// " repeat='10 business minutes'" +
" transition='timer fires' />" +
" <transition name='timer fires' to='async'/>" +
" <transition name='normal continuation' to='end'/>" +
" </state>" +
" <node name='async' async='true'>" +
" <transition to='timed'/>" +
" </node>" +
" <end-state name='end' />" +
"</process-definition>"
);
processDefinition = saveAndReload(processDefinition);
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
jbpmContext.save(processInstance);
commitAndCloseSession();
SchedulerThread schedulerThread = new SchedulerThread(jbpmConfiguration);
schedulerThread.executeTimers();
beginSessionTransaction();
}
}