Search in sources :

Example 21 with StandaloneRequestor

use of com.adaptris.core.StandaloneRequestor in project interlok by adaptris.

the class BasicActiveMqProducerTest method testTopicRequestReply_Bug2277.

@Test
public void testTopicRequestReply_Bug2277() throws Exception {
    TopicLoopback echo = new TopicLoopback(activeMqBroker, getName());
    try {
        echo.start();
        StandaloneRequestor standaloneProducer = new StandaloneRequestor(activeMqBroker.getJmsConnection(createVendorImpl()), new PasProducer().withTopic(getName()));
        AdaptrisMessage msg = createMessage();
        msg.addMetadata(JmsConstants.JMS_ASYNC_STATIC_REPLY_TO, getName() + "_reply");
        ExampleServiceCase.execute(standaloneProducer, msg);
        echo.waitFor(DEFAULT_TIMEOUT);
        assertNotNull(echo.getLastMessage());
        assertNotNull(echo.getLastMessage().getJMSReplyTo());
        assertEquals("topic://" + getName() + "_reply", echo.getLastMessage().getJMSReplyTo().toString());
    } finally {
        echo.stop();
    }
}
Also used : StandaloneRequestor(com.adaptris.core.StandaloneRequestor) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) PasProducer(com.adaptris.core.jms.PasProducer) Test(org.junit.Test)

Example 22 with StandaloneRequestor

use of com.adaptris.core.StandaloneRequestor in project interlok by adaptris.

the class BasicActiveMqProducerTest method testQueueRequestReply.

@Test
public void testQueueRequestReply() throws Exception {
    QueueLoopback echo = new QueueLoopback(activeMqBroker, getName());
    try {
        echo.start();
        StandaloneRequestor standaloneProducer = new StandaloneRequestor(activeMqBroker.getJmsConnection(createVendorImpl()), new PtpProducer().withQueue((getName())));
        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();
    }
}
Also used : StandaloneRequestor(com.adaptris.core.StandaloneRequestor) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) PtpProducer(com.adaptris.core.jms.PtpProducer) Test(org.junit.Test)

Example 23 with StandaloneRequestor

use of com.adaptris.core.StandaloneRequestor in project interlok by adaptris.

the class BasicActiveMqProducerTest method testTopicRequestReply.

@Test
public void testTopicRequestReply() throws Exception {
    TopicLoopback echo = new TopicLoopback(activeMqBroker, getName());
    try {
        echo.start();
        StandaloneRequestor standaloneProducer = new StandaloneRequestor(activeMqBroker.getJmsConnection(createVendorImpl()), new PasProducer().withTopic(getName()));
        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();
    }
}
Also used : StandaloneRequestor(com.adaptris.core.StandaloneRequestor) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) PasProducer(com.adaptris.core.jms.PasProducer) Test(org.junit.Test)

Example 24 with StandaloneRequestor

use of com.adaptris.core.StandaloneRequestor in project interlok by adaptris.

the class BasicActiveMqProducerTest method testQueueRequestReply_Bug2277.

@Test
public void testQueueRequestReply_Bug2277() throws Exception {
    QueueLoopback echo = new QueueLoopback(activeMqBroker, getName());
    try {
        echo.start();
        StandaloneRequestor standaloneProducer = new StandaloneRequestor(activeMqBroker.getJmsConnection(createVendorImpl()), new PtpProducer().withQueue((getName())));
        AdaptrisMessage msg = createMessage();
        msg.addMetadata(JmsConstants.JMS_ASYNC_STATIC_REPLY_TO, getName() + "_reply");
        ExampleServiceCase.execute(standaloneProducer, msg);
        echo.waitFor(DEFAULT_TIMEOUT);
        assertNotNull(echo.getLastMessage());
        assertNotNull(echo.getLastMessage().getJMSReplyTo());
        assertEquals("queue://" + getName() + "_reply", echo.getLastMessage().getJMSReplyTo().toString());
    } finally {
        echo.stop();
    }
}
Also used : StandaloneRequestor(com.adaptris.core.StandaloneRequestor) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) PtpProducer(com.adaptris.core.jms.PtpProducer) Test(org.junit.Test)

Example 25 with StandaloneRequestor

use of com.adaptris.core.StandaloneRequestor 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();
    }
}
Also used : StandaloneRequestor(com.adaptris.core.StandaloneRequestor) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) PasProducer(com.adaptris.core.jms.PasProducer) BytesMessageTranslator(com.adaptris.core.jms.BytesMessageTranslator) Test(org.junit.Test)

Aggregations

StandaloneRequestor (com.adaptris.core.StandaloneRequestor)50 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)49 Test (org.junit.Test)49 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)33 Channel (com.adaptris.core.Channel)30 JettyHelper.createChannel (com.adaptris.core.http.jetty.JettyHelper.createChannel)30 ServiceList (com.adaptris.core.ServiceList)23 StandaloneProducer (com.adaptris.core.StandaloneProducer)19 ConfiguredRequestMethodProvider (com.adaptris.core.http.client.ConfiguredRequestMethodProvider)16 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)15 HttpConsumerTest (com.adaptris.core.http.jetty.HttpConsumerTest)15 StandardWorkflow (com.adaptris.core.StandardWorkflow)12 HttpConnection (com.adaptris.core.http.jetty.HttpConnection)12 JettyMessageConsumer (com.adaptris.core.http.jetty.JettyMessageConsumer)12 StandardResponseProducer (com.adaptris.core.http.jetty.StandardResponseProducer)12 StandardHttpProducer (com.adaptris.core.http.client.net.StandardHttpProducer)8 PayloadFromTemplateService (com.adaptris.core.services.metadata.PayloadFromTemplateService)8 TimeInterval (com.adaptris.util.TimeInterval)7 MetadataContentTypeProvider (com.adaptris.core.http.MetadataContentTypeProvider)6 ServiceException (com.adaptris.core.ServiceException)5