use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class HistoricJobLogTest method testDeletedJob.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml" })
public void testDeletedJob() {
// given
runtimeService.startProcessInstanceByKey("process");
String jobId = managementService.createJobQuery().singleResult().getId();
HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().jobId(jobId);
HistoricJobLogQuery createdQuery = historyService.createHistoricJobLogQuery().jobId(jobId).creationLog();
HistoricJobLogQuery deletedQuery = historyService.createHistoricJobLogQuery().jobId(jobId).deletionLog();
// there exists one historic job log entry
assertEquals(1, query.count());
assertEquals(1, createdQuery.count());
assertEquals(0, deletedQuery.count());
// when
managementService.deleteJob(jobId);
// then
assertEquals(2, query.count());
assertEquals(1, createdQuery.count());
assertEquals(1, deletedQuery.count());
HistoricJobLog createdJobLogEntry = createdQuery.singleResult();
assertEquals(3, createdJobLogEntry.getJobRetries());
HistoricJobLog deletedJobLogEntry = deletedQuery.singleResult();
assertEquals(3, deletedJobLogEntry.getJobRetries());
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class HistoricJobLogTest method testBoundaryTimerEventJobHandlerType.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testBoundaryTimerEvent.bpmn20.xml" })
public void testBoundaryTimerEventJobHandlerType() {
runtimeService.startProcessInstanceByKey("process");
Job job = managementService.createJobQuery().singleResult();
HistoricJobLog historicJob = historyService.createHistoricJobLogQuery().jobId(job.getId()).singleResult();
assertNotNull(historicJob);
assertEquals(job.getId(), historicJob.getJobId());
assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId());
assertEquals("timer", historicJob.getActivityId());
assertEquals(TimerExecuteNestedActivityJobHandler.TYPE, historicJob.getJobDefinitionType());
assertEquals("DURATION: PT5M", historicJob.getJobDefinitionConfiguration());
assertEquals(job.getDuedate(), historicJob.getJobDueDate());
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class HistoricJobLogTest method testSuccessfulJobEvent.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml" })
public void testSuccessfulJobEvent() {
// given
runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("fail", false));
String jobId = managementService.createJobQuery().singleResult().getId();
HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().jobId(jobId);
HistoricJobLogQuery createdQuery = historyService.createHistoricJobLogQuery().jobId(jobId).creationLog();
HistoricJobLogQuery succeededQuery = historyService.createHistoricJobLogQuery().jobId(jobId).successLog();
// there exists one historic job log entry
assertEquals(1, query.count());
assertEquals(1, createdQuery.count());
assertEquals(0, succeededQuery.count());
// when
managementService.executeJob(jobId);
// then
assertEquals(2, query.count());
assertEquals(1, createdQuery.count());
assertEquals(1, succeededQuery.count());
HistoricJobLog createdJobLogEntry = createdQuery.singleResult();
assertEquals(3, createdJobLogEntry.getJobRetries());
HistoricJobLog succeededJobLogEntry = succeededQuery.singleResult();
assertEquals(3, succeededJobLogEntry.getJobRetries());
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class HistoricJobLogTest method testTerminateEndEvent.
@Deployment
public void testTerminateEndEvent() {
// given
runtimeService.startProcessInstanceByKey("process").getId();
String serviceTask1JobId = managementService.createJobQuery().activityId("serviceTask1").singleResult().getId();
HistoricJobLogQuery query = historyService.createHistoricJobLogQuery();
assertEquals(2, query.count());
// serviceTask1
HistoricJobLogQuery serviceTask1Query = historyService.createHistoricJobLogQuery().jobId(serviceTask1JobId);
HistoricJobLogQuery serviceTask1CreatedQuery = historyService.createHistoricJobLogQuery().jobId(serviceTask1JobId).creationLog();
HistoricJobLogQuery serviceTask1DeletedQuery = historyService.createHistoricJobLogQuery().jobId(serviceTask1JobId).deletionLog();
HistoricJobLogQuery serviceTask1SuccessfulQuery = historyService.createHistoricJobLogQuery().jobId(serviceTask1JobId).successLog();
assertEquals(1, serviceTask1Query.count());
assertEquals(1, serviceTask1CreatedQuery.count());
assertEquals(0, serviceTask1DeletedQuery.count());
assertEquals(0, serviceTask1SuccessfulQuery.count());
// serviceTask2
String serviceTask2JobId = managementService.createJobQuery().activityId("serviceTask2").singleResult().getId();
HistoricJobLogQuery serviceTask2Query = historyService.createHistoricJobLogQuery().jobId(serviceTask2JobId);
HistoricJobLogQuery serviceTask2CreatedQuery = historyService.createHistoricJobLogQuery().jobId(serviceTask2JobId).creationLog();
HistoricJobLogQuery serviceTask2DeletedQuery = historyService.createHistoricJobLogQuery().jobId(serviceTask2JobId).deletionLog();
HistoricJobLogQuery serviceTask2SuccessfulQuery = historyService.createHistoricJobLogQuery().jobId(serviceTask2JobId).successLog();
assertEquals(1, serviceTask2Query.count());
assertEquals(1, serviceTask2CreatedQuery.count());
assertEquals(0, serviceTask2DeletedQuery.count());
assertEquals(0, serviceTask2SuccessfulQuery.count());
// when
managementService.executeJob(serviceTask1JobId);
// then
assertEquals(4, query.count());
// serviceTas1
assertEquals(2, serviceTask1Query.count());
assertEquals(1, serviceTask1CreatedQuery.count());
assertEquals(0, serviceTask1DeletedQuery.count());
assertEquals(1, serviceTask1SuccessfulQuery.count());
HistoricJobLog serviceTask1CreatedJobLogEntry = serviceTask1CreatedQuery.singleResult();
assertEquals(3, serviceTask1CreatedJobLogEntry.getJobRetries());
HistoricJobLog serviceTask1SuccessfulJobLogEntry = serviceTask1SuccessfulQuery.singleResult();
assertEquals(3, serviceTask1SuccessfulJobLogEntry.getJobRetries());
// serviceTask2
assertEquals(2, serviceTask2Query.count());
assertEquals(1, serviceTask2CreatedQuery.count());
assertEquals(1, serviceTask2DeletedQuery.count());
assertEquals(0, serviceTask2SuccessfulQuery.count());
HistoricJobLog serviceTask2CreatedJobLogEntry = serviceTask2CreatedQuery.singleResult();
assertEquals(3, serviceTask2CreatedJobLogEntry.getJobRetries());
HistoricJobLog serviceTask2DeletedJobLogEntry = serviceTask2DeletedQuery.singleResult();
assertEquals(3, serviceTask2DeletedJobLogEntry.getJobRetries());
}
use of org.camunda.bpm.engine.history.HistoricJobLog in project camunda-bpm-platform by camunda.
the class HistoricJobLogTest method testIntermediateTimerEventJobHandlerType.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testIntermediateTimerEvent.bpmn20.xml" })
public void testIntermediateTimerEventJobHandlerType() {
runtimeService.startProcessInstanceByKey("process");
Job job = managementService.createJobQuery().singleResult();
HistoricJobLog historicJob = historyService.createHistoricJobLogQuery().jobId(job.getId()).singleResult();
assertNotNull(historicJob);
assertEquals(job.getId(), historicJob.getJobId());
assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId());
assertEquals("timer", historicJob.getActivityId());
assertEquals(TimerCatchIntermediateEventJobHandler.TYPE, historicJob.getJobDefinitionType());
assertEquals("DURATION: PT1M", historicJob.getJobDefinitionConfiguration());
assertEquals(job.getDuedate(), historicJob.getJobDueDate());
}
Aggregations