use of org.camunda.bpm.dmn.engine.impl.spi.transform.DmnTransformer in project camunda-engine-dmn by camunda.
the class DefaultDmnEngineConfigurationApiTest method shouldBeFluentConfigurable.
@Test
public void shouldBeFluentConfigurable() {
DefaultEngineMetricCollector metricCollector = new DefaultEngineMetricCollector();
ArrayList<DmnDecisionTableEvaluationListener> preListeners = new ArrayList<DmnDecisionTableEvaluationListener>();
preListeners.add(new DefaultEngineMetricCollector());
ArrayList<DmnDecisionTableEvaluationListener> postListeners = new ArrayList<DmnDecisionTableEvaluationListener>();
preListeners.add(new DefaultEngineMetricCollector());
ArrayList<DmnDecisionEvaluationListener> preDecisionListeners = new ArrayList<DmnDecisionEvaluationListener>();
preDecisionListeners.add(new TestDecisionEvaluationListener());
ArrayList<DmnDecisionEvaluationListener> postDecisionListeners = new ArrayList<DmnDecisionEvaluationListener>();
postDecisionListeners.add(new TestDecisionEvaluationListener());
DefaultScriptEngineResolver scriptEngineResolver = new DefaultScriptEngineResolver();
ElProvider elProvider = new JuelElProvider();
FeelEngineFactory feelEngineFactory = new FeelEngineFactoryImpl();
DmnTransformer transformer = new DefaultDmnTransformer();
DmnEngine engine = configuration.engineMetricCollector(metricCollector).customPreDecisionTableEvaluationListeners(preListeners).customPostDecisionTableEvaluationListeners(postListeners).customPreDecisionEvaluationListeners(preDecisionListeners).customPostDecisionEvaluationListeners(postDecisionListeners).scriptEngineResolver(scriptEngineResolver).elProvider(elProvider).feelEngineFactory(feelEngineFactory).defaultInputExpressionExpressionLanguage("camunda").defaultInputEntryExpressionLanguage("camunda").defaultOutputEntryExpressionLanguage("camunda").transformer(transformer).buildEngine();
configuration = (DefaultDmnEngineConfiguration) engine.getConfiguration();
assertThat(configuration.getEngineMetricCollector()).isEqualTo(metricCollector);
assertThat(configuration.getCustomPreDecisionTableEvaluationListeners()).containsExactlyElementsOf(preListeners);
assertThat(configuration.getCustomPostDecisionTableEvaluationListeners()).containsExactlyElementsOf(postListeners);
assertThat(configuration.getCustomPreDecisionEvaluationListeners()).containsExactlyElementsOf(preDecisionListeners);
assertThat(configuration.getCustomPostDecisionEvaluationListeners()).containsExactlyElementsOf(postDecisionListeners);
assertThat(configuration.getScriptEngineResolver()).isEqualTo(scriptEngineResolver);
assertThat(configuration.getElProvider()).isEqualTo(elProvider);
assertThat(configuration.getFeelEngineFactory()).isEqualTo(feelEngineFactory);
assertThat(configuration.getDefaultInputExpressionExpressionLanguage()).isEqualTo("camunda");
assertThat(configuration.getDefaultInputEntryExpressionLanguage()).isEqualTo("camunda");
assertThat(configuration.getDefaultOutputEntryExpressionLanguage()).isEqualTo("camunda");
assertThat(configuration.getTransformer()).isEqualTo(transformer);
}
use of org.camunda.bpm.dmn.engine.impl.spi.transform.DmnTransformer in project camunda-bpm-platform by camunda.
the class DmnEngineConfigurationBuilder method build.
/**
* Modify the given DMN engine configuration and return it.
*/
public DefaultDmnEngineConfiguration build() {
List<DmnDecisionEvaluationListener> decisionEvaluationListeners = createCustomPostDecisionEvaluationListeners();
dmnEngineConfiguration.setCustomPostDecisionEvaluationListeners(decisionEvaluationListeners);
// override the decision table handler
DmnTransformer dmnTransformer = dmnEngineConfiguration.getTransformer();
dmnTransformer.getElementTransformHandlerRegistry().addHandler(Definitions.class, new DecisionRequirementsDefinitionTransformHandler());
dmnTransformer.getElementTransformHandlerRegistry().addHandler(Decision.class, new DecisionDefinitionHandler());
// do not override the script engine resolver if set
if (dmnEngineConfiguration.getScriptEngineResolver() == null) {
ensureNotNull("scriptEngineResolver", scriptEngineResolver);
dmnEngineConfiguration.setScriptEngineResolver(scriptEngineResolver);
}
// do not override the el provider if set
if (dmnEngineConfiguration.getElProvider() == null) {
ensureNotNull("expressionManager", expressionManager);
ProcessEngineElProvider elProvider = new ProcessEngineElProvider(expressionManager);
dmnEngineConfiguration.setElProvider(elProvider);
}
return dmnEngineConfiguration;
}
use of org.camunda.bpm.dmn.engine.impl.spi.transform.DmnTransformer in project camunda-engine-dmn by camunda.
the class DefaultDmnEngineConfigurationApiTest method shouldSetTransformer.
@Test
public void shouldSetTransformer() {
configuration.setTransformer(null);
assertThat(configuration.getTransformer()).isNull();
DmnTransformer transformer = new DefaultDmnTransformer();
configuration.setTransformer(transformer);
assertThat(configuration.getTransformer()).isEqualTo(transformer);
}
use of org.camunda.bpm.dmn.engine.impl.spi.transform.DmnTransformer in project camunda-engine-dmn by camunda.
the class DefaultDmnEngineConfigurationApiTest method shouldSetFluentTransformer.
@Test
public void shouldSetFluentTransformer() {
configuration.transformer(null);
assertThat(configuration.getTransformer()).isNull();
DmnTransformer transformer = new DefaultDmnTransformer();
configuration.transformer(transformer);
assertThat(configuration.getTransformer()).isEqualTo(transformer);
}
Aggregations