use of org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceStatisticsQueryTest method testStatisticForRootDecisionWithNullInstanceConstraintEvaluation.
@Test
public void testStatisticForRootDecisionWithNullInstanceConstraintEvaluation() throws Exception {
// when
decisionService.evaluateDecisionTableByKey(DISH_DECISION).variables(Variables.createVariables().putValue(TEMPERATURE, 21).putValue(DAY_TYPE, WEEKEND)).evaluate();
DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
// when
HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId()).decisionInstanceId(null);
// then
try {
query.count();
} catch (NullValueException e) {
// expected
}
try {
query.list();
} catch (NullValueException e) {
// expected
}
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery in project camunda-bpm-platform by camunda.
the class MultiTenancySharedDecisionInstanceStatisticsQueryTest method testQueryNoAuthenticatedTenants.
@Test
public void testQueryNoAuthenticatedTenants() {
DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
identityService.setAuthentication(USER_ID, null, null);
HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId());
assertThat(query.count(), is(0L));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceStatisticsQueryTest method testStatisticForChildDecisionEvaluation.
@Test
public void testStatisticForChildDecisionEvaluation() throws Exception {
// when
decisionService.evaluateDecisionTableByKey("season").variables(Variables.createVariables().putValue(TEMPERATURE, 21)).evaluate();
DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
HistoricDecisionInstanceStatisticsQuery statisticsQuery = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId());
// then
assertThat(statisticsQuery.count(), is(1L));
assertThat(statisticsQuery.list().size(), is(1));
assertThat(statisticsQuery.list().get(0).getEvaluations(), is(1));
assertThat(statisticsQuery.list().get(0).getDecisionDefinitionKey(), is(notNullValue()));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceStatisticsQueryTest method testStatisticForRootDecisionWithInstanceConstraintEvaluation.
@Test
public void testStatisticForRootDecisionWithInstanceConstraintEvaluation() throws Exception {
// when
decisionService.evaluateDecisionTableByKey(DISH_DECISION).variables(Variables.createVariables().putValue(TEMPERATURE, 21).putValue(DAY_TYPE, WEEKEND)).evaluate();
decisionService.evaluateDecisionTableByKey(DISH_DECISION).variables(Variables.createVariables().putValue(TEMPERATURE, 11).putValue(DAY_TYPE, WEEKEND)).evaluate();
DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
String decisionInstanceId = engineRule.getHistoryService().createHistoricDecisionInstanceQuery().decisionRequirementsDefinitionId(decisionRequirementsDefinition.getId()).rootDecisionInstancesOnly().list().get(0).getId();
HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId()).decisionInstanceId(decisionInstanceId);
// then
assertThat(query.count(), is(3L));
assertThat(query.list().size(), is(3));
assertThat(query.list().get(0).getEvaluations(), is(1));
assertThat(query.list().get(0).getDecisionDefinitionKey(), is(notNullValue()));
}
Aggregations