KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > jpdl > patterns > Wfp02ParallelSplitTest


1 package org.jbpm.jpdl.patterns;
2
3 import junit.framework.TestCase;
4
5 import org.jbpm.graph.def.ProcessDefinition;
6 import org.jbpm.graph.exe.ProcessInstance;
7 import org.jbpm.graph.exe.Token;
8
9 /**
10  * http://is.tm.tue.nl/research/patterns/download/swf/pat_2.swf
11  */

12 public class Wfp02ParallelSplitTest extends TestCase {
13
14   public void testParallelSplit() {
15     ProcessDefinition pd = ProcessDefinition.parseXmlString(
16       "<process-definition>" +
17       " <start-state name='start'>" +
18       " <transition to='and' />" +
19       " </start-state>" +
20       " <fork name='and'>" +
21       " <transition name='first' to='a' />" +
22       " <transition name='second' to='b' />" +
23       " </fork>" +
24       " <state name='a'/>" +
25       " <state name='b'/>" +
26       "</process-definition>"
27     );
28
29     ProcessInstance pi = new ProcessInstance( pd );
30     pi.signal();
31     Token root = pi.getRootToken();
32     assertNotNull( root );
33     
34     Token firstToken = root.getChild( "first" );
35     assertNotNull( firstToken );
36     assertSame( pd.getNode("a"), firstToken.getNode() );
37     
38     Token secondToken = root.getChild( "second" );
39     assertNotNull( secondToken );
40     assertSame( pd.getNode("b"), secondToken.getNode() );
41   }
42 }
43
Popular Tags