Search in sources :

Example 36 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogQueryTest method testQueryByWorkerId.

@Test
public void testQueryByWorkerId() {
    // given
    List<ExternalTask> taskList = startExternalTaskProcesses(2);
    ExternalTask taskToCheck = taskList.get(1);
    completeExternalTaskWithWorker(taskList.get(0).getId(), "dummyWorker");
    completeExternalTaskWithWorker(taskToCheck.getId(), WORKER_ID);
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().workerId(WORKER_ID).singleResult();
    // then
    assertNotNull(log);
    assertThat(log.getExternalTaskId(), is(taskToCheck.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 37 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogQueryTest method testQueryByErrorMessage.

@Test
public void testQueryByErrorMessage() {
    // given
    List<ExternalTask> taskList = startExternalTaskProcesses(2);
    String errorMessage = "This is an important error!";
    reportExternalTaskFailure(taskList.get(0).getId(), "Dummy error message");
    reportExternalTaskFailure(taskList.get(1).getId(), errorMessage);
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().errorMessage(errorMessage).singleResult();
    // then
    assertNotNull(log);
    assertThat(log.getExternalTaskId(), is(taskList.get(1).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 38 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogQueryTest method testQueryByProcessDefinitionId.

@Test
public void testQueryByProcessDefinitionId() {
    // given
    startExternalTaskProcesses(2);
    String definitionId = retrieveFirstHistoricExternalTaskLog().getProcessDefinitionId();
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().processDefinitionId(definitionId).singleResult();
    // then
    assertNotNull(log);
    assertThat(log.getProcessDefinitionId(), is(definitionId));
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) Test(org.junit.Test)

Example 39 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogQueryTest method testQueryByExecutionIds.

@Test
public void testQueryByExecutionIds() {
    // given
    startExternalTaskProcesses(2);
    HistoricExternalTaskLog taskLog = retrieveFirstHistoricExternalTaskLog();
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().executionIdIn(taskLog.getExecutionId()).singleResult();
    // then
    assertNotNull(log);
    assertThat(log.getId(), is(taskLog.getId()));
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) Test(org.junit.Test)

Example 40 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogQueryTest method testQueryByNonExistingExternalTaskId.

@Test
public void testQueryByNonExistingExternalTaskId() {
    // given
    startExternalTaskProcess();
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().externalTaskId("foo").singleResult();
    // then
    assertNull(log);
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) 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