use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class HistoricJobLogTest method testSuccessfulHistoricJobLogProperties.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml" })
public void testSuccessfulHistoricJobLogProperties() {
runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("fail", false));
Job job = managementService.createJobQuery().singleResult();
managementService.executeJob(job.getId());
HistoricJobLog historicJob = historyService.createHistoricJobLogQuery().successLog().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());
assertTrue(historicJob.isSuccessLog());
assertFalse(historicJob.isDeletionLog());
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class HistoricJobLogQueryTest method testQueryByJobPriority.
@Deployment
public void testQueryByJobPriority() {
// given 5 process instances with 5 jobs
List<ProcessInstance> processInstances = new ArrayList<ProcessInstance>();
for (int i = 0; i < 5; i++) {
processInstances.add(runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("priority", i)));
}
// then the creation logs can be filtered by priority of the jobs
// (1) lower than or equal a priority
List<HistoricJobLog> jobLogs = historyService.createHistoricJobLogQuery().jobPriorityLowerThanOrEquals(2L).orderByJobPriority().asc().list();
assertEquals(3, jobLogs.size());
for (HistoricJobLog log : jobLogs) {
assertTrue(log.getJobPriority() <= 2);
}
// (2) higher than or equal a given priorty
jobLogs = historyService.createHistoricJobLogQuery().jobPriorityHigherThanOrEquals(3L).orderByJobPriority().asc().list();
assertEquals(2, jobLogs.size());
for (HistoricJobLog log : jobLogs) {
assertTrue(log.getJobPriority() >= 3);
}
// (3) lower and higher than or equal
jobLogs = historyService.createHistoricJobLogQuery().jobPriorityHigherThanOrEquals(1L).jobPriorityLowerThanOrEquals(3L).orderByJobPriority().asc().list();
assertEquals(3, jobLogs.size());
for (HistoricJobLog log : jobLogs) {
assertTrue(log.getJobPriority() >= 1 && log.getJobPriority() <= 3);
}
// (4) lower and higher than or equal are disjunctive
jobLogs = historyService.createHistoricJobLogQuery().jobPriorityHigherThanOrEquals(3).jobPriorityLowerThanOrEquals(1).orderByJobPriority().asc().list();
assertEquals(0, jobLogs.size());
}
Aggregations