Search in sources :

Example 41 with DecisionResource

use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.

the class DmnEngineApiTest method shouldEvaluateDecisionLiteralExpression.

@Test
@DecisionResource(resource = DECISION_LITERAL_EXPRESSION_DMN)
public void shouldEvaluateDecisionLiteralExpression() {
    DmnDecisionResult results = dmnEngine.evaluateDecision(decision, createVariables().putValue("input", INPUT_VALUE));
    assertThat(results.getSingleEntry()).isNotNull().isEqualTo(EXPECTED_OUTPUT_VALUE);
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 42 with DecisionResource

use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.

the class DmnEngineApiTest method shouldEvaluateDecisionWithVariableMap.

@Test
@DecisionResource(resource = ONE_RULE_DMN)
public void shouldEvaluateDecisionWithVariableMap() {
    DmnDecisionResult results = dmnEngine.evaluateDecision(decision, createVariables().putValue("input", INPUT_VALUE));
    assertThat(results.getSingleEntry()).isNotNull().isEqualTo(EXPECTED_OUTPUT_VALUE);
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 43 with DecisionResource

use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.

the class DmnEngineMetricCollectorTest method testExecutedDecisionElementsOfDrg.

@Test
@DecisionResource(resource = DISH_EXAMPLE_DMN, decisionKey = "Dish")
public void testExecutedDecisionElementsOfDrg() {
    assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(0L);
    VariableMap variableMap = createVariables().putValue("temperature", 20).putValue("dayType", "Weekend");
    dmnEngine.evaluateDecisionTable(decision, variableMap);
    assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(30L);
    dmnEngine.evaluateDecisionTable(decision, variableMap);
    assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(60L);
    dmnEngine.evaluateDecisionTable(decision, variableMap);
    dmnEngine.evaluateDecisionTable(decision, variableMap);
    assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(120L);
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 44 with DecisionResource

use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.

the class ExpressionEvaluationTest method testHasInputVariableNameInVariableContext.

@Test
@DecisionResource(resource = DMN_VARIABLE_CONTEXT_WITH_INPUT_VARIABLE)
public void testHasInputVariableNameInVariableContext() {
    DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("in", 3));
    assertThat(decisionResult.getSingleEntry()).isEqualTo(true);
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 45 with DecisionResource

use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.

the class ExpressionEvaluationTest method testHasInputVariableName.

@Test
@DecisionResource(resource = DMN_INPUT_VARIABLE)
public void testHasInputVariableName() {
    DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("in", 2));
    assertThat(decisionResult.getSingleEntry()).isEqualTo(true);
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Aggregations

DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)56 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)56 Test (org.junit.Test)56 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)25 DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)20 DmnEngine (org.camunda.bpm.dmn.engine.DmnEngine)10 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)8 DefaultDmnEngineConfiguration (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)5 DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)4 DmnDecisionRuleResult (org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)4 DmnDecisionResultException (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException)4 VariableContext (org.camunda.bpm.engine.variable.context.VariableContext)4 Map (java.util.Map)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 DmnDecisionLiteralExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionLiteralExpressionImpl)1 DmnDecisionTableImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl)1 DmnDecisionTableInputImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableInputImpl)1 DmnDecisionTableRuleImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl)1 DmnExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)1