use of org.jbpm.bpmn2.handler.SendTaskHandler in project jbpm by kiegroup.
the class StandaloneBPMNProcessTest method testMessageEnd.
@Test
public void testMessageEnd() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-MessageEndEvent.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("MessageEndEvent", params);
assertThat(processInstance.getState()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}
use of org.jbpm.bpmn2.handler.SendTaskHandler in project jbpm by kiegroup.
the class EndEventTest method testMessageEnd.
@Test
public void testMessageEnd() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-MessageEndEvent.bpmn2");
StatefulKnowledgeSession 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("MessageEndEvent", params);
assertProcessInstanceCompleted(processInstance);
}
use of org.jbpm.bpmn2.handler.SendTaskHandler in project jbpm by kiegroup.
the class PerProcessInstanceRuntimeManagerTest method testEndMessageEventProcess.
@Test
public void testEndMessageEventProcess() {
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().userGroupCallback(userGroupCallback).addAsset(ResourceFactory.newClassPathResource("events/EndMessageEvent.bpmn2"), ResourceType.BPMN2).registerableItemsFactory(new DefaultRegisterableItemsFactory() {
@Override
public Map<String, WorkItemHandler> getWorkItemHandlers(RuntimeEngine runtime) {
Map<String, WorkItemHandler> handlers = new HashMap<String, WorkItemHandler>();
handlers.putAll(super.getWorkItemHandlers(runtime));
handlers.put("Send Task", new SendTaskHandler());
return handlers;
}
}).get();
manager = RuntimeManagerFactory.Factory.get().newPerProcessInstanceRuntimeManager(environment);
assertNotNull(manager);
// since there is no process instance yet we need to get new session
RuntimeEngine runtime = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
KieSession ksession = runtime.getKieSession();
ProcessInstance pi1 = ksession.startProcess("test-process");
assertEquals(ProcessInstance.STATE_COMPLETED, pi1.getState());
manager.close();
}
Aggregations