use of com.adaptris.core.stubs.MockMessageConsumer 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);
}
use of com.adaptris.core.stubs.MockMessageConsumer 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);
}
use of com.adaptris.core.stubs.MockMessageConsumer 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);
}
use of com.adaptris.core.stubs.MockMessageConsumer in project interlok by adaptris.
the class AdaptrisConnectionTest method testCloseWithoutWorkferLifecycle.
@Test
public void testCloseWithoutWorkferLifecycle() throws Exception {
MockConnection mc = new MockConnection();
List<MockMessageConsumer> consumers = createConsumers();
List<MockMessageProducer> producers = createProducers();
for (MockMessageConsumer c : consumers) {
mc.addMessageConsumer(c);
}
for (MockMessageProducer c : producers) {
mc.addMessageProducer(c);
}
invoke(mc, INIT);
invoke(producers, INIT);
invoke(consumers, INIT);
invoke(mc, START);
invoke(producers, START);
invoke(consumers, START);
invoke(mc, STOP);
assertState(producers, StartedState.getInstance());
assertState(consumers, StartedState.getInstance());
invoke(producers, STOP);
invoke(consumers, STOP);
invoke(mc, CLOSE);
assertState(producers, StoppedState.getInstance());
assertState(consumers, StoppedState.getInstance());
invoke(producers, CLOSE);
invoke(consumers, CLOSE);
}
use of com.adaptris.core.stubs.MockMessageConsumer in project interlok by adaptris.
the class AdaptrisConnectionTest method testAddMessageConsumer.
@Test
public void testAddMessageConsumer() throws Exception {
MockConnection mc = new MockConnection();
List<MockMessageConsumer> consumers = createConsumers();
mc.addMessageConsumer(null);
for (MockMessageConsumer c : consumers) {
mc.addMessageConsumer(c);
}
for (MockMessageConsumer c : consumers) {
mc.addMessageConsumer(c);
}
assertEquals(mc.retrieveMessageConsumers().size(), consumers.size());
}
Aggregations