Search in sources :

Example 36 with DecisionRequirementsDefinition

use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.

the class DeploymentManager method deleteDecisionRequirementDeployment.

protected void deleteDecisionRequirementDeployment(String deploymentId) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    if (processEngineConfiguration.isDmnEnabled()) {
        DecisionRequirementsDefinitionManager manager = getDecisionRequirementsDefinitionManager();
        List<DecisionRequirementsDefinition> decisionRequirementsDefinitions = manager.findDecisionRequirementsDefinitionByDeploymentId(deploymentId);
        // delete decision requirements definitions from db
        manager.deleteDecisionRequirementsDefinitionsByDeploymentId(deploymentId);
        DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
        for (DecisionRequirementsDefinition decisionRequirementsDefinition : decisionRequirementsDefinitions) {
            String decisionDefinitionId = decisionRequirementsDefinition.getId();
            // remove decision requirements definitions from cache:
            deploymentCache.removeDecisionRequirementsDefinition(decisionDefinitionId);
        }
    }
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) DecisionRequirementsDefinitionManager(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionManager) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 37 with DecisionRequirementsDefinition

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

Example 38 with DecisionRequirementsDefinition

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

Example 39 with DecisionRequirementsDefinition

use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.

the class HistoricDecisionInstanceTest method testDecisionInstancePropertiesOfDrdDecision.

@Deployment(resources = DRG_DMN)
public void testDecisionInstancePropertiesOfDrdDecision() {
    decisionService.evaluateDecisionTableByKey("dish-decision").variables(Variables.createVariables().putValue("temperature", 21).putValue("dayType", "Weekend")).evaluate();
    DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
    HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
    assertThat(query.count(), is(3L));
    HistoricDecisionInstance rootHistoricDecisionInstance = query.decisionDefinitionKey("dish-decision").singleResult();
    HistoricDecisionInstance requiredHistoricDecisionInstance1 = query.decisionDefinitionKey("season").singleResult();
    HistoricDecisionInstance requiredHistoricDecisionInstance2 = query.decisionDefinitionKey("guestCount").singleResult();
    assertThat(rootHistoricDecisionInstance.getRootDecisionInstanceId(), is(nullValue()));
    assertThat(rootHistoricDecisionInstance.getDecisionRequirementsDefinitionId(), is(decisionRequirementsDefinition.getId()));
    assertThat(rootHistoricDecisionInstance.getDecisionRequirementsDefinitionKey(), is(decisionRequirementsDefinition.getKey()));
    assertThat(requiredHistoricDecisionInstance1.getRootDecisionInstanceId(), is(rootHistoricDecisionInstance.getId()));
    assertThat(requiredHistoricDecisionInstance1.getDecisionRequirementsDefinitionId(), is(decisionRequirementsDefinition.getId()));
    assertThat(requiredHistoricDecisionInstance1.getDecisionRequirementsDefinitionKey(), is(decisionRequirementsDefinition.getKey()));
    assertThat(requiredHistoricDecisionInstance2.getRootDecisionInstanceId(), is(rootHistoricDecisionInstance.getId()));
    assertThat(requiredHistoricDecisionInstance2.getDecisionRequirementsDefinitionId(), is(decisionRequirementsDefinition.getId()));
    assertThat(requiredHistoricDecisionInstance2.getDecisionRequirementsDefinitionKey(), is(decisionRequirementsDefinition.getKey()));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 40 with DecisionRequirementsDefinition

use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.

the class DecisionRequirementsDefinitionRestServiceInteractionTest method setUpRuntime.

@Before
public void setUpRuntime() throws FileNotFoundException, URISyntaxException {
    DecisionRequirementsDefinition mockDecisionRequirementsDefinition = MockProvider.createMockDecisionRequirementsDefinition();
    setUpRuntimeData(mockDecisionRequirementsDefinition);
    decisionServiceMock = mock(DecisionService.class);
    when(processEngine.getDecisionService()).thenReturn(decisionServiceMock);
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) DecisionService(org.camunda.bpm.engine.DecisionService) Before(org.junit.Before)

Aggregations

DecisionRequirementsDefinition (org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)40 Test (org.junit.Test)25 HistoricDecisionInstanceStatisticsQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery)13 DecisionRequirementsDefinitionQuery (org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery)9 Deployment (org.camunda.bpm.engine.test.Deployment)6 InputStream (java.io.InputStream)5 Response (com.jayway.restassured.response.Response)2 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)2 GetDeploymentResourceCmd (org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)2 Before (org.junit.Before)2 ArrayList (java.util.ArrayList)1 DecisionService (org.camunda.bpm.engine.DecisionService)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 RepositoryService (org.camunda.bpm.engine.RepositoryService)1 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1 NullValueException (org.camunda.bpm.engine.exception.NullValueException)1 HistoricDecisionInstance (org.camunda.bpm.engine.history.HistoricDecisionInstance)1 NativeHistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.NativeHistoricDecisionInstanceQuery)1