use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class AsyncAuditLogProducerTest method createSession.
public KieSession createSession(KieBase kbase, Environment env) {
KieSession session = createKieSession(kbase, env);
session.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
return session;
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class AbstractAuditLogServiceTest method runTestLogger5.
public static void runTestLogger5(KieSession session, AuditLogService auditLogService) throws Exception {
session.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
// record the initial count to compare to later
List<ProcessInstanceLog> processInstances = auditLogService.findProcessInstances("com.sample.ruleflow");
int initialProcessInstanceSize = processInstances.size();
// start process instance
long processInstanceId = session.startProcess("com.sample.ruleflow").getId();
logger.debug("Checking process instances for process 'com.sample.ruleflow'");
processInstances = auditLogService.findProcessInstances("com.sample.ruleflow");
Assertions.assertThat(processInstances.size()).isEqualTo(initialProcessInstanceSize + 1);
ProcessInstanceLog processInstance = processInstances.get(initialProcessInstanceSize);
logger.debug("{} -> {} - {}", processInstance.toString(), processInstance.getStart(), processInstance.getEnd());
Assertions.assertThat(processInstance.getStart()).isNotNull();
Assertions.assertThat(processInstance.getEnd()).isNotNull();
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId);
Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow");
Assertions.assertThat(processInstance.getStatus().intValue()).isEqualTo(ProcessInstance.STATE_COMPLETED);
List<NodeInstanceLog> nodeInstances = auditLogService.findNodeInstances(processInstanceId);
Assertions.assertThat(nodeInstances.size()).isEqualTo(6);
for (NodeInstanceLog nodeInstance : nodeInstances) {
logger.debug(nodeInstance.toString());
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId);
Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow");
Assertions.assertThat(nodeInstance.getDate()).isNotNull();
}
auditLogService.clear();
processInstances = auditLogService.findProcessInstances("com.sample.ruleflow");
Assertions.assertThat(processInstances).isEmpty();
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class AbstractAuditLogServiceTest method runTestLogger1.
public static void runTestLogger1(KieSession session, AuditLogService auditLogService) throws Exception {
session.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
// record the initial count to compare to later
List<ProcessInstanceLog> processInstances = auditLogService.findProcessInstances("com.sample.ruleflow");
int initialProcessInstanceSize = processInstances.size();
// start process instance
long processInstanceId = session.startProcess("com.sample.ruleflow").getId();
logger.debug("Checking process instances for process 'com.sample.ruleflow'");
processInstances = auditLogService.findProcessInstances("com.sample.ruleflow");
Assertions.assertThat(processInstances.size()).isEqualTo(initialProcessInstanceSize + 1);
ProcessInstanceLog processInstance = processInstances.get(initialProcessInstanceSize);
logger.debug("{} -> {} - {}", processInstance.toString(), processInstance.getStart(), processInstance.getEnd());
Assertions.assertThat(processInstance.getStart()).isNotNull();
Assertions.assertThat(processInstance.getEnd()).isNotNull().withFailMessage("ProcessInstanceLog does not contain end date.");
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId);
Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow");
List<NodeInstanceLog> nodeInstances = auditLogService.findNodeInstances(processInstanceId);
Assertions.assertThat(nodeInstances.size()).isEqualTo(6);
for (NodeInstanceLog nodeInstance : nodeInstances) {
logger.debug(nodeInstance.toString());
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId);
Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow");
Assertions.assertThat(nodeInstance.getDate()).isNotNull();
}
auditLogService.clear();
processInstances = auditLogService.findProcessInstances("com.sample.ruleflow");
Assertions.assertThat(processInstances).isEmpty();
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class WorkingMemoryDbLoggerWithSeparateLoggingEmfTest method startProcess.
@Override
public ProcessInstance startProcess(String processName) {
if (ksession == null) {
KieBase kbase = createKnowledgeBase();
Environment env = createEnvironment(context);
ksession = createKieSession(kbase, env);
ksession.addEventListener(new JPAWorkingMemoryDbLogger(emf));
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
}
return ksession.startProcess(processName);
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class IntermediateEventTest method testIntermediateCatchEventSignalWithRef.
@Test
public void testIntermediateCatchEventSignalWithRef() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-IntermediateCatchEventSignalWithRef.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent");
assertProcessInstanceActive(processInstance);
ksession = restoreSession(ksession, true);
// now signal process instance
ksession.signalEvent("Signal1", "SomeValue", processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
assertNodeTriggered(processInstance.getId(), "StartProcess", "UserTask", "EndProcess", "event");
}
Aggregations