use of org.mule.runtime.core.internal.routing.ForkJoinStrategy.RoutingPair in project mule by mulesoft.
the class JoinOnlyForkJoinStrategyTestCase method joinOnly.
@Test
@Description("This strategy waits for all routes to return and then returns the original event.")
public void joinOnly() throws Throwable {
CoreEvent original = testEvent();
Processor processor1 = createProcessorSpy(of(1));
Processor processor2 = createProcessorSpy(of(2));
Processor processor3 = createProcessorSpy(of(3));
RoutingPair pair1 = createRoutingPair(processor1);
RoutingPair pair2 = createRoutingPair(processor2);
RoutingPair pair3 = createRoutingPair(processor3);
CoreEvent result = invokeStrategyBlocking(strategy, original, asList(pair1, pair2, pair3));
assertThat(result, is(original));
verify(processor1, times(1)).process(any(CoreEvent.class));
verify(processor2, times(1)).process(any(CoreEvent.class));
verify(processor2, times(1)).process(any(CoreEvent.class));
}
use of org.mule.runtime.core.internal.routing.ForkJoinStrategy.RoutingPair in project mule by mulesoft.
the class ScatterGatherRouterTestCase method routingPairs.
@Test
@Description("RoutingPairs are created for each route configured. Each RoutingPair has the same input event.")
public void routingPairs() throws Exception {
CoreEvent event = mock(CoreEvent.class);
MessageProcessorChain route1 = mock(MessageProcessorChain.class);
MessageProcessorChain route2 = mock(MessageProcessorChain.class);
MessageProcessorChain route3 = mock(MessageProcessorChain.class);
router.setRoutes(asList(route1, route2, route3));
List<RoutingPair> routingPairs = from(router.getRoutingPairs(event)).collectList().block();
assertThat(routingPairs, hasSize(3));
assertThat(routingPairs.get(0), equalTo(of(event, route1)));
assertThat(routingPairs.get(1), equalTo(of(event, route2)));
assertThat(routingPairs.get(2), equalTo(of(event, route3)));
}
Aggregations