use of org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogQueryBuilder in project jbpm by kiegroup.
the class AuditQueryTest method intersectQueryBuilderTest.
@Test
public void intersectQueryBuilderTest() {
ProcessInstanceLogQueryBuilder builder = this.processInstanceLogQuery();
builder.intersect();
builder.duration(pilTestData[4].getDuration());
List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList();
assertEquals("duration result", 1, resultList.size());
builder.endDate(pilTestData[5].getEnd());
resultList = builder.build().getResultList();
assertEquals("intersect: duration AND end result", 0, resultList.size());
builder.identity(pilTestData[6].getIdentity());
resultList = builder.build().getResultList();
assertEquals("intersect: duration AND end AND identity result", 0, resultList.size());
}
use of org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogQueryBuilder in project jbpm by kiegroup.
the class AuditQueryTest method unionQueryBuilderTest.
@Test
public void unionQueryBuilderTest() {
ProcessInstanceLogQueryBuilder builder = this.processInstanceLogQuery();
builder.duration(pilTestData[4].getDuration());
List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList();
assertEquals("duration result", 1, resultList.size());
builder.endDate(pilTestData[5].getEnd(), pilTestData[6].getEnd());
resultList = builder.build().getResultList();
assertEquals("union: duration OR end result", 3, resultList.size());
builder.identity(pilTestData[7].getIdentity(), pilTestData[8].getIdentity());
resultList = builder.build().getResultList();
assertEquals("union: duration OR end OR identity result", 5, resultList.size());
}
use of org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogQueryBuilder in project jbpm by kiegroup.
the class AuditQueryTest method intersectUnionQueryBuilderTest.
@Test
public void intersectUnionQueryBuilderTest() {
ProcessInstanceLogQueryBuilder builder = this.processInstanceLogQuery();
builder.duration(pilTestData[0].getDuration(), pilTestData[2].getDuration());
List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> resultList = builder.build().getResultList();
assertEquals("duration result", 3, resultList.size());
builder.intersect().endDate(pilTestData[0].getEnd());
resultList = builder.build().getResultList();
assertEquals("intersect: duration AND end result", 1, resultList.size());
builder.union().processId(pilTestData[10].getProcessId());
resultList = builder.build().getResultList();
assertEquals("intersect/union: duration AND end OR processId result", 1 + 1, resultList.size());
}
use of org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogQueryBuilder 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();
}
}
}
Aggregations