0 Replies Latest reply on Jan 6, 2012 9:07 AM by Pascal S

    JUnit ProcessTest - groups are ignored?

    Pascal S Newbie



      I have written a simple JUnit test with two HumanTasks and two Groups, but I think the test ignores groups.

      I use in the test a different goupname as i have define in the processdefinition, but the has test pased.:-(


      I would be very happy If someone can test my test. ;-)



      package de.akquinet.jbpm5demo.myWorkflow.testing.examples;


      import java.util.ArrayList;

      import java.util.List;


      import org.drools.runtime.StatefulKnowledgeSession;

      import org.jbpm.task.TaskService;

      import org.jbpm.test.JbpmJUnitTestCase;

      import org.jbpm.workflow.instance.WorkflowProcessInstance;

      import org.junit.Test;


      public class MySimpleTwoHumanTaskTwoGroupsExample extends JbpmJUnitTestCase {


          private static final String PROCESS_FILE_NAME = "mySimpleTwoHumanTaskTwoGroupsExample.bpmn";

          private static final String PROCESS_ID = "mySimpleTwoHumanTaskTwoGroupsExample";


          public MySimpleTwoHumanTaskTwoGroupsExample() {




          private static final String USER_1 = "user1";

          private static final String USER_2 = "user2";


          private static final String GROUP_1 = "blubb"; //not the same groupname as in the processdefinition

          private static final String GROUP_2 = "group2";


          private static final List<String> GROUP_LIST_1 = new ArrayList<String>();

          private static final List<String> GROUP_LIST_2 = new ArrayList<String>();   



          public void testProcess() {



              StatefulKnowledgeSession ksession = createKnowledgeSession(PROCESS_FILE_NAME);

              TaskService taskService = getTaskService(ksession);

              WorkflowProcessInstance processInstance  = (WorkflowProcessInstance) ksession.startProcess(PROCESS_ID);

              assertProcessInstanceActive(processInstance.getId(), ksession);


              assertNodeTriggered(processInstance.getId(), "StartProcess");


              assertNodeTriggered(processInstance.getId(), "Human Task 1");

              long taskId =taskService.getTasksAssignedAsPotentialOwner(USER_1, GROUP_LIST_1, "en-UK").get(0).getId();

              taskService.claim(taskId, USER_1, GROUP_LIST_1);

              taskService.start(taskId, USER_1);       

              taskService.complete(taskId, USER_1, null);



              assertNodeTriggered(processInstance.getId(), "Human Task 2");

              long task2Id = taskService.getTasksAssignedAsPotentialOwner(USER_2, GROUP_LIST_2, "en-UK").get(0).getId();

              taskService.claim(task2Id, USER_2, GROUP_LIST_2);

              taskService.start(task2Id, USER_2);       

              taskService.complete(task2Id, USER_2, null);       


              assertProcessInstanceCompleted(processInstance.getId(), ksession);






      jBPM 5.2 with the jBPM 5.2 Eclipse Plug-In