Java Code Examples for org.flowable.engine.HistoryService#deleteHistoricTaskLogEntry()

The following examples show how to use org.flowable.engine.HistoryService#deleteHistoricTaskLogEntry() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HistoryServiceTaskLogTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Test
public void deleteTaskEventLogEntry(TaskService taskService, HistoryService historyService, ManagementService managementService,
        ProcessEngineConfiguration processEngineConfiguration) {
    task = taskService.createTaskBuilder().
            assignee("testAssignee").
            create();

    if (HistoryTestHelper.isHistoricTaskLoggingEnabled(processEngineConfiguration)) {
        List<HistoricTaskLogEntry> taskLogsByTaskInstanceId = historyService.createHistoricTaskLogEntryQuery().taskId(task.getId()).list();
        assertThat(taskLogsByTaskInstanceId).hasSize(1);

        historyService.deleteHistoricTaskLogEntry(taskLogsByTaskInstanceId.get(0).getLogNumber());

        HistoryTestHelper.waitForJobExecutorToProcessAllHistoryJobs(processEngineConfiguration, managementService, 5000, 200);
        taskLogsByTaskInstanceId = historyService.createHistoricTaskLogEntryQuery().taskId(task.getId()).list();
        assertThat(taskLogsByTaskInstanceId).isEmpty();
    }
}
 
Example 2
Source File: HistoryServiceTaskLogTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Test
public void deleteNonExistingTaskEventLogEntry(TaskService taskService, HistoryService historyService,
        ProcessEngineConfiguration processEngineConfiguration) {
    task = taskService.createTaskBuilder().create();

    if (HistoryTestHelper.isHistoricTaskLoggingEnabled(processEngineConfiguration)) {
        // non existing log entry delete should be successful
        historyService.deleteHistoricTaskLogEntry(Long.MIN_VALUE);

        assertThat(historyService.createHistoricTaskLogEntryQuery().taskId(task.getId()).list()).hasSize(1);
    }
}
 
Example 3
Source File: HistoryServiceTaskLogTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Test
public void createCustomTaskEventLog(TaskService taskService, HistoryService historyService, ManagementService managementService,
        ProcessEngineConfiguration processEngineConfiguration) {
    task = taskService.createTaskBuilder().create();

    Date todayDate = new Date();
    HistoricTaskLogEntryBuilder historicTaskLogEntryBuilder = historyService.createHistoricTaskLogEntryBuilder(task);
    historicTaskLogEntryBuilder.timeStamp(todayDate);
    historicTaskLogEntryBuilder.userId("testUser");
    historicTaskLogEntryBuilder.type("customType");
    historicTaskLogEntryBuilder.data("testData");
    historicTaskLogEntryBuilder.create();

    if (HistoryTestHelper.isHistoricTaskLoggingEnabled(processEngineConfiguration)) {
        List<HistoricTaskLogEntry> logEntries = historyService.createHistoricTaskLogEntryQuery().taskId(task.getId()).list();
        assertThat(logEntries).hasSize(2);

        logEntries = historyService.createHistoricTaskLogEntryQuery().taskId(task.getId()).type("customType").list();
        assertThat(logEntries).hasSize(1);
        HistoricTaskLogEntry historicTaskLogEntry = logEntries.get(0);
        assertThat(historicTaskLogEntry.getLogNumber()).isNotNull();
        assertThat(historicTaskLogEntry.getUserId()).isEqualTo("testUser");
        assertThat(historicTaskLogEntry.getTaskId()).isEqualTo(task.getId());
        assertThat(historicTaskLogEntry.getType()).isEqualTo("customType");
        assertThat(simpleDateFormat.format(historicTaskLogEntry.getTimeStamp())).isEqualTo(simpleDateFormat.format(todayDate));
        assertThat(historicTaskLogEntry.getData()).isEqualTo("testData");
        historyService.deleteHistoricTaskLogEntry(historicTaskLogEntry.getLogNumber());
    }
}