Search in sources :

Example 1 with DmnEngineConfiguration

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

the class DmnEngineConfigurationApiTest method shouldCreateDefaultEngineConfiguration.

@Test
public void shouldCreateDefaultEngineConfiguration() {
    DmnEngineConfiguration configuration = DmnEngineConfiguration.createDefaultDmnEngineConfiguration();
    assertThat(configuration).isInstanceOf(DefaultDmnEngineConfiguration.class).isNotNull();
}
Also used : DmnEngineConfiguration(org.camunda.bpm.dmn.engine.DmnEngineConfiguration) DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration) DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration) Test(org.junit.Test)

Example 2 with DmnEngineConfiguration

use of org.camunda.bpm.dmn.engine.DmnEngineConfiguration 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 3 with DmnEngineConfiguration

use of org.camunda.bpm.dmn.engine.DmnEngineConfiguration 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)

Example 4 with DmnEngineConfiguration

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

the class DmnDataTypeTransformerTest method initRegistry.

@Before
public void initRegistry() {
    DmnEngineConfiguration configuration = dmnEngine.getConfiguration();
    registry = ((DefaultDmnEngineConfiguration) configuration).getTransformer().getDataTypeTransformerRegistry();
}
Also used : DmnEngineConfiguration(org.camunda.bpm.dmn.engine.DmnEngineConfiguration) DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration) DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration) Before(org.junit.Before)

Aggregations

DmnEngineConfiguration (org.camunda.bpm.dmn.engine.DmnEngineConfiguration)4 DefaultDmnEngineConfiguration (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)3 Test (org.junit.Test)3 DmnEngine (org.camunda.bpm.dmn.engine.DmnEngine)2 ArrayList (java.util.ArrayList)1 DmnDecisionEvaluationListener (org.camunda.bpm.dmn.engine.delegate.DmnDecisionEvaluationListener)1 DmnDecisionTableEvaluationEvent (org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationEvent)1 DmnDecisionTableEvaluationListener (org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationListener)1 DefaultEngineMetricCollector (org.camunda.bpm.dmn.engine.impl.metrics.DefaultEngineMetricCollector)1 DmnEngineMetricCollector (org.camunda.bpm.dmn.engine.spi.DmnEngineMetricCollector)1 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)1 Before (org.junit.Before)1