Search in sources :

Example 6 with HistoricDecisionInstanceStatisticsQuery

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));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) HistoricDecisionInstanceStatisticsQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery) Test(org.junit.Test)

Example 7 with HistoricDecisionInstanceStatisticsQuery

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()));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) HistoricDecisionInstanceStatisticsQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery) Test(org.junit.Test)

Example 8 with HistoricDecisionInstanceStatisticsQuery

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));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) HistoricDecisionInstanceStatisticsQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery) Test(org.junit.Test)

Example 9 with HistoricDecisionInstanceStatisticsQuery

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));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) HistoricDecisionInstanceStatisticsQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery) Test(org.junit.Test)

Example 10 with HistoricDecisionInstanceStatisticsQuery

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()));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) HistoricDecisionInstanceStatisticsQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery) Test(org.junit.Test)

Aggregations

HistoricDecisionInstanceStatisticsQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery)14 DecisionRequirementsDefinition (org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)13 Test (org.junit.Test)13 ArrayList (java.util.ArrayList)1 NullValueException (org.camunda.bpm.engine.exception.NullValueException)1 HistoricDecisionInstanceStatistics (org.camunda.bpm.engine.history.HistoricDecisionInstanceStatistics)1 HistoricDecisionInstanceStatisticsDto (org.camunda.bpm.engine.rest.dto.history.HistoricDecisionInstanceStatisticsDto)1