KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > graph > def > TransitionDbTest


1 package org.jbpm.graph.def;
2
3 import org.jbpm.db.AbstractDbTestCase;
4
5 public class TransitionDbTest extends AbstractDbTestCase {
6
7   public void testTranisitionName() {
8     ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
9       "<process-definition>" +
10       " <node name='n'>" +
11       " <transition name='t' to='n' />" +
12       " </node>" +
13       "</process-definition>");
14   
15     processDefinition = saveAndReload(processDefinition);
16   
17     Node n = processDefinition.getNode("n");
18     Transition t = (Transition) n.getLeavingTransitionsList().get(0);
19     assertEquals("t", t.getName());
20   }
21
22   public void testTranisitionFrom() {
23     ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
24       "<process-definition>" +
25       " <node name='n'>" +
26       " <transition name='t' to='m' />" +
27       " </node>" +
28       " <node name='m' />" +
29       "</process-definition>");
30   
31     processDefinition = saveAndReload(processDefinition);
32   
33     Node n = processDefinition.getNode("n");
34     Transition t = (Transition) n.getLeavingTransitionsList().get(0);
35     assertSame(n, t.getFrom());
36   }
37
38   public void testTranisitionTo() {
39     ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
40       "<process-definition>" +
41       " <node name='n'>" +
42       " <transition name='t' to='m' />" +
43       " </node>" +
44       " <node name='m' />" +
45       "</process-definition>");
46   
47     processDefinition = saveAndReload(processDefinition);
48   
49     Node n = processDefinition.getNode("n");
50     Node m = processDefinition.getNode("m");
51     Transition t = (Transition) n.getLeavingTransitionsList().get(0);
52     assertSame(m, t.getTo());
53   }
54
55 }
56
Popular Tags