use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class HistoricJobLogTest method testDeletedHistoricJobLogProperties.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml" })
public void testDeletedHistoricJobLogProperties() {
String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
Job job = managementService.createJobQuery().singleResult();
runtimeService.deleteProcessInstance(processInstanceId, null);
HistoricJobLog historicJob = historyService.createHistoricJobLogQuery().deletionLog().singleResult();
assertNotNull(historicJob);
assertNotNull(historicJob.getTimestamp());
assertNull(historicJob.getJobExceptionMessage());
assertEquals(job.getId(), historicJob.getJobId());
assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId());
assertEquals("serviceTask", historicJob.getActivityId());
assertEquals(AsyncContinuationJobHandler.TYPE, historicJob.getJobDefinitionType());
assertEquals(MessageJobDeclaration.ASYNC_BEFORE, historicJob.getJobDefinitionConfiguration());
assertEquals(job.getDuedate(), historicJob.getJobDueDate());
assertEquals(job.getRetries(), historicJob.getJobRetries());
assertEquals(job.getExecutionId(), historicJob.getExecutionId());
assertEquals(job.getProcessInstanceId(), historicJob.getProcessInstanceId());
assertEquals(job.getProcessDefinitionId(), historicJob.getProcessDefinitionId());
assertEquals(job.getProcessDefinitionKey(), historicJob.getProcessDefinitionKey());
assertEquals(job.getDeploymentId(), historicJob.getDeploymentId());
assertEquals(job.getPriority(), historicJob.getJobPriority());
assertFalse(historicJob.isCreationLog());
assertFalse(historicJob.isFailureLog());
assertFalse(historicJob.isSuccessLog());
assertTrue(historicJob.isDeletionLog());
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class HistoricJobLogRestServiceInteractionTest method setUpRuntimeData.
@Before
public void setUpRuntimeData() {
mockQuery = mock(HistoricJobLogQuery.class);
HistoricJobLog mockedHistoricJobLog = MockProvider.createMockHistoricJobLog();
when(mockQuery.singleResult()).thenReturn(mockedHistoricJobLog);
when(mockQuery.logId(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_ID)).thenReturn(mockQuery);
mockHistoryService = mock(HistoryService.class);
when(mockHistoryService.createHistoricJobLogQuery()).thenReturn(mockQuery);
namedProcessEngine = getProcessEngine(MockProvider.EXAMPLE_PROCESS_ENGINE_NAME);
when(namedProcessEngine.getHistoryService()).thenReturn(mockHistoryService);
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class MockProvider method createMockHistoricJobLog.
public static HistoricJobLog createMockHistoricJobLog(String tenantId) {
HistoricJobLog mock = mock(HistoricJobLog.class);
when(mock.getId()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_ID);
when(mock.getTimestamp()).thenReturn(DateTimeUtil.parseDate(EXAMPLE_HISTORIC_JOB_LOG_TIMESTAMP));
when(mock.getJobId()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_JOB_ID);
when(mock.getJobDueDate()).thenReturn(DateTimeUtil.parseDate(EXAMPLE_HISTORIC_JOB_LOG_JOB_DUE_DATE));
when(mock.getJobRetries()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_JOB_RETRIES);
when(mock.getJobPriority()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_JOB_PRIORITY);
when(mock.getJobExceptionMessage()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_JOB_EXCEPTION_MSG);
when(mock.getJobDefinitionId()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_JOB_DEF_ID);
when(mock.getJobDefinitionType()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_JOB_DEF_TYPE);
when(mock.getJobDefinitionConfiguration()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_JOB_DEF_CONFIG);
when(mock.getActivityId()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_ACTIVITY_ID);
when(mock.getExecutionId()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_EXECUTION_ID);
when(mock.getProcessInstanceId()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_PROC_INST_ID);
when(mock.getProcessDefinitionId()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_PROC_DEF_ID);
when(mock.getProcessDefinitionKey()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_PROC_DEF_KEY);
when(mock.getDeploymentId()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_DEPLOYMENT_ID);
when(mock.getTenantId()).thenReturn(tenantId);
when(mock.isCreationLog()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_IS_CREATION_LOG);
when(mock.isFailureLog()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_IS_FAILURE_LOG);
when(mock.isSuccessLog()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_IS_SUCCESS_LOG);
when(mock.isDeletionLog()).thenReturn(EXAMPLE_HISTORIC_JOB_LOG_IS_DELETION_LOG);
return mock;
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class HistoricJobLogRestServiceImpl method queryHistoricJobLogs.
public List<HistoricJobLogDto> queryHistoricJobLogs(HistoricJobLogQueryDto queryDto, Integer firstResult, Integer maxResults) {
queryDto.setObjectMapper(objectMapper);
HistoricJobLogQuery query = queryDto.toQuery(processEngine);
List<HistoricJobLog> matchingHistoricJobLogs;
if (firstResult != null || maxResults != null) {
matchingHistoricJobLogs = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingHistoricJobLogs = query.list();
}
List<HistoricJobLogDto> results = new ArrayList<HistoricJobLogDto>();
for (HistoricJobLog historicJobLog : matchingHistoricJobLogs) {
HistoricJobLogDto result = HistoricJobLogDto.fromHistoricJobLog(historicJobLog);
results.add(result);
}
return results;
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class BatchMigrationHistoryTest method testHistoricSeedJobLogForBatchDeletion.
@Test
public void testHistoricSeedJobLogForBatchDeletion() {
Batch batch = helper.migrateProcessInstancesAsync(1);
// when
Date deletionDate = helper.addSecondsToClock(12);
managementService.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());
}
Aggregations