use of com.adaptris.core.event.AdapterInitEvent in project interlok by adaptris.
the class AdapterTest method testAdapterInitThrowsException.
@Test
public void testAdapterInitThrowsException() throws Exception {
MockMessageProducer mockEventProducer = new MockMessageProducer();
Adapter a = createAdapter("testAdapterInitThrowsException", new DefaultEventHandler(mockEventProducer));
a.getChannelList().add(new Channel() {
@Override
public void init() throws CoreException {
super.init();
throw new CoreException();
}
});
try {
a.requestInit();
fail();
} catch (CoreException e) {
}
// if channel.init() fails, we never
waitForMessages(mockEventProducer, 1);
// send a StartUp Event.
assertEquals(1, mockEventProducer.messageCount());
Event event = EventFactory.createEvent(mockEventProducer.getMessages().get(0));
assertEquals(AdapterInitEvent.class, event.getClass());
assertEquals(false, ((AdapterInitEvent) event).getWasSuccessful());
a.requestClose();
}
Aggregations