@Test @BZ("1188702") public void testDeleteLogsByDate() { kieSession = createKSession(HUMAN_TASK); processInstanceList = startProcess(kieSession, HUMAN_TASK_ID, 4); TaskService taskService = getRuntimeEngine().getTaskService(); // Delete the last two task logs for (int i = processInstanceList.size() - 1; i > 0; i--) { List<Long> taskIdList = taskService.getTasksByProcessInstanceId(processInstanceList.get(i).getId()); Assertions.assertThat(taskIdList).hasSize(1); Task task = taskService.getTaskById(taskIdList.get(0)); Assertions.assertThat(task).isNotNull(); int resultCount = taskAuditService .auditTaskDelete() .date(task.getTaskData().getCreatedOn()) .build() .execute(); Assertions.assertThat(resultCount).isEqualTo(1); } }
private int deleteAuditTaskInstanceLogs(Date startDate, Date endDate) { return taskAuditService .auditTaskDelete() .dateRangeStart(startDate) .dateRangeEnd(endDate) .build() .execute(); }
@Test public void testDeleteLogsByProcessId() { kieSession = createKSession(HUMAN_TASK); processInstanceList = startProcess(kieSession, HUMAN_TASK_ID, 2); int deletedLogs = taskAuditService.auditTaskDelete().processId(HUMAN_TASK_ID).build().execute(); Assertions.assertThat(deletedLogs).isEqualTo(2); Assertions.assertThat(getAllAuditTaskLogs()).hasSize(0); }
@Test public void testDeleteLogsByProcessName() { kieSession = createKSession(HUMAN_TASK); processInstanceList = startProcess(kieSession, HUMAN_TASK_ID, 3); int resultCount = taskAuditService .auditTaskDelete() .processInstanceId( processInstanceList.get(0).getId(), processInstanceList.get(1).getId()) .build() .execute(); Assertions.assertThat(resultCount).isEqualTo(2); TaskService taskService = getRuntimeEngine().getTaskService(); List<Long> taskIdList = taskService.getTasksByProcessInstanceId(processInstanceList.get(2).getId()); Assertions.assertThat(taskIdList).hasSize(1); }