Search in sources :

Example 16 with DmnEngine

use of org.camunda.bpm.dmn.engine.DmnEngine 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());
}
Also used : DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 17 with DmnEngine

use of org.camunda.bpm.dmn.engine.DmnEngine 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));
}
Also used : DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) VariableContext(org.camunda.bpm.engine.variable.context.VariableContext) DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 18 with DmnEngine

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

the class FeelIntegrationTest method testFeelInputExpression.

@Test
@DecisionResource(resource = DMN)
public void testFeelInputExpression() {
    DefaultDmnEngineConfiguration configuration = (DefaultDmnEngineConfiguration) getDmnEngineConfiguration();
    configuration.setDefaultInputExpressionExpressionLanguage(DefaultDmnEngineConfiguration.FEEL_EXPRESSION_LANGUAGE);
    DmnEngine engine = configuration.buildEngine();
    try {
        engine.evaluateDecision(decision, Variables.createVariables().putValue("score", 3));
        failBecauseExceptionWasNotThrown(UnsupportedOperationException.class);
    } catch (UnsupportedOperationException e) {
        assertThat(e).hasMessageStartingWith("FEEL-01016");
        verify(feelEngineSpy).evaluateSimpleExpression(anyString(), any(VariableContext.class));
    }
}
Also used : DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 19 with DmnEngine

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

the class DmnEngineRuleTest method shouldCreateEngineFromCustomConfiguration.

@Test
public void shouldCreateEngineFromCustomConfiguration() {
    DmnEngine dmnEngine = customEngineRule.getDmnEngine();
    assertThat(dmnEngine).isNotNull();
    assertThat(dmnEngine.getConfiguration()).isEqualTo(customConfiguration);
}
Also used : DefaultDmnEngine(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine) DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) Test(org.junit.Test)

Example 20 with DmnEngine

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

the class DmnEngineRuleTest method shouldCreateDefaultDmnEngineWithNullConfiguration.

@Test
public void shouldCreateDefaultDmnEngineWithNullConfiguration() {
    DmnEngine dmnEngine = nullEngineRule.getDmnEngine();
    assertThat(dmnEngine).isInstanceOf(DefaultDmnEngine.class).isNotNull();
}
Also used : DefaultDmnEngine(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine) DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) DefaultDmnEngine(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine) Test(org.junit.Test)

Aggregations

DmnEngine (org.camunda.bpm.dmn.engine.DmnEngine)20 Test (org.junit.Test)18 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)11 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)10 DefaultDmnEngineConfiguration (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)7 DefaultDmnEngine (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine)5 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)3 VariableContext (org.camunda.bpm.engine.variable.context.VariableContext)3 ArrayList (java.util.ArrayList)2 DmnEngineConfiguration (org.camunda.bpm.dmn.engine.DmnEngineConfiguration)2 DmnDecisionEvaluationListener (org.camunda.bpm.dmn.engine.delegate.DmnDecisionEvaluationListener)2 DmnDecisionTableEvaluationListener (org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener)2 DefaultEngineMetricCollector (org.camunda.bpm.dmn.engine.impl.metrics.DefaultEngineMetricCollector)2 DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)1 DmnDecisionTableEvaluationEvent (org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationEvent)1 DefaultScriptEngineResolver (org.camunda.bpm.dmn.engine.impl.el.DefaultScriptEngineResolver)1 JuelElProvider (org.camunda.bpm.dmn.engine.impl.el.JuelElProvider)1 ElProvider (org.camunda.bpm.dmn.engine.impl.spi.el.ElProvider)1 DmnTransformer (org.camunda.bpm.dmn.engine.impl.spi.transform.DmnTransformer)1 DefaultDmnTransformer (org.camunda.bpm.dmn.engine.impl.transform.DefaultDmnTransformer)1