use of io.qameta.allure.Description in project mule by mulesoft.
the class AbstractForkJoinStrategyTestCase method timeoutEager.
@Test
@Description("When configured with delayErrors='false' the first timeout causes strategy to throw a TimeoutException.")
public void timeoutEager() throws Throwable {
strategy = createStrategy(processingStrategy, 1, false, 50);
Message pair2Result = of(2);
Processor pair2Processor = createProcessorSpy(pair2Result);
RoutingPair pair2 = of(testEvent(), createChain(pair2Processor));
expectedException.expect(instanceOf(DefaultMuleException.class));
expectedException.expectCause(instanceOf(TimeoutException.class));
invokeStrategyBlocking(strategy, testEvent(), asList(createRoutingPairWithSleep(of(1), 250), pair2), throwable -> verify(pair2Processor, never()).process(any(CoreEvent.class)));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class AbstractForkJoinStrategyTestCase method timeout.
@Test
@Description("When a route timeout occurs a CompositeRoutingException is thrown with details of timeout error in RoutingResult.")
public void timeout() throws Throwable {
strategy = createStrategy(processingStrategy, 1, true, 50);
expectedException.expect(instanceOf(CompositeRoutingException.class));
invokeStrategyBlocking(strategy, testEvent(), asList(createRoutingPairWithSleep(of(1), 250)), throwable -> {
CompositeRoutingException compositeRoutingException = assertCompositeRoutingException(throwable, 1);
RoutingResult routingResult = assertRoutingResult(compositeRoutingException, 0, 1);
assertThat(routingResult.getFailures().get("0").getCause(), instanceOf(TimeoutException.class));
});
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class CollectListForkJoinStrategyTestCase method collectList.
@Test
@Description("This strategy waits for all routes to return and then collects results into a list.")
public void collectList() throws Throwable {
CoreEvent original = testEvent();
Message route1Result = of(1);
Message route2Result = of(2);
Message route3Result = of(3);
RoutingPair pair1 = createRoutingPair(route1Result);
RoutingPair pair2 = createRoutingPair(route2Result);
RoutingPair pair3 = createRoutingPair(route3Result);
CoreEvent result = invokeStrategyBlocking(strategy, original, asList(pair1, pair2, pair3));
assertThat(result.getMessage().getPayload().getValue(), instanceOf(List.class));
List<Message> resultList = (List<Message>) result.getMessage().getPayload().getValue();
assertThat(resultList, hasSize(3));
assertThat(resultList, hasItems(route1Result, route2Result, route3Result));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class ScatterGatherRouterTestCase method consumablePayload.
@Test
@Description("Consumable payloads are not supported.")
public void consumablePayload() throws Exception {
MessageProcessorChain route1 = newChain(empty(), event -> event);
MessageProcessorChain route2 = newChain(empty(), event -> event);
router.setRoutes(asList(route1, route2));
muleContext.getInjector().inject(router);
router.setAnnotations(getAppleFlowComponentLocationAnnotations());
router.initialise();
expectedException.expect(instanceOf(MuleRuntimeException.class));
router.process(CoreEvent.builder(testEvent()).message(Message.of(new StringBufferInputStream(TEST_PAYLOAD))).build());
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class SplitAggregateScopeTestCase method customTargetMessage.
@Test
@Description("When a custom target is configured the router result is set in a variable and the input event is output.")
public void customTargetMessage() 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);
router.setTargetValue("#[message]");
muleContext.getInjector().inject(router);
router.setAnnotations(getAppleFlowComponentLocationAnnotations());
router.initialise();
Event result = router.process(original);
assertThat(result.getMessage(), equalTo(original.getMessage()));
assertThat(((Message) result.getVariables().get(variableName).getValue()).getPayload().getValue(), instanceOf(List.class));
List<Message> resultList = (List<Message>) ((Message) result.getVariables().get(variableName).getValue()).getPayload().getValue();
assertThat(resultList, hasSize(2));
}
Aggregations