Search in sources :

Example 1 with InputParameter

use of org.jbpm.bpmn2.handler.LoggingTaskHandlerDecorator.InputParameter in project jbpm by kiegroup.

the class LoggingTaskHandlerWrapperTest method testFormatLoggingError.

@Test
public void testFormatLoggingError() throws Exception {
    KieBase kbase = createKnowledgeBase("BPMN2-ExceptionThrowingServiceProcess.bpmn2");
    ksession = createKnowledgeSession(kbase);
    LoggingTaskHandlerDecorator loggingTaskHandlerWrapper = new LoggingTaskHandlerDecorator(ServiceTaskHandler.class, 2);
    loggingTaskHandlerWrapper.setLoggedMessageFormat("{0} - {1} - {2} - {3}");
    List<InputParameter> inputParameters = new ArrayList<LoggingTaskHandlerDecorator.InputParameter>();
    inputParameters.add(InputParameter.EXCEPTION_CLASS);
    inputParameters.add(InputParameter.WORK_ITEM_ID);
    inputParameters.add(InputParameter.WORK_ITEM_NAME);
    inputParameters.add(InputParameter.PROCESS_INSTANCE_ID);
    loggingTaskHandlerWrapper.setLoggedMessageInput(inputParameters);
    loggingTaskHandlerWrapper.setPrintStackTrace(false);
    ksession.getWorkItemManager().registerWorkItemHandler("Service Task", loggingTaskHandlerWrapper);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("serviceInputItem", "exception message");
    ksession.startProcess("ServiceProcess", params);
    ksession.startProcess("ServiceProcess", params);
    ksession.startProcess("ServiceProcess", params);
}
Also used : HashMap(java.util.HashMap) KieBase(org.kie.api.KieBase) ArrayList(java.util.ArrayList) InputParameter(org.jbpm.bpmn2.handler.LoggingTaskHandlerDecorator.InputParameter) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 InputParameter (org.jbpm.bpmn2.handler.LoggingTaskHandlerDecorator.InputParameter)1 Test (org.junit.Test)1 KieBase (org.kie.api.KieBase)1