Search in sources :

Example 1 with MockStandaloneConsumer

use of com.adaptris.core.stubs.MockStandaloneConsumer 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 MockStandaloneConsumer

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

the class ConnectionErrorHandlerTest method testAdaptrisComponentConnectionErrorHandler.

@Test
public void testAdaptrisComponentConnectionErrorHandler() throws Exception {
    MockStandaloneConsumer c = new MockStandaloneConsumer(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 : MockStandaloneConsumer(com.adaptris.core.stubs.MockStandaloneConsumer) MockMessageConsumer(com.adaptris.core.stubs.MockMessageConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) Test(org.junit.Test)

Example 3 with MockStandaloneConsumer

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

the class ConnectionErrorHandlerTest method testAdaptrisComponentNullConnectionErrorHandler.

@Test
public void testAdaptrisComponentNullConnectionErrorHandler() throws Exception {
    MockStandaloneConsumer c = new MockStandaloneConsumer(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 : MockStandaloneConsumer(com.adaptris.core.stubs.MockStandaloneConsumer) MockMessageConsumer(com.adaptris.core.stubs.MockMessageConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) Test(org.junit.Test)

Example 4 with MockStandaloneConsumer

use of com.adaptris.core.stubs.MockStandaloneConsumer 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)4 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)4 MockStandaloneConsumer (com.adaptris.core.stubs.MockStandaloneConsumer)4 Test (org.junit.Test)4 StateManagedStandaloneConsumer (com.adaptris.core.stubs.StateManagedStandaloneConsumer)2