use of com.adaptris.core.stubs.EventHandlerAwareService in project interlok by adaptris.
the class ServiceCollectionCase method testInitWithEventHandlerAware.
@Test
public void testInitWithEventHandlerAware() throws Exception {
EventHandlerAwareService s = new EventHandlerAwareService(UUID.randomUUID().toString());
ServiceCollectionImp sc = createServiceCollection();
DefaultEventHandler eh = new DefaultEventHandler();
sc.registerEventHandler(eh);
sc.addService(new NullService(UUID.randomUUID().toString()));
sc.addService(s);
LifecycleHelper.init(sc);
assertNotNull(s.retrieveEventHandler());
assertEquals(eh, s.retrieveEventHandler());
}
use of com.adaptris.core.stubs.EventHandlerAwareService in project interlok by adaptris.
the class RetryMessageErrorHandlerTest method testChannel_HasEventHandler.
@Test
public void testChannel_HasEventHandler() throws Exception {
EventHandlerAwareService srv = new EventHandlerAwareService();
RetryMessageErrorHandler meh = new RetryMessageErrorHandler(srv);
DefaultEventHandler eventHandler = new DefaultEventHandler();
Adapter adapter = AdapterTest.createAdapter(getName(), eventHandler);
Channel c = new Channel();
c.setMessageErrorHandler(meh);
adapter.getChannelList().add(c);
try {
LifecycleHelper.init(adapter);
assertEquals(eventHandler, srv.retrieveEventHandler());
} finally {
LifecycleHelper.close(adapter);
}
}
use of com.adaptris.core.stubs.EventHandlerAwareService in project interlok by adaptris.
the class BranchingServiceCollectionTest method testInitWithEventHandlerAware.
@Override
public void testInitWithEventHandlerAware() throws Exception {
EventHandlerAwareService s = new EventHandlerAwareService(UUID.randomUUID().toString());
BranchingServiceCollection sc = createServiceCollection();
sc.setFirstServiceId(FIRST_SERVICE_ID);
DefaultEventHandler eh = new DefaultEventHandler();
sc.registerEventHandler(eh);
sc.addService(new NullService(UUID.randomUUID().toString()));
sc.addService(s);
LifecycleHelper.init(sc);
assertNotNull(s.retrieveEventHandler());
assertEquals(eh, s.retrieveEventHandler());
}
use of com.adaptris.core.stubs.EventHandlerAwareService in project interlok by adaptris.
the class StandardProcessingExceptionHandlerTest method testChannel_HasEventHandler.
@Test
public void testChannel_HasEventHandler() throws Exception {
EventHandlerAwareService srv = new EventHandlerAwareService();
StandardProcessingExceptionHandler meh = new StandardProcessingExceptionHandler(srv);
DefaultEventHandler eventHandler = new DefaultEventHandler();
Adapter adapter = AdapterTest.createAdapter(getName(), eventHandler);
Channel c = new Channel();
c.setMessageErrorHandler(meh);
adapter.getChannelList().add(c);
try {
LifecycleHelper.init(adapter);
assertEquals(eventHandler, srv.retrieveEventHandler());
} finally {
LifecycleHelper.close(adapter);
}
}
use of com.adaptris.core.stubs.EventHandlerAwareService in project interlok by adaptris.
the class StandardWorkflowTest method testInitialiseWithEventAware.
@Test
public void testInitialiseWithEventAware() throws Exception {
EventHandlerAwareProducer prod = new EventHandlerAwareProducer();
EventHandlerAwareConsumer cons = new EventHandlerAwareConsumer();
EventHandlerAwareService service = new EventHandlerAwareService();
MockChannel channel = createChannel(prod, Arrays.asList(new Service[] { service }));
((WorkflowImp) channel.getWorkflowList().get(0)).setConsumer(cons);
log.error("------------{}---------------", getName());
channel.requestInit();
EventHandler eh = channel.obtainEventHandler();
log.error("Obtained [{}]", eh);
log.error("------------{}---------------", getName());
assertEquals(eh, prod.retrieveEventHandler());
assertEquals(eh, cons.retrieveEventHandler());
assertEquals(eh, service.retrieveEventHandler());
}
Aggregations