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");
}
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);
}
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);
}
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);
}
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);
}
Aggregations