use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.
the class JmsConnectionErrorHandlerTest method testActiveJmsAllowedInConjunctionWith_NullConnectString.
@Test
public void testActiveJmsAllowedInConjunctionWith_NullConnectString() throws Exception {
ActiveJmsConnectionErrorHandler jms1 = new ActiveJmsConnectionErrorHandler();
JmsConnection c = new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:61616"));
jms1.registerConnection(c);
ActiveJmsConnectionErrorHandler jms2 = new ActiveJmsConnectionErrorHandler();
jms2.registerConnection(c);
assertFalse(jms1.allowedInConjunctionWith(jms2));
}
use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.
the class FailoverJmsProducerCase method testBug1012.
@Test
public void testBug1012() throws Exception {
FailoverJmsConnection connection = new FailoverJmsConnection();
List<JmsConnection> ptp = new ArrayList<JmsConnection>();
ptp.add(activeMqBroker.getJmsConnection());
ptp.add(activeMqBroker.getJmsConnection(new BasicActiveMqImplementation(), true));
connection.setConnections(ptp);
LifecycleHelper.init(connection);
assertEquals(1, connection.currentJmsConnection().retrieveExceptionListeners().size());
AdaptrisComponent owner = (AdaptrisComponent) connection.currentJmsConnection().retrieveExceptionListeners().toArray()[0];
assertTrue("Owner should be failover connection", connection == owner);
LifecycleHelper.close(connection);
Channel channel = new MockChannel();
connection = new FailoverJmsConnection();
connection.setRegisterOwner(true);
channel.setConsumeConnection(connection);
ptp = new ArrayList<JmsConnection>();
ptp.add(activeMqBroker.getJmsConnection());
ptp.add(activeMqBroker.getJmsConnection(new BasicActiveMqImplementation(), true));
connection.setConnections(ptp);
LifecycleHelper.init(connection);
// setting the consume connection no longer sets up the exception handler, so expect 0 here.
assertEquals(0, connection.currentJmsConnection().retrieveExceptionListeners().size());
LifecycleHelper.close(connection);
}
use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.
the class FailoverJmsProducerCase method testNeverConnects.
@Test
public void testNeverConnects() throws Exception {
FailoverJmsConnection connection = new FailoverJmsConnection();
connection.addConnection(new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:123456")));
connection.addConnection(new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:123456")));
connection.setConnectionRetryInterval(new TimeInterval(250L, TimeUnit.MILLISECONDS));
connection.setConnectionAttempts(1);
connection.addExceptionListener(new StandaloneConsumer());
connection.setRegisterOwner(true);
try {
LifecycleHelper.initAndStart(connection);
} catch (CoreException expected) {
} finally {
LifecycleHelper.stopAndClose(connection);
}
}
use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.
the class AggregatingJmsConsumeServiceTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
AggregatingJmsConsumeService service = null;
service = new AggregatingJmsConsumeService();
JmsConnection jmsConnection = new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:61616"));
jmsConnection.setConnectionAttempts(2);
jmsConnection.setConnectionRetryInterval(new TimeInterval(3L, "SECONDS"));
service.setConnection(jmsConnection);
AggregatingQueueConsumer consumer = new AggregatingQueueConsumer();
consumer.setEndpoint("Sample.Q1");
consumer.setFilterExpression("%message{filterSelectorKey}");
consumer.setMessageAggregator(new ReplaceWithFirstMessage());
consumer.setMessageTranslator(new TextMessageTranslator());
service.setJmsConsumer(consumer);
return service;
}
Aggregations