How to write a JUnit test case to test custom workitemhandler implementation in jBPM 6 ?

Solution Unverified - Updated -

Issue

  • There is a custom woritemhanlder implementation which is developed in jBPM 6 . Users would need to write JUnit test cases to test it's functionality (e.g. complete a task) separately. Is there any sample JUnit test case to the requirements on this woritemhanlder as listed below?
public class SimpleWoritemHandler extends
        AbstractLogOrThrowWorkItemHandler {

        public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {

        Map<String, Object> params = workItem.getParameters();
        Map<String, Object> results = new HashMap<String, Object>();
        ...
        }

@Override
    public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {

    }
...

}

Requirements.

(1) Excecute and test the executeWorkItem(...) method from a JUnit test case.
(2) Pass dummy WorkItem and WorkItemManager parameters from the JUnit test case.

  • Also, how to write a JUnit test case which would be able to test the sample workitemhandler implementation which is declared inside kmodule.xml file instead of registering it through jBPM 6 API (i.e. registerWorkItemHandler(String, WorkItemHandler)) ?

Environment

  • Red Hat JBoss BPM Suite (BPMS)
    • 6.0.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.