use of org.kie.api.runtime.manager.audit.ProcessInstanceLog in project jbpm by kiegroup.
the class TaskSubjectAndDescriptionTest method testSubjectProperty.
@Test
public void testSubjectProperty() {
ProcessInstance processInstance = kieSession.startProcess(HUMAN_TASK2_ID);
List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
TaskSummary task = list.get(0);
Task t = taskService.getTaskById(task.getId());
Assertions.assertThat(task.getDescription()).isEqualTo(EXPECTED_SUBJECT);
Assertions.assertThat(task.getSubject()).isEqualTo(EXPECTED_SUBJECT);
Assertions.assertThat(t.getSubject()).isEqualTo(EXPECTED_SUBJECT);
taskService.start(task.getId(), "john");
taskService.complete(task.getId(), "john", null);
ProcessInstanceLog plog = getLogService().findProcessInstance(processInstance.getId());
Assertions.assertThat(plog.getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}
use of org.kie.api.runtime.manager.audit.ProcessInstanceLog in project jbpm by kiegroup.
the class TaskSubjectAndDescriptionTest method testSubjectAndDescriptionProperties.
@Test
public void testSubjectAndDescriptionProperties() {
ProcessInstance processInstance = kieSession.startProcess(HUMAN_TASK_ID);
List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
TaskSummary task = list.get(0);
Task t = taskService.getTaskById(task.getId());
Assertions.assertThat(task.getDescription()).isEqualTo("This is description of the human task.");
Assertions.assertThat(task.getSubject()).isEqualTo(EXPECTED_SUBJECT);
Assertions.assertThat(t.getSubject()).isEqualTo(EXPECTED_SUBJECT);
taskService.start(task.getId(), "john");
taskService.complete(task.getId(), "john", null);
ProcessInstanceLog plog = getLogService().findProcessInstance(processInstance.getId());
Assertions.assertThat(plog.getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}
use of org.kie.api.runtime.manager.audit.ProcessInstanceLog in project jbpm by kiegroup.
the class ProcessInstanceLogCleanTest method deleteLogsWithStatusActive.
@Test
public void deleteLogsWithStatusActive() {
KieSession kieSession = null;
List<ProcessInstance> instanceList1 = null;
List<ProcessInstance> instanceList2 = null;
try {
kieSession = createKSession(HELLO_WORLD_PROCESS, HUMAN_TASK);
instanceList1 = startProcess(kieSession, HELLO_WORLD_PROCESS_ID, 3);
instanceList2 = startProcess(kieSession, HUMAN_TASK_ID, 5);
ProcessInstanceLogDeleteBuilder deleteBuilder = auditService.processInstanceLogDelete().status(ProcessInstance.STATE_ACTIVE);
int deleteResult = deleteBuilder.build().execute();
Assertions.assertThat(deleteResult).isEqualTo(5);
ProcessInstanceLogQueryBuilder queryBuilder = auditService.processInstanceLogQuery().status(ProcessInstance.STATE_COMPLETED);
List<ProcessInstanceLog> queryList = queryBuilder.build().getResultList();
Assertions.assertThat(queryList).hasSize(3);
Assertions.assertThat(queryList).extracting("processId").containsExactly(HELLO_WORLD_PROCESS_ID, HELLO_WORLD_PROCESS_ID, HELLO_WORLD_PROCESS_ID);
Assertions.assertThat(queryList).extracting("processVersion").containsExactly("1.0", "1.0", "1.0");
Assertions.assertThat(queryList).extracting("status").containsExactly(ProcessInstance.STATE_COMPLETED, ProcessInstance.STATE_COMPLETED, ProcessInstance.STATE_COMPLETED);
} finally {
if (instanceList2 != null) {
abortProcess(kieSession, instanceList2);
}
if (kieSession != null) {
kieSession.dispose();
}
}
}
use of org.kie.api.runtime.manager.audit.ProcessInstanceLog in project jbpm by kiegroup.
the class ProcessInstanceLogCleanTest method deleteLogsByDateRange.
@Test
@BZ("1192498")
public void deleteLogsByDateRange() throws InterruptedException {
KieSession kieSession = createKSession(PARENT_PROCESS_CALLER, PARENT_PROCESS_INFO, HELLO_WORLD_PROCESS);
Date date1 = new Date();
startProcess(kieSession, PARENT_PROCESS_CALLER_ID, 4);
Date date2 = new Date();
Thread.sleep(1000);
startProcess(kieSession, HELLO_WORLD_PROCESS_ID, 2);
Date date3 = new Date();
int beforeSize = getProcessInstanceLogSize(getYesterday(), getTomorrow());
Assertions.assertThat(beforeSize).isEqualTo(10);
int resultCount = auditService.processInstanceLogDelete().startDateRangeStart(date1).startDateRangeEnd(date2).build().execute();
// 1 for ReussableSubprocess and 1 for ParentProcessInfo called by it
Assertions.assertThat(resultCount).isEqualTo(8);
List<ProcessInstanceLog> resultList = auditService.processInstanceLogQuery().startDateRangeEnd(date3).build().getResultList();
Assertions.assertThat(resultList).hasSize(2).extracting("processId").containsExactly(HELLO_WORLD_PROCESS_ID, HELLO_WORLD_PROCESS_ID);
int afterSize = getProcessInstanceLogSize(date1, date3);
Assertions.assertThat(afterSize).isEqualTo(2);
}
use of org.kie.api.runtime.manager.audit.ProcessInstanceLog in project jbpm by kiegroup.
the class HumanTaskResolver method testConcurrentInvocationsIncludingUserTasks.
@Test(timeout = 10000)
public void testConcurrentInvocationsIncludingUserTasks() throws Exception {
CountDownLatch latch = new CountDownLatch(THREADS);
for (int i = 0; i < THREADS; i++) {
ProcessRunner pr = new ProcessRunner(i, getEmf(), latch);
Thread t = new Thread(pr, i + "-process-runner");
t.start();
}
latch.await();
AuditLogService logService = new JPAAuditLogService(getEmf());
List<? extends ProcessInstanceLog> logs = logService.findProcessInstances("com.sample.humantask.concurrent");
assertEquals(2, logs.size());
for (ProcessInstanceLog log : logs) {
assertEquals(ProcessInstance.STATE_COMPLETED, log.getStatus().intValue());
}
logService.dispose();
}
Aggregations