KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > jpdl > exe > JoinDbTest


1 package org.jbpm.jpdl.exe;
2
3 import org.jbpm.db.AbstractDbTestCase;
4 import org.jbpm.graph.def.ProcessDefinition;
5 import org.jbpm.graph.exe.ProcessInstance;
6
7 public class JoinDbTest extends AbstractDbTestCase {
8
9   public void testJoinPersistence() {
10     ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
11       "<process-definition>" +
12       " <start-state>" +
13       " <transition to='f' />" +
14       " </start-state>" +
15       " <fork name='f'>" +
16       " <transition name='a' to='a' />" +
17       " <transition name='b' to='b' />" +
18       " </fork>" +
19       " <state name='a'>" +
20       " <transition to='j' />" +
21       " </state>" +
22       " <state name='b'>" +
23       " <transition to='j' />" +
24       " </state>" +
25       " <join name='j'>" +
26       " <transition to='end' />" +
27       " </join>" +
28       " <end-state name='end'/>" +
29       "</process-definition>"
30     );
31     jbpmSession.getGraphSession().saveProcessDefinition(processDefinition);
32     
33     ProcessInstance processInstance = new ProcessInstance(processDefinition);
34     processInstance.signal();
35     processInstance.findToken("/a").signal();
36
37     processInstance = saveAndReload(processInstance);
38     processInstance.findToken("/b").signal();
39     
40     assertEquals("end", processInstance.getRootToken().getNode().getName());
41     assertEquals("j", processInstance.findToken("/a").getNode().getName());
42     assertEquals("j", processInstance.findToken("/b").getNode().getName());
43   }
44 }
45
Popular Tags