Search in sources :

Example 11 with DmnExpressionImpl

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

the class DmnDecisionTableConditionTransformHandler method createFromInputEntry.

protected DmnExpressionImpl createFromInputEntry(DmnElementTransformContext context, InputEntry inputEntry) {
    DmnExpressionImpl condition = createDmnElement(context, inputEntry);
    condition.setId(inputEntry.getId());
    condition.setName(inputEntry.getLabel());
    condition.setExpressionLanguage(getExpressionLanguage(context, inputEntry));
    condition.setExpression(getExpression(inputEntry));
    return condition;
}
Also used : DmnExpressionImpl(org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)

Example 12 with DmnExpressionImpl

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

the class DmnDecisionTableInputExpressionTransformHandler method createFromInputExpression.

protected DmnExpressionImpl createFromInputExpression(DmnElementTransformContext context, InputExpression inputExpression) {
    DmnExpressionImpl dmnExpression = createDmnElement(context, inputExpression);
    dmnExpression.setId(inputExpression.getId());
    dmnExpression.setName(inputExpression.getLabel());
    dmnExpression.setTypeDefinition(createTypeDefinition(context, inputExpression));
    dmnExpression.setExpressionLanguage(getExpressionLanguage(context, inputExpression));
    dmnExpression.setExpression(getExpression(inputExpression));
    return dmnExpression;
}
Also used : DmnExpressionImpl(org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)

Example 13 with DmnExpressionImpl

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

the class DmnLiternalExpressionTransformHandler method createFromLiteralExpressionEntry.

protected DmnExpressionImpl createFromLiteralExpressionEntry(DmnElementTransformContext context, LiteralExpression literalExpression) {
    DmnExpressionImpl dmnExpression = createDmnElement(context, literalExpression);
    dmnExpression.setId(literalExpression.getId());
    dmnExpression.setName(literalExpression.getLabel());
    dmnExpression.setExpressionLanguage(getExpressionLanguage(context, literalExpression));
    dmnExpression.setExpression(getExpression(literalExpression));
    return dmnExpression;
}
Also used : DmnExpressionImpl(org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)

Example 14 with DmnExpressionImpl

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

the class ExpressionCachingTest method createExpression.

private DmnExpressionImpl createExpression(String text, String language) {
    DmnExpressionImpl expression = spy(new DmnExpressionImpl());
    expression.setExpression(text);
    expression.setExpressionLanguage(language);
    return expression;
}
Also used : DmnExpressionImpl(org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)

Example 15 with DmnExpressionImpl

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

the class ExpressionCachingTest method testCompiledScriptCaching.

@Test
public void testCompiledScriptCaching() throws ScriptException {
    // given
    DmnExpressionImpl expression = createExpression("1 > 2", "groovy");
    // when
    expressionEvaluationHandler.evaluateExpression("groovy", expression, emptyVariableContext());
    // then
    InOrder inOrder = inOrder(expression, scriptEngineSpy);
    inOrder.verify(expression, atLeastOnce()).getCachedCompiledScript();
    inOrder.verify(compilableSpy, times(1)).compile(anyString());
    inOrder.verify(expression, times(1)).cacheCompiledScript(any(CompiledScript.class));
    // when (2)
    expressionEvaluationHandler.evaluateExpression("groovy", expression, emptyVariableContext());
    // then (2)
    inOrder.verify(expression, atLeastOnce()).getCachedCompiledScript();
    inOrder.verify(compilableSpy, times(0)).compile(anyString());
}
Also used : CompiledScript(javax.script.CompiledScript) DmnExpressionImpl(org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl) InOrder(org.mockito.InOrder) Test(org.junit.Test)

Aggregations

DmnExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)16 Test (org.junit.Test)6 DmnDecisionTableInputImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableInputImpl)4 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)4 DmnDecisionLiteralExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionLiteralExpressionImpl)3 DmnDecisionTableImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl)3 DmnDecisionTableRuleImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl)3 DmnVariableImpl (org.camunda.bpm.dmn.engine.impl.DmnVariableImpl)3 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)3 DmnDecisionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl)2 DmnDecisionTableOutputImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableOutputImpl)2 InOrder (org.mockito.InOrder)2 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 CompiledScript (javax.script.CompiledScript)1 DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)1 DmnEvaluatedOutput (org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedOutput)1 DmnDecisionLiteralExpressionEvaluationEventImpl (org.camunda.bpm.dmn.engine.impl.delegate.DmnDecisionLiteralExpressionEvaluationEventImpl)1 DmnEvaluatedInputImpl (org.camunda.bpm.dmn.engine.impl.delegate.DmnEvaluatedInputImpl)1 DmnEvaluatedOutputImpl (org.camunda.bpm.dmn.engine.impl.delegate.DmnEvaluatedOutputImpl)1