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);
}
Aggregations