Search in sources :

Example 1 with DmnEngine

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

the class DefaultDmnEngineConfigurationApiTest method shouldBuildDefaultDmnEngine.

@Test
public void shouldBuildDefaultDmnEngine() {
    DmnEngine engine = configuration.buildEngine();
    assertThat(engine).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 2 with DmnEngine

use of org.camunda.bpm.dmn.engine.DmnEngine 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);
}
Also used : DmnDecisionEvaluationListener(org.camunda.bpm.dmn.engine.delegate.DmnDecisionEvaluationListener) ArrayList(java.util.ArrayList) DefaultDmnTransformer(org.camunda.bpm.dmn.engine.impl.transform.DefaultDmnTransformer) DefaultEngineMetricCollector(org.camunda.bpm.dmn.engine.impl.metrics.DefaultEngineMetricCollector) FeelEngineFactory(org.camunda.bpm.dmn.feel.impl.FeelEngineFactory) FeelEngineFactoryImpl(org.camunda.bpm.dmn.feel.impl.juel.FeelEngineFactoryImpl) ElProvider(org.camunda.bpm.dmn.engine.impl.spi.el.ElProvider) JuelElProvider(org.camunda.bpm.dmn.engine.impl.el.JuelElProvider) DefaultDmnEngine(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine) DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) JuelElProvider(org.camunda.bpm.dmn.engine.impl.el.JuelElProvider) DefaultDmnTransformer(org.camunda.bpm.dmn.engine.impl.transform.DefaultDmnTransformer) DmnTransformer(org.camunda.bpm.dmn.engine.impl.spi.transform.DmnTransformer) DefaultScriptEngineResolver(org.camunda.bpm.dmn.engine.impl.el.DefaultScriptEngineResolver) DmnDecisionTableEvaluationListener(org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener) Test(org.junit.Test)

Example 3 with DmnEngine

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

the class DmnEngineConfigurationApiTest 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());
    DmnEngine engine = DmnEngineConfiguration.createDefaultDmnEngineConfiguration().engineMetricCollector(metricCollector).customPreDecisionTableEvaluationListeners(preListeners).customPostDecisionTableEvaluationListeners(postListeners).customPreDecisionEvaluationListeners(preDecisionListeners).customPostDecisionEvaluationListeners(postDecisionListeners).buildEngine();
    DmnEngineConfiguration configuration = 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);
}
Also used : DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) DmnDecisionEvaluationListener(org.camunda.bpm.dmn.engine.delegate.DmnDecisionEvaluationListener) ArrayList(java.util.ArrayList) DefaultEngineMetricCollector(org.camunda.bpm.dmn.engine.impl.metrics.DefaultEngineMetricCollector) DmnDecisionTableEvaluationListener(org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener) DmnEngineConfiguration(org.camunda.bpm.dmn.engine.DmnEngineConfiguration) DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration) Test(org.junit.Test)

Example 4 with DmnEngine

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

the class DmnEngineConfigurationApiTest method shouldBuildEngine.

@Test
public void shouldBuildEngine() {
    DmnEngine engine = configuration.buildEngine();
    assertThat(engine).isNotNull();
}
Also used : DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) Test(org.junit.Test)

Example 5 with DmnEngine

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

the class DmnEngineMetricCollectorTest method testCustomEngineMetricCollector.

@Test
public void testCustomEngineMetricCollector() {
    DmnEngineConfiguration configuration = DmnEngineConfiguration.createDefaultDmnEngineConfiguration();
    DmnEngineMetricCollector mockMetricCollector = mock(DmnEngineMetricCollector.class);
    configuration.setEngineMetricCollector(mockMetricCollector);
    DmnEngine engine = configuration.buildEngine();
    // evaluate one decision table
    engine.evaluateDecisionTable(parseDecisionFromFile("decision", EXAMPLE_DMN), variables);
    verify(mockMetricCollector, times(1)).notify(any(DmnDecisionTableEvaluationEvent.class));
    // evaluate one decision literal expression
    engine.evaluateDecision(parseDecisionFromFile("c", DRG_WITH_LITERAL_EXPRESSIONS), variables);
    verify(mockMetricCollector, times(1)).notify(any(DmnDecisionTableEvaluationEvent.class));
}
Also used : DmnEngine(org.camunda.bpm.dmn.engine.DmnEngine) DmnEngineMetricCollector(org.camunda.bpm.dmn.engine.spi.DmnEngineMetricCollector) DmnEngineConfiguration(org.camunda.bpm.dmn.engine.DmnEngineConfiguration) DmnDecisionTableEvaluationEvent(org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationEvent) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

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