use of org.jbpm.bpmn2.handler.SendTaskHandler in project jbpm by kiegroup.
the class IntermediateEventTest method testMessageIntermediateThrowWithTransformation.
@Test
public void testMessageIntermediateThrowWithTransformation() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-IntermediateThrowEventMessageWithTransformation.bpmn2");
ksession = createKnowledgeSession(kbase);
final StringBuffer messageContent = new StringBuffer();
ksession.getWorkItemManager().registerWorkItemHandler("Send Task", new SendTaskHandler() {
@Override
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
// collect message content for verification
messageContent.append(workItem.getParameter("Message"));
super.executeWorkItem(workItem, manager);
}
});
Map<String, Object> params = new HashMap<String, Object>();
params.put("x", "MyValue");
ProcessInstance processInstance = ksession.startProcess("MessageIntermediateEvent", params);
assertProcessInstanceCompleted(processInstance);
assertThat(messageContent.toString()).isEqualTo("MYVALUE");
}
use of org.jbpm.bpmn2.handler.SendTaskHandler in project jbpm by kiegroup.
the class StandaloneBPMNProcessTest method testSendTask.
@Test
public void testSendTask() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-SendTask.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Send Task", new SendTaskHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("s", "john");
WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("SendTask", params);
assertProcessInstanceCompleted(processInstance.getId(), ksession);
}
use of org.jbpm.bpmn2.handler.SendTaskHandler in project jbpm by kiegroup.
the class ActivityTest method testSendTask.
@Test
public void testSendTask() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-SendTask.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Send Task", new SendTaskHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("s", "john");
WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("SendTask", params);
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.bpmn2.handler.SendTaskHandler in project jbpm by kiegroup.
the class StandaloneBPMNProcessTest method testMessageIntermediateThrow.
@Test
public void testMessageIntermediateThrow() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-IntermediateThrowEventMessage.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Send Task", new SendTaskHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("x", "MyValue");
ProcessInstance processInstance = ksession.startProcess("MessageIntermediateEvent", params);
assertThat(processInstance.getState()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}
use of org.jbpm.bpmn2.handler.SendTaskHandler in project jbpm by kiegroup.
the class IntermediateEventTest method testMessageIntermediateThrow.
@Test
public void testMessageIntermediateThrow() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-IntermediateThrowEventMessage.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Send Task", new SendTaskHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("x", "MyValue");
ProcessInstance processInstance = ksession.startProcess("MessageIntermediateEvent", params);
assertProcessInstanceCompleted(processInstance);
}
Aggregations