[jboss-user] [jBPM] - JUnit ProcessTest - groups are ignored?

Pascal S do-not-reply at jboss.com
Fri Jan 6 09:07:59 EST 2012


Pascal S [http://community.jboss.org/people/spascal] created the discussion

"JUnit ProcessTest - groups are ignored?"

To view the discussion, visit: http://community.jboss.org/message/645055#645055

--------------------------------------------------------------
Hi,

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. ;-)

{code}
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() {
        super(true);
    }

    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>();    

    @Test
    public void testProcess() {
        GROUP_LIST_1.add(GROUP_1);
        GROUP_LIST_2.add(GROUP_2);
        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);
        ksession.dispose();
    }
}
{code}

jBPM 5.2 with the jBPM 5.2 Eclipse Plug-In

regards
Pascal
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/645055#645055]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120106/97b26210/attachment-0001.html 


More information about the jboss-user mailing list