Search in sources :

Example 6 with SignallingTaskHandlerDecorator

use of org.jbpm.bpmn2.handler.SignallingTaskHandlerDecorator in project jbpm by kiegroup.

the class EventSubprocessTest method testErrorCodeException.

@Test
@BZ("1082111")
public void testErrorCodeException() {
    KieSession ksession = createKSession(ERROR_CODE_EXCEPTION);
    ksession.getWorkItemManager().registerWorkItemHandler("Request Handler", new SignallingTaskHandlerDecorator(ExceptionOnPurposeHandler.class, "Error-90277"));
    ksession.getWorkItemManager().registerWorkItemHandler("Error Handler", new SystemOutWorkItemHandler());
    try {
        ProcessInstance processInstance = ksession.startProcess(ERROR_CODE_EXCEPTION_ID);
        assertProcessInstanceNotActive(processInstance.getId(), ksession);
        Assertions.assertThat(((WorkflowProcessInstance) processInstance).getOutcome()).isEqualTo("90277");
    } catch (WorkflowRuntimeException e) {
        fail("Error code exceptions in subprocess does not work.");
    }
}
Also used : SystemOutWorkItemHandler(org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler) SignallingTaskHandlerDecorator(org.jbpm.bpmn2.handler.SignallingTaskHandlerDecorator) KieSession(org.kie.api.runtime.KieSession) WorkflowProcessInstance(org.jbpm.workflow.instance.WorkflowProcessInstance) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkflowRuntimeException(org.jbpm.workflow.instance.WorkflowRuntimeException) WorkflowProcessInstance(org.jbpm.workflow.instance.WorkflowProcessInstance) Test(org.junit.Test) BZ(qa.tools.ikeeper.annotation.BZ)

Aggregations

SignallingTaskHandlerDecorator (org.jbpm.bpmn2.handler.SignallingTaskHandlerDecorator)6 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)5 HashMap (java.util.HashMap)4 KieSession (org.kie.api.runtime.KieSession)3 SystemOutWorkItemHandler (org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler)2 WorkflowProcessInstance (org.jbpm.workflow.instance.WorkflowProcessInstance)2 Test (org.junit.Test)2 RuntimeManager (org.kie.api.runtime.manager.RuntimeManager)2 WorkItem (org.kie.api.runtime.process.WorkItem)2 WorkflowProcessInstance (org.kie.api.runtime.process.WorkflowProcessInstance)2 ExceptionOnPurposeHandler (org.jbpm.bpmn2.objects.ExceptionOnPurposeHandler)1 TestWorkItemHandler (org.jbpm.bpmn2.objects.TestWorkItemHandler)1 WorkflowRuntimeException (org.jbpm.workflow.instance.WorkflowRuntimeException)1 KieBase (org.kie.api.KieBase)1 BZ (qa.tools.ikeeper.annotation.BZ)1