Search in sources :

Example 1 with AttributeEvaluator

use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.

the class SetPayloadMessageProcessor method initialise.

@Override
public void initialise() throws InitialisationException {
    valueEvaluator = new AttributeEvaluator(value, dataType);
    valueEvaluator.initialize(muleContext.getExpressionManager());
}
Also used : AttributeEvaluator(org.mule.runtime.core.privileged.util.AttributeEvaluator)

Example 2 with AttributeEvaluator

use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.

the class AbstractRemoveVariablePropertyProcessor method setIdentifier.

public void setIdentifier(String identifier) {
    if (StringUtils.isBlank(identifier)) {
        throw new IllegalArgumentException("Remove with null identifier is not supported");
    }
    this.identifierEvaluator = new AttributeEvaluator(identifier, STRING);
    this.wildcardAttributeEvaluator = new WildcardAttributeEvaluator(identifier);
}
Also used : WildcardAttributeEvaluator(org.mule.runtime.core.api.util.WildcardAttributeEvaluator) AttributeEvaluator(org.mule.runtime.core.privileged.util.AttributeEvaluator) WildcardAttributeEvaluator(org.mule.runtime.core.api.util.WildcardAttributeEvaluator)

Example 3 with AttributeEvaluator

use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.

the class DWAttributeEvaluatorTestCase method getListOfCarsFromExpression.

@Test
public void getListOfCarsFromExpression() throws MuleException {
    AttributeEvaluator attributeEvaluator = getAttributeEvaluator(DW_CAR_LIST, CAR_LIST_DATA_TYPE);
    List<Car> cars = attributeEvaluator.resolveValue(newEvent(JSON_CAR, APPLICATION_JSON));
    Car car = cars.get(0);
    assertThat(car, is(allOf(hasProperty("color", is("RED")), hasProperty("price", is(1000)))));
}
Also used : AttributeEvaluator(org.mule.runtime.core.privileged.util.AttributeEvaluator) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 4 with AttributeEvaluator

use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.

the class DWAttributeEvaluatorTestCase method getJavaIntFromIntJsonProperty.

@Test
public void getJavaIntFromIntJsonProperty() throws MuleException {
    AttributeEvaluator attributeEvaluator = getAttributeEvaluator("#[payload.port]", NUMBER);
    CoreEvent event = newEvent(HOST_PORT_JSON, APPLICATION_JSON);
    Object port = attributeEvaluator.resolveValue(event);
    assertThat(port, is(8081));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) AttributeEvaluator(org.mule.runtime.core.privileged.util.AttributeEvaluator) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 5 with AttributeEvaluator

use of org.mule.runtime.core.privileged.util.AttributeEvaluator in project mule by mulesoft.

the class DWAttributeEvaluatorTestCase method getAttributeEvaluator.

private AttributeEvaluator getAttributeEvaluator(String expression, DataType expectedDataType) {
    AttributeEvaluator attributeEvaluator = new AttributeEvaluator(expression, expectedDataType);
    attributeEvaluator.initialize(expressionManager);
    return attributeEvaluator;
}
Also used : AttributeEvaluator(org.mule.runtime.core.privileged.util.AttributeEvaluator)

Aggregations

AttributeEvaluator (org.mule.runtime.core.privileged.util.AttributeEvaluator)35 Test (org.junit.Test)30 SmallTest (org.mule.tck.size.SmallTest)30 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)18 DataType (org.mule.runtime.api.metadata.DataType)13 BindingContext (org.mule.runtime.api.el.BindingContext)6 Matchers.anyString (org.mockito.Matchers.anyString)4 TypedValue (org.mule.runtime.api.metadata.TypedValue)3 InputStream (java.io.InputStream)2 Map (java.util.Map)2 List (java.util.List)1 TestConnectorQueueHandler (org.mule.functional.api.component.TestConnectorQueueHandler)1 WildcardAttributeEvaluator (org.mule.runtime.core.api.util.WildcardAttributeEvaluator)1