[jboss-user] [jBPM] New message: "Re: Strange Fork Behavior"

Andre Muniz do-not-reply at jboss.com
Wed Jan 20 15:40:51 EST 2010

User development,

A new message was posted in the thread "Strange Fork Behavior":


Author  : Andre Muniz
Profile : http://community.jboss.org/people/andre.muniz

Sorry, the test really wasn't clear enough. I know task3 is duplicated because I debugged it! 
Here goes the new unit test:
package test2;
import java.util.List;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
public class ForkTest extends JbpmTestCase {
    /** Deployment id. */
    String deploymentId;
     * Set up.
     * @throws Exception exception
    protected void setUp() throws Exception {
        // XML definition
        StringBuilder jpdl = new StringBuilder();
        jpdl.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        jpdl.append("<process key=\"forkTest\" name=\"Fork Test\" xmlns=\"http://jbpm.org/4.3/jpdl\">");
        jpdl.append("   <start g=\"7,137,48,48\" name=\"Lease Termination\">");
        jpdl.append("      <transition g=\"-43,-18\" name=\"to fork1\" to=\"fork1\"/>");
        jpdl.append("   </start>");
        jpdl.append("   <end g=\"841,83,48,48\" name=\"end1\"/>");
        jpdl.append("   <fork g=\"118,140,48,48\" name=\"fork1\">");
        jpdl.append("      <transition g=\"-44,-18\" name=\"to task1\" to=\"task1\"/>");
        jpdl.append("      <transition g=\"-44,-18\" name=\"to task2\" to=\"task2\"/>");
        jpdl.append("   </fork>");
        jpdl.append("   <task candidate-groups=\"leasing\" g=\"231,71,92,52\" name=\"task1\">");
        jpdl.append("      <transition name=\"to join2\" to=\"join2\" g=\"-41,-18\"/>");
        jpdl.append("   </task>");
        jpdl.append("   <task candidate-groups=\"leasing\" g=\"230,225,92,52\" name=\"task2\">");
        jpdl.append("      <transition name=\"to fork2\" to=\"fork2\" g=\"-43,-18\"/>");
        jpdl.append("   </task>");
        jpdl.append("   <task candidate-groups=\"leasing\" g=\"507,188,92,52\" name=\"task3\">");
        jpdl.append("      <transition g=\"-41,-18\" name=\"to join1\" to=\"join1\"/>");
        jpdl.append("   </task>");
        jpdl.append("   <task candidate-groups=\"leasing\" g=\"511,306,92,52\" name=\"task4\">");
        jpdl.append("      <transition g=\"-41,-18\" name=\"to join1\" to=\"join1\"/>");
        jpdl.append("   </task>");
        jpdl.append("   <join g=\"653,244,48,48\" name=\"join1\">");
        jpdl.append("      <transition g=\"-44,-18\" name=\"to task5\" to=\"task5\"/>");
        jpdl.append("   </join>");
        jpdl.append("   <task candidate-groups=\"leasing\" g=\"781,237,92,52\" name=\"task5\">");
        jpdl.append("      <transition g=\"-41,-18\" name=\"to join2\" to=\"join2\"/>");
        jpdl.append("   </task>");
        jpdl.append("   <join g=\"674,80,48,48\" name=\"join2\">");
        jpdl.append("      <transition g=\"-42,-18\" name=\"to end1\" to=\"end1\"/>");
        jpdl.append("   </join>");
        jpdl.append("   <fork g=\"402,232,48,48\" name=\"fork2\">");
        jpdl.append("      <transition g=\"-44,-18\" name=\"to task3\" to=\"task3\"/>");
        jpdl.append("      <transition g=\"-44,-18\" name=\"to task4\" to=\"task4\"/>");
        jpdl.append("   </fork>");
        // Deploys the process
        deploymentId =
                repositoryService.createDeployment().addResourceFromString("forkTest.jpdl.xml", jpdl.toString())
     * Tear down.
     * @throws Exception exception
    protected void tearDown() throws Exception {
     * Tests the process.
    public void testProcess() {
        // Starts a new process instance
        // Gets the pending tasks (task1 and task2)
        List < Task > taskList = taskService.createTaskQuery().list();
        assertEquals(2, taskList.size());
        assertContainsTask(taskList, "task1");
        assertContainsTask(taskList, "task2");
        // Completes task1 and task2
        // Gets the pending tasks (task3 and task4)
        taskList = taskService.createTaskQuery().list();
        // At this point we should have 2 pending tasks ([0] = task3, [1] = task4)
        // But the following tests shows that the taskList collection contains 3 pending tasks ([0] = task3, [1] = task4, [2] = task3)
        assertEquals(3, taskList.size());
        assertEquals("task3", taskList.get(0).getName());
        assertEquals("task4", taskList.get(1).getName());
        assertEquals("task3", taskList.get(2).getName());
        // This should be the right result, but it's where the test is breaking now
        // Failure Trace: "expected:<2> but was:<3>"
        assertEquals(2, taskList.size());
        assertEquals("task3", taskList.get(0).getName());
        assertEquals("task4", taskList.get(1).getName());


To reply to this message visit the message page: http://community.jboss.org/message/521203#521203

More information about the jboss-user mailing list