use of org.mule.tck.SensingNullMessageProcessor 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.SensingNullMessageProcessor 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.SensingNullMessageProcessor in project mule by mulesoft.
the class AsyncRequestReplyRequesterTestCase method testSingleEventNoTimeout.
@Test
public void testSingleEventNoTimeout() throws Exception {
asyncReplyMP = new TestAsyncRequestReplyRequester(muleContext);
SensingNullMessageProcessor target = getSensingNullMessageProcessor();
asyncReplyMP.setListener(target);
asyncReplyMP.setReplySource(target.getMessageSource());
asyncReplyMP.setMuleContext(muleContext);
CoreEvent resultEvent = asyncReplyMP.process(testEvent());
// Can't assert same because we copy event when we receive async reply
assertEquals(((PrivilegedEvent) testEvent()).getMessageAsString(muleContext), ((PrivilegedEvent) resultEvent).getMessageAsString(muleContext));
}
use of org.mule.tck.SensingNullMessageProcessor in project mule by mulesoft.
the class AsyncRequestReplyRequesterTestCase method testMultiple.
@Test
@Ignore("See MULE-8830")
public void testMultiple() throws Exception {
asyncReplyMP = new TestAsyncRequestReplyRequester(muleContext);
SensingNullMessageProcessor target = getSensingNullMessageProcessor();
target.setWaitTime(50);
AsyncDelegateMessageProcessor asyncMP = createAsyncMessageProcessor(target);
asyncMP.initialise();
asyncReplyMP.setListener(asyncMP);
asyncReplyMP.setReplySource(target.getMessageSource());
final AtomicInteger count = new AtomicInteger();
for (int i = 0; i < 500; i++) {
scheduler.execute(() -> {
try {
CoreEvent resultEvent = asyncReplyMP.process(testEvent());
// Can't assert same because we copy event for async currently
assertEquals(((PrivilegedEvent) testEvent()).getMessageAsString(muleContext), ((PrivilegedEvent) resultEvent).getMessageAsString(muleContext));
count.incrementAndGet();
LOGGER.debug("Finished " + count.get());
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
new PollingProber().check(new JUnitLambdaProbe(() -> {
assertThat(count.get(), greaterThanOrEqualTo(500));
return true;
}));
}
use of org.mule.tck.SensingNullMessageProcessor in project mule by mulesoft.
the class ResponseAssertionMessageProcessorTestCase method createAssertionMessageProcessor.
@Override
protected ResponseAssertionMessageProcessor createAssertionMessageProcessor() {
ResponseAssertionMessageProcessor mp = new ResponseAssertionMessageProcessor();
mp.setListener(new SensingNullMessageProcessor());
return mp;
}
Aggregations