[jboss-user] [JBoss jBPM] - Does AssignmentHandler work within the start node??
ardavan
do-not-reply at jboss.com
Tue Nov 25 17:03:41 EST 2008
Hi,
I can't assign the actorid that I want for a simple start node:
As a test case I am using a simple processdefinition:
| <?xml version="1.0" encoding="UTF-8"?>
| <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="test">
|
| <start-state name="Submission">
| <task name="taskSubmission">
| <assignment class="jbpm.taskmgmt.EmiliAssignmentHandler"></assignment>
| </task>
| <transition to="Evaluate" name="trEvaluate"></transition>
| </start-state>
|
| <task-node name="Evaluate">
| <task name="evaluateTask">
| <assignment class="jbpm.taskmgmt.ManagerAssignmentHandler"></assignment>
| <controller></controller>
| </task>
| <transition to="end" name="trAbort"></transition>
| </task-node>
|
| <end-state name="end">
| <event type=""></event>
| </end-state>
| </process-definition>
|
My issue is within the task: "taskSubmission" f the start node and the class "EmiliAssignmentHandler":
| package jbpm.taskmgmt;
| import org.jbpm.graph.exe.*;
| import org.jbpm.taskmgmt.def.*;
| import org.jbpm.taskmgmt.exe.Assignable;
|
| public class EmiliAssignmentHandler implements AssignmentHandler {
|
| private static final long serialVersionUID = 1L;
| public void assign(Assignable assignable, ExecutionContext executionContext) {
| assignable.setActorId("emili");
| }
| }
|
I run the JUNIT test:
| + the correct imports...
|
| public class TestCase2 extends junit.framework.TestCase {
|
| static JbpmConfiguration jbpmConfiguration =
| JbpmConfiguration.parseResource("jbpm.cfg.xml");
|
| ... variables ...
| public void setUp() {
| ... same as in jbpm examples
| }
|
| public void tearDown() {
| ... same as in jbpm examples
| }
|
| private void newTransaction() {
| ... same as in jbpm examples
| }
|
| private void deployProcess() {
| ... same as in jbpm examples
| }
|
| private TaskInstance createNewProcessInstance() {
| GraphSession graphSession = jbpmContext.getGraphSession();
| ProcessDefinition processDefinition =
| graphSession.findLatestProcessDefinition("test");
| processInstance =
| new ProcessInstance(processDefinition);
| processInstanceId = processInstance.getId();
| contextInstance = processInstance.getContextInstance();
| taskMgmtInstance = processInstance.getTaskMgmtInstance();
| return processInstance.getTaskMgmtInstance().createStartTaskInstance();
| }
|
| public void testStartSubmissionParameters() {
| TaskInstance taskInstance = createNewProcessInstance();
| assertEquals("taskSubmission", taskInstance.getName());
| assertEquals(0, taskInstance.getVariables().size());
| }
|
| public void testSubmissionTask(){
| TaskInstance taskInstance = createNewProcessInstance();
| taskInstance.setActorId("emili");
| taskInstance.end();
| assertEquals("emili", taskInstance.getActorId()); <----WORKS
| List emiliTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("emili");
| assertEquals(0, emiliTasks.size()); <----WORKS
| }
|
| public void testSubmissionNotWorking(){
| // create a task to start the test process
| TaskInstance taskInstance = createNewProcessInstance();
| assertEquals("emili", taskInstance.getActorId()); <----PROBLEM
| taskInstance.end();
| }
| }
|
Why does taskInstance.getActorId() in method testSubmissionTask() equal null where it should be equal to "emili" because of the EmiliAssignmentHandler class in the "taskSubmission" start node ????
thank you for your help
Ardavan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4192287#4192287
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4192287
More information about the jboss-user
mailing list