use of com.adaptris.core.jms.ActiveJmsConnectionErrorHandler in project interlok by adaptris.
the class ActiveJmsConnectionErrorHandlerTest method createErrorHandler.
private ActiveJmsConnectionErrorHandler createErrorHandler() {
ActiveJmsConnectionErrorHandler handler = new ActiveJmsConnectionErrorHandler();
handler.setAdditionalLogging(true);
handler.setCheckInterval(new TimeInterval(500L, TimeUnit.MILLISECONDS));
return handler;
}
use of com.adaptris.core.jms.ActiveJmsConnectionErrorHandler in project interlok by adaptris.
the class ActiveJmsConnectionErrorHandlerTest method testConnectionErrorHandlerWhileConnectionIsClosed.
@Test
public void testConnectionErrorHandlerWhileConnectionIsClosed() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
JmsConnection jmsCon = activeMqBroker.getJndiPasConnection(new StandardJndiImplementation(), false, queueName, topicName);
jmsCon.setConnectionAttempts(null);
MockChannel channel = createChannel(activeMqBroker, jmsCon, topicName);
try {
ActiveJmsConnectionErrorHandler handler = new ActiveJmsConnectionErrorHandler();
handler.setCheckInterval(new TimeInterval(100L, TimeUnit.MILLISECONDS));
handler.setAdditionalLogging(Boolean.TRUE);
channel.getConsumeConnection().setConnectionErrorHandler(handler);
channel.requestStart();
assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
channel.requestClose();
activeMqBroker.stop();
activeMqBroker.start();
assertEquals(ClosedState.getInstance(), channel.retrieveComponentState());
} finally {
channel.requestClose();
}
}
use of com.adaptris.core.jms.ActiveJmsConnectionErrorHandler in project interlok by adaptris.
the class ActiveJmsConnectionErrorHandlerCase method testAdditionalLogging.
@Test
public void testAdditionalLogging() {
ActiveJmsConnectionErrorHandler ajceh = new ActiveJmsConnectionErrorHandler();
assertNull(ajceh.getAdditionalLogging());
assertFalse(ajceh.additionalLogging());
ajceh.setAdditionalLogging(Boolean.TRUE);
assertNotNull(ajceh.getAdditionalLogging());
assertEquals(true, ajceh.additionalLogging());
assertEquals(Boolean.TRUE, ajceh.getAdditionalLogging());
ajceh.setAdditionalLogging(null);
assertNull(ajceh.getAdditionalLogging());
assertFalse(ajceh.additionalLogging());
}
use of com.adaptris.core.jms.ActiveJmsConnectionErrorHandler in project interlok by adaptris.
the class ActiveJmsConnectionErrorHandlerCase method testRetryInterval.
@Test
public void testRetryInterval() {
ActiveJmsConnectionErrorHandler handler = new ActiveJmsConnectionErrorHandler();
assertNull(handler.getCheckInterval());
assertEquals(5000, handler.retryInterval());
TimeInterval interval = new TimeInterval(1L, TimeUnit.MINUTES);
TimeInterval bad = new TimeInterval(0L, TimeUnit.MILLISECONDS);
handler.setCheckInterval(interval);
assertEquals(interval, handler.getCheckInterval());
assertEquals(interval.toMilliseconds(), handler.retryInterval());
handler.setCheckInterval(bad);
assertEquals(bad, handler.getCheckInterval());
assertEquals(5000, handler.retryInterval());
handler.setCheckInterval(null);
assertNull(handler.getCheckInterval());
assertEquals(5000, handler.retryInterval());
}
Aggregations