use of com.adaptris.core.stubs.MockRequestReplyProducer in project interlok by adaptris.
the class RequestReplyWorkflowTest method testWorkflow.
@Test
public void testWorkflow() throws Exception {
Channel channel = createChannel();
RequestReplyWorkflow workflow = (RequestReplyWorkflow) channel.getWorkflowList().get(0);
workflow.setRetainUniqueId(true);
MockMessageProducer replier = (MockMessageProducer) workflow.getReplyProducer();
MockRequestReplyProducer requestor = (MockRequestReplyProducer) workflow.getProducer();
try {
start(channel);
submitMessages(workflow, 1);
doDefaultAssertions(requestor, replier);
AdaptrisMessage replyMsg = replier.getMessages().get(0);
assertTrue("Request Metadata", replyMsg.headersContainsKey(REQUEST_METADATA_KEY));
} finally {
stop(channel);
}
}
use of com.adaptris.core.stubs.MockRequestReplyProducer in project interlok by adaptris.
the class RequestReplyWorkflowTest method testWorkflow_UseReplyMetadata.
@Test
public void testWorkflow_UseReplyMetadata() throws Exception {
Channel channel = createChannel();
RequestReplyWorkflow workflow = (RequestReplyWorkflow) channel.getWorkflowList().get(0);
MockMessageProducer replier = (MockMessageProducer) workflow.getReplyProducer();
MockRequestReplyProducer requestor = (MockRequestReplyProducer) workflow.getProducer();
try {
requestor.setIgnoreReplyMetadata(false);
start(channel);
submitMessages(workflow, 1);
doDefaultAssertions(requestor, replier);
AdaptrisMessage reply = replier.getMessages().get(0);
assertTrue("Contains Request Metadata key", reply.headersContainsKey(REQUEST_METADATA_KEY));
assertTrue("Reply Metadata key", reply.headersContainsKey(MockRequestReplyProducer.REPLY_METADATA_KEY));
} finally {
stop(channel);
}
}
use of com.adaptris.core.stubs.MockRequestReplyProducer in project interlok by adaptris.
the class RequestReplyWorkflowTest method testWorkflow_IgnoreReplyMetadata.
@Test
public void testWorkflow_IgnoreReplyMetadata() throws Exception {
Channel channel = createChannel();
RequestReplyWorkflow workflow = (RequestReplyWorkflow) channel.getWorkflowList().get(0);
MockMessageProducer replier = (MockMessageProducer) workflow.getReplyProducer();
MockRequestReplyProducer requestor = (MockRequestReplyProducer) workflow.getProducer();
try {
requestor.setIgnoreReplyMetadata(true);
start(channel);
submitMessages(workflow, 1);
doDefaultAssertions(requestor, replier);
AdaptrisMessage reply = replier.getMessages().get(0);
assertTrue("Contains Request Metadata key", reply.headersContainsKey(REQUEST_METADATA_KEY));
assertFalse("Reply Metadata key", reply.headersContainsKey(MockRequestReplyProducer.REPLY_METADATA_KEY));
} finally {
stop(channel);
}
}
use of com.adaptris.core.stubs.MockRequestReplyProducer in project interlok by adaptris.
the class RequestReplyWorkflowTest method createChannel.
// private RequestReplyWorkflow workFlow;
// private MockMessageConsumer consumer;
// private MockRequestReplyProducer producer;
// private MockMessageProducer replyProducer;
private Channel createChannel() throws Exception {
Channel channel = new MockChannel();
MockMessageConsumer consumer = new MockMessageConsumer();
MockRequestReplyProducer producer = new MockRequestReplyProducer();
MockMessageProducer replyProducer = new MockMessageProducer();
RequestReplyWorkflow workFlow = new RequestReplyWorkflow();
workFlow.setConsumer(consumer);
workFlow.setProducer(producer);
workFlow.setReplyProducer(replyProducer);
channel.getWorkflowList().addWorkflow(workFlow);
channel.prepare();
return channel;
}
use of com.adaptris.core.stubs.MockRequestReplyProducer in project interlok by adaptris.
the class RequestReplyProducerTest method testProduce_AdaptrisMessage_ProduceDestination.
@Test
public void testProduce_AdaptrisMessage_ProduceDestination() throws Exception {
MockRequestReplyProducer mock = createAndStart();
try {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("dummy");
mock.produce(msg);
assertEquals(1, mock.getProducedMessages().size());
} finally {
LifecycleHelper.stopAndClose(mock);
}
}
Aggregations