Search in sources :

Example 1 with StubEventHandler

use of com.adaptris.core.stubs.StubEventHandler in project interlok by adaptris.

the class AdapterTest method testAdapterLogsEventSendException.

// Probably a redundant test, but you get a nice warm feeling from have 100%
// code coverage don't you
@Test
public void testAdapterLogsEventSendException() throws Exception {
    Adapter a = createAdapter("testAdapterLogsEventSendException", new StubEventHandler() {

        @Override
        public void send(Event evt) throws CoreException {
            if (evt instanceof AdapterCloseEvent) {
                throw new CoreException();
            } else if (evt instanceof AdapterStopEvent) {
                throw new CoreException();
            }
        }
    });
    a.requestStart();
    a.requestClose();
}
Also used : AdapterCloseEvent(com.adaptris.core.event.AdapterCloseEvent) StubEventHandler(com.adaptris.core.stubs.StubEventHandler) AdapterCloseEvent(com.adaptris.core.event.AdapterCloseEvent) StubAdapterStartUpEvent(com.adaptris.core.stubs.StubAdapterStartUpEvent) AdapterStopEvent(com.adaptris.core.event.AdapterStopEvent) AdapterInitEvent(com.adaptris.core.event.AdapterInitEvent) AdapterStartEvent(com.adaptris.core.event.AdapterStartEvent) AdapterStopEvent(com.adaptris.core.event.AdapterStopEvent) Test(org.junit.Test)

Example 2 with StubEventHandler

use of com.adaptris.core.stubs.StubEventHandler in project interlok by adaptris.

the class DefaultFailedMessageRetrierTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Adapter result = null;
    try {
        DefaultFailedMessageRetrier fmr = new DefaultFailedMessageRetrier();
        FsConsumer consumer = new FsConsumer().withBaseDirectoryUrl("/path/to/retry-directory");
        StandaloneConsumer c = new StandaloneConsumer(consumer);
        fmr.setStandaloneConsumer(c);
        result = new Adapter();
        result.setFailedMessageRetrier(fmr);
        result.setChannelList(new ChannelList());
        result.setEventHandler(new StubEventHandler());
        result.setUniqueId(UUID.randomUUID().toString());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return result;
}
Also used : FsConsumer(com.adaptris.core.fs.FsConsumer) StubEventHandler(com.adaptris.core.stubs.StubEventHandler)

Example 3 with StubEventHandler

use of com.adaptris.core.stubs.StubEventHandler in project interlok by adaptris.

the class ExampleErrorHandlerCase method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Adapter result = new Adapter();
    result.setUniqueId("dummy-adapter");
    ProcessingExceptionHandler meh = createForExamples();
    result.setMessageErrorHandler(meh);
    result.setEventHandler(new StubEventHandler());
    result.setChannelList(new ChannelList());
    return result;
}
Also used : ProcessingExceptionHandler(com.adaptris.core.ProcessingExceptionHandler) StubEventHandler(com.adaptris.core.stubs.StubEventHandler) Adapter(com.adaptris.core.Adapter) ChannelList(com.adaptris.core.ChannelList)

Example 4 with StubEventHandler

use of com.adaptris.core.stubs.StubEventHandler in project interlok by adaptris.

the class RetryFromJettyTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Adapter result = null;
    try {
        RetryFromJetty fmr = new RetryFromJetty();
        fmr.setConnection(new EmbeddedConnection());
        fmr.setRetryStore(new InMemoryRetryStore());
        result = new Adapter();
        result.setFailedMessageRetrier(fmr);
        result.setChannelList(new ChannelList());
        result.setEventHandler(new StubEventHandler());
        result.setUniqueId(UUID.randomUUID().toString());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return result;
}
Also used : StubEventHandler(com.adaptris.core.stubs.StubEventHandler) EmbeddedConnection(com.adaptris.core.http.jetty.EmbeddedConnection) Adapter(com.adaptris.core.Adapter) ChannelList(com.adaptris.core.ChannelList) InterlokException(com.adaptris.interlok.InterlokException) ConfiguredException(com.adaptris.core.services.exception.ConfiguredException)

Aggregations

StubEventHandler (com.adaptris.core.stubs.StubEventHandler)4 Adapter (com.adaptris.core.Adapter)2 ChannelList (com.adaptris.core.ChannelList)2 ProcessingExceptionHandler (com.adaptris.core.ProcessingExceptionHandler)1 AdapterCloseEvent (com.adaptris.core.event.AdapterCloseEvent)1 AdapterInitEvent (com.adaptris.core.event.AdapterInitEvent)1 AdapterStartEvent (com.adaptris.core.event.AdapterStartEvent)1 AdapterStopEvent (com.adaptris.core.event.AdapterStopEvent)1 FsConsumer (com.adaptris.core.fs.FsConsumer)1 EmbeddedConnection (com.adaptris.core.http.jetty.EmbeddedConnection)1 ConfiguredException (com.adaptris.core.services.exception.ConfiguredException)1 StubAdapterStartUpEvent (com.adaptris.core.stubs.StubAdapterStartUpEvent)1 InterlokException (com.adaptris.interlok.InterlokException)1 Test (org.junit.Test)1