Search in sources :

Example 21 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogTest method testHistoricExternalTaskLogSuccessfulProperties.

@Test
public void testHistoricExternalTaskLogSuccessfulProperties() {
    // given
    ExternalTask task = startExternalTaskProcess();
    completeExternalTask(task.getId());
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().successLog().singleResult();
    // then
    assertHistoricLogPropertiesAreProperlySet(task, log);
    assertEquals(WORKER_ID, log.getWorkerId());
    assertLogIsInSuccessfulState(log);
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask) Test(org.junit.Test)

Example 22 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogRestServiceInteractionTest method setUpRuntimeData.

@Before
public void setUpRuntimeData() {
    mockQuery = mock(HistoricExternalTaskLogQuery.class);
    HistoricExternalTaskLog mockedHistoricExternalTaskLog = MockProvider.createMockHistoricExternalTaskLog();
    when(mockQuery.singleResult()).thenReturn(mockedHistoricExternalTaskLog);
    when(mockQuery.logId(MockProvider.EXAMPLE_HISTORIC_EXTERNAL_TASK_LOG_ID)).thenReturn(mockQuery);
    mockHistoryService = mock(HistoryService.class);
    when(mockHistoryService.createHistoricExternalTaskLogQuery()).thenReturn(mockQuery);
    namedProcessEngine = getProcessEngine(MockProvider.EXAMPLE_PROCESS_ENGINE_NAME);
    when(namedProcessEngine.getHistoryService()).thenReturn(mockHistoryService);
}
Also used : HistoryService(org.camunda.bpm.engine.HistoryService) HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) HistoricExternalTaskLogQuery(org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery) Before(org.junit.Before)

Example 23 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogRestServiceImpl method queryHistoricExternalTaskLogs.

@Override
public List<HistoricExternalTaskLogDto> queryHistoricExternalTaskLogs(HistoricExternalTaskLogQueryDto queryDto, Integer firstResult, Integer maxResults) {
    queryDto.setObjectMapper(objectMapper);
    HistoricExternalTaskLogQuery query = queryDto.toQuery(processEngine);
    List<HistoricExternalTaskLog> matchingHistoricExternalTaskLogs;
    if (firstResult != null || maxResults != null) {
        matchingHistoricExternalTaskLogs = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        matchingHistoricExternalTaskLogs = query.list();
    }
    List<HistoricExternalTaskLogDto> results = new ArrayList<HistoricExternalTaskLogDto>();
    for (HistoricExternalTaskLog historicExternalTaskLog : matchingHistoricExternalTaskLogs) {
        HistoricExternalTaskLogDto result = HistoricExternalTaskLogDto.fromHistoricExternalTaskLog(historicExternalTaskLog);
        results.add(result);
    }
    return results;
}
Also used : ArrayList(java.util.ArrayList) HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) HistoricExternalTaskLogQuery(org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery) HistoricExternalTaskLogDto(org.camunda.bpm.engine.rest.dto.history.HistoricExternalTaskLogDto)

Example 24 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogTest method testHistoricExternalTaskLogFailedProperties.

@Test
public void testHistoricExternalTaskLogFailedProperties() {
    // given
    ExternalTask task = startExternalTaskProcess();
    reportExternalTaskFailure(task.getId());
    task = externalTaskService.createExternalTaskQuery().singleResult();
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().failureLog().singleResult();
    // then
    assertHistoricLogPropertiesAreProperlySet(task, log);
    assertEquals(WORKER_ID, log.getWorkerId());
    assertLogIsInFailedState(log);
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask) Test(org.junit.Test)

Example 25 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogTest method testHistoricExternalTaskLogCreateProperties.

@Test
public void testHistoricExternalTaskLogCreateProperties() {
    // given
    ExternalTask task = startExternalTaskProcess();
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().creationLog().singleResult();
    // then
    assertHistoricLogPropertiesAreProperlySet(task, log);
    assertEquals(null, log.getWorkerId());
    assertLogIsInCreatedState(log);
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask) 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