Search in sources :

Example 6 with ProcessInstanceLogDeleteBuilder

use of org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder in project jbpm by kiegroup.

the class AuditDeleteTest method testDeleteProcessInstanceInfoLogByDateRangeStart.

@Test
public void testDeleteProcessInstanceInfoLogByDateRangeStart() {
    Date endDate = pilTestData[8].getEnd();
    ProcessInstanceLogDeleteBuilder updateBuilder = this.processInstanceLogDelete().endDateRangeStart(endDate);
    int result = updateBuilder.build().execute();
    assertEquals(3, result);
}
Also used : ProcessInstanceLogDeleteBuilder(org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder) Date(java.util.Date) AuditLogServiceTest(org.jbpm.process.audit.AuditLogServiceTest) Test(org.junit.Test)

Example 7 with ProcessInstanceLogDeleteBuilder

use of org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder in project jbpm by kiegroup.

the class AuditDeleteTest method testDeleteProcessInstanceInfoLogByProcessIdAndDate.

@Test
public void testDeleteProcessInstanceInfoLogByProcessIdAndDate() {
    int p = 0;
    String processId = pilTestData[p].getProcessId();
    Date endDate = pilTestData[p].getEnd();
    ProcessInstanceLogDeleteBuilder updateBuilder = this.processInstanceLogDelete().endDate(endDate).processId(processId);
    int result = updateBuilder.build().execute();
    assertEquals(1, result);
}
Also used : ProcessInstanceLogDeleteBuilder(org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder) Date(java.util.Date) AuditLogServiceTest(org.jbpm.process.audit.AuditLogServiceTest) Test(org.junit.Test)

Example 8 with ProcessInstanceLogDeleteBuilder

use of org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder in project jbpm by kiegroup.

the class AuditDeleteTest method testDeleteProcessInstanceInfoLogByDate.

@Test
public void testDeleteProcessInstanceInfoLogByDate() {
    int p = 0;
    Date endDate = pilTestData[p++].getEnd();
    ProcessInstanceLogDeleteBuilder updateBuilder = this.processInstanceLogDelete().endDate(endDate);
    int result = updateBuilder.build().execute();
    assertEquals(1, result);
}
Also used : ProcessInstanceLogDeleteBuilder(org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder) Date(java.util.Date) AuditLogServiceTest(org.jbpm.process.audit.AuditLogServiceTest) Test(org.junit.Test)

Example 9 with ProcessInstanceLogDeleteBuilder

use of org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder in project jbpm by kiegroup.

the class AuditDeleteTest method testDeleteProcessInstanceInfoLogByDateRangeEnd.

@Test
public void testDeleteProcessInstanceInfoLogByDateRangeEnd() {
    Date endDate = pilTestData[4].getEnd();
    ProcessInstanceLogDeleteBuilder updateBuilder = this.processInstanceLogDelete().endDateRangeEnd(endDate);
    int result = updateBuilder.build().execute();
    assertEquals(5, result);
}
Also used : ProcessInstanceLogDeleteBuilder(org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder) Date(java.util.Date) AuditLogServiceTest(org.jbpm.process.audit.AuditLogServiceTest) Test(org.junit.Test)

Example 10 with ProcessInstanceLogDeleteBuilder

use of org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder 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();
        }
    }
}
Also used : ProcessInstanceLogDeleteBuilder(org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) ProcessInstanceLogQueryBuilder(org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogQueryBuilder) ProcessInstanceLog(org.kie.api.runtime.manager.audit.ProcessInstanceLog) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)10 ProcessInstanceLogDeleteBuilder (org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder)10 AuditLogServiceTest (org.jbpm.process.audit.AuditLogServiceTest)8 Date (java.util.Date)6 KieSession (org.kie.api.runtime.KieSession)2 ProcessInstanceLog (org.kie.api.runtime.manager.audit.ProcessInstanceLog)2 ProcessInstanceLog (org.jbpm.process.audit.ProcessInstanceLog)1 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)1 ProcessInstanceLogQueryBuilder (org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogQueryBuilder)1