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);
}
}
}
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()));
}
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()));
}
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()));
}
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);
}
Aggregations