Search in sources :

Example 11 with DmnEngine

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

the class FeelIntegrationTest method testFeelInputEntryWithAlternativeName.

@Test
@DecisionResource(resource = DMN)
public void testFeelInputEntryWithAlternativeName() {
    DefaultDmnEngineConfiguration configuration = (DefaultDmnEngineConfiguration) getDmnEngineConfiguration();
    configuration.setDefaultInputEntryExpressionLanguage("feel");
    DmnEngine dmnEngine = configuration.buildEngine();
    DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("score", 3));
    assertThat(decisionResult.getSingleEntry()).isEqualTo("a");
    verify(feelEngineSpy, atLeastOnce()).evaluateSimpleUnaryTests(anyString(), 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 12 with DmnEngine

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

the class DmnEngineRuleTest method shouldCreateDefaultDmnEngineWithoutConfiguration.

@Test
public void shouldCreateDefaultDmnEngineWithoutConfiguration() {
    DmnEngine dmnEngine = engineRule.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)

Example 13 with DmnEngine

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

the class DecisionInvocation method invoke.

@Override
protected void invoke() throws Exception {
    final DmnEngine dmnEngine = Context.getProcessEngineConfiguration().getDmnEngine();
    invocationResult = dmnEngine.evaluateDecision((DmnDecision) decisionDefinition, variableContext);
}
Also used : DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision)

Example 14 with DmnEngine

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

the class DmnEngineConfigurationTest method getConfigurationOfDmnEngine.

protected DefaultDmnEngineConfiguration getConfigurationOfDmnEngine() {
    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) engine.getProcessEngineConfiguration();
    DmnEngine dmnEngine = processEngineConfiguration.getDmnEngine();
    return (DefaultDmnEngineConfiguration) dmnEngine.getConfiguration();
}
Also used : DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)

Example 15 with DmnEngine

use of org.camunda.bpm.dmn.engine.DmnEngine 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");
}
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)

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