use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class ExpressionEvaluationTest method testOverrideInputVariableName.
@Test
@DecisionResource(resource = DMN_OVERRIDE_INPUT_VARIABLE)
public void testOverrideInputVariableName() {
DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("in", 2));
assertThat(decisionResult.getSingleEntry()).isEqualTo(true);
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class ExpressionLanguageTest method testGlobalExpressionLanguageDecisionLiteralExpression.
@Test
@DecisionResource(resource = GROOVY_DECISION_LITERAL_EXPRESSION_DMN)
public void testGlobalExpressionLanguageDecisionLiteralExpression() {
DmnDecisionLiteralExpressionImpl decisionLiteralExpression = (DmnDecisionLiteralExpressionImpl) decision.getDecisionLogic();
assertThat(decisionLiteralExpression.getExpression().getExpressionLanguage()).isEqualTo("groovy");
dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("a", 2).putValue("b", 3));
verify(scriptEngineResolver, atLeastOnce()).getScriptEngineForLanguage("groovy");
verify(scriptEngineResolver, never()).getScriptEngineForLanguage(JUEL);
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class ExpressionLanguageTest method testExecuteLiteralExpressionWithGroovyDmnEngineConfiguration.
@Test
@DecisionResource(resource = DECISION_WITH_LITERAL_EXPRESSION_DMN)
public void testExecuteLiteralExpressionWithGroovyDmnEngineConfiguration() {
DmnEngine juelEngine = createEngineWithDefaultExpressionLanguage("groovy");
juelEngine.evaluateDecision(decision, Variables.createVariables().putValue("a", 1).putValue("b", 2));
verify(scriptEngineResolver, atLeastOnce()).getScriptEngineForLanguage("groovy");
verify(scriptEngineResolver, never()).getScriptEngineForLanguage("juel");
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class ExpressionLanguageTest method testExecuteJuelDmnEngineConfiguration.
@Test
@DecisionResource(resource = SCRIPT_DMN)
public void testExecuteJuelDmnEngineConfiguration() {
DmnEngine juelEngine = createEngineWithDefaultExpressionLanguage(JUEL);
assertExample(juelEngine, decision);
verify(elProvider, atLeastOnce()).createExpression(anyString());
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class FeelIntegrationTest method testFeelOutputEntryWithCustomEngine.
@Test
@DecisionResource(resource = DMN)
public void testFeelOutputEntryWithCustomEngine() {
DefaultDmnEngineConfiguration configuration = (DefaultDmnEngineConfiguration) getDmnEngineConfiguration();
configuration.setDefaultOutputEntryExpressionLanguage(DefaultDmnEngineConfiguration.FEEL_EXPRESSION_LANGUAGE);
DmnEngine engine = configuration.buildEngine();
// stubbing the default FEEL engine behavior
doReturn("a").when(feelEngineSpy).evaluateSimpleExpression(eq("\"a\""), any(VariableContext.class));
DmnDecisionResult decisionResult = engine.evaluateDecision(decision, Variables.createVariables().putValue("score", 3));
assertThat(decisionResult.getSingleEntry()).isEqualTo("a");
verify(feelEngineSpy).evaluateSimpleExpression(anyString(), any(VariableContext.class));
}
Aggregations