Search in sources :

Example 86 with WorkItem

use of org.kie.api.runtime.process.WorkItem in project jbpm by kiegroup.

the class HumanResourcesHiringTest method testHiringProcess.

@SuppressWarnings("unchecked")
private void testHiringProcess(RuntimeManager manager, Context<?> context) {
    RuntimeEngine runtime = manager.getRuntimeEngine(context);
    KieSession ksession = runtime.getKieSession();
    TaskService taskService = runtime.getTaskService();
    assertNotNull(runtime);
    assertNotNull(ksession);
    ksession.getWorkItemManager().registerWorkItemHandler("EmailService", new WorkItemHandler() {

        @Override
        public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
            manager.completeWorkItem(workItem.getId(), null);
        }

        @Override
        public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    ksession.getWorkItemManager().registerWorkItemHandler("TwitterService", new WorkItemHandler() {

        @Override
        public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
            manager.completeWorkItem(workItem.getId(), null);
        }

        @Override
        public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    ProcessInstance processInstance = ksession.startProcess("hiring");
    Collection<NodeInstanceDesc> activeNodes = runtimeDataService.getProcessInstanceHistoryActive(processInstance.getId(), new QueryContext());
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    Collection<NodeInstanceDesc> completedNodes = runtimeDataService.getProcessInstanceHistoryCompleted(processInstance.getId(), new QueryContext());
    assertNotNull(completedNodes);
    assertEquals(1, completedNodes.size());
    List<TaskSummary> tasks = ((InternalTaskService) taskService).getTasksAssignedByGroup("HR");
    TaskSummary HRInterview = tasks.get(0);
    taskService.claim(HRInterview.getId(), "katy");
    taskService.start(HRInterview.getId(), "katy");
    Map<String, Object> hrOutput = new HashMap<String, Object>();
    hrOutput.put("out_name", "salaboy");
    hrOutput.put("out_age", 29);
    hrOutput.put("out_mail", "salaboy@gmail.com");
    hrOutput.put("out_score", 8);
    taskService.complete(HRInterview.getId(), "katy", hrOutput);
    activeNodes = runtimeDataService.getProcessInstanceHistoryActive(processInstance.getId(), new QueryContext());
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    completedNodes = runtimeDataService.getProcessInstanceHistoryCompleted(processInstance.getId(), new QueryContext());
    assertNotNull(completedNodes);
    assertEquals(2, completedNodes.size());
    assertNotNull(processInstance);
    assertNotNull(tasks);
    assertEquals(1, tasks.size());
    tasks = ((InternalTaskService) taskService).getTasksAssignedByGroup("IT");
    assertNotNull(tasks);
    assertEquals(1, tasks.size());
    TaskSummary techInterview = tasks.get(0);
    Task techInterviewTask = taskService.getTaskById(techInterview.getId());
    Content contentById = taskService.getContentById(techInterviewTask.getTaskData().getDocumentContentId());
    assertNotNull(contentById);
    Map<String, Object> taskContent = (Map<String, Object>) ContentMarshallerHelper.unmarshall(contentById.getContent(), null);
    assertEquals(7, taskContent.size());
    assertEquals("salaboy@gmail.com", taskContent.get("in_mail"));
    assertEquals(29, taskContent.get("in_age"));
    assertEquals("salaboy", taskContent.get("in_name"));
    taskService.claim(techInterview.getId(), "salaboy");
    taskService.start(techInterview.getId(), "salaboy");
    Map<String, Object> techOutput = new HashMap<String, Object>();
    techOutput.put("out_skills", "java, jbpm, drools");
    techOutput.put("out_twitter", "@salaboy");
    techOutput.put("out_score", 8);
    taskService.complete(techInterview.getId(), "salaboy", techOutput);
    activeNodes = runtimeDataService.getProcessInstanceHistoryActive(processInstance.getId(), new QueryContext());
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    completedNodes = runtimeDataService.getProcessInstanceHistoryCompleted(processInstance.getId(), new QueryContext());
    assertNotNull(completedNodes);
    assertEquals(3, completedNodes.size());
    tasks = ((InternalTaskService) taskService).getTasksAssignedByGroup("Accounting");
    assertNotNull(tasks);
    assertEquals(1, tasks.size());
    TaskSummary createProposal = tasks.get(0);
    Task createProposalTask = taskService.getTaskById(createProposal.getId());
    contentById = taskService.getContentById(createProposalTask.getTaskData().getDocumentContentId());
    assertNotNull(contentById);
    taskContent = (Map<String, Object>) ContentMarshallerHelper.unmarshall(contentById.getContent(), null);
    assertEquals(6, taskContent.size());
    assertEquals(8, taskContent.get("in_tech_score"));
    assertEquals(8, taskContent.get("in_hr_score"));
    taskService.claim(createProposal.getId(), "john");
    taskService.start(createProposal.getId(), "john");
    Map<String, Object> proposalOutput = new HashMap<String, Object>();
    proposalOutput.put("out_offering", 10000);
    taskService.complete(createProposal.getId(), "john", proposalOutput);
    activeNodes = runtimeDataService.getProcessInstanceHistoryActive(processInstance.getId(), new QueryContext());
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    completedNodes = runtimeDataService.getProcessInstanceHistoryCompleted(processInstance.getId(), new QueryContext());
    assertNotNull(completedNodes);
    assertEquals(5, completedNodes.size());
    tasks = ((InternalTaskService) taskService).getTasksAssignedByGroup("HR");
    assertNotNull(tasks);
    assertEquals(1, tasks.size());
    TaskSummary signContract = tasks.get(0);
    Task signContractTask = taskService.getTaskById(signContract.getId());
    contentById = taskService.getContentById(signContractTask.getTaskData().getDocumentContentId());
    assertNotNull(contentById);
    taskContent = (Map<String, Object>) ContentMarshallerHelper.unmarshall(contentById.getContent(), null);
    assertEquals(6, taskContent.size());
    assertEquals(10000, taskContent.get("in_offering"));
    assertEquals("salaboy", taskContent.get("in_name"));
    taskService.claim(signContract.getId(), "katy");
    taskService.start(signContract.getId(), "katy");
    Map<String, Object> signOutput = new HashMap<String, Object>();
    signOutput.put("out_signed", true);
    taskService.complete(signContract.getId(), "katy", signOutput);
    activeNodes = runtimeDataService.getProcessInstanceHistoryActive(processInstance.getId(), new QueryContext());
    assertNotNull(activeNodes);
    assertEquals(0, activeNodes.size());
    completedNodes = runtimeDataService.getProcessInstanceHistoryCompleted(processInstance.getId(), new QueryContext());
    assertNotNull(completedNodes);
    assertEquals(8, completedNodes.size());
    int removeAllTasks = ((InternalTaskService) taskService).removeAllTasks();
    logger.debug(">>> Removed Tasks > {}", removeAllTasks);
}
Also used : RuntimeEngine(org.kie.api.runtime.manager.RuntimeEngine) Task(org.kie.api.task.model.Task) HashMap(java.util.HashMap) InternalTaskService(org.kie.internal.task.api.InternalTaskService) TaskService(org.kie.api.task.TaskService) InternalTaskService(org.kie.internal.task.api.InternalTaskService) QueryContext(org.kie.api.runtime.query.QueryContext) WorkItem(org.kie.api.runtime.process.WorkItem) WorkItemHandler(org.kie.api.runtime.process.WorkItemHandler) Content(org.kie.api.task.model.Content) TaskSummary(org.kie.api.task.model.TaskSummary) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkItemManager(org.kie.api.runtime.process.WorkItemManager) NodeInstanceDesc(org.jbpm.services.api.model.NodeInstanceDesc) Map(java.util.Map) HashMap(java.util.HashMap)

Example 87 with WorkItem

use of org.kie.api.runtime.process.WorkItem in project jbpm by kiegroup.

the class ProcessDynamicNodeTest method TODOtestDynamicAsyncActions.

@Test
@Ignore
public void TODOtestDynamicAsyncActions() {
    Reader source = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" + "         xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "         xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-5.0.xsd\"\n" + "         type=\"RuleFlow\" name=\"ruleflow\" id=\"org.drools.dynamic\" package-name=\"org.drools\" >\n" + "\n" + "  <header>\n" + "    <globals>\n" + "      <global identifier=\"list\" type=\"java.util.List\" />\n" + "    </globals>\n" + "  </header>\n" + "\n" + "  <nodes>\n" + "    <start id=\"1\" name=\"Start\" />\n" + "    <dynamic id=\"2\" name=\"DynamicNode\" >\n" + "      <nodes>\n" + "        <workItem id=\"1\" name=\"Work\" >\n" + "          <work name=\"Work\" />\n" + "        </workItem>\n" + "        <actionNode id=\"2\" name=\"Action2\" >\n" + "          <action type=\"expression\" dialect=\"mvel\" >System.out.println(\"Action2\");\n" + "list.add(\"Action2\");</action>\n" + "        </actionNode>\n" + "        <actionNode id=\"3\" name=\"Action3\" >\n" + "          <action type=\"expression\" dialect=\"mvel\" >System.out.println(\"Action3\");\n" + "list.add(\"Action3\");</action>\n" + "        </actionNode>\n" + "      </nodes>\n" + "      <connections>\n" + "        <connection from=\"1\" to=\"3\" />\n" + "      </connections>\n" + "      <in-ports/>\n" + "      <out-ports/>\n" + "    </dynamic>\n" + "    <actionNode id=\"3\" name=\"Action4\" >\n" + "      <action type=\"expression\" dialect=\"mvel\" >System.out.println(\"Action4\");\n" + "list.add(\"Action4\");</action>\n" + "    </actionNode>\n" + "    <end id=\"4\" name=\"End\" />\n" + "  </nodes>\n" + "\n" + "  <connections>\n" + "    <connection from=\"1\" to=\"2\" />\n" + "    <connection from=\"2\" to=\"3\" />\n" + "    <connection from=\"3\" to=\"4\" />\n" + "  </connections>\n" + "</process>");
    builder.addRuleFlow(source);
    for (DroolsError error : builder.getErrors().getErrors()) {
        logger.error(error.toString());
    }
    KieSession ksession = createKieSession(builder.getPackages());
    List<String> list = new ArrayList<String>();
    ksession.setGlobal("list", list);
    TestWorkItemHandler testHandler = new TestWorkItemHandler();
    ksession.getWorkItemManager().registerWorkItemHandler("Work", testHandler);
    ProcessInstance processInstance = (ProcessInstance) ksession.startProcess("org.drools.dynamic");
    assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
    assertEquals(1, list.size());
    WorkItem workItem = testHandler.getWorkItem();
    assertNotNull(workItem);
    ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null);
    assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
    assertEquals(3, list.size());
}
Also used : TestWorkItemHandler(org.jbpm.integrationtests.handler.TestWorkItemHandler) DroolsError(org.drools.compiler.compiler.DroolsError) StringReader(java.io.StringReader) ArrayList(java.util.ArrayList) Reader(java.io.Reader) StringReader(java.io.StringReader) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.jbpm.process.instance.ProcessInstance) WorkflowProcessInstance(org.kie.api.runtime.process.WorkflowProcessInstance) WorkItem(org.kie.api.runtime.process.WorkItem) Ignore(org.junit.Ignore) Test(org.junit.Test) AbstractBaseTest(org.jbpm.test.util.AbstractBaseTest)

Example 88 with WorkItem

use of org.kie.api.runtime.process.WorkItem in project jbpm by kiegroup.

the class ProcessForEachTest method testForEachLargeList.

@Test
public void testForEachLargeList() {
    Reader source = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" + "         xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "         xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-5.0.xsd\"\n" + "         type=\"RuleFlow\" name=\"ForEach\" id=\"org.drools.ForEach\" package-name=\"org.drools\" >\n" + "  <header>\n" + "    <variables>\n" + "      <variable name=\"collection\" >\n" + "        <type name=\"org.jbpm.process.core.datatype.impl.type.ObjectDataType\" className=\"java.util.List\" />\n" + "      </variable>\n" + "    </variables>\n" + "  </header>\n" + "\n" + "  <nodes>\n" + "    <forEach id=\"2\" name=\"ForEach\" variableName=\"item\" collectionExpression=\"collection\" >\n" + "      <nodes>\n" + "        <workItem id=\"1\" name=\"Log\" >\n" + "          <work name=\"Log\" >\n" + "            <parameter name=\"Message\" >\n" + "              <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "            </parameter>\n" + "          </work>\n" + "          <mapping type=\"in\" from=\"item\" to=\"Message\" />" + "        </workItem>\n" + "      </nodes>\n" + "      <connections>\n" + "      </connections>\n" + "      <in-ports>\n" + "        <in-port type=\"DROOLS_DEFAULT\" nodeId=\"1\" nodeInType=\"DROOLS_DEFAULT\" />\n" + "      </in-ports>\n" + "      <out-ports>\n" + "        <out-port type=\"DROOLS_DEFAULT\" nodeId=\"1\" nodeOutType=\"DROOLS_DEFAULT\" />\n" + "      </out-ports>\n" + "    </forEach>\n" + "    <start id=\"1\" name=\"Start\" />\n" + "    <end id=\"3\" name=\"End\" />\n" + "  </nodes>\n" + "\n" + "  <connections>\n" + "    <connection from=\"1\" to=\"2\" />\n" + "    <connection from=\"2\" to=\"3\" />\n" + "  </connections>\n" + "</process>");
    builder.addRuleFlow(source);
    KieSession workingMemory = createKieSession(builder.getPackages());
    final List<String> myList = new ArrayList<String>();
    workingMemory.getWorkItemManager().registerWorkItemHandler("Log", new WorkItemHandler() {

        public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
            String message = (String) workItem.getParameter("Message");
            myList.add(message);
            manager.completeWorkItem(workItem.getId(), null);
        }

        public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
        }
    });
    List<String> collection = new ArrayList<String>();
    for (int i = 0; i < 10000; i++) {
        collection.add(i + "");
    }
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("collection", collection);
    ProcessInstance processInstance = (ProcessInstance) workingMemory.startProcess("org.drools.ForEach", params);
    assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
    assertEquals(10000, myList.size());
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Reader(java.io.Reader) StringReader(java.io.StringReader) WorkItem(org.kie.api.runtime.process.WorkItem) WorkItemHandler(org.kie.api.runtime.process.WorkItemHandler) StringReader(java.io.StringReader) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.jbpm.process.instance.ProcessInstance) WorkItemManager(org.kie.api.runtime.process.WorkItemManager) Test(org.junit.Test) AbstractBaseTest(org.jbpm.test.util.AbstractBaseTest)

Example 89 with WorkItem

use of org.kie.api.runtime.process.WorkItem in project jbpm by kiegroup.

the class ProcessHumanTaskTest method testHumanTaskCancel2.

@Test
public void testHumanTaskCancel2() {
    Reader source = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" + "         xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "         xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-5.0.xsd\"\n" + "         type=\"RuleFlow\" name=\"flow\" id=\"org.drools.humantask\" package-name=\"org.drools\" version=\"1\" >\n" + "\n" + "  <header>\n" + "  </header>\n" + "\n" + "  <nodes>\n" + "    <start id=\"1\" name=\"Start\" />\n" + "    <humanTask id=\"2\" name=\"HumanTask\" >\n" + "      <work name=\"Human Task\" >\n" + "        <parameter name=\"ActorId\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "          <value>John Doe</value>\n" + "        </parameter>\n" + "        <parameter name=\"TaskName\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "          <value>Do something</value>\n" + "        </parameter>\n" + "        <parameter name=\"Priority\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "        </parameter>\n" + "        <parameter name=\"Comment\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "        </parameter>\n" + "      </work>\n" + "      <onExit>\n" + "        <action type=\"expression\" name=\"Cancel\" dialect=\"java\" >((org.jbpm.workflow.instance.NodeInstance) kcontext.getNodeInstance()).cancel();</action>\n" + "      </onExit>\n" + "    </humanTask>\n" + "    <end id=\"3\" name=\"End\" />\n" + "  </nodes>\n" + "\n" + "  <connections>\n" + "    <connection from=\"1\" to=\"2\" />\n" + "    <connection from=\"2\" to=\"3\" />\n" + "  </connections>\n" + "\n" + "</process>");
    builder.addRuleFlow(source);
    KieSession workingMemory = createKieSession(builder.getPackages());
    TestWorkItemHandler handler = new TestWorkItemHandler();
    workingMemory.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
    ProcessInstance processInstance = (ProcessInstance) workingMemory.startProcess("org.drools.humantask");
    assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
    WorkItem workItem = handler.getWorkItem();
    assertNotNull(workItem);
    workingMemory.getWorkItemManager().completeWorkItem(workItem.getId(), null);
    assertFalse(handler.isAborted());
}
Also used : TestWorkItemHandler(org.jbpm.integrationtests.handler.TestWorkItemHandler) StringReader(java.io.StringReader) StringReader(java.io.StringReader) Reader(java.io.Reader) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.jbpm.process.instance.ProcessInstance) WorkItem(org.kie.api.runtime.process.WorkItem) Test(org.junit.Test) AbstractBaseTest(org.jbpm.test.util.AbstractBaseTest)

Example 90 with WorkItem

use of org.kie.api.runtime.process.WorkItem in project jbpm by kiegroup.

the class ProcessHumanTaskTest method testSwimlane.

@Test
public void testSwimlane() {
    Reader source = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" + "         xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "         xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-5.0.xsd\"\n" + "         type=\"RuleFlow\" name=\"flow\" id=\"org.drools.humantask\" package-name=\"org.drools\" version=\"1\" >\n" + "\n" + "  <header>\n" + "    <swimlanes>\n" + "      <swimlane name=\"actor1\" />\n" + "    </swimlanes>\n" + "  </header>\n" + "\n" + "  <nodes>\n" + "    <start id=\"1\" name=\"Start\" />\n" + "    <humanTask id=\"2\" name=\"HumanTask\" swimlane=\"actor1\" >\n" + "      <work name=\"Human Task\" >\n" + "        <parameter name=\"ActorId\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "          <value>John Doe</value>\n" + "        </parameter>\n" + "        <parameter name=\"TaskName\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "          <value>Do something</value>\n" + "        </parameter>\n" + "        <parameter name=\"Priority\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "        </parameter>\n" + "        <parameter name=\"Comment\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "        </parameter>\n" + "      </work>\n" + "      <mapping type=\"out\" from=\"ActorId\" to=\"ActorId\" />" + "    </humanTask>\n" + "    <humanTask id=\"3\" name=\"HumanTask\" swimlane=\"actor1\" >\n" + "      <work name=\"Human Task\" >\n" + "        <parameter name=\"ActorId\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "        </parameter>\n" + "        <parameter name=\"TaskName\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "          <value>Do something else</value>\n" + "        </parameter>\n" + "        <parameter name=\"Priority\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "        </parameter>\n" + "        <parameter name=\"Comment\" >\n" + "          <type name=\"org.jbpm.process.core.datatype.impl.type.StringDataType\" />\n" + "        </parameter>\n" + "      </work>\n" + "      <mapping type=\"out\" from=\"ActorId\" to=\"ActorId\" />" + "    </humanTask>\n" + "    <end id=\"4\" name=\"End\" />\n" + "  </nodes>\n" + "\n" + "  <connections>\n" + "    <connection from=\"1\" to=\"2\" />\n" + "    <connection from=\"2\" to=\"3\" />\n" + "    <connection from=\"3\" to=\"4\" />\n" + "  </connections>\n" + "\n" + "</process>");
    builder.addRuleFlow(source);
    KieSession workingMemory = createKieSession(builder.getPackages());
    TestWorkItemHandler handler = new TestWorkItemHandler();
    workingMemory.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
    ProcessInstance processInstance = (ProcessInstance) workingMemory.startProcess("org.drools.humantask");
    assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
    WorkItem workItem = handler.getWorkItem();
    assertNotNull(workItem);
    assertEquals("Do something", workItem.getParameter("TaskName"));
    assertEquals("John Doe", workItem.getParameter("ActorId"));
    Map<String, Object> results = new HashMap<String, Object>();
    results.put("ActorId", "Jane Doe");
    workingMemory.getWorkItemManager().completeWorkItem(workItem.getId(), results);
    workItem = handler.getWorkItem();
    assertNotNull(workItem);
    assertEquals("Do something else", workItem.getParameter("TaskName"));
    assertEquals("Jane Doe", workItem.getParameter("SwimlaneActorId"));
    workingMemory.getWorkItemManager().completeWorkItem(workItem.getId(), null);
    assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
}
Also used : TestWorkItemHandler(org.jbpm.integrationtests.handler.TestWorkItemHandler) HashMap(java.util.HashMap) StringReader(java.io.StringReader) StringReader(java.io.StringReader) Reader(java.io.Reader) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.jbpm.process.instance.ProcessInstance) WorkItem(org.kie.api.runtime.process.WorkItem) Test(org.junit.Test) AbstractBaseTest(org.jbpm.test.util.AbstractBaseTest)

Aggregations

WorkItem (org.kie.api.runtime.process.WorkItem)174 Test (org.junit.Test)139 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)127 KieBase (org.kie.api.KieBase)110 TestWorkItemHandler (org.jbpm.bpmn2.objects.TestWorkItemHandler)91 WorkflowProcessInstance (org.kie.api.runtime.process.WorkflowProcessInstance)87 HashMap (java.util.HashMap)72 KieSession (org.kie.api.runtime.KieSession)48 WorkItemManager (org.kie.api.runtime.process.WorkItemManager)33 ArrayList (java.util.ArrayList)29 DefaultProcessEventListener (org.kie.api.event.process.DefaultProcessEventListener)27 AbstractBaseTest (org.jbpm.test.util.AbstractBaseTest)26 WorkItemHandler (org.kie.api.runtime.process.WorkItemHandler)22 SystemOutWorkItemHandler (org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler)20 NodeLeftCountDownProcessEventListener (org.jbpm.test.listener.NodeLeftCountDownProcessEventListener)14 TestWorkItemHandler (org.jbpm.persistence.session.objects.TestWorkItemHandler)13 ProcessEventListener (org.kie.api.event.process.ProcessEventListener)13 Map (java.util.Map)11 StringReader (java.io.StringReader)10 InternalKnowledgeBase (org.drools.core.impl.InternalKnowledgeBase)10