use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createMonitorJobByQuery.
@Test
public void createMonitorJobByQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null);
// when
helper.executeSeedJob(batch);
// then the seed job definition still exists but the seed job is removed
JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
assertNotNull(seedJobDefinition);
Job seedJob = helper.getSeedJob(batch);
assertNull(seedJob);
// and a monitor job definition and job exists
JobDefinition monitorJobDefinition = helper.getMonitorJobDefinition(batch);
assertNotNull(monitorJobDefinition);
Job monitorJob = helper.getMonitorJob(batch);
assertNotNull(monitorJob);
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createSeedJobByIds.
@Test
public void createSeedJobByIds() {
// when
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, null);
// then there exists a seed job definition with the batch id as
// configuration
JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
assertNotNull(seedJobDefinition);
assertEquals(batch.getId(), seedJobDefinition.getJobConfiguration());
assertEquals(BatchSeedJobHandler.TYPE, seedJobDefinition.getJobType());
// and there exists a deletion job definition
JobDefinition deletionJobDefinition = helper.getExecutionJobDefinition(batch);
assertNotNull(deletionJobDefinition);
assertEquals(Batch.TYPE_HISTORIC_DECISION_INSTANCE_DELETION, deletionJobDefinition.getJobType());
// and a seed job with no relation to a process or execution etc.
Job seedJob = helper.getSeedJob(batch);
assertNotNull(seedJob);
assertEquals(seedJobDefinition.getId(), seedJob.getJobDefinitionId());
assertNull(seedJob.getDuedate());
assertNull(seedJob.getDeploymentId());
assertNull(seedJob.getProcessDefinitionId());
assertNull(seedJob.getProcessDefinitionKey());
assertNull(seedJob.getProcessInstanceId());
assertNull(seedJob.getExecutionId());
// but no deletion jobs where created
List<Job> deletionJobs = helper.getExecutionJobs(batch);
assertEquals(0, deletionJobs.size());
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createSeedJobByQuery.
@Test
public void createSeedJobByQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
// when
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null);
// then there exists a seed job definition with the batch id as
// configuration
JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
assertNotNull(seedJobDefinition);
assertEquals(batch.getId(), seedJobDefinition.getJobConfiguration());
assertEquals(BatchSeedJobHandler.TYPE, seedJobDefinition.getJobType());
// and there exists a deletion job definition
JobDefinition deletionJobDefinition = helper.getExecutionJobDefinition(batch);
assertNotNull(deletionJobDefinition);
assertEquals(Batch.TYPE_HISTORIC_DECISION_INSTANCE_DELETION, deletionJobDefinition.getJobType());
// and a seed job with no relation to a process or execution etc.
Job seedJob = helper.getSeedJob(batch);
assertNotNull(seedJob);
assertEquals(seedJobDefinition.getId(), seedJob.getJobDefinitionId());
assertNull(seedJob.getDuedate());
assertNull(seedJob.getDeploymentId());
assertNull(seedJob.getProcessDefinitionId());
assertNull(seedJob.getProcessDefinitionKey());
assertNull(seedJob.getProcessInstanceId());
assertNull(seedJob.getExecutionId());
// but no deletion jobs where created
List<Job> deletionJobs = helper.getExecutionJobs(batch);
assertEquals(0, deletionJobs.size());
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createMonitorJobByIdsAndQuery.
@Test
public void createMonitorJobByIdsAndQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null);
// when
helper.executeSeedJob(batch);
// then the seed job definition still exists but the seed job is removed
JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
assertNotNull(seedJobDefinition);
Job seedJob = helper.getSeedJob(batch);
assertNull(seedJob);
// and a monitor job definition and job exists
JobDefinition monitorJobDefinition = helper.getMonitorJobDefinition(batch);
assertNotNull(monitorJobDefinition);
Job monitorJob = helper.getMonitorJob(batch);
assertNotNull(monitorJob);
}
use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method deleteInstancesByIds.
@Test
public void deleteInstancesByIds() {
// given
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, null);
helper.executeSeedJob(batch);
List<Job> deletionJobs = helper.getExecutionJobs(batch);
// when
for (Job deletionJob : deletionJobs) {
helper.executeJob(deletionJob);
}
// then
assertEquals(0, historyService.createHistoricDecisionInstanceQuery().count());
assertEquals(0, historyService.createHistoricDecisionInstanceQuery().count());
}
Aggregations