Search in sources :

Example 1 with ProcessInstanceLogDeleteBuilder

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

the class ProcessInstanceLogCleanTest method deleteLogsByVersion.

@Test
public void deleteLogsByVersion() {
    KieSession kieSession = createKSession(HELLO_WORLD_PROCESS);
    startProcess(kieSession, HELLO_WORLD_PROCESS_ID, 7);
    disposeRuntimeManager();
    kieSession = createKSession(HELLO_WORLD_PROCESS2);
    startProcess(kieSession, HELLO_WORLD_PROCESS2_ID, 2);
    // Delete all logs of version 1.1
    ProcessInstanceLogDeleteBuilder deleteBuilder = auditService.processInstanceLogDelete().processVersion("1.0");
    int deleteResult = deleteBuilder.build().execute();
    Assertions.assertThat(deleteResult).isEqualTo(7);
    // Make sure that the 1.1 version logs are gone
    List<ProcessInstanceLog> resultList = auditService.processInstanceLogQuery().processVersion("1.0").build().getResultList();
    Assertions.assertThat(resultList).hasSize(0);
    // Now check that 1.0 version logs are present
    resultList = auditService.processInstanceLogQuery().processVersion("1.1").build().getResultList();
    Assertions.assertThat(resultList).hasSize(2);
    Assertions.assertThat(resultList).extracting("processVersion").containsExactly("1.1", "1.1");
}
Also used : ProcessInstanceLogDeleteBuilder(org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder) KieSession(org.kie.api.runtime.KieSession) ProcessInstanceLog(org.kie.api.runtime.manager.audit.ProcessInstanceLog) Test(org.junit.Test)

Example 2 with ProcessInstanceLogDeleteBuilder

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

the class AuditDeleteTest method testDeleteProcessInstanceInfoLogByTimestamp.

@Test
public void testDeleteProcessInstanceInfoLogByTimestamp() {
    int p = 0;
    Date endDate = pilTestData[p++].getEnd();
    List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> logs = this.processInstanceLogQuery().endDate(endDate).build().getResultList();
    assertEquals(1, logs.size());
    ProcessInstanceLogDeleteBuilder updateBuilder = this.processInstanceLogDelete().endDate(logs.get(0).getEnd());
    int result = updateBuilder.build().execute();
    assertEquals(1, result);
}
Also used : ProcessInstanceLogDeleteBuilder(org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder) Date(java.util.Date) ProcessInstanceLog(org.jbpm.process.audit.ProcessInstanceLog) AuditLogServiceTest(org.jbpm.process.audit.AuditLogServiceTest) Test(org.junit.Test)

Example 3 with ProcessInstanceLogDeleteBuilder

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

the class AuditDeleteTest method testDeleteProcessInstanceInfoLogByStatus.

@Test
public void testDeleteProcessInstanceInfoLogByStatus() {
    int status = pilTestData[5].getStatus();
    ProcessInstanceLogDeleteBuilder updateBuilder = this.processInstanceLogDelete().status(status);
    int result = updateBuilder.build().execute();
    assertEquals(1, result);
}
Also used : ProcessInstanceLogDeleteBuilder(org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder) AuditLogServiceTest(org.jbpm.process.audit.AuditLogServiceTest) Test(org.junit.Test)

Example 4 with ProcessInstanceLogDeleteBuilder

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

the class AuditDeleteTest method testDeleteProcessInstanceInfoLogByProcessIdAndNotMatchingDate.

@Test
public void testDeleteProcessInstanceInfoLogByProcessIdAndNotMatchingDate() {
    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(0, 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 5 with ProcessInstanceLogDeleteBuilder

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

the class AuditDeleteTest method testDeleteProcessInstanceInfoLogByProcessId.

@Test
public void testDeleteProcessInstanceInfoLogByProcessId() {
    int p = 0;
    String processId = pilTestData[p++].getProcessId();
    String processId2 = pilTestData[p++].getProcessId();
    ProcessInstanceLogDeleteBuilder updateBuilder = this.processInstanceLogDelete().processId(processId, processId2);
    int result = updateBuilder.build().execute();
    assertEquals(2, result);
}
Also used : ProcessInstanceLogDeleteBuilder(org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder) AuditLogServiceTest(org.jbpm.process.audit.AuditLogServiceTest) 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