1 package org.jbpm.tutorial.context; 2 3 import junit.framework.TestCase; 4 5 import org.jbpm.context.exe.ContextInstance; 6 import org.jbpm.graph.def.ProcessDefinition; 7 import org.jbpm.graph.exe.ProcessInstance; 8 9 public class ContextTest extends TestCase { 10 11 public void testContext() { 12 ProcessDefinition processDefinition = ProcessDefinition.parseXmlString( 15 "<process-definition>" + 16 " <start-state>" + 17 " <transition to='s' />" + 18 " </start-state>" + 19 " <state name='s'>" + 20 " <transition to='end' />" + 21 " </state>" + 22 " <end-state name='end' />" + 23 "</process-definition>" 24 ); 25 26 ProcessInstance processInstance = 27 new ProcessInstance(processDefinition); 28 29 ContextInstance contextInstance = 32 processInstance.getContextInstance(); 33 34 contextInstance.setVariable("amount", new Integer (500)); 38 contextInstance.setVariable("reason", "i met my deadline"); 39 40 46 processInstance.signal(); 47 48 50 assertEquals(new Integer (500), 51 contextInstance.getVariable("amount")); 52 assertEquals("i met my deadline", 53 contextInstance.getVariable("reason")); 54 } 55 56 } 57 | Popular Tags |