use of com.adaptris.core.jms.BytesMessageTranslator 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);
}
use of com.adaptris.core.jms.BytesMessageTranslator in project interlok by adaptris.
the class BasicActiveMqProducerTest method testQueueProduceAndConsumeWrongType.
@Test
public void testQueueProduceAndConsumeWrongType() throws Exception {
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
consumer.setMessageTranslator(new BytesMessageTranslator());
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PtpProducer().withQueue((getName())));
execute(standaloneConsumer, standaloneProducer, createMessage(), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.jms.BytesMessageTranslator in project interlok by adaptris.
the class BasicActiveMqProducerTest method testTopicProduceAndConsumeWrongType.
@Test
public void testTopicProduceAndConsumeWrongType() throws Exception {
PasConsumer consumer = new PasConsumer().withTopic(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
consumer.setMessageTranslator(new BytesMessageTranslator());
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PasProducer().withTopic(getName()));
execute(standaloneConsumer, standaloneProducer, createMessage(), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.jms.BytesMessageTranslator in project interlok by adaptris.
the class BasicActiveMqProducerTest method testTopicRequestReplyWithMessageWrongType.
@Test
public void testTopicRequestReplyWithMessageWrongType() throws Exception {
TopicLoopback echo = new TopicLoopback(activeMqBroker, getName(), false);
try {
echo.start();
PasProducer producer = new PasProducer().withTopic(getName());
producer.setMessageTranslator(new BytesMessageTranslator());
StandaloneRequestor req = new StandaloneRequestor(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
AdaptrisMessage msg = createMessage();
ExampleServiceCase.execute(req, msg);
echo.waitFor(DEFAULT_TIMEOUT);
assertNotNull(echo.getLastMessage());
assertNotNull(echo.getLastMessage().getJMSReplyTo());
} finally {
echo.stop();
}
}
use of com.adaptris.core.jms.BytesMessageTranslator in project interlok by adaptris.
the class BasicActiveMqProducerTest method testQueueRequestReplyWithMessageWrongType.
@Test
public void testQueueRequestReplyWithMessageWrongType() throws Exception {
QueueLoopback echo = new QueueLoopback(activeMqBroker, getName(), false);
try {
echo.start();
PtpProducer producer = new PtpProducer().withQueue((getName()));
producer.setMessageTranslator(new BytesMessageTranslator());
StandaloneRequestor standaloneProducer = new StandaloneRequestor(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
AdaptrisMessage msg = createMessage();
ExampleServiceCase.execute(standaloneProducer, msg);
echo.waitFor(DEFAULT_TIMEOUT);
assertNotNull(echo.getLastMessage());
assertNotNull(echo.getLastMessage().getJMSReplyTo());
assertEquals(DEFAULT_PAYLOAD.toUpperCase(), msg.getContent());
} finally {
echo.stop();
}
}
Aggregations