use of com.adaptris.core.stubs.MockMessageListener in project interlok by adaptris.
the class DestinationCacheJndiPasProducerTest method testProduceAndConsumeWithCache.
@Test
public void testProduceAndConsumeWithCache() throws Exception {
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJndiPasConnection(recvVendorImp, false, queueName, topicName), new PasConsumer().withTopic(topicName));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPasConnection(sendVendorImp, false, queueName, topicName), new PasProducer().withTopic(topicName));
try {
start(standaloneConsumer);
start(standaloneProducer);
standaloneProducer.doService(createMessage(null));
standaloneProducer.doService(createMessage(null));
waitForMessages(jms, 2);
assertMessages(jms, 2);
} finally {
stop(standaloneProducer);
stop(standaloneConsumer);
}
}
use of com.adaptris.core.stubs.MockMessageListener in project interlok by adaptris.
the class ActiveMqPasPollingConsumerTest method testProduceConsume.
@Test
public void testProduceConsume() throws Exception {
int msgCount = 5;
final StandaloneProducer sender = new StandaloneProducer(activeMqBroker.getJmsConnection(), new PasProducer().withTopic(testName.getMethodName()));
final StandaloneConsumer receiver = createStandalone(activeMqBroker, "testProduceConsume", testName.getMethodName());
try {
MockMessageListener jms = new MockMessageListener();
receiver.registerAdaptrisMessageListener(jms);
startAndStop(receiver);
start(receiver);
start(sender);
for (int i = 0; i < msgCount; i++) {
sender.doService(createMessage());
}
waitForMessages(jms, msgCount);
assertMessages(jms, msgCount);
} finally {
shutdownQuietly(sender, receiver);
}
}
use of com.adaptris.core.stubs.MockMessageListener in project interlok by adaptris.
the class AdvancedActiveMqProducerTest method testQueueProduceAndConsumeWithPrefetch.
@Test
public void testQueueProduceAndConsumeWithPrefetch() throws Exception {
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl(null, createPrefetch())), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl(null, createPrefetch())), new PtpProducer().withQueue((getName())));
execute(standaloneConsumer, standaloneProducer, createMessage(), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.stubs.MockMessageListener in project interlok by adaptris.
the class AdvancedActiveMqProducerTest method testQueueProduceAndConsumeWithRedeliveryPolicy.
@Test
public void testQueueProduceAndConsumeWithRedeliveryPolicy() throws Exception {
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl(createRedelivery(), null)), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl(createRedelivery(), null)), new PtpProducer().withQueue((getName())));
execute(standaloneConsumer, standaloneProducer, createMessage(), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.stubs.MockMessageListener in project interlok by adaptris.
the class BasicActiveMqConsumerTest method testTopicProduceAndConsumeWithExplicitFallbackMessageTranslation.
@Test
public void testTopicProduceAndConsumeWithExplicitFallbackMessageTranslation() throws Exception {
PasConsumer consumer = new PasConsumer().withTopic(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
consumer.setMessageTranslator(new AutoConvertMessageTranslator());
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
DefinedJmsProducer producer = new PasProducer().withTopic(getName());
producer.setMessageTranslator(new BytesMessageTranslator());
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms, 1);
}
Aggregations