Search in sources :

Example 1 with HistoricExternalTaskLog

use of org.camunda.bpm.engine.history.HistoricExternalTaskLog in project camunda-bpm-platform by camunda.

the class ProcessEngineRestServiceTest method createHistoricExternalTaskLogMock.

private void createHistoricExternalTaskLogMock() {
    HistoricExternalTaskLogQuery mockHistoricExternalTaskLogQuery = mock(HistoricExternalTaskLogQuery.class);
    List<HistoricExternalTaskLog> historicExternalTaskLogs = MockProvider.createMockHistoricExternalTaskLogs();
    when(mockHistoricExternalTaskLogQuery.list()).thenReturn(historicExternalTaskLogs);
    when(mockHistoryService.createHistoricExternalTaskLogQuery()).thenReturn(mockHistoricExternalTaskLogQuery);
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) HistoricExternalTaskLogQuery(org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery)

Example 2 with HistoricExternalTaskLog

use of org.camunda.bpm.engine.history.HistoricExternalTaskLog in project camunda-bpm-platform by camunda.

the class HistoricExternalTaskLogResourceImpl method getHistoricExternalTaskLog.

@Override
public HistoricExternalTaskLogDto getHistoricExternalTaskLog() {
    HistoryService historyService = engine.getHistoryService();
    HistoricExternalTaskLog historicExternalTaskLog = historyService.createHistoricExternalTaskLogQuery().logId(id).singleResult();
    if (historicExternalTaskLog == null) {
        throw new InvalidRequestException(Status.NOT_FOUND, "Historic external task log with id " + id + " does not exist");
    }
    return HistoricExternalTaskLogDto.fromHistoricExternalTaskLog(historicExternalTaskLog);
}
Also used : HistoryService(org.camunda.bpm.engine.HistoryService) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog)

Example 3 with HistoricExternalTaskLog

use of org.camunda.bpm.engine.history.HistoricExternalTaskLog in project camunda-bpm-platform by camunda.

the class MockProvider method createMockHistoricExternalTaskLog.

public static HistoricExternalTaskLog createMockHistoricExternalTaskLog(String tenantId) {
    HistoricExternalTaskLog mock = mock(HistoricExternalTaskLog.class);
    when(mock.getId()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ID);
    when(mock.getTimestamp()).thenReturn(DateTimeUtil.parseDate(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_TIMESTAMP));
    when(mock.getExternalTaskId()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_EXTERNAL_TASK_ID);
    when(mock.getTopicName()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_TOPIC_NAME);
    when(mock.getWorkerId()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_WORKER_ID);
    when(mock.getRetries()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_RETRIES);
    when(mock.getPriority()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_PRIORITY);
    when(mock.getErrorMessage()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ERROR_MSG);
    when(mock.getActivityId()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ACTIVITY_ID);
    when(mock.getActivityInstanceId()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ACTIVITY_INSTANCE_ID);
    when(mock.getExecutionId()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_EXECUTION_ID);
    when(mock.getProcessInstanceId()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_PROC_INST_ID);
    when(mock.getProcessDefinitionId()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_PROC_DEF_ID);
    when(mock.getProcessDefinitionKey()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_PROC_DEF_KEY);
    when(mock.getTenantId()).thenReturn(tenantId);
    when(mock.isCreationLog()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_IS_CREATION_LOG);
    when(mock.isFailureLog()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_IS_FAILURE_LOG);
    when(mock.isSuccessLog()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_IS_SUCCESS_LOG);
    when(mock.isDeletionLog()).thenReturn(EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_IS_DELETION_LOG);
    return mock;
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog)

Example 4 with HistoricExternalTaskLog

use of org.camunda.bpm.engine.history.HistoricExternalTaskLog in project camunda-bpm-platform by camunda.

the class HistoricExternalTaskLogQueryTest method testQueryByDeletionLog.

@Test
public void testQueryByDeletionLog() {
    // given
    ExternalTask task = startExternalTaskProcess();
    runtimeService.deleteProcessInstance(task.getProcessInstanceId(), null);
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().deletionLog().singleResult();
    // then
    assertNotNull(log);
    assertThat(log.getExternalTaskId(), is(task.getId()));
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask) LockedExternalTask(org.camunda.bpm.engine.externaltask.LockedExternalTask) Test(org.junit.Test)

Example 5 with HistoricExternalTaskLog

use of org.camunda.bpm.engine.history.HistoricExternalTaskLog in project camunda-bpm-platform by camunda.

the class HistoricExternalTaskLogQueryTest method testQuery.

@Test
public void testQuery() {
    // given
    ExternalTask task = startExternalTaskProcess();
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().singleResult();
    // then
    assertNotNull(log);
    assertThat(log.getExternalTaskId(), is(task.getId()));
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask) LockedExternalTask(org.camunda.bpm.engine.externaltask.LockedExternalTask) Test(org.junit.Test)

Aggregations

HistoricExternalTaskLog (org.camunda.bpm.engine.history.HistoricExternalTaskLog)42 Test (org.junit.Test)37 ExternalTask (org.camunda.bpm.engine.externaltask.ExternalTask)19 LockedExternalTask (org.camunda.bpm.engine.externaltask.LockedExternalTask)12 HistoricExternalTaskLogQuery (org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery)3 HistoryService (org.camunda.bpm.engine.HistoryService)2 ArrayList (java.util.ArrayList)1 HistoricExternalTaskLogDto (org.camunda.bpm.engine.rest.dto.history.HistoricExternalTaskLogDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1 Before (org.junit.Before)1