}
}
public void testMultiple() throws Exception
{
final RequestReplyRequesterMessageProcessor asyncReplyMP = new TestAsyncRequestReplyRequester();
SensingNullMessageProcessor target = getSensingNullMessageProcessor();
target.setWaitTime(50);
AsyncInterceptingMessageProcessor asyncMP = new AsyncInterceptingMessageProcessor(
new WorkManagerSource()
{
public WorkManager getWorkManager() throws MuleException
{
return muleContext.getWorkManager();
}
}, true);
asyncMP.setListener(target);
asyncReplyMP.setListener(asyncMP);
asyncReplyMP.setReplySource(target.getMessageSource());
final InboundEndpoint inboundEndpoint = getTestInboundEndpoint(MessageExchangePattern.ONE_WAY);
final Service service = getTestService();
for (int i = 0; i < 500; i++)
{
muleContext.getWorkManager().scheduleWork(new Work()
{
public void run()
{
MuleEvent event;
try
{
event = getTestEvent(TEST_MESSAGE, service, inboundEndpoint);
MuleEvent resultEvent = asyncReplyMP.process(event);
// Can't assert same because we copy event for async currently
assertEquals(event.getMessageAsString(), resultEvent.getMessageAsString());
assertEquals(event.getMessage().getUniqueId(), resultEvent.getMessage().getUniqueId());
}