1 package org.jbpm.tutorial.taskmgmt; 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 import org.jbpm.taskmgmt.exe.TaskInstance; 9 10 public class TaskAssignmentTest extends TestCase { 11 12 public void testTaskAssignment() { 13 ProcessDefinition processDefinition = ProcessDefinition.parseXmlString( 19 "<process-definition name='the baby process'>" + 20 " <start-state>" + 21 " <transition name='baby cries' to='t' />" + 22 " </start-state>" + 23 " <task-node name='t'>" + 24 " <task name='change nappy'>" + 25 " <assignment class='org.jbpm.tutorial.taskmgmt.NappyAssignmentHandler' />" + 26 " </task>" + 27 " <transition to='end' />" + 28 " </task-node>" + 29 " <end-state name='end' />" + 30 "</process-definition>" 31 ); 32 33 ProcessInstance processInstance = 35 new ProcessInstance(processDefinition); 36 Token token = processInstance.getRootToken(); 37 38 token.signal(); 41 assertSame(processDefinition.getNode("t"), token.getNode()); 44 45 50 TaskInstance taskInstance = (TaskInstance) 57 processInstance 58 .getTaskMgmtInstance() 59 .getTaskInstances() 60 .iterator().next(); 61 62 assertEquals("papa", taskInstance.getActorId() ); 64 65 taskInstance.end(); 68 71 assertSame(processDefinition.getNode("end"), token.getNode()); 72 } 73 74 } 75 | Popular Tags |