use of io.qameta.allure.Description in project mule by mulesoft.
the class DefaultExpressionManagerTestCase method flowVars.
@Test
@Description("Verifies that flowVars work, returning null for non existent ones and it's value for those that do.")
public void flowVars() throws MuleException {
CoreEvent.Builder eventBuilder = CoreEvent.builder(testEvent());
String flowVars = "vars.myVar";
assertThat(expressionManager.evaluate(flowVars, eventBuilder.build()).getValue(), nullValue());
String value = "Leda";
eventBuilder.addVariable(MY_VAR, value);
assertThat(expressionManager.evaluate(flowVars, eventBuilder.build()).getValue(), is(value));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class DefaultExpressionManagerTestCase method simple.
@Test
@Description("Verifies that a simple literal expression is successful.")
public void simple() {
String expression = "\"wow\"";
assertString(expression);
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class StreamingUtilsTestCase method consumeRepeatableIteratorPayload.
@Test
@Description("Test that repeatable iterator is consumed into a list")
public void consumeRepeatableIteratorPayload() throws Exception {
CursorIteratorProvider payload = asCursorProvider(TEST_LIST);
CoreEvent event = consumeRepeatablePayload(getEventBuilder().message(Message.of(payload)).build());
assertConsumedObjectStream(payload, event);
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class StreamingUtilsTestCase method consumeJsonRepeatableInputStreamPayload.
@Test
@Description("Test that repeatable stream in the payload is consumed into another fully in memory stream provider while maintaining " + "the original media type")
public void consumeJsonRepeatableInputStreamPayload() throws Exception {
CursorStreamProvider payload = asCursorProvider(TEST_PAYLOAD);
CoreEvent event = consumeRepeatablePayload(getEventBuilder().message(Message.builder().payload(TypedValue.of(payload)).mediaType(APPLICATION_JSON).build()).build());
assertConsumedRepeatableInputStream(payload, event);
assertThat(event.getMessage().getPayload().getDataType().getMediaType(), is(APPLICATION_JSON));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class SplitAggregateScopeTestCase method customTargetDefaultPayload.
@Test
@Description("When a custom target is configured the router result is set in a variable and the input event is output.")
public void customTargetDefaultPayload() throws Exception {
final String variableName = "foo";
CoreEvent original = createListEvent();
MessageProcessorChain nested = newChain(empty(), event -> event);
nested.setMuleContext(muleContext);
router.setMessageProcessors(singletonList(nested));
router.setTarget(variableName);
muleContext.getInjector().inject(router);
router.setAnnotations(getAppleFlowComponentLocationAnnotations());
router.initialise();
Event result = router.process(original);
assertThat(result.getMessage(), equalTo(original.getMessage()));
final TypedValue<?> typedValue = result.getVariables().get(variableName);
assertThat(typedValue.getValue(), instanceOf(List.class));
assertThat(List.class.isAssignableFrom(typedValue.getDataType().getType()), is(true));
List<Message> resultList = (List<Message>) typedValue.getValue();
assertThat(resultList, hasSize(2));
}
Aggregations