use of com.adaptris.core.stubs.ChannelRestartConnectionErrorHandler in project interlok by adaptris.
the class RetryMessageErrorHandlerTest method testBug854.
@Test
@SuppressWarnings("deprecation")
public void testBug854() throws Exception {
String name = renameThread("testBug854");
try {
MockMessageProducer failProducer = new MockMessageProducer();
RetryMessageErrorHandler meh = createMessageErrorHandler(failProducer);
meh.setRetryInterval(DEFAULT_RETRY_INTERVAL);
meh.setRetryLimit(0);
FailFirstMockMessageProducer workflowProducer = new FailFirstMockMessageProducer(1);
StandardWorkflow workflow = createWorkflow(workflowProducer);
workflow.setServiceCollection(new ServiceList());
workflow.setProduceExceptionHandler(new RestartProduceExceptionHandler());
Channel channel = new Channel();
channel.getWorkflowList().add(workflow);
channel.setProduceConnection(new MockConnection());
channel.getProduceConnection().setConnectionErrorHandler(new ChannelRestartConnectionErrorHandler());
Adapter adapter = new Adapter();
adapter.setUniqueId(new SimpleIdGenerator().create(this));
adapter.setMessageErrorHandler(meh);
adapter.getChannelList().addChannel(channel);
// adapter.prepare();
adapter.requestStart();
workflow.onAdaptrisMessage(AdaptrisMessageFactory.getDefaultInstance().newMessage("XXXX"));
waitForMessages(workflowProducer, 1);
adapter.requestClose();
assertEquals("Ensure producer success", 1, workflowProducer.getMessages().size());
assertEquals("Should not have produced to failProducer", 0, failProducer.getMessages().size());
} finally {
renameThread(name);
}
}
Aggregations