use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createBatchDeletionByInvalidQueryByKey.
@Test
public void createBatchDeletionByInvalidQueryByKey() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey("foo");
// then
thrown.expect(BadUserRequestException.class);
// when
historyService.deleteHistoricDecisionInstancesAsync(query, null);
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery 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.history.HistoricDecisionInstanceQuery 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.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createDeletionJobsByIdsAndQuery.
@Test
public void createDeletionJobsByIdsAndQuery() {
// given
rule.getProcessEngineConfiguration().setBatchJobsPerSeed(5);
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null);
JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
JobDefinition deletionJobDefinition = helper.getExecutionJobDefinition(batch);
;
// when
helper.executeSeedJob(batch);
// then
List<Job> deletionJobs = helper.getJobsForDefinition(deletionJobDefinition);
assertEquals(5, deletionJobs.size());
for (Job deletionJob : deletionJobs) {
assertEquals(deletionJobDefinition.getId(), deletionJob.getJobDefinitionId());
assertNull(deletionJob.getDuedate());
assertNull(deletionJob.getProcessDefinitionId());
assertNull(deletionJob.getProcessDefinitionKey());
assertNull(deletionJob.getProcessInstanceId());
assertNull(deletionJob.getExecutionId());
}
// and the seed job still exists
Job seedJob = helper.getJobForDefinition(seedJobDefinition);
assertNotNull(seedJob);
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createDeletionJobsByQuery.
@Test
public void createDeletionJobsByQuery() {
// given
rule.getProcessEngineConfiguration().setBatchJobsPerSeed(5);
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null);
JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
JobDefinition deletionJobDefinition = helper.getExecutionJobDefinition(batch);
;
// when
helper.executeSeedJob(batch);
// then
List<Job> deletionJobs = helper.getJobsForDefinition(deletionJobDefinition);
assertEquals(5, deletionJobs.size());
for (Job deletionJob : deletionJobs) {
assertEquals(deletionJobDefinition.getId(), deletionJob.getJobDefinitionId());
assertNull(deletionJob.getDuedate());
assertNull(deletionJob.getProcessDefinitionId());
assertNull(deletionJob.getProcessDefinitionKey());
assertNull(deletionJob.getProcessInstanceId());
assertNull(deletionJob.getExecutionId());
}
// and the seed job still exists
Job seedJob = helper.getJobForDefinition(seedJobDefinition);
assertNotNull(seedJob);
}
Aggregations