public static void runTestLogger3(KieSession session, AuditLogService auditLogService) { 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.ruleflow2").getId(); logger.debug("Checking process instances for process 'com.sample.ruleflow2'"); processInstances = auditLogService.findProcessInstances("com.sample.ruleflow2"); 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.ruleflow2"); List<NodeInstanceLog> nodeInstances = auditLogService.findNodeInstances(processInstanceId); for (NodeInstanceLog nodeInstance: nodeInstances) { logger.debug("{} -> {}", nodeInstance.toString(), nodeInstance.getDate()); Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId); Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow2"); Assertions.assertThat(nodeInstance.getDate()).isNotNull(); } Assertions.assertThat(nodeInstances.size()).isEqualTo(14); auditLogService.clear(); }
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);
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(processInstances.size()).isEqualTo(expected).withFailMessage(String.format("Expected %d ProcessInstanceLog instances, not %d", expected, processInstances.size())); 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);
public static void runTestLogger2(KieSession session, AuditLogService auditLogService) { 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 session.startProcess("com.sample.ruleflow"); session.startProcess("com.sample.ruleflow"); logger.debug("Checking process instances for process 'com.sample.ruleflow'"); processInstances = auditLogService.findProcessInstances("com.sample.ruleflow"); Assertions.assertThat(processInstances.size()).isEqualTo(initialProcessInstanceSize + 2); for (ProcessInstanceLog processInstance: processInstances) { logger.debug("{} -> {} - {}", processInstance.toString(), processInstance.getStart(), processInstance.getEnd()); List<NodeInstanceLog> nodeInstances = auditLogService.findNodeInstances(processInstance.getProcessInstanceId()); for (NodeInstanceLog nodeInstance: nodeInstances) { logger.debug("{} -> {}",nodeInstance.toString(), nodeInstance.getDate()); } Assertions.assertThat(nodeInstances.size()).isEqualTo(6); } auditLogService.clear(); }
@Override public AuditEvent buildEvent(ProcessCompletedEvent pce, Object log) { ProcessInstanceImpl pi = (ProcessInstanceImpl) pce.getProcessInstance(); ProcessInstanceLog logEvent = null; if (log != null) { logEvent = (ProcessInstanceLog) log; } else { logEvent = new ProcessInstanceLog(pi.getId(), pi.getProcessId()); } logEvent.setOutcome(pi.getOutcome()); logEvent.setStatus(pi.getState()); logEvent.setEnd(pce.getEventDate()); logEvent.setDuration(logEvent.getEnd().getTime() - logEvent.getStart().getTime()); logEvent.setProcessInstanceDescription( pi.getDescription() ); logEvent.setSlaCompliance(pi.getSlaCompliance()); return logEvent; }
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(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(processInstances.size()).isEqualTo(initialProcessInstanceSize + 1); ProcessInstanceLog processInstance = processInstances.get(initialProcessInstanceSize); logger.debug("{} -> {} - {}", processInstance.toString(), processInstance.getStart(), processInstance.getEnd()); Assertions.assertThat(processInstance.getStart()).isNotNull();
@Test public void testLogger2() { // start process instance startProcess("com.sample.ruleflow"); startProcess("com.sample.ruleflow"); logger.debug("Checking process instances for process 'com.sample.ruleflow'"); List<ProcessInstanceLog> processInstances = logService.findProcessInstances("com.sample.ruleflow"); assertEquals(2, processInstances.size()); for (ProcessInstanceLog processInstance: processInstances) { logger.debug("{}", processInstance); logger.debug(" -> {} - {}", processInstance.getStart(), processInstance.getEnd()); List<NodeInstanceLog> nodeInstances = logService.findNodeInstances(processInstance.getProcessInstanceId()); for (NodeInstanceLog nodeInstance: nodeInstances) { logger.debug("{}", nodeInstance); logger.debug(" -> {}", nodeInstance.getDate()); } assertEquals(6, nodeInstances.size()); assertRuleFlowSampleLogsSorting(nodeInstances, processInstance.getProcessInstanceId()); } logService.clear(); }
@Test public void testLogger3() { long processInstanceId = startProcess("com.sample.ruleflow2").getId(); logger.debug("Checking process instances for process 'com.sample.ruleflow2'"); List<ProcessInstanceLog> processInstances = logService.findProcessInstances("com.sample.ruleflow2"); assertEquals(1, processInstances.size()); ProcessInstanceLog processInstance = processInstances.get(0); logger.debug("{}", processInstance); logger.debug(" -> {} - {} ", processInstance.getStart(), processInstance.getEnd()); assertNotNull(processInstance.getStart()); assertNotNull(processInstance.getEnd()); assertEquals(processInstanceId, processInstance.getProcessInstanceId().longValue()); assertEquals("com.sample.ruleflow2", processInstance.getProcessId()); List<NodeInstanceLog> nodeInstances = logService.findNodeInstances(processInstanceId); for (NodeInstanceLog nodeInstance: nodeInstances) { logger.debug("{}", nodeInstance); logger.debug(" -> {}", nodeInstance.getDate()); assertEquals(processInstanceId, processInstance.getProcessInstanceId().longValue()); assertEquals("com.sample.ruleflow2", processInstance.getProcessId()); assertNotNull(nodeInstance.getDate()); } assertEquals(14, nodeInstances.size()); logService.clear(); }
ProcessInstanceLog processInstance = processInstances.get(initialProcessInstanceSize); logger.debug( "{} -> {} - {}",processInstance.toString(), processInstance.getStart(), processInstance.getEnd()); assertNotNull(processInstance.getStart()); assertNotNull("ProcessInstanceLog does not contain end date.", processInstance.getEnd()); assertEquals(processInstanceId, processInstance.getProcessInstanceId().longValue());
@Test public void testLogger1() { // start process instance long processInstanceId = startProcess("com.sample.ruleflow").getId(); logger.debug("Checking process instances for process 'com.sample.ruleflow'"); List<ProcessInstanceLog> processInstances = logService.findProcessInstances("com.sample.ruleflow"); assertEquals(1, processInstances.size()); ProcessInstanceLog processInstance = processInstances.get(0); logger.debug("{}", processInstance); assertNotNull(processInstance.getStart()); assertNotNull(processInstance.getEnd()); assertEquals(processInstanceId, processInstance.getProcessInstanceId().longValue()); assertEquals("com.sample.ruleflow", processInstance.getProcessId()); List<NodeInstanceLog> nodeInstances = logService.findNodeInstances(processInstanceId); assertEquals(6, nodeInstances.size()); for (NodeInstanceLog nodeInstance: nodeInstances) { logger.debug("{}", nodeInstance); assertEquals(processInstanceId, processInstance.getProcessInstanceId().longValue()); assertEquals("com.sample.ruleflow", processInstance.getProcessId()); assertNotNull(nodeInstance.getDate()); } assertRuleFlowSampleLogsSorting(nodeInstances, processInstanceId); logService.clear(); }
break; case 8: testData[i-1].setStart(testData[i].getStart()); break; case 9:
Date start = pilTestData[p++].getStart(); builder = this.processInstanceLogQuery().startDate(start); resultList = builder.build().getResultList();
break; case 8: testData[i-1].setStart(testData[i].getStart()); break; case 9:
System.out.println("Process Instance: "+pi.getProcessName() + " - Version: "+pi.getProcessVersion() + " - Started at: "+pi.getStart());
public static void runTestLogger2(KieSession session, AuditLogService auditLogService) { 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 session.startProcess("com.sample.ruleflow"); session.startProcess("com.sample.ruleflow"); logger.debug("Checking process instances for process 'com.sample.ruleflow'"); processInstances = auditLogService.findProcessInstances("com.sample.ruleflow"); Assertions.assertThat(processInstances.size()).isEqualTo(initialProcessInstanceSize + 2); for (ProcessInstanceLog processInstance: processInstances) { logger.debug("{} -> {} - {}", processInstance.toString(), processInstance.getStart(), processInstance.getEnd()); List<NodeInstanceLog> nodeInstances = auditLogService.findNodeInstances(processInstance.getProcessInstanceId()); for (NodeInstanceLog nodeInstance: nodeInstances) { logger.debug("{} -> {}",nodeInstance.toString(), nodeInstance.getDate()); } Assertions.assertThat(nodeInstances.size()).isEqualTo(6); } auditLogService.clear(); }
@Test public void testLogger2() { // start process instance startProcess("com.sample.ruleflow"); startProcess("com.sample.ruleflow"); logger.debug("Checking process instances for process 'com.sample.ruleflow'"); List<ProcessInstanceLog> processInstances = logService.findProcessInstances("com.sample.ruleflow"); assertEquals(2, processInstances.size()); for (ProcessInstanceLog processInstance: processInstances) { logger.debug("{}", processInstance); logger.debug(" -> {} - {}", processInstance.getStart(), processInstance.getEnd()); List<NodeInstanceLog> nodeInstances = logService.findNodeInstances(processInstance.getProcessInstanceId()); for (NodeInstanceLog nodeInstance: nodeInstances) { logger.debug("{}", nodeInstance); logger.debug(" -> {}", nodeInstance.getDate()); } assertEquals(6, nodeInstances.size()); assertRuleFlowSampleLogsSorting(nodeInstances, processInstance.getProcessInstanceId()); } logService.clear(); }
@Test public void testLogger1() { // start process instance long processInstanceId = startProcess("com.sample.ruleflow").getId(); logger.debug("Checking process instances for process 'com.sample.ruleflow'"); List<ProcessInstanceLog> processInstances = logService.findProcessInstances("com.sample.ruleflow"); assertEquals(1, processInstances.size()); ProcessInstanceLog processInstance = processInstances.get(0); logger.debug("{}", processInstance); assertNotNull(processInstance.getStart()); assertNotNull(processInstance.getEnd()); assertEquals(processInstanceId, processInstance.getProcessInstanceId().longValue()); assertEquals("com.sample.ruleflow", processInstance.getProcessId()); List<NodeInstanceLog> nodeInstances = logService.findNodeInstances(processInstanceId); assertEquals(6, nodeInstances.size()); for (NodeInstanceLog nodeInstance: nodeInstances) { logger.debug("{}", nodeInstance); assertEquals(processInstanceId, processInstance.getProcessInstanceId().longValue()); assertEquals("com.sample.ruleflow", processInstance.getProcessId()); assertNotNull(nodeInstance.getDate()); } assertRuleFlowSampleLogsSorting(nodeInstances, processInstanceId); logService.clear(); }