use of org.jbpm.test.container.archive.ejbtransactions.ProcessScenario in project jbpm by kiegroup.
the class EJBTransactionsTest method startProcess.
private void startProcess(ProcessEJB ejb) {
TrackingProcessEventListener listener = new TrackingProcessEventListener();
final TestWorkItemHandler wih = new TestWorkItemHandler();
Assertions.assertThat(kbase).isNotNull();
ProcessScenario scenario = new ProcessScenario(kbase, EJBTransactions.PROCESS_DOUBLE_HUMAN_TASKS, null, listener) {
@Override
protected void runScenario(String procId, Map<String, Object> params, KieSession ksession) {
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", wih);
ksession.startProcess(procId, params);
// first task
ksession.getWorkItemManager().completeWorkItem(wih.getWorkItem().getId(), null);
// second task
ksession.getWorkItemManager().completeWorkItem(wih.getWorkItem().getId(), null);
}
};
ejb.startProcess(scenario);
if (scenario.hasErrors()) {
throw new RuntimeException(scenario.getErrors().get(0));
}
TrackingListenerAssert.assertProcessStarted(listener, EJBTransactions.PROCESS_DOUBLE_HUMAN_TASKS);
TrackingListenerAssert.assertTriggeredAndLeft(listener, "Upload Form");
TrackingListenerAssert.assertTriggeredAndLeft(listener, "Approve It");
TrackingListenerAssert.assertProcessCompleted(listener, EJBTransactions.PROCESS_DOUBLE_HUMAN_TASKS);
}
Aggregations