use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.
the class DecisionContextSwitchTest method shouldSwitchContextWhenUsingDecisionService.
@Test
@OperateOnDeployment("clientDeployment")
public void shouldSwitchContextWhenUsingDecisionService() {
DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey("decision", Variables.createVariables());
assertEquals("ok", decisionResult.getFirstResult().getFirstEntry());
}
use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.
the class DecisionServiceTest method evaluateDecisionTableById.
@Deployment(resources = DMN_DECISION_TABLE)
@Test
public void evaluateDecisionTableById() {
DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult();
DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableById(decisionDefinition.getId(), createVariables());
assertThatDecisionHasResult(decisionResult, RESULT_OF_FIRST_VERSION);
}
use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.
the class DecisionServiceTest method evaluateDecisionTableByKeyAndNullVersion.
@Deployment(resources = DMN_DECISION_TABLE)
@Test
public void evaluateDecisionTableByKeyAndNullVersion() {
testRule.deploy(DMN_DECISION_TABLE_V2);
DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKeyAndVersion(DECISION_DEFINITION_KEY, null, createVariables());
assertThatDecisionHasResult(decisionResult, RESULT_OF_SECOND_VERSION);
}
use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.
the class DecisionServiceDelegate method evaluate.
public boolean evaluate(DelegateCaseExecution caseExecution) {
DecisionService decisionService = caseExecution.getProcessEngineServices().getDecisionService();
DmnDecisionTableResult result = evaluateDecision(decisionService, caseExecution);
DmnDecisionRuleResult singleResult = result.getSingleResult();
return (Boolean) singleResult.getSingleEntry();
}
use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-engine-dmn by camunda.
the class DmnExampleVerifier method assertExample.
public static void assertExample(DmnEngine engine, DmnDecision decision) {
VariableMap variables = Variables.createVariables();
variables.put("status", "bronze");
variables.put("sum", 200);
DmnDecisionTableResult results = engine.evaluateDecisionTable(decision, variables);
assertThat(results).hasSingleResult().containsKeys("result", "reason").containsEntry("result", "notok").containsEntry("reason", "work on your status first, as bronze you're not going to get anything");
variables.put("status", "silver");
results = engine.evaluateDecisionTable(decision, variables);
assertThat(results).hasSingleResult().containsKeys("result", "reason").containsEntry("result", "ok").containsEntry("reason", "you little fish will get what you want");
variables.put("sum", 1200);
results = engine.evaluateDecisionTable(decision, variables);
assertThat(results).hasSingleResult().containsKeys("result", "reason").containsEntry("result", "notok").containsEntry("reason", "you took too much man, you took too much!");
variables.put("status", "gold");
variables.put("sum", 200);
results = engine.evaluateDecisionTable(decision, variables);
assertThat(results).hasSingleResult().containsKeys("result", "reason").containsEntry("result", "ok").containsEntry("reason", "you get anything you want");
}
Aggregations