use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceQueryTest method testQueryByDecisionInstanceId.
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN })
public void testQueryByDecisionInstanceId() {
ProcessInstance pi1 = startProcessInstanceAndEvaluateDecision();
ProcessInstance pi2 = startProcessInstanceAndEvaluateDecision();
String decisionInstanceId1 = historyService.createHistoricDecisionInstanceQuery().processInstanceId(pi1.getId()).singleResult().getId();
String decisionInstanceId2 = historyService.createHistoricDecisionInstanceQuery().processInstanceId(pi2.getId()).singleResult().getId();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
assertThat(query.decisionInstanceId(decisionInstanceId1).count(), is(1L));
assertThat(query.decisionInstanceId(decisionInstanceId2).count(), is(1L));
assertThat(query.decisionInstanceId("unknown").count(), is(0L));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceQueryTest method testQueryPaging.
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN })
public void testQueryPaging() {
startProcessInstanceAndEvaluateDecision();
startProcessInstanceAndEvaluateDecision();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
assertThat(query.listPage(0, 2).size(), is(2));
assertThat(query.listPage(1, 1).size(), is(1));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceQueryTest method testQueryByRootDecisionInstancesOnly.
@Deployment(resources = { DRG_DMN })
public void testQueryByRootDecisionInstancesOnly() {
decisionService.evaluateDecisionTableByKey(DISH_DECISION).variables(Variables.createVariables().putValue("temperature", 21).putValue("dayType", "Weekend")).evaluate();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
assertThat(query.count(), is(3L));
assertThat(query.rootDecisionInstancesOnly().count(), is(1L));
assertThat(query.rootDecisionInstancesOnly().singleResult().getDecisionDefinitionKey(), is(DISH_DECISION));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceTest method testDeleteHistoricDecisionInstanceByUndeployment.
public void testDeleteHistoricDecisionInstanceByUndeployment() {
String firstDeploymentId = repositoryService.createDeployment().addClasspathResource(DECISION_PROCESS).addClasspathResource(DECISION_SINGLE_OUTPUT_DMN).deploy().getId();
startProcessInstanceAndEvaluateDecision();
String secondDeploymentId = repositoryService.createDeployment().addClasspathResource(DECISION_PROCESS).addClasspathResource(DECISION_MULTIPLE_OUTPUT_DMN).deploy().getId();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
assertThat(query.count(), is(1L));
repositoryService.deleteDeployment(secondDeploymentId, true);
assertThat(query.count(), is(1L));
repositoryService.deleteDeployment(firstDeploymentId, true);
assertThat(query.count(), is(0L));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceTest method testDeleteHistoricDecisionInstances.
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN })
public void testDeleteHistoricDecisionInstances() {
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY);
startProcessInstanceAndEvaluateDecision();
assertThat(query.count(), is(1L));
DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult();
historyService.deleteHistoricDecisionInstanceByDefinitionId(decisionDefinition.getId());
assertThat(query.count(), is(0L));
}
Aggregations