Search in sources :

Example 1 with AutoConvertMessageTranslator

use of com.adaptris.core.jms.AutoConvertMessageTranslator 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);
}
Also used : DefinedJmsProducer(com.adaptris.core.jms.DefinedJmsProducer) AutoConvertMessageTranslator(com.adaptris.core.jms.AutoConvertMessageTranslator) PasConsumer(com.adaptris.core.jms.PasConsumer) PasProducer(com.adaptris.core.jms.PasProducer) StandaloneConsumer(com.adaptris.core.StandaloneConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) BytesMessageTranslator(com.adaptris.core.jms.BytesMessageTranslator) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 2 with AutoConvertMessageTranslator

use of com.adaptris.core.jms.AutoConvertMessageTranslator in project interlok by adaptris.

the class BasicActiveMqConsumerTest method testQueueProduceAndConsumeWithExplicitFallbackMessageTranslation.

@Test
public void testQueueProduceAndConsumeWithExplicitFallbackMessageTranslation() throws Exception {
    PtpConsumer consumer = new PtpConsumer().withQueue(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 PtpProducer().withQueue((getName()));
    producer.setMessageTranslator(new BytesMessageTranslator());
    StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
    execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
    assertMessages(jms, 1);
}
Also used : PtpConsumer(com.adaptris.core.jms.PtpConsumer) DefinedJmsProducer(com.adaptris.core.jms.DefinedJmsProducer) AutoConvertMessageTranslator(com.adaptris.core.jms.AutoConvertMessageTranslator) PtpProducer(com.adaptris.core.jms.PtpProducer) StandaloneConsumer(com.adaptris.core.StandaloneConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) BytesMessageTranslator(com.adaptris.core.jms.BytesMessageTranslator) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 3 with AutoConvertMessageTranslator

use of com.adaptris.core.jms.AutoConvertMessageTranslator in project interlok by adaptris.

the class MessageTypeTranslatorCase method testTranslatorNullMessage.

@Test
public void testTranslatorNullMessage() throws Exception {
    Message nullMessage = null;
    assertNull(MessageTypeTranslatorImp.translate(new AutoConvertMessageTranslator(), nullMessage));
}
Also used : AutoConvertMessageTranslator(com.adaptris.core.jms.AutoConvertMessageTranslator) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Message(javax.jms.Message) Test(org.junit.Test)

Aggregations

AutoConvertMessageTranslator (com.adaptris.core.jms.AutoConvertMessageTranslator)3 Test (org.junit.Test)3 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)2 StandaloneProducer (com.adaptris.core.StandaloneProducer)2 BytesMessageTranslator (com.adaptris.core.jms.BytesMessageTranslator)2 DefinedJmsProducer (com.adaptris.core.jms.DefinedJmsProducer)2 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)2 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)1 PasConsumer (com.adaptris.core.jms.PasConsumer)1 PasProducer (com.adaptris.core.jms.PasProducer)1 PtpConsumer (com.adaptris.core.jms.PtpConsumer)1 PtpProducer (com.adaptris.core.jms.PtpProducer)1 Message (javax.jms.Message)1