use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class FlowTest method testMultiInstanceLoopCharacteristicsTaskWithOutputCompletionCondition.
@Test
public void testMultiInstanceLoopCharacteristicsTaskWithOutputCompletionCondition() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-MultiInstanceLoopCharacteristicsTaskWithOutputCmpCond.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
List<String> myList = new ArrayList<String>();
List<String> myListOut = new ArrayList<String>();
myList.add("First Item");
myList.add("Second Item");
params.put("list", myList);
params.put("listOut", myListOut);
assertEquals(0, myListOut.size());
ProcessInstance processInstance = ksession.startProcess("MultiInstanceLoopCharacteristicsTask", params);
assertProcessInstanceCompleted(processInstance);
assertEquals(1, myListOut.size());
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class FlowTest method testMultiInstanceLoopCharacteristicsTaskWithOutputCompletionCondition2.
@Test
public void testMultiInstanceLoopCharacteristicsTaskWithOutputCompletionCondition2() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-MultiInstanceLoopCharacteristicsTaskWithOutputCmpCond2.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
List<String> myList = new ArrayList<String>();
List<String> myListOut = new ArrayList<String>();
myList.add("approved");
myList.add("rejected");
myList.add("approved");
myList.add("approved");
myList.add("rejected");
params.put("list", myList);
params.put("listOut", myListOut);
assertEquals(0, myListOut.size());
ProcessInstance processInstance = ksession.startProcess("MultiInstanceLoopCharacteristicsTask", params);
assertProcessInstanceCompleted(processInstance);
// only two approved outcomes are required to complete multiinstance and since there was reject in between we should have
// three elements in the list
assertEquals(3, myListOut.size());
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class ActivityTest method testServiceTaskInterface.
// JBPM-3951
@Test
public void testServiceTaskInterface() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-ServiceTask.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Service Task", new SystemOutWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("EAID_DP000000_23D3_4e7e_80FE_6D8C0AF83CAA", params);
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class CompensationTest method compensationInvokingSubProcess.
@Test
public void compensationInvokingSubProcess() throws Exception {
KieSession ksession = createKnowledgeSession("compensation/BPMN2-UserTaskCompensation.bpmn2");
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("compensation", "True");
ProcessInstance processInstance = ksession.startProcess("UserTaskCompensation", params);
assertProcessInstanceCompleted(processInstance.getId(), ksession);
assertProcessVarValue(processInstance, "compensation", "compensation");
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class StandaloneBPMNProcessTest method testEvaluationProcess.
@Test
public void testEvaluationProcess() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-EvaluationProcess.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("RegisterRequest", new SystemOutWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("employee", "UserId-12345");
ProcessInstance processInstance = ksession.startProcess("Evaluation", params);
assertThat(processInstance.getState()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}
Aggregations