use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class ActiveMqJmsTransactedWorkflowTest method createStartableChannel.
private Channel createStartableChannel(Workflow w) throws Exception {
Channel channel = new MockChannel();
channel.getWorkflowList().add(w);
channel.prepare();
return channel;
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class ActiveMqJmsTransactedWorkflowTest method createPlainChannel.
private Channel createPlainChannel(EmbeddedActiveMq mq, boolean isPtp) throws Exception {
Channel result = new MockChannel();
result.setUniqueId(mq.getName() + "_channel");
result.setConsumeConnection(isPtp ? mq.getJmsConnection() : mq.getJmsConnection());
return result;
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class JmsConnectionErrorHandlerTest method testConnectionErrorHandler_WithRuntimeException.
// Tests INTERLOK-2063
@Test
public void testConnectionErrorHandler_WithRuntimeException() throws Exception {
MockChannel channel = createChannel(activeMqBroker, new JmsConnectionCloseWithRuntimeException(activeMqBroker.getJmsConnection(new BasicActiveMqImplementation(), true)), testName.getMethodName(), new JmsConnectionErrorHandler() {
@Override
protected long retryWaitTimeMs() {
return 500L;
}
});
try {
channel.requestStart();
assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
activeMqBroker.stop();
Thread.sleep(1000);
activeMqBroker.start();
waitForChannelToMatchState(StartedState.getInstance(), channel);
assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
assertEquals(2, channel.getStartCount());
} finally {
channel.requestClose();
}
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class JmsConnectionErrorHandlerTest method testConnectionErrorHandler_NotSingleExecution.
@Test
public void testConnectionErrorHandler_NotSingleExecution() throws Exception {
MockChannel channel = createChannel(activeMqBroker, activeMqBroker.getJmsConnection(new BasicActiveMqImplementation(), true), testName.getMethodName(), new JmsConnectionErrorHandler(false));
try {
channel.requestStart();
assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
activeMqBroker.stop();
Thread.sleep(1000);
activeMqBroker.start();
waitForChannelToMatchState(StartedState.getInstance(), channel);
assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
assertEquals(2, channel.getStartCount());
} finally {
channel.requestClose();
}
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class JmsConnectionErrorHandlerTest method testConnectionErrorHandlerWithUnamedChannel.
@Test
public void testConnectionErrorHandlerWithUnamedChannel() throws Exception {
MockChannel channel = createChannel(null, activeMqBroker, activeMqBroker.getJmsConnection(new BasicActiveMqImplementation(), true), testName.getMethodName());
try {
channel.requestStart();
assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
activeMqBroker.stop();
Thread.sleep(1000);
activeMqBroker.start();
waitForChannelToMatchState(StartedState.getInstance(), channel);
assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
assertEquals(2, channel.getStartCount());
} finally {
channel.requestClose();
}
}
Aggregations