Search in sources :

Example 1 with DmnDecisionTableEvaluationListener

use of org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener 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));
}
Also used : ArrayList(java.util.ArrayList) DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration) DmnDecisionTableEvaluationListener(org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) Test(org.junit.Test)

Example 2 with DmnDecisionTableEvaluationListener

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

the class DmnEngineConfigurationApiTest method shouldSetCustomPostDecisionTableEvaluationListeners.

@Test
public void shouldSetCustomPostDecisionTableEvaluationListeners() {
    configuration.setCustomPostDecisionTableEvaluationListeners(null);
    assertThat(configuration.getCustomPostDecisionTableEvaluationListeners()).isNull();
    configuration.setCustomPostDecisionTableEvaluationListeners(Collections.<DmnDecisionTableEvaluationListener>emptyList());
    assertThat(configuration.getCustomPostDecisionTableEvaluationListeners()).isEmpty();
    ArrayList<DmnDecisionTableEvaluationListener> listeners = new ArrayList<DmnDecisionTableEvaluationListener>();
    listeners.add(new DefaultEngineMetricCollector());
    listeners.add(new DefaultEngineMetricCollector());
    configuration.setCustomPostDecisionTableEvaluationListeners(listeners);
    assertThat(configuration.getCustomPostDecisionTableEvaluationListeners()).containsExactlyElementsOf(listeners);
}
Also used : ArrayList(java.util.ArrayList) DefaultEngineMetricCollector(org.camunda.bpm.dmn.engine.impl.metrics.DefaultEngineMetricCollector) DmnDecisionTableEvaluationListener(org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener) Test(org.junit.Test)

Example 3 with DmnDecisionTableEvaluationListener

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

the class DmnEngineConfigurationApiTest method shouldSetCustomPreDecisionTableEvaluationListeners.

@Test
public void shouldSetCustomPreDecisionTableEvaluationListeners() {
    configuration.setCustomPreDecisionTableEvaluationListeners(null);
    assertThat(configuration.getCustomPreDecisionTableEvaluationListeners()).isNull();
    configuration.setCustomPreDecisionTableEvaluationListeners(Collections.<DmnDecisionTableEvaluationListener>emptyList());
    assertThat(configuration.getCustomPreDecisionTableEvaluationListeners()).isEmpty();
    ArrayList<DmnDecisionTableEvaluationListener> listeners = new ArrayList<DmnDecisionTableEvaluationListener>();
    listeners.add(new DefaultEngineMetricCollector());
    listeners.add(new DefaultEngineMetricCollector());
    configuration.setCustomPreDecisionTableEvaluationListeners(listeners);
    assertThat(configuration.getCustomPreDecisionTableEvaluationListeners()).containsExactlyElementsOf(listeners);
}
Also used : ArrayList(java.util.ArrayList) DefaultEngineMetricCollector(org.camunda.bpm.dmn.engine.impl.metrics.DefaultEngineMetricCollector) DmnDecisionTableEvaluationListener(org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener) Test(org.junit.Test)

Example 4 with DmnDecisionTableEvaluationListener

use of org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener 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 5 with DmnDecisionTableEvaluationListener

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

the class DmnEngineConfigurationApiTest method shouldSetFluentCustomPostDecisionTableEvaluationListeners.

@Test
public void shouldSetFluentCustomPostDecisionTableEvaluationListeners() {
    configuration.customPostDecisionTableEvaluationListeners(null);
    assertThat(configuration.getCustomPostDecisionTableEvaluationListeners()).isNull();
    configuration.customPostDecisionTableEvaluationListeners(Collections.<DmnDecisionTableEvaluationListener>emptyList());
    assertThat(configuration.getCustomPostDecisionTableEvaluationListeners()).isEmpty();
    ArrayList<DmnDecisionTableEvaluationListener> listeners = new ArrayList<DmnDecisionTableEvaluationListener>();
    listeners.add(new DefaultEngineMetricCollector());
    listeners.add(new DefaultEngineMetricCollector());
    configuration.customPostDecisionTableEvaluationListeners(listeners);
    assertThat(configuration.getCustomPostDecisionTableEvaluationListeners()).containsExactlyElementsOf(listeners);
}
Also used : ArrayList(java.util.ArrayList) DefaultEngineMetricCollector(org.camunda.bpm.dmn.engine.impl.metrics.DefaultEngineMetricCollector) DmnDecisionTableEvaluationListener(org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener) Test(org.junit.Test)

Aggregations

DmnDecisionTableEvaluationListener (org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener)13 ArrayList (java.util.ArrayList)12 Test (org.junit.Test)12 DefaultEngineMetricCollector (org.camunda.bpm.dmn.engine.impl.metrics.DefaultEngineMetricCollector)11 DmnEngine (org.camunda.bpm.dmn.engine.DmnEngine)2 DmnDecisionEvaluationListener (org.camunda.bpm.dmn.engine.delegate.DmnDecisionEvaluationListener)2 DefaultDmnEngineConfiguration (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)2 DmnEngineConfiguration (org.camunda.bpm.dmn.engine.DmnEngineConfiguration)1 DefaultDmnEngine (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine)1 DmnDecisionTableImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl)1 DmnDecisionTableEvaluationEventImpl (org.camunda.bpm.dmn.engine.impl.delegate.DmnDecisionTableEvaluationEventImpl)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 FeelEngineFactory (org.camunda.bpm.dmn.feel.impl.FeelEngineFactory)1 FeelEngineFactoryImpl (org.camunda.bpm.dmn.feel.impl.juel.FeelEngineFactoryImpl)1 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1