Search in sources :

Example 1 with HistoricJobLog

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

the class ProcessEngineRestServiceTest method createHistoricJobLogMock.

private void createHistoricJobLogMock() {
    HistoricJobLogQuery mockHistoricJobLogQuery = mock(HistoricJobLogQuery.class);
    List<HistoricJobLog> historicJobLogs = MockProvider.createMockHistoricJobLogs();
    when(mockHistoricJobLogQuery.list()).thenReturn(historicJobLogs);
    when(mockHistoryService.createHistoricJobLogQuery()).thenReturn(mockHistoricJobLogQuery);
}
Also used : HistoricJobLogQuery(org.camunda.bpm.engine.history.HistoricJobLogQuery) HistoricJobLog(org.camunda.bpm.engine.history.HistoricJobLog)

Example 2 with HistoricJobLog

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

the class HistoricJobLogResourceImpl method getHistoricJobLog.

public HistoricJobLogDto getHistoricJobLog() {
    HistoryService historyService = engine.getHistoryService();
    HistoricJobLog historicJobLog = historyService.createHistoricJobLogQuery().logId(id).singleResult();
    if (historicJobLog == null) {
        throw new InvalidRequestException(Status.NOT_FOUND, "Historic job log with id " + id + " does not exist");
    }
    return HistoricJobLogDto.fromHistoricJobLog(historicJobLog);
}
Also used : HistoricJobLog(org.camunda.bpm.engine.history.HistoricJobLog) HistoryService(org.camunda.bpm.engine.HistoryService) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException)

Example 3 with HistoricJobLog

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

the class HistoryCleanupHistoricBatchTest method findExceptionByteArrayIds.

private List<String> findExceptionByteArrayIds() {
    List<String> exceptionByteArrayIds = new ArrayList<String>();
    List<HistoricJobLog> historicJobLogs = historyService.createHistoricJobLogQuery().list();
    for (HistoricJobLog historicJobLog : historicJobLogs) {
        HistoricJobLogEventEntity historicJobLogEventEntity = (HistoricJobLogEventEntity) historicJobLog;
        if (historicJobLogEventEntity.getExceptionByteArrayId() != null) {
            exceptionByteArrayIds.add(historicJobLogEventEntity.getExceptionByteArrayId());
        }
    }
    return exceptionByteArrayIds;
}
Also used : HistoricJobLog(org.camunda.bpm.engine.history.HistoricJobLog) ArrayList(java.util.ArrayList) HistoricJobLogEventEntity(org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogEventEntity)

Example 4 with HistoricJobLog

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

the class BatchModificationHistoryTest method testHistoricMonitorJobLogForBatchDeletion.

@Test
public void testHistoricMonitorJobLogForBatchDeletion() {
    ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
    Batch batch = helper.startAfterAsync("process1", 1, "user1", processDefinition.getId());
    helper.executeSeedJob(batch);
    // when
    Date deletionDate = helper.addSecondsToClock(12);
    rule.getManagementService().deleteBatch(batch.getId(), false);
    // then a deletion historic job log was added
    HistoricJobLog jobLog = helper.getHistoricMonitorJobLog(batch).get(1);
    assertNotNull(jobLog);
    assertTrue(jobLog.isDeletionLog());
    assertEquals(deletionDate, jobLog.getTimestamp());
}
Also used : HistoricJobLog(org.camunda.bpm.engine.history.HistoricJobLog) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Date(java.util.Date) Test(org.junit.Test)

Example 5 with HistoricJobLog

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

the class BatchModificationHistoryTest method testHistoricSeedJobLogForBatchDeletion.

@Test
public void testHistoricSeedJobLogForBatchDeletion() {
    ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
    Batch batch = helper.startBeforeAsync("process1", 1, "user1", processDefinition.getId());
    // when
    Date deletionDate = helper.addSecondsToClock(12);
    rule.getManagementService().deleteBatch(batch.getId(), false);
    // then a deletion historic job log was added
    HistoricJobLog jobLog = helper.getHistoricSeedJobLog(batch).get(1);
    assertNotNull(jobLog);
    assertTrue(jobLog.isDeletionLog());
    assertEquals(deletionDate, jobLog.getTimestamp());
}
Also used : HistoricJobLog(org.camunda.bpm.engine.history.HistoricJobLog) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Date(java.util.Date) Test(org.junit.Test)

Aggregations

HistoricJobLog (org.camunda.bpm.engine.history.HistoricJobLog)47 Deployment (org.camunda.bpm.engine.test.Deployment)26 Job (org.camunda.bpm.engine.runtime.Job)15 Date (java.util.Date)14 HistoricJobLogQuery (org.camunda.bpm.engine.history.HistoricJobLogQuery)13 Batch (org.camunda.bpm.engine.batch.Batch)12 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)12 Test (org.junit.Test)12 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)8 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)6 ArrayList (java.util.ArrayList)5 HistoryService (org.camunda.bpm.engine.HistoryService)2 HistoricJobLogEventEntity (org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogEventEntity)2 HashSet (java.util.HashSet)1 List (java.util.List)1 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1 CommandExecutor (org.camunda.bpm.engine.impl.interceptor.CommandExecutor)1 JobManager (org.camunda.bpm.engine.impl.persistence.entity.JobManager)1 HistoricJobLogDto (org.camunda.bpm.engine.rest.dto.history.HistoricJobLogDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1