Search in sources :

Example 1 with DefaultDmnEngineConfiguration

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

the class ExpressionLanguageTest method getDmnEngineConfiguration.

@Override
public DmnEngineConfiguration getDmnEngineConfiguration() {
    DefaultDmnEngineConfiguration configuration = new DefaultDmnEngineConfiguration();
    configuration.setScriptEngineResolver(createScriptEngineResolver());
    configuration.setElProvider(createElProvider());
    return configuration;
}
Also used : DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)

Example 2 with DefaultDmnEngineConfiguration

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

the class ExpressionLanguageTest method createEngineWithDefaultExpressionLanguage.

protected DmnEngine createEngineWithDefaultExpressionLanguage(String expressionLanguage) {
    DefaultDmnEngineConfiguration configuration = (DefaultDmnEngineConfiguration) getDmnEngineConfiguration();
    configuration.setDefaultInputExpressionExpressionLanguage(expressionLanguage);
    configuration.setDefaultInputEntryExpressionLanguage(expressionLanguage);
    configuration.setDefaultOutputEntryExpressionLanguage(expressionLanguage);
    configuration.setDefaultLiteralExpressionLanguage(expressionLanguage);
    return configuration.buildEngine();
}
Also used : DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)

Example 3 with DefaultDmnEngineConfiguration

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

the class FeelIntegrationTest method testFeelInputExpressionWithCustomEngine.

@Test
@DecisionResource(resource = DMN)
public void testFeelInputExpressionWithCustomEngine() {
    DefaultDmnEngineConfiguration configuration = (DefaultDmnEngineConfiguration) getDmnEngineConfiguration();
    configuration.setDefaultInputExpressionExpressionLanguage(DefaultDmnEngineConfiguration.FEEL_EXPRESSION_LANGUAGE);
    DmnEngine engine = configuration.buildEngine();
    // stubbing the default FEEL engine behavior
    doReturn(3).when(feelEngineSpy).evaluateSimpleExpression(eq("score"), 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 4 with DefaultDmnEngineConfiguration

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

the class FeelIntegrationTest method getDmnEngineConfiguration.

@Override
public DmnEngineConfiguration getDmnEngineConfiguration() {
    DefaultDmnEngineConfiguration configuration = new DefaultDmnEngineConfiguration();
    configuration.setFeelEngineFactory(new TestFeelEngineFactory());
    return configuration;
}
Also used : DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)

Example 5 with DefaultDmnEngineConfiguration

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

the class FeelIntegrationTest method testFeelOutputEntry.

@Test
@DecisionResource(resource = DMN)
public void testFeelOutputEntry() {
    DefaultDmnEngineConfiguration configuration = (DefaultDmnEngineConfiguration) getDmnEngineConfiguration();
    configuration.setDefaultOutputEntryExpressionLanguage(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)

Aggregations

DefaultDmnEngineConfiguration (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)19 Test (org.junit.Test)11 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)7 DmnEngine (org.camunda.bpm.dmn.engine.DmnEngine)6 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)5 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)5 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)3 VariableContext (org.camunda.bpm.engine.variable.context.VariableContext)3 Before (org.junit.Before)2 ArrayList (java.util.ArrayList)1 Compilable (javax.script.Compilable)1 ScriptEngine (javax.script.ScriptEngine)1 ScriptEngineManager (javax.script.ScriptEngineManager)1 DmnEngineConfiguration (org.camunda.bpm.dmn.engine.DmnEngineConfiguration)1 DmnDecisionTableEvaluationListener (org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener)1 DefaultScriptEngineResolver (org.camunda.bpm.dmn.engine.impl.el.DefaultScriptEngineResolver)1 ExpressionEvaluationHandler (org.camunda.bpm.dmn.engine.impl.evaluation.ExpressionEvaluationHandler)1 DmnScriptEngineResolver (org.camunda.bpm.dmn.engine.impl.spi.el.DmnScriptEngineResolver)1 ElProvider (org.camunda.bpm.dmn.engine.impl.spi.el.ElProvider)1 DmnDataTypeTransformer (org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer)1