use of com.adaptris.core.DefaultEventHandler in project interlok by adaptris.
the class BaseCase method createandStartDummyEventHandler.
public static EventHandler createandStartDummyEventHandler() throws CoreException {
DefaultEventHandler eh = new DefaultEventHandler();
LifecycleHelper.init(eh);
LifecycleHelper.start(eh);
return eh;
}
use of com.adaptris.core.DefaultEventHandler in project interlok by adaptris.
the class ExampleWorkflowCase method testRegisterObjects.
@Test
public void testRegisterObjects() throws Exception {
WorkflowImp wf = createWorkflowForGenericTests();
wf.registerChannel(new Channel());
try {
wf.registerChannel(null);
fail();
} catch (IllegalArgumentException e) {
;
}
wf.registerActiveMsgErrorHandler(new NullProcessingExceptionHandler());
try {
wf.registerActiveMsgErrorHandler(null);
fail();
} catch (IllegalArgumentException e) {
;
}
wf.registerActiveMsgErrorHandler(new NullProcessingExceptionHandler());
try {
wf.registerActiveMsgErrorHandler(null);
fail();
} catch (IllegalArgumentException e) {
;
}
wf.registerEventHandler(new DefaultEventHandler());
try {
wf.registerEventHandler(null);
fail();
} catch (IllegalArgumentException e) {
;
}
}
use of com.adaptris.core.DefaultEventHandler 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.DefaultEventHandler in project interlok by adaptris.
the class MockChannel method prepare.
@Override
public void prepare() throws CoreException {
if (eh == null) {
eh = new DefaultEventHandler();
}
eh.requestStart();
registerEventHandler(eh);
super.prepare();
registerActiveMsgErrorHandler(getMessageErrorHandler());
for (Workflow workflow : getWorkflowList()) {
if (workflow.getMessageErrorHandler() != null) {
workflow.registerActiveMsgErrorHandler(workflow.getMessageErrorHandler());
} else {
workflow.registerActiveMsgErrorHandler(getMessageErrorHandler());
}
}
}
use of com.adaptris.core.DefaultEventHandler in project interlok by adaptris.
the class PooledSplitJoinServiceTest method testService_WithException.
@Test(expected = ServiceException.class)
public void testService_WithException() throws Exception {
PooledSplitJoinService service = new PooledSplitJoinService();
service.setAggregator(new AppendingMessageAggregator());
service.setSplitter(new LineCountSplitter(1));
service.setPoolsize(10);
service.setTimeout(new TimeInterval(5L, TimeUnit.SECONDS));
service.setService(new ThrowExceptionService(new ConfiguredException("always-fail")));
service.registerEventHandler(LifecycleHelper.initAndStart(new DefaultEventHandler()));
AdaptrisMessage msg = createLineCountMessageInput(50);
try {
ExampleServiceCase.execute(service, msg);
} catch (ServiceException e) {
assertEquals("always-fail", e.getMessage());
throw e;
}
}
Aggregations