Search in sources :

Example 1 with DefinedJmsProducer

use of com.adaptris.core.jms.DefinedJmsProducer 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 DefinedJmsProducer

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

the class BasicActiveMqConsumerTest method testTopicProduceAndConsumeWithImplicitFallbackMessageTranslation.

@Test
public void testTopicProduceAndConsumeWithImplicitFallbackMessageTranslation() throws Exception {
    PasConsumer consumer = new PasConsumer().withTopic(getName());
    consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
    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) 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 3 with DefinedJmsProducer

use of com.adaptris.core.jms.DefinedJmsProducer 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 4 with DefinedJmsProducer

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

the class BasicActiveMqConsumerTest method testQueueProduceAndConsumeWithImplicitFallbackMessageTranslation.

@Test
public void testQueueProduceAndConsumeWithImplicitFallbackMessageTranslation() throws Exception {
    PtpConsumer consumer = new PtpConsumer().withQueue(getName());
    consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
    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) 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 5 with DefinedJmsProducer

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

the class JmsProducerCase method testSetPriority.

@Test
public void testSetPriority() throws Exception {
    DefinedJmsProducer p = createDummyProducer();
    assertEquals(Integer.valueOf(1), p.getPriority());
    assertEquals(1, p.messagePriority());
    p.setPriority(null);
    assertEquals(null, p.getPriority());
    assertEquals(4, p.messagePriority());
}
Also used : DefinedJmsProducer(com.adaptris.core.jms.DefinedJmsProducer) Test(org.junit.Test)

Aggregations

DefinedJmsProducer (com.adaptris.core.jms.DefinedJmsProducer)5 Test (org.junit.Test)5 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)4 StandaloneProducer (com.adaptris.core.StandaloneProducer)4 BytesMessageTranslator (com.adaptris.core.jms.BytesMessageTranslator)4 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)4 AutoConvertMessageTranslator (com.adaptris.core.jms.AutoConvertMessageTranslator)2 PasConsumer (com.adaptris.core.jms.PasConsumer)2 PasProducer (com.adaptris.core.jms.PasProducer)2 PtpConsumer (com.adaptris.core.jms.PtpConsumer)2 PtpProducer (com.adaptris.core.jms.PtpProducer)2