Search in sources :

Example 1 with ExpressionEvaluationHandler

use of org.camunda.bpm.dmn.engine.impl.evaluation.ExpressionEvaluationHandler in project camunda-engine-dmn by camunda.

the class ExpressionCachingTest method setup.

@Before
public void setup() {
    ScriptEngineManager scriptEngineManager = spy(new ScriptEngineManager());
    when(scriptEngineManager.getEngineByName(anyString())).then(new Answer<ScriptEngine>() {

        public ScriptEngine answer(InvocationOnMock invocation) throws Throwable {
            scriptEngineSpy = spy((ScriptEngine) invocation.callRealMethod());
            compilableSpy = (Compilable) scriptEngineSpy;
            return scriptEngineSpy;
        }
    });
    DefaultDmnEngineConfiguration configuration = new DefaultDmnEngineConfiguration();
    configuration.setScriptEngineResolver(new DefaultScriptEngineResolver(scriptEngineManager));
    configuration.init();
    elProviderSpy = spy(configuration.getElProvider());
    configuration.setElProvider(elProviderSpy);
    expressionEvaluationHandler = new ExpressionEvaluationHandler(configuration);
}
Also used : ExpressionEvaluationHandler(org.camunda.bpm.dmn.engine.impl.evaluation.ExpressionEvaluationHandler) InvocationOnMock(org.mockito.invocation.InvocationOnMock) Compilable(javax.script.Compilable) ScriptEngineManager(javax.script.ScriptEngineManager) DefaultScriptEngineResolver(org.camunda.bpm.dmn.engine.impl.el.DefaultScriptEngineResolver) DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration) ScriptEngine(javax.script.ScriptEngine) Before(org.junit.Before)

Aggregations

Compilable (javax.script.Compilable)1 ScriptEngine (javax.script.ScriptEngine)1 ScriptEngineManager (javax.script.ScriptEngineManager)1 DefaultDmnEngineConfiguration (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)1 DefaultScriptEngineResolver (org.camunda.bpm.dmn.engine.impl.el.DefaultScriptEngineResolver)1 ExpressionEvaluationHandler (org.camunda.bpm.dmn.engine.impl.evaluation.ExpressionEvaluationHandler)1 Before (org.junit.Before)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1