ProcessInstanceLog log = result.get(result.size() - 1); log.setOutcome(processCompletedEvent.getOutcome()); log.setStatus(processCompletedEvent.getStatus()); log.setEnd(processCompletedEvent.getEnd()); log.setDuration(processCompletedEvent.getDuration());
protected boolean assertProcessInstanceState(int state, ProcessInstance processInstance) { if (sessionPersistence) { ProcessInstanceLog log = logService.findProcessInstance(processInstance.getId()); if (log != null) { return log.getStatus() == state; } } else { return processInstance.getState() == state; } return false; }
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);
@Test public void testDeleteProcessInstanceInfoLogByStatus() { int status = pilTestData[5].getStatus(); ProcessInstanceLogDeleteBuilder updateBuilder = this.processInstanceLogDelete().status(status); int result = updateBuilder.build().execute(); assertEquals(1, result); }
assertEquals("Process instance id", log.getProcessInstanceId().longValue(), processInstance.getId()); assertEquals("Process id", log.getProcessId(), processInstance.getProcessId()); assertEquals("Status", log.getStatus().intValue(), ProcessInstance.STATE_ACTIVE );
break; case 9: testData[i-1].setStatus(testData[i].getStatus()); break; case 10:
int status = pilTestData[p++].getStatus(); builder = this.processInstanceLogQuery().status(status); resultList = builder.build().getResultList();
break; case 9: testData[i-1].setStatus(testData[i].getStatus()); break; case 10:
protected boolean assertProcessInstanceState(int state, ProcessInstance processInstance) { if (sessionPersistence) { ProcessInstanceLog log = logService.findProcessInstance(processInstance.getId()); if (log != null) { return log.getStatus() == state; } } else { return processInstance.getState() == state; } return false; }
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);
@Test public void testDeleteProcessInstanceInfoLogByStatus() { int status = pilTestData[5].getStatus(); ProcessInstanceLogDeleteBuilder updateBuilder = this.processInstanceLogDelete().status(status); int result = updateBuilder.build().execute(); assertEquals(1, result); }
/** * Simple test to verify that application is operational even without context factory defined. */ @Test public void testSimpleTaskInvocation() throws Exception { RuntimeManager manager = getManager(); AuditLogService logService = getLogService(); RuntimeEngine engine = getEngine(); KieSession ksession = getKieSession(); ProcessInstance processInstance = ksession.startProcess(SAMPLE_HELLO_PROCESS_ID); System.out.println("Process started"); ProcessInstanceLog instanceLog = logService.findProcessInstance(processInstance.getId()); assertNotNull(instanceLog); assertEquals(ProcessInstance.STATE_ACTIVE, instanceLog.getStatus().intValue()); ksession.abortProcessInstance(processInstance.getId()); System.out.println("Process instance aborted"); instanceLog = logService.findProcessInstance(processInstance.getId()); assertNotNull(instanceLog); assertEquals(ProcessInstance.STATE_ABORTED, instanceLog.getStatus().intValue()); manager.disposeRuntimeEngine(engine); } }
@Test public void testUserTransaction() throws Exception { UserTransaction ut = (UserTransaction) new InitialContext().lookup( JtaTransactionManager.DEFAULT_USER_TRANSACTION_NAME ); ut.begin(); RuntimeManager manager = getManager(); RuntimeEngine engine = getEngine(); KieSession ksession = getKieSession(); ProcessInstance processInstance = ksession.startProcess(SCRIPT_TASK_PROCESS_ID); ProcessInstanceLog instanceLog = getLogService().findProcessInstance(processInstance.getId()); assertNotNull(instanceLog); assertEquals(ProcessInstance.STATE_COMPLETED, instanceLog.getStatus().intValue()); ut.commit(); manager.disposeRuntimeEngine(engine); } }
/** * Simple test to verify that application is operational even without context factory defined. */ @Test public void testSimpleTaskInvocation() throws Exception { RuntimeManager manager = getManager(); AuditLogService logService = getLogService(); RuntimeEngine engine = getEngine(); KieSession ksession = getKieSession(); ProcessInstance processInstance = ksession.startProcess(SAMPLE_HELLO_PROCESS_ID); System.out.println("Process started"); ProcessInstanceLog instanceLog = logService.findProcessInstance(processInstance.getId()); assertNotNull(instanceLog); assertEquals(ProcessInstance.STATE_ACTIVE, instanceLog.getStatus().intValue()); ksession.abortProcessInstance(processInstance.getId()); System.out.println("Process instance aborted"); instanceLog = logService.findProcessInstance(processInstance.getId()); assertNotNull(instanceLog); assertEquals(ProcessInstance.STATE_ABORTED, instanceLog.getStatus().intValue()); manager.disposeRuntimeEngine(engine); } }
@Test public void testUserTransaction() throws Exception { UserTransaction ut = (UserTransaction) new InitialContext().lookup( JtaTransactionManager.DEFAULT_USER_TRANSACTION_NAME ); ut.begin(); RuntimeManager manager = getManager(); RuntimeEngine engine = getEngine(); KieSession ksession = getKieSession(); ProcessInstance processInstance = ksession.startProcess(SCRIPT_TASK_PROCESS_ID); ProcessInstanceLog instanceLog = getLogService().findProcessInstance(processInstance.getId()); assertNotNull(instanceLog); assertEquals(ProcessInstance.STATE_COMPLETED, instanceLog.getStatus().intValue()); ut.commit(); manager.disposeRuntimeEngine(engine); } }
@Test public void testAuditLog() throws Exception { KieSession ksession = getKieSession(); final ProcessInstance processInstance = ksession.startProcess(SAMPLE_HELLO_PROCESS_ID); RuntimeManager manager = getManager(); RuntimeEngine engine = getEngine(); AuditLogService logService = getLogService(); ProcessInstanceLog instanceLog = logService.findProcessInstance(processInstance.getId()); assertNotNull(instanceLog); assertEquals(ProcessInstance.STATE_ACTIVE, instanceLog.getStatus().intValue()); ksession.abortProcessInstance(processInstance.getId()); instanceLog = logService.findProcessInstance(processInstance.getId()); assertNotNull(instanceLog); assertEquals(ProcessInstance.STATE_ABORTED, instanceLog.getStatus().intValue()); manager.disposeRuntimeEngine(engine); }
@Test public void testAuditLog() throws Exception { KieSession ksession = getKieSession(); final ProcessInstance processInstance = ksession.startProcess(SAMPLE_HELLO_PROCESS_ID); RuntimeManager manager = getManager(); RuntimeEngine engine = getEngine(); AuditLogService logService = getLogService(); ProcessInstanceLog instanceLog = logService.findProcessInstance(processInstance.getId()); assertNotNull(instanceLog); assertEquals(ProcessInstance.STATE_ACTIVE, instanceLog.getStatus().intValue()); ksession.abortProcessInstance(processInstance.getId()); instanceLog = logService.findProcessInstance(processInstance.getId()); assertNotNull(instanceLog); assertEquals(ProcessInstance.STATE_ABORTED, instanceLog.getStatus().intValue()); manager.disposeRuntimeEngine(engine); }