use of org.mule.runtime.core.internal.el.mvel.MVELExpressionLanguageContext in project mule by mulesoft.
the class RegexExpressionLanguageFunctionTestCase method setup.
@Before
public void setup() throws InitialisationException {
ParserConfiguration parserConfiguration = new ParserConfiguration();
expressionExecutor = new MVELExpressionExecutor(parserConfiguration);
muleContext = mock(MuleContext.class);
context = new MVELExpressionLanguageContext(parserConfiguration, muleContext);
regexFuntion = new RegexExpressionLanguageFuntion();
context.declareFunction("regex", regexFuntion);
}
use of org.mule.runtime.core.internal.el.mvel.MVELExpressionLanguageContext in project mule by mulesoft.
the class WildcardExpressionLanguageFunctionTestCase method setup.
@Before
public void setup() throws InitialisationException {
ParserConfiguration parserConfiguration = new ParserConfiguration();
expressionExecutor = new MVELExpressionExecutor(parserConfiguration);
muleContext = mock(MuleContext.class);
context = new MVELExpressionLanguageContext(parserConfiguration, muleContext);
wildcardFunction = new WildcardExpressionLanguageFuntion();
context.declareFunction("wildcard", wildcardFunction);
}
use of org.mule.runtime.core.internal.el.mvel.MVELExpressionLanguageContext in project mule by mulesoft.
the class AbstractVarAssignmentDataTypePropagatorTestCase method compileMelExpression.
private CompiledExpression compileMelExpression(String expression, PrivilegedEvent testEvent, PrivilegedEvent.Builder builder) {
final ParserConfiguration parserConfiguration = MVELExpressionLanguage.createParserConfiguration(Collections.EMPTY_MAP);
final MVELExpressionLanguageContext context = createMvelExpressionLanguageContext(testEvent, builder, parserConfiguration);
CompiledExpression compiledExpression = (CompiledExpression) compileExpression(expression, new ParserContext(parserConfiguration));
// Expression must be executed, otherwise the variable accessor is not properly configured
MVEL.executeExpression(compiledExpression, context);
return compiledExpression;
}
use of org.mule.runtime.core.internal.el.mvel.MVELExpressionLanguageContext in project mule by mulesoft.
the class AbstractVarExpressionDataTypeResolverTestCase method createMvelExpressionLanguageContext.
protected MVELExpressionLanguageContext createMvelExpressionLanguageContext(PrivilegedEvent testEvent, ParserConfiguration parserConfiguration) {
final MVELExpressionLanguageContext context = new MVELExpressionLanguageContext(parserConfiguration, muleContext);
final StaticVariableResolverFactory staticContext = new StaticVariableResolverFactory(parserConfiguration, muleContext);
final GlobalVariableResolverFactory globalContext = new GlobalVariableResolverFactory(Collections.EMPTY_MAP, Collections.EMPTY_MAP, parserConfiguration, muleContext);
final DelegateVariableResolverFactory innerDelegate = new DelegateVariableResolverFactory(globalContext, new VariableVariableResolverFactory(parserConfiguration, muleContext, testEvent, PrivilegedEvent.builder(testEvent)));
final DelegateVariableResolverFactory delegate = new DelegateVariableResolverFactory(staticContext, new MessageVariableResolverFactory(parserConfiguration, muleContext, testEvent, PrivilegedEvent.builder(testEvent), innerDelegate));
context.setNextFactory(new CachedMapVariableResolverFactory(Collections.EMPTY_MAP, delegate));
return context;
}
Aggregations