use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.
the class MELAttributeEvaluatorTestCase method plainTextValue.
@Test
public void plainTextValue() {
AttributeEvaluator attributeEvaluator = new AttributeEvaluator("attributeEvaluator");
when(mockExpressionManager.isExpression("attributeEvaluator")).thenReturn(false);
attributeEvaluator.initialize(mockExpressionManager);
attributeEvaluator.resolveValue(event);
verify(mockExpressionManager, never()).parse(anyString(), any(CoreEvent.class), any());
verify(mockExpressionManager, never()).evaluate(anyString(), any(CoreEvent.class));
verify(mockExpressionManager, never()).evaluate(anyString(), any(DataType.class), any(), any(CoreEvent.class));
}
use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.
the class QueueWriterMessageProcessor method initialise.
@Override
public void initialise() throws InitialisationException {
if (attributeEvaluator == null) {
String attribute = content == null ? "#[payload]" : content;
if (contentJavaType != null) {
attributeEvaluator = new AttributeEvaluator(attribute, fromType(contentJavaType));
} else {
attributeEvaluator = new AttributeEvaluator(attribute);
}
}
attributeEvaluator.initialize(expressionManager);
queueHandler = new TestConnectorQueueHandler(registry);
}
use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.
the class DWAttributeEvaluatorTestCase method getJavaStringFromStringJsonProperty.
@Test
public void getJavaStringFromStringJsonProperty() throws MuleException {
AttributeEvaluator attributeEvaluator = getAttributeEvaluator("#[payload.host]", STRING);
CoreEvent event = newEvent(HOST_PORT_JSON, APPLICATION_JSON);
Object host = attributeEvaluator.resolveValue(event);
assertThat(host, is("0.0.0.0"));
}
use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.
the class DWAttributeEvaluatorTestCase method parseExpressionAreNotSupported.
@Test(expected = ExpressionRuntimeException.class)
public void parseExpressionAreNotSupported() throws MuleException {
AttributeEvaluator attributeEvaluator = getAttributeEvaluator("invalid #['expression']");
attributeEvaluator.resolveValue(newEvent());
}
use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.
the class DWAttributeEvaluatorTestCase method resolveStringValue.
@Test
public void resolveStringValue() throws MuleException {
AttributeEvaluator attributeEvaluator = getAttributeEvaluator("#[payload.port]", STRING);
String port = attributeEvaluator.resolveValue(newEvent(HOST_PORT_JSON, APPLICATION_JSON));
assertThat(port, is("8081"));
}
Aggregations