Search in sources :

Example 1 with StateManagedStandaloneConsumer

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

the class ConnectionErrorHandlerTest method testStateManagedComponentConnectionErrorHandler.

@Test
public void testStateManagedComponentConnectionErrorHandler() throws Exception {
    MockStandaloneConsumer c = new StateManagedStandaloneConsumer(new TriggeredFailingConnection(), new MockMessageConsumer(new MockMessageListener()));
    start(c);
    ((TriggeredFailingConnection) c.getConnection()).triggerError();
    assertEquals(2, c.getInitCount());
    assertEquals(2, c.getStartCount());
    assertEquals(1, c.getStopCount());
    assertEquals(1, c.getCloseCount());
    stop(c);
}
Also used : StateManagedStandaloneConsumer(com.adaptris.core.stubs.StateManagedStandaloneConsumer) MockStandaloneConsumer(com.adaptris.core.stubs.MockStandaloneConsumer) MockMessageConsumer(com.adaptris.core.stubs.MockMessageConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) Test(org.junit.Test)

Example 2 with StateManagedStandaloneConsumer

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

the class ConnectionErrorHandlerTest method testStateManagedComponentNullConnectionErrorHandler.

@Test
public void testStateManagedComponentNullConnectionErrorHandler() throws Exception {
    MockStandaloneConsumer c = new StateManagedStandaloneConsumer(new TriggeredFailingConnection(new NullConnectionErrorHandler()), new MockMessageConsumer(new MockMessageListener()));
    start(c);
    ((TriggeredFailingConnection) c.getConnection()).triggerError();
    assertEquals(1, c.getInitCount());
    assertEquals(1, c.getStartCount());
    assertEquals(0, c.getStopCount());
    assertEquals(0, c.getCloseCount());
    stop(c);
}
Also used : StateManagedStandaloneConsumer(com.adaptris.core.stubs.StateManagedStandaloneConsumer) MockStandaloneConsumer(com.adaptris.core.stubs.MockStandaloneConsumer) MockMessageConsumer(com.adaptris.core.stubs.MockMessageConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) Test(org.junit.Test)

Aggregations

MockMessageConsumer (com.adaptris.core.stubs.MockMessageConsumer)2 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)2 MockStandaloneConsumer (com.adaptris.core.stubs.MockStandaloneConsumer)2 StateManagedStandaloneConsumer (com.adaptris.core.stubs.StateManagedStandaloneConsumer)2 Test (org.junit.Test)2