use of org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration 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));
}
use of org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration in project camunda-bpm-platform by camunda.
the class DmnEngineConfigurationTest method setCustomPostTableExecutionListener.
@Test
public void setCustomPostTableExecutionListener() {
// given a DMN engine configuration with custom listener
DefaultDmnEngineConfiguration dmnEngineConfiguration = (DefaultDmnEngineConfiguration) DmnEngineConfiguration.createDefaultDmnEngineConfiguration();
DmnDecisionTableEvaluationListener customEvaluationListener = mock(DmnDecisionTableEvaluationListener.class);
List<DmnDecisionTableEvaluationListener> customListeners = new ArrayList<DmnDecisionTableEvaluationListener>();
customListeners.add(customEvaluationListener);
dmnEngineConfiguration.setCustomPostDecisionTableEvaluationListeners(customListeners);
ProcessEngineConfigurationImpl processEngineConfiguration = createProcessEngineConfiguration();
processEngineConfiguration.setDmnEngineConfiguration(dmnEngineConfiguration);
// when the engine is initialized
engine = processEngineConfiguration.buildProcessEngine();
// then the custom listener should be set on the DMN engine
assertThat(getConfigurationOfDmnEngine().getCustomPostDecisionTableEvaluationListeners(), hasItem(customEvaluationListener));
}
use of org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration in project camunda-bpm-platform by camunda.
the class DmnEngineConfigurationTest method setElProvider.
@Test
public void setElProvider() {
// given a DMN engine configuration with el provider
DefaultDmnEngineConfiguration dmnEngineConfiguration = (DefaultDmnEngineConfiguration) DmnEngineConfiguration.createDefaultDmnEngineConfiguration();
ElProvider elProvider = mock(ElProvider.class);
dmnEngineConfiguration.setElProvider(elProvider);
ProcessEngineConfigurationImpl processEngineConfiguration = createProcessEngineConfiguration();
processEngineConfiguration.setDmnEngineConfiguration(dmnEngineConfiguration);
// when the engine is initialized
engine = processEngineConfiguration.buildProcessEngine();
// then the el provider should be set on the DMN engine
assertThat(getConfigurationOfDmnEngine().getElProvider(), is(elProvider));
}
use of org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration in project camunda-bpm-platform by camunda.
the class DmnEngineConfigurationTest method setFeelEngineFactory.
@Test
public void setFeelEngineFactory() {
// given a DMN engine configuration with feel engine factory
DefaultDmnEngineConfiguration dmnEngineConfiguration = (DefaultDmnEngineConfiguration) DmnEngineConfiguration.createDefaultDmnEngineConfiguration();
FeelEngineFactory feelEngineFactory = mock(FeelEngineFactory.class);
dmnEngineConfiguration.setFeelEngineFactory(feelEngineFactory);
ProcessEngineConfigurationImpl processEngineConfiguration = createProcessEngineConfiguration();
processEngineConfiguration.setDmnEngineConfiguration(dmnEngineConfiguration);
// when the engine is initialized
engine = processEngineConfiguration.buildProcessEngine();
// then the feel engine factory should be set on the DMN engine
assertThat(getConfigurationOfDmnEngine().getFeelEngineFactory(), is(feelEngineFactory));
}
use of org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration in project camunda-bpm-platform by camunda.
the class DmnEngineConfigurationTest method setDmnEngineConfigurationOverXmlConfiguration.
@Test
public void setDmnEngineConfigurationOverXmlConfiguration() {
// given an embedded DMN engine configuration in XML process engine configuration
// with default expression language
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(CONFIGURATION_XML);
// checks that the configuration is set as on XML
DefaultDmnEngineConfiguration dmnEngineConfiguration = processEngineConfiguration.getDmnEngineConfiguration();
assertThat(dmnEngineConfiguration, is(notNullValue()));
assertThat(dmnEngineConfiguration.getDefaultInputExpressionExpressionLanguage(), is("groovy"));
// when the engine is initialized
engine = processEngineConfiguration.buildProcessEngine();
// then the default expression language should be set in the DMN engine
assertThat(getConfigurationOfDmnEngine().getDefaultInputExpressionExpressionLanguage(), is("groovy"));
}
Aggregations