use of org.mule.tck.MuleTestUtils.APPLE_FLOW in project mule by mulesoft.
the class DefaultMessageProcessorChainTestCase method testAll.
@Test
public void testAll() throws Exception {
createAndRegisterFlow(muleContext, APPLE_FLOW, componentLocator);
ScatterGatherRouter scatterGatherRouter = new ScatterGatherRouter();
scatterGatherRouter.setAnnotations(getAppleFlowComponentLocationAnnotations());
scatterGatherRouter.setRoutes(asList(newChain(empty(), getAppendingMP("1")), newChain(empty(), getAppendingMP("2")), newChain(empty(), getAppendingMP("3"))));
initialiseIfNeeded(scatterGatherRouter, true, muleContext);
scatterGatherRouter.start();
CoreEvent event = getTestEventUsingFlow("0");
final MessageProcessorChain chain = newChain(empty(), singletonList(scatterGatherRouter));
Message result = process(chain, CoreEvent.builder(event).message(event.getMessage()).build()).getMessage();
assertThat(result.getPayload().getValue(), instanceOf(Map.class));
Map<String, Message> resultMessage = (Map<String, Message>) result.getPayload().getValue();
assertThat(resultMessage.values().stream().map(msg -> msg.getPayload().getValue()).collect(toList()).toArray(), is(equalTo(new String[] { "01", "02", "03" })));
scatterGatherRouter.stop();
scatterGatherRouter.dispose();
}
Aggregations