Search in sources :

Example 1 with Loopback

use of com.adaptris.core.jms.BasicJmsProducerCase.Loopback in project interlok by adaptris.

the class JmsProducerTest method testMultipleRequestorWithSession.

@Test
public void testMultipleRequestorWithSession() throws Exception {
    String rfc6167 = "jms:queue:" + getName() + "";
    ServiceList serviceList = new ServiceList(new Service[] { new StandaloneRequestor(activeMqBroker.getJmsConnection(), createProducer(rfc6167), new TimeInterval(1L, TimeUnit.SECONDS)), new StandaloneRequestor(activeMqBroker.getJmsConnection(), createProducer(rfc6167), new TimeInterval(1L, TimeUnit.SECONDS)) });
    Loopback echo = createLoopback(activeMqBroker, getName());
    try {
        echo.start();
        start(serviceList);
        AdaptrisMessage msg1 = createMessage();
        AdaptrisMessage msg2 = createMessage();
        serviceList.doService(msg1);
        serviceList.doService(msg2);
        assertEquals(DEFAULT_PAYLOAD.toUpperCase(), msg1.getContent());
        assertEquals(DEFAULT_PAYLOAD.toUpperCase(), msg2.getContent());
    } finally {
        stop(serviceList);
        echo.stop();
    }
}
Also used : StandaloneRequestor(com.adaptris.core.StandaloneRequestor) TimeInterval(com.adaptris.util.TimeInterval) Loopback(com.adaptris.core.jms.BasicJmsProducerCase.Loopback) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) ServiceList(com.adaptris.core.ServiceList) Test(org.junit.Test)

Example 2 with Loopback

use of com.adaptris.core.jms.BasicJmsProducerCase.Loopback in project interlok by adaptris.

the class JmsProducerTest method testRequest_DefinedReplyTo.

@Test
public void testRequest_DefinedReplyTo() throws Exception {
    String rfc6167 = String.format("jms:queue:%1$s?replyToName=%1$s_reply", getName());
    StandaloneRequestor serviceList = new StandaloneRequestor(activeMqBroker.getJmsConnection(), createProducer(rfc6167), new TimeInterval(1L, TimeUnit.SECONDS));
    Loopback echo = createLoopback(activeMqBroker, getName());
    try {
        echo.start();
        start(serviceList);
        AdaptrisMessage msg = createMessage();
        serviceList.doService(msg);
        assertEquals(DEFAULT_PAYLOAD.toUpperCase(), msg.getContent());
    } finally {
        stop(serviceList);
        echo.stop();
    }
}
Also used : StandaloneRequestor(com.adaptris.core.StandaloneRequestor) TimeInterval(com.adaptris.util.TimeInterval) Loopback(com.adaptris.core.jms.BasicJmsProducerCase.Loopback) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 3 with Loopback

use of com.adaptris.core.jms.BasicJmsProducerCase.Loopback in project interlok by adaptris.

the class JmsProducerTest method testRequest_AsyncReplyTo_Metadata.

@Test
public void testRequest_AsyncReplyTo_Metadata() throws Exception {
    String rfc6167 = "jms:queue:" + getName() + "";
    StandaloneRequestor serviceList = new StandaloneRequestor(activeMqBroker.getJmsConnection(), createProducer(rfc6167), new TimeInterval(1L, TimeUnit.SECONDS));
    Loopback echo = createLoopback(activeMqBroker, getName());
    try {
        echo.start();
        start(serviceList);
        AdaptrisMessage msg = createMessage();
        msg.addMetadata(JmsConstants.JMS_ASYNC_STATIC_REPLY_TO, getName() + "_reply");
        serviceList.doService(msg);
        assertEquals(DEFAULT_PAYLOAD.toUpperCase(), msg.getContent());
    } finally {
        stop(serviceList);
        echo.stop();
    }
}
Also used : StandaloneRequestor(com.adaptris.core.StandaloneRequestor) TimeInterval(com.adaptris.util.TimeInterval) Loopback(com.adaptris.core.jms.BasicJmsProducerCase.Loopback) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Aggregations

AdaptrisMessage (com.adaptris.core.AdaptrisMessage)3 StandaloneRequestor (com.adaptris.core.StandaloneRequestor)3 Loopback (com.adaptris.core.jms.BasicJmsProducerCase.Loopback)3 TimeInterval (com.adaptris.util.TimeInterval)3 Test (org.junit.Test)3 ServiceList (com.adaptris.core.ServiceList)1