use of org.mule.tck.testmodels.mule.TestMessageProcessor in project mule by mulesoft.
the class ForeachTestCase method initialise.
@Before
public void initialise() throws MuleException {
processedEvents = new ArrayList<>();
simpleForeach = createForeach(getSimpleMessageProcessors(new TestMessageProcessor("zas")));
nestedForeach = createForeach(getNestedMessageProcessors());
}
use of org.mule.tck.testmodels.mule.TestMessageProcessor in project mule by mulesoft.
the class ForeachTestCase method failingExpressionInChain.
@Test
public void failingExpressionInChain() throws Exception {
Foreach foreach = createForeach();
foreach.setCollectionExpression("!@INVALID");
SensingNullMessageProcessor firstProcessor = new SensingNullMessageProcessor();
List<Processor> processors = getSimpleMessageProcessors(new TestMessageProcessor("zas"));
processors.add(0, firstProcessor);
foreach.setMessageProcessors(processors);
initialiseIfNeeded(foreach, muleContext);
try {
expectExpressionException(foreach);
processInChain(foreach, eventBuilder(muleContext).message(of(new DummyNestedIterableClass().iterator())).build());
} finally {
assertThat(firstProcessor.invocations, equalTo(0));
}
}
use of org.mule.tck.testmodels.mule.TestMessageProcessor in project mule by mulesoft.
the class ForeachTestCase method failingExpression.
@Test
public void failingExpression() throws Exception {
Foreach foreach = createForeach();
foreach.setCollectionExpression("!@INVALID");
SensingNullMessageProcessor firstProcessor = new SensingNullMessageProcessor();
List<Processor> processors = getSimpleMessageProcessors(new TestMessageProcessor("zas"));
processors.add(0, firstProcessor);
foreach.setMessageProcessors(processors);
initialiseIfNeeded(foreach, muleContext);
try {
expectExpressionException(foreach);
process(foreach, eventBuilder(muleContext).message(of(new DummyNestedIterableClass().iterator())).build(), false);
} finally {
assertThat(firstProcessor.invocations, equalTo(0));
}
}
use of org.mule.tck.testmodels.mule.TestMessageProcessor in project mule by mulesoft.
the class ChoiceRouterTestCase method testMatchingRouteWithStatistics.
@Test
public void testMatchingRouteWithStatistics() throws Exception {
choiceRouter.addRoute(payloadZapExpression(), newChain(empty(), new TestMessageProcessor("bar")));
choiceRouter.setRouterStatistics(new RouterStatistics(TYPE_OUTBOUND));
choiceRouter.setMuleContext(muleContext);
choiceRouter.initialise();
assertThat(process(choiceRouter, zapEvent()).getMessage().getPayload().getValue(), is("zap:bar"));
}
use of org.mule.tck.testmodels.mule.TestMessageProcessor in project mule by mulesoft.
the class ChoiceRouterTestCase method testNoMatchingNorDefaultRoute.
@Test
public void testNoMatchingNorDefaultRoute() throws Exception {
choiceRouter.addRoute(payloadZapExpression(), newChain(empty(), new TestMessageProcessor("bar")));
CoreEvent inputEvent = fooEvent();
assertThat(process(choiceRouter, inputEvent), is(inputEvent));
}
Aggregations