use of com.adaptris.core.StandaloneRequestor 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();
}
}
use of com.adaptris.core.StandaloneRequestor in project interlok by adaptris.
the class BasicJmsProducerCase method testMultipleRequestorWithSession.
@Test
public void testMultipleRequestorWithSession() throws Exception {
ServiceList serviceList = new ServiceList(new Service[] { new StandaloneRequestor(activeMqBroker.getJmsConnection(), createProducer(getName()), new TimeInterval(1L, TimeUnit.SECONDS)), new StandaloneRequestor(activeMqBroker.getJmsConnection(), createProducer(getName()), 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();
}
}
use of com.adaptris.core.StandaloneRequestor 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();
}
}
use of com.adaptris.core.StandaloneRequestor in project interlok by adaptris.
the class JmsProducerTest method testRequest_Timeout.
@Test(expected = ServiceException.class)
public void testRequest_Timeout() throws Exception {
String rfc6167 = "jms:queue:" + getName() + "";
JmsProducer producer = createProducer(rfc6167);
producer.setPerMessageProperties(false);
StandaloneRequestor serviceList = new StandaloneRequestor(activeMqBroker.getJmsConnection(), producer, new TimeInterval(1L, TimeUnit.SECONDS));
try {
start(serviceList);
AdaptrisMessage msg1 = createMessage();
serviceList.doService(msg1);
} finally {
stop(serviceList);
}
}
use of com.adaptris.core.StandaloneRequestor in project interlok by adaptris.
the class FtpProducerTest method testRequestReply_NoReplyDirectory.
@Test
public void testRequestReply_NoReplyDirectory() throws Exception {
EmbeddedFtpServer helper = new EmbeddedFtpServer();
FileSystem filesystem = helper.createFilesystem_DirsOnly();
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(PAYLOAD);
filesystem.add(new FileEntry(DEFAULT_REPLY_DIR_CANONICAL + SLASH + msg.getUniqueId(), PAYLOAD_ALTERNATE));
FakeFtpServer server = helper.createAndStart(filesystem);
StandaloneRequestor requestor = null;
try {
FtpProducer ftpProducer = createForTests();
FtpConnection produceConnection = create(server);
requestor = new StandaloneRequestor(produceConnection, ftpProducer);
requestor.setReplyTimeout(DEFAULT_TIMEOUT);
start(requestor);
requestor.doService(msg);
fail();
} catch (ServiceException expected) {
} finally {
stop(requestor);
server.stop();
}
}
Aggregations