Search in sources :

Example 26 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogTest method testErrorMessageTruncation.

@Test
public void testErrorMessageTruncation() {
    // given
    String exceptionMessage = createStringOfLength(1000);
    ExternalTask task = startExternalTaskProcess();
    reportExternalTaskFailure(task.getId(), exceptionMessage, ERROR_DETAILS);
    // when
    HistoricExternalTaskLog failedLog = historyService.createHistoricExternalTaskLogQuery().failureLog().singleResult();
    String errorMessage = failedLog.getErrorMessage();
    String expectedErrorMessage = exceptionMessage.substring(0, ExternalTaskEntity.MAX_EXCEPTION_MESSAGE_LENGTH);
    // then
    assertNotNull(failedLog);
    assertEquals(ExternalTaskEntity.MAX_EXCEPTION_MESSAGE_LENGTH, errorMessage.length());
    assertEquals(expectedErrorMessage, errorMessage);
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask) Test(org.junit.Test)

Example 27 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogTest method testErrorDetailsWithTwoDifferentErrorsThrown.

@Test
public void testErrorDetailsWithTwoDifferentErrorsThrown() {
    // given
    ExternalTask task = startExternalTaskProcess();
    String firstErrorDetails = "Dummy error details!";
    String secondErrorDetails = ERROR_DETAILS;
    reportExternalTaskFailure(task.getId(), ERROR_MESSAGE, firstErrorDetails);
    ensureEnoughTimePassedByForTimestampOrdering();
    reportExternalTaskFailure(task.getId(), ERROR_MESSAGE, secondErrorDetails);
    // when
    List<HistoricExternalTaskLog> list = historyService.createHistoricExternalTaskLogQuery().failureLog().orderByTimestamp().asc().list();
    String firstFailedLogId = list.get(0).getId();
    String secondFailedLogId = list.get(1).getId();
    // then
    String stacktrace1 = historyService.getHistoricExternalTaskLogErrorDetails(firstFailedLogId);
    String stacktrace2 = historyService.getHistoricExternalTaskLogErrorDetails(secondFailedLogId);
    assertNotNull(stacktrace1);
    assertNotNull(stacktrace2);
    assertEquals(firstErrorDetails, stacktrace1);
    assertEquals(secondErrorDetails, stacktrace2);
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask) Test(org.junit.Test)

Example 28 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogQueryTest method testQueryByNonExistingTopicName.

@Test
public void testQueryByNonExistingTopicName() {
    // given
    startExternalTaskProcess();
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().topicName("foo bar").singleResult();
    // then
    assertNull(log);
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) Test(org.junit.Test)

Example 29 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogQueryTest method testQueryByNonExistingExecutionIds.

@Test
public void testQueryByNonExistingExecutionIds() {
    // given
    startExternalTaskProcess();
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().executionIdIn("foo").singleResult();
    // then
    assertNull(log);
}
Also used : HistoricExternalTaskLog(org.camunda.bpm.engine.history.HistoricExternalTaskLog) Test(org.junit.Test)

Example 30 with HistoricExternalTaskLog

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

the class HistoricExternalTaskLogQueryTest method testQueryByNonExistingActivityInstanceIds.

@Test
public void testQueryByNonExistingActivityInstanceIds() {
    // given
    startExternalTaskProcess();
    // when
    HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().activityInstanceIdIn("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