Search in sources :

Example 21 with HistoricExternalTaskLogQuery

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

the class HistoricExternalTaskLogQuerySortingTest method testQuerySortingByTaskIdAsc.

@Test
public void testQuerySortingByTaskIdAsc() {
    // given
    int taskCount = 10;
    startProcesses(taskCount);
    // when
    HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();
    query.orderByExternalTaskId().asc();
    // then
    verifyQueryWithOrdering(query, taskCount, historicExternalTaskLogByExternalTaskId());
}
Also used : HistoricExternalTaskLogQuery(org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery) Test(org.junit.Test)

Example 22 with HistoricExternalTaskLogQuery

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

the class HistoricExternalTaskLogQuerySortingTest method testQuerySortingByTimestampDsc.

@Test
public void testQuerySortingByTimestampDsc() {
    // given
    int taskCount = 10;
    startProcesses(taskCount);
    // when
    HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();
    query.orderByTimestamp().desc();
    // then
    verifyQueryWithOrdering(query, taskCount, inverted(historicExternalTaskByTimestamp()));
}
Also used : HistoricExternalTaskLogQuery(org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery) Test(org.junit.Test)

Example 23 with HistoricExternalTaskLogQuery

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

the class HistoricExternalTaskLogRestServiceInteractionTest method testHistoricExternalTaskLogGetIdDoesntExist.

@Test
public void testHistoricExternalTaskLogGetIdDoesntExist() {
    String id = "nonExistingId";
    HistoricExternalTaskLogQuery invalidQueryNonExistingHistoricExternalTaskLog = mock(HistoricExternalTaskLogQuery.class);
    when(mockHistoryService.createHistoricExternalTaskLogQuery().logId(id)).thenReturn(invalidQueryNonExistingHistoricExternalTaskLog);
    when(invalidQueryNonExistingHistoricExternalTaskLog.singleResult()).thenReturn(null);
    given().pathParam("id", id).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo("Historic external task log with id " + id + " does not exist")).when().get(SINGLE_HISTORIC_EXTERNAL_TASK_LOG_RESOURCE_URL);
}
Also used : InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) HistoricExternalTaskLogQuery(org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery) Test(org.junit.Test) AbstractRestServiceTest(org.camunda.bpm.engine.rest.AbstractRestServiceTest)

Example 24 with HistoricExternalTaskLogQuery

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

the class HistoricExternalTaskLogRestServiceImpl method queryHistoricExternalTaskLogsCount.

@Override
public CountResultDto queryHistoricExternalTaskLogsCount(HistoricExternalTaskLogQueryDto queryDto) {
    queryDto.setObjectMapper(objectMapper);
    HistoricExternalTaskLogQuery query = queryDto.toQuery(processEngine);
    long count = query.count();
    CountResultDto result = new CountResultDto();
    result.setCount(count);
    return result;
}
Also used : CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) HistoricExternalTaskLogQuery(org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery)

Example 25 with HistoricExternalTaskLogQuery

use of org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery 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)

Aggregations

HistoricExternalTaskLogQuery (org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery)44 Test (org.junit.Test)33 ExternalTask (org.camunda.bpm.engine.externaltask.ExternalTask)4 LockedExternalTask (org.camunda.bpm.engine.externaltask.LockedExternalTask)4 HistoricExternalTaskLog (org.camunda.bpm.engine.history.HistoricExternalTaskLog)2 ArrayList (java.util.ArrayList)1 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricExternalTaskLogDto (org.camunda.bpm.engine.rest.dto.history.HistoricExternalTaskLogDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1