use of com.adaptris.core.Workflow in project interlok by adaptris.
the class EmbeddedHttpConsumerTest method testBasicConsumeWorkflow_UpdatedConfig.
// INTERLOK-201
@Test
public void testBasicConsumeWorkflow_UpdatedConfig() throws Exception {
EmbeddedJettyHelper helper = new EmbeddedJettyHelper();
helper.startServer();
MockMessageProducer mockProducer = new MockMessageProducer();
MockMessageProducer mock2 = new MockMessageProducer();
Channel channel = JettyHelper.createChannel(new EmbeddedConnection(), JettyHelper.createConsumer(URL_TO_POST_TO), mockProducer);
Workflow workflow = JettyHelper.createWorkflow(JettyHelper.createConsumer(URL_TO_POST_TO), mock2);
try {
channel.requestStart();
channel.requestClose();
// Update the configuration.
channel.getWorkflowList().clear();
channel.getWorkflowList().add(workflow);
// Now restart
channel.requestStart();
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML_PAYLOAD);
msg.addMetadata(CONTENT_TYPE_METADATA_KEY, "text/xml");
httpProducer.setUrl(helper.createProduceDestination());
start(httpProducer);
AdaptrisMessage reply = httpProducer.request(msg);
assertEquals("Reply Payloads", XML_PAYLOAD, reply.getContent());
doAssertions(mock2);
} finally {
stop(httpProducer);
channel.requestClose();
helper.stopServer();
}
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class JettyHelper method createChannel.
public static Channel createChannel(AdaptrisConnection connection, Workflow... workflows) throws Exception {
Channel result = new MockChannel();
result.setUniqueId("channel");
result.registerEventHandler(createEventHandler());
result.setMessageErrorHandler(new NullProcessingExceptionHandler());
result.setConsumeConnection(connection);
for (Workflow w : workflows) {
result.getWorkflowList().add(w);
}
return result;
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class HttpConsumerTest method testBasicConsumeWorkflow_UpdatedConfig.
@Test
public void testBasicConsumeWorkflow_UpdatedConfig() throws Exception {
HttpConnection connection = createConnection(null);
MockMessageProducer mockProducer = new MockMessageProducer();
MockMessageProducer mock2 = new MockMessageProducer();
Channel channel = JettyHelper.createChannel(connection, JettyHelper.createConsumer(URL_TO_POST_TO), mockProducer);
Workflow workflow = JettyHelper.createWorkflow(JettyHelper.createConsumer(URL_TO_POST_TO), mock2);
try {
channel.requestStart();
channel.requestClose();
channel.getWorkflowList().clear();
channel.getWorkflowList().add(workflow);
channel.requestStart();
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML_PAYLOAD);
msg.addMetadata(CONTENT_TYPE_METADATA_KEY, "text/xml");
httpProducer.setUrl(createProduceDestinationUrl(connection.getPort()));
start(httpProducer);
AdaptrisMessage reply = httpProducer.request(msg);
assertEquals("Reply Payloads", XML_PAYLOAD, reply.getContent());
doAssertions(mock2);
} finally {
stop(httpProducer);
channel.requestClose();
PortManager.release(connection.getPort());
}
}
Aggregations