KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > context > exe > TransientVariableTest


1 package org.jbpm.context.exe;
2
3 import org.jbpm.context.def.*;
4 import org.jbpm.graph.def.*;
5 import org.jbpm.graph.exe.*;
6
7 import junit.framework.*;
8
9 public class TransientVariableTest extends TestCase {
10
11   ProcessDefinition processDefinition = null;
12   ContextInstance contextInstance = null;
13   
14   public void setUp() {
15     processDefinition = new ProcessDefinition();
16     processDefinition.addDefinition(new ContextDefinition());
17     contextInstance = new ProcessInstance(processDefinition).getContextInstance();
18   }
19   
20   public void testSetTransientVariable() {
21     contextInstance.setTransientVariable("t", new Integer JavaDoc(3));
22   }
23
24   public void testGetTransientVariable() {
25     contextInstance.setTransientVariable("t", new Integer JavaDoc(3));
26     assertEquals(new Integer JavaDoc(3), contextInstance.getTransientVariable("t"));
27   }
28
29   public void testGetUnpersistableTransientVariable() {
30     Thread JavaDoc t = new Thread JavaDoc();
31     contextInstance.setTransientVariable("t", t);
32     assertSame(t, contextInstance.getTransientVariable("t"));
33   }
34 }
35
Popular Tags