use of org.mule.runtime.core.internal.el.context.MessageContext in project mule by mulesoft.
the class WildcardExpressionLanguageFunctionTestCase method addMessageToContextWithPayload.
@SuppressWarnings("unchecked")
protected void addMessageToContextWithPayload(String payload) throws MuleException {
message = mock(InternalMessage.class);
event = getEventBuilder().message(message).build();
eventBuilder = CoreEvent.builder(event);
InternalMessage transformedMessage = mock(InternalMessage.class, RETURNS_DEEP_STUBS);
when(transformedMessage.getPayload()).thenReturn(new TypedValue<>(payload, STRING));
TransformationService transformationService = mock(TransformationService.class);
when(muleContext.getTransformationService()).thenReturn(transformationService);
when(transformationService.transform(any(InternalMessage.class), any(DataType.class))).thenReturn(transformedMessage);
context.addFinalVariable("message", new MessageContext(event, eventBuilder, muleContext));
}
use of org.mule.runtime.core.internal.el.context.MessageContext in project mule by mulesoft.
the class RegexExpressionLanguageFunctionTestCase method addMessageToContextWithPayload.
protected void addMessageToContextWithPayload(String payload) throws MuleException {
message = mock(InternalMessage.class);
event = getEventBuilder().message(message).build();
eventBuilder = CoreEvent.builder(event);
InternalMessage transformedMessage = mock(InternalMessage.class, RETURNS_DEEP_STUBS);
when(transformedMessage.getPayload()).thenReturn(new TypedValue<>(payload, DataType.fromObject(payload)));
TransformationService transformationService = mock(TransformationService.class);
when(muleContext.getTransformationService()).thenReturn(transformationService);
when(transformationService.transform(any(InternalMessage.class), any(DataType.class))).thenReturn(transformedMessage);
context.addFinalVariable("message", new MessageContext(event, eventBuilder, muleContext));
}
Aggregations