Search in sources :

Example 46 with ELContext

use of javax.el.ELContext in project Activiti by Activiti.

the class ExpressionManager method getElContext.

public ELContext getElContext(VariableScope variableScope) {
    ELContext elContext = null;
    if (variableScope instanceof VariableScopeImpl) {
        VariableScopeImpl variableScopeImpl = (VariableScopeImpl) variableScope;
        elContext = variableScopeImpl.getCachedElContext();
    }
    if (elContext == null) {
        elContext = createElContext(variableScope);
        if (variableScope instanceof VariableScopeImpl) {
            ((VariableScopeImpl) variableScope).setCachedElContext(elContext);
        }
    }
    return elContext;
}
Also used : ELContext(javax.el.ELContext) VariableScopeImpl(org.activiti.engine.impl.persistence.entity.VariableScopeImpl)

Example 47 with ELContext

use of javax.el.ELContext in project Activiti by Activiti.

the class VariableScopeElResolverTest method getValue_should_returnNullWhenNoneOfItemResolversCanResolveTheProperty.

@Test
public void getValue_should_returnNullWhenNoneOfItemResolversCanResolveTheProperty() {
    // given
    String property = "myVar";
    ELContext elContext = mock(ELContext.class);
    given(firstItemResolver.canResolve(property, variableScope)).willReturn(false);
    given(secondItemResolver.canResolve(property, variableScope)).willReturn(false);
    given(secondItemResolver.canResolve(property, variableScope)).willReturn(false);
    // when
    Object result = variableScopeElResolver.getValue(elContext, null, property);
    // then
    assertThat(result).isNull();
    verifyZeroInteractions(elContext);
}
Also used : ELContext(javax.el.ELContext) Test(org.junit.Test)

Aggregations

ELContext (javax.el.ELContext)47 ValueExpression (javax.el.ValueExpression)31 Test (org.junit.Test)29 ExpressionFactory (javax.el.ExpressionFactory)22 ELContextImpl (org.apache.jasper.el.ELContextImpl)15 ValueReference (javax.el.ValueReference)8 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)8 UIComponent (javax.faces.component.UIComponent)7 ELException (javax.el.ELException)4 ELResolver (javax.el.ELResolver)4 BeanELResolver (javax.el.BeanELResolver)3 ArrayELResolver (javax.el.ArrayELResolver)2 CompositeELResolver (javax.el.CompositeELResolver)2 FunctionMapper (javax.el.FunctionMapper)2 ListELResolver (javax.el.ListELResolver)2 MapELResolver (javax.el.MapELResolver)2 ResourceBundleELResolver (javax.el.ResourceBundleELResolver)2 VariableMapper (javax.el.VariableMapper)2 FacesContext (javax.faces.context.FacesContext)2 ExpressionFactoryImpl (de.odysseus.el.ExpressionFactoryImpl)1