use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createSeedJobByIdsAndQuery.
@Test
public void createSeedJobByIdsAndQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
// when
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(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 HistoricDecisionInstanceQueryTest method testQueryByActivityId.
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN })
public void testQueryByActivityId() {
startProcessInstanceAndEvaluateDecision();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
assertThat(query.activityIdIn("task").count(), is(1L));
assertThat(query.activityIdIn("other activity").count(), is(0L));
assertThat(query.activityIdIn("task", "other activity").count(), is(1L));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceQueryTest method testQueryByActivityInstanceId.
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN })
public void testQueryByActivityInstanceId() {
startProcessInstanceAndEvaluateDecision();
String activityInstanceId = historyService.createHistoricActivityInstanceQuery().activityId("task").singleResult().getId();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
assertThat(query.activityInstanceIdIn(activityInstanceId).count(), is(1L));
assertThat(query.activityInstanceIdIn("other activity").count(), is(0L));
assertThat(query.activityInstanceIdIn(activityInstanceId, "other activity").count(), is(1L));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceQueryTest method testQueryIncludeOutputsForNonExistingDecision.
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN })
public void testQueryIncludeOutputsForNonExistingDecision() {
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().includeOutputs();
assertThat(query.singleResult(), is(nullValue()));
startProcessInstanceAndEvaluateDecision();
assertThat(query.decisionInstanceId("nonExisting").singleResult(), is(nullValue()));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceQueryTest method testQueryIncludeOutputsNoInput.
@Deployment(resources = { DECISION_PROCESS, DECISION_NO_INPUT_DMN })
public void testQueryIncludeOutputsNoInput() {
startProcessInstanceAndEvaluateDecision();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
assertThat(query.includeOutputs().singleResult().getOutputs().size(), is(0));
}
Aggregations