use of org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery in project camunda-bpm-platform by camunda.
the class MultiTenancySharedDecisionInstanceStatisticsQueryTest method testQueryAuthenticatedTenant.
@Test
public void testQueryAuthenticatedTenant() {
DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
identityService.setAuthentication(USER_ID, null, Arrays.asList(TENANT_ONE));
HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId());
assertThat(query.count(), is(3L));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceStatisticsQueryTest method testStatisticForRootDecisionEvaluation.
@Test
public void testStatisticForRootDecisionEvaluation() 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();
HistoricDecisionInstanceStatisticsQuery statisticsQuery = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId());
// then
assertThat(statisticsQuery.count(), is(3L));
assertThat(statisticsQuery.list().size(), is(3));
assertThat(statisticsQuery.list().get(0).getEvaluations(), is(2));
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 testStatisticForNotEvaluatedDRD.
@Test
public void testStatisticForNotEvaluatedDRD() throws Exception {
// when
DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
HistoricDecisionInstanceStatisticsQuery statisticsQuery = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId());
// then
assertThat("available statistics count", statisticsQuery.count(), is(0L));
assertThat("available statistics elements", statisticsQuery.list().size(), is(0));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceStatisticsQueryTest method testStatisticForRootDecisionWithFakeInstanceConstraintEvaluation.
@Test
public void testStatisticForRootDecisionWithFakeInstanceConstraintEvaluation() throws Exception {
// when
decisionService.evaluateDecisionTableByKey(DISH_DECISION).variables(Variables.createVariables().putValue(TEMPERATURE, 21).putValue(DAY_TYPE, WEEKEND)).evaluate();
DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId()).decisionInstanceId(NON_EXISTING);
// then
assertThat(query.count(), is(0L));
assertThat(query.list().size(), is(0));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceStatisticsQueryTest method testStatisticConstrainedToOneDRD.
@Test
public void testStatisticConstrainedToOneDRD() throws Exception {
// given
testRule.deploy(SCORE_DRG_DMN);
// when
decisionService.evaluateDecisionTableByKey("score-decision").variables(Variables.createVariables().putValue("input", "john")).evaluate();
decisionService.evaluateDecisionTableByKey("season").variables(Variables.createVariables().putValue(TEMPERATURE, 21)).evaluate();
DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionName("Score").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()));
}
Aggregations