use of io.qameta.allure.Description in project mule by mulesoft.
the class DefaultExpressionManagerTestCase method parseLogXml.
@Test
@Description("Verifies that XML content can be used for logging in DW.")
public void parseLogXml() throws MuleException {
CoreEvent event = getEventBuilder().message(Message.builder().value("<?xml version='1.0' encoding='US-ASCII'?>\n" + "<wsc_fields>\n" + " <operation>echo</operation>\n" + " <body_test>test</body_test>\n" + "</wsc_fields>").mediaType(XML).build()).build();
assertThat(expressionManager.parseLogTemplate("this is #[payload.wsc_fields.operation]", event, TEST_CONNECTOR_LOCATION, NULL_BINDING_CONTEXT), is("this is \"echo\""));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class DefaultExpressionManagerTestCase method simpleCustomVariable.
@Test
@Description("Verifies that custom variables are considered.")
public void simpleCustomVariable() {
Object object = new Object();
BindingContext context = builder().addBinding(MY_VAR, new TypedValue(object, OBJECT)).build();
assertThat(expressionManager.evaluate("#[myVar]", context).getValue(), equalTo(object));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class DefaultExpressionManagerTestCase method parseLogMessage.
@Test
@Description("Verifies that parsing works for log template scenarios for both DW and MVEL using the message.")
public void parseLogMessage() throws MuleException {
String expectedOutput = "current message is \norg.mule.runtime.core.internal.message.DefaultMessageBuilder$MessageImplementation\n{" + "\n payload=test\n mediaType=*/*\n attributes=<not set>\n attributesMediaType=*/*\n}";
assertThat(expressionManager.parseLogTemplate("current message is #[mel:message]", testEvent(), TEST_CONNECTOR_LOCATION, NULL_BINDING_CONTEXT), is(expectedOutput));
assertThat(expressionManager.parseLogTemplate("current message is #[message]", testEvent(), TEST_CONNECTOR_LOCATION, NULL_BINDING_CONTEXT), is(expectedOutput));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class DefaultExpressionManagerTestCase method flowName.
@Test
@Description("Verifies that the flow variable exposing it's name works.")
public void flowName() throws MuleException {
FlowConstruct mockFlowConstruct = mock(FlowConstruct.class);
when(mockFlowConstruct.getName()).thenReturn("myFlowName");
String result = (String) expressionManager.evaluate("#[flow.name]", testEvent(), fromSingleComponent(mockFlowConstruct.getName())).getValue();
assertThat(result, is(mockFlowConstruct.getName()));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class DefaultExpressionManagerTestCase method map.
@Test
@Description("Verifies that a map expression is successful.")
public void map() {
String expression = "{\'name\' : \'Sarah\', \'surname\' : \'Manning\'}";
Object result = expressionManager.evaluate(expression).getValue();
assertThat(result, is(instanceOf(Map.class)));
assertThat((Map<String, String>) result, hasEntry("name", "Sarah"));
assertThat((Map<String, String>) result, hasEntry("surname", "Manning"));
}
Aggregations