KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > exe > LinkInstanceDbTest


1 package org.jbpm.bpel.exe;
2 import org.jbpm.context.def.ContextDefinition;
3 import org.jbpm.graph.exe.ProcessInstance;
4 import org.jbpm.graph.exe.Token;
5
6 import org.jbpm.bpel.db.AbstractDbTestCase;
7 import org.jbpm.bpel.def.BpelDefinition;
8
9 public class LinkInstanceDbTest extends AbstractDbTestCase {
10   
11   public void testReached() {
12     BpelDefinition processDefinition = new BpelDefinition("definition");
13     processDefinition.addDefinition(new ContextDefinition());
14     graphSession.saveProcessDefinition(processDefinition);
15     ProcessInstance processInstance = new ProcessInstance(processDefinition);
16     Token token = processInstance.getRootToken();
17     LinkInstance.create(token, "linkName").setReached(Boolean.TRUE);
18     
19     processInstance = saveAndReload(processInstance);
20
21     LinkInstance link = LinkInstance.get(processInstance.getRootToken(), "linkName");
22     assertEquals(Boolean.TRUE, link.getReached());
23   }
24
25   public void testToken() {
26     BpelDefinition processDefinition = new BpelDefinition("definition");
27     processDefinition.addDefinition(new ContextDefinition());
28     graphSession.saveProcessDefinition(processDefinition);
29     ProcessInstance processInstance = new ProcessInstance(processDefinition);
30     Token token = processInstance.getRootToken();
31     LinkInstance.create(token, "linkName");
32     
33     processInstance = saveAndReload(processInstance);
34
35     LinkInstance link = LinkInstance.get(processInstance.getRootToken(), "linkName");
36     assertEquals(processInstance.getRootToken(), link.getToken());
37   }
38   
39 }
40
Popular Tags