public Void execute(Context cntxt) { setLogEnvironment(cntxt); this.auditLogService.clear(); return null; }
protected void clearHistory() { if (sessionPersistence) { try { if (logService != null) { logService.clear(); } } catch(Exception e) { log.error("History could not be deleted.", e); } } else { if (logger != null) { logger.clear(); } } }
@After public void tearDown() throws Exception { if (session != null) { session.dispose(); } session = null; auditLogService.clear(); auditLogService = null; cleanUp(context); System.clearProperty("org.jbpm.var.log.length"); }
@After public void tearDown() throws Exception { session.dispose(); auditLogService.clear(); session = null; auditLogService = null; cleanUp(context); }
Assertions.assertThat(nodeInstance.getDate()).isNotNull(); auditLogService.clear(); processInstances = auditLogService.findProcessInstances("com.sample.ruleflow"); Assertions.assertThat(processInstances).isEmpty();
Assertions.assertThat(nodeInstance.getDate()).isNotNull(); auditLogService.clear(); processInstances = auditLogService.findProcessInstances("com.sample.ruleflow"); Assertions.assertThat(processInstances).isEmpty();
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(nodeInstance.getDate()).isNotNull(); logService.clear(); processInstances = logService.findProcessInstances("com.sample.ruleflow"); logService.dispose();
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(); }
Assertions.assertThat(variableInstance.getDate()).isNotNull(); auditLogService.clear(); processInstances = auditLogService.findProcessInstances("com.sample.ruleflow3"); Assertions.assertThat(processInstances).isNullOrEmpty();
Assertions.assertThat(nodeInstance.getDate()).isNotNull(); logService.clear(); processInstances = logService.findProcessInstances("com.sample.ruleflow"); logService.dispose();
Assertions.assertThat(varLog.getValue()).isEqualTo(varValue); auditLogService.clear(); processInstances = auditLogService.findProcessInstances("com.sample.ruleflow3"); Assertions.assertThat(processInstances).isEmpty();
Assertions.assertThat(varLog.getValue()).isEqualTo(varValue); auditLogService.clear(); processInstances = auditLogService.findProcessInstances("com.sample.ruleflow3"); Assertions.assertThat(processInstances).isEmpty();
@BeforeClass public static void setup() throws Exception { setUpDataSource(); // clear logs Environment env = EnvironmentFactory.newEnvironment(); env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf); logService = new JPAAuditLogService(env); logService.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(); }
Assertions.assertThat(variableIds).contains("list[0]", "list[1]", "list[2]"); logService.clear(); processInstances = logService.findProcessInstances("com.sample.ruleflow3"); logService.dispose();
Assertions.assertThat(var.getVariableInstanceId()).isEqualTo("s"); logService.clear(); processInstances = logService.findProcessInstances("com.sample.ruleflow3"); logService.dispose();
Assertions.assertThat(varLog.getValue()).isEqualTo(varValue); auditLogService.clear(); processInstances = auditLogService.findProcessInstances("com.sample.ruleflow3"); Assertions.assertThat(processInstances).isEmpty();
@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(); }
@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(); }