Tasks are completed /released without intervention
--------------------------------------------------
Key: JBPM-2690
URL:
https://jira.jboss.org/jira/browse/JBPM-2690
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Runtime Engine
Environment: JBPM 4.3, jdk1.5.0_06
Reporter: Tim Johnson
In the following process - Task A is manually completed in the test, the subsequent
decision is fired routing to Task B (request.status == MODIFY). Task B is completed by the
process engine before the task is picked up and completed by the assignee. The assignee
never receives the task.
PROCESS
<?xml version="1.0" encoding="UTF-8"?>
<process name="test"
xmlns="http://jbpm.org/4.0/jpdl">
<swimlane candidate-groups="role-a" name="role a"/>
<start g="103,217,48,48" name="start1">
<transition g="-25,-18" name="start" to="A"/>
</start>
<task g="268,216,92,52" name="A" swimlane="role
a">
<transition g="-32,-19" name="to exclusive1"
to="exclusive1"/>
</task>
<decision g="446,217,48,48" name="exclusive1">
<transition g="-24,-18" name="to B" to="B">
<condition expr="#{request.status=="MODIFY"}"/>
</transition>
<transition g="-42,-18" name="to end1"
to="end1">
<condition
expr="#{request.status=="COMPLETE"}"/>
</transition>
</decision>
<task assignee="#{request.submitter}" g="423,78,92,52"
name="B">
<transition g="314,103:-25,-18" name="to A"
to="A"/>
</task>
<end g="631,219,48,48" name="end1"/>
</process>
REQUEST
package org.jbpm.examples.problem;
import java.io.Serializable;
public class Request implements Serializable {
public String getSubmitter() {
return submitter;
}
public void setSubmitter(String submitter) {
this.submitter = submitter;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
private String submitter;
private String status;
}
TEST
package org.jbpm.examples.problem;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.jbpm.api.IdentityService;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
public class ProblemTest extends JbpmTestCase {
String deploymentId;
protected void setUp() throws Exception {
super.setUp();
identityService = processEngine.get(IdentityService.class);
identityService.createUser("johntim", "Tim",
"Johnson");
identityService.createUser("davrbob", "Bobby",
"Davro");
String roleA = identityService.createGroup("role-a");
identityService.createMembership("davrbob", roleA, "approver");
deploymentId = repositoryService.createDeployment()
.addResourceFromClasspath("org/jbpm/examples/problem/test.jpdl.xml")
.deploy();
}
protected void tearDown() throws Exception {
repositoryService.deleteDeploymentCascade(deploymentId);
super.tearDown();
}
public void testProblem() {
Map<String, Object> variables = new HashMap<String, Object>();
Request req = new Request();
req.setSubmitter("johntim");
req.setStatus("MODIFY");
variables.put("request", req);
ProcessInstance processInstance =
executionService.startProcessInstanceByKey("test", variables);
assertTrue(processInstance.isActive("A"));
/* =============================================== */
/* Complete TASK A */
/* =============================================== */
List<Task> taskList = taskService.findGroupTasks("davrbob");
assertEquals("Expected a single task in davrbob's group task list", 1,
taskList.size());
Task task = taskList.get(0);
String taskId = task.getId();
taskService.takeTask(taskId, "davrbob");
Request request = (Request)taskService.getVariable(taskId, "request");
// Set the status used in the decision
request.setStatus("MODIFY");
Map vars = new HashMap();
vars.put("request", request);
taskService.setVariables(taskId, vars);
taskService.completeTask(taskId);
assertTrue(processInstance.isActive("B"));
// Doesn't get this far A is active
/* =============================================== */
/* Complete TASK B */
/* =============================================== */
taskList = taskService.findPersonalTasks("johntim");
assertEquals("Expected a single task in johntim's personal task list",
1, taskList.size());
task = taskList.get(0);
taskId = task.getId();
//taskService.setVariables(taskId, vars);
taskService.completeTask(taskId);
assertTrue(processInstance.isActive("A"));
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira