use of org.apache.camel.support.DefaultExchange in project webofneeds by researchstudio-sat.
the class WonMessageSlipComputerTests method testConnectMessageFromNode.
@Test
public void testConnectMessageFromNode() throws Exception {
Exchange exchange = new DefaultExchange(new DefaultCamelContext());
exchange.getIn().setHeader(WonCamelConstants.MESSAGE_HEADER, dummyMessage);
exchange.getIn().setHeader(WonCamelConstants.MESSAGE_TYPE_HEADER, URI.create(WONMSG.ConnectMessageString));
exchange.getIn().setHeader(WonCamelConstants.DIRECTION_HEADER, URI.create(WonMessageDirection.FROM_EXTERNAL.getResource().getURI().toString()));
exchange.getIn().setHeader(WonCamelConstants.SOCKET_TYPE_URI_HEADER, WXCHAT.ChatSocket.asURI());
String slip = fixedMessageProcessorSlip.evaluate(exchange, String.class);
Assert.assertEquals("bean:connectMessageFromNodeProcessor?method=process", slip);
}
use of org.apache.camel.support.DefaultExchange in project webofneeds by researchstudio-sat.
the class WonMessageRoutesTest method send.
protected void send(Map properties, Map<String, Object> headers, Object body, String endpoint) {
Exchange exchange = new DefaultExchange(camelContext);
exchange.setPattern(ExchangePattern.InOnly);
Endpoint ep = camelContext.getEndpoint(endpoint);
if (properties != null) {
if (properties.containsKey("methodName")) {
exchange.setProperty("methodName", properties.get("methodName"));
}
if (properties.containsKey("protocol")) {
exchange.setProperty("protocol", properties.get("protocol"));
}
}
if (headers != null) {
exchange.getIn().setHeaders(headers);
}
exchange.getIn().setBody(body);
producerTemplate.send(ep, exchange);
}
use of org.apache.camel.support.DefaultExchange in project webofneeds by researchstudio-sat.
the class WonMessageSlipComputerTests method testConnectMessageFromOwner.
@Test
public void testConnectMessageFromOwner() throws Exception {
Exchange exchange = new DefaultExchange(new DefaultCamelContext());
exchange.getIn().setHeader(WonCamelConstants.MESSAGE_HEADER, dummyMessage);
exchange.getIn().setHeader(WonCamelConstants.MESSAGE_TYPE_HEADER, URI.create(WONMSG.ConnectMessageString));
exchange.getIn().setHeader(WonCamelConstants.DIRECTION_HEADER, URI.create(WonMessageDirection.FROM_OWNER.getResource().getURI().toString()));
exchange.getIn().setHeader(WonCamelConstants.SOCKET_TYPE_URI_HEADER, WXCHAT.ChatSocket.asURI());
String slip = fixedMessageProcessorSlip.evaluate(exchange, String.class);
Assert.assertEquals("bean:connectMessageFromOwnerProcessor?method=process", slip);
}
use of org.apache.camel.support.DefaultExchange in project webofneeds by researchstudio-sat.
the class WonMessageSlipComputerTests method testSendMessageFromOwner.
@Test
public void testSendMessageFromOwner() throws Exception {
Exchange exchange = new DefaultExchange(new DefaultCamelContext());
exchange.getIn().setHeader(WonCamelConstants.MESSAGE_HEADER, dummyMessage);
exchange.getIn().setHeader(WonCamelConstants.MESSAGE_TYPE_HEADER, URI.create(WONMSG.ConnectionMessageString));
exchange.getIn().setHeader(WonCamelConstants.DIRECTION_HEADER, URI.create(WonMessageDirection.FROM_OWNER.getResource().getURI().toString()));
exchange.getIn().setHeader(WonCamelConstants.SOCKET_TYPE_URI_HEADER, WXCHAT.ChatSocket.asURI());
String slip = fixedMessageProcessorSlip.evaluate(exchange, String.class);
Assert.assertEquals("bean:sendMessageFromOwnerProcessor?method=process", slip);
}
use of org.apache.camel.support.DefaultExchange in project webofneeds by researchstudio-sat.
the class WonMessageSlipComputerTests method testCreateFromOwner.
@Test
public void testCreateFromOwner() throws Exception {
Exchange exchange = new DefaultExchange(new DefaultCamelContext());
exchange.getIn().setHeader(WonCamelConstants.MESSAGE_HEADER, dummyMessage);
exchange.getIn().setHeader(WonCamelConstants.MESSAGE_TYPE_HEADER, URI.create(WONMSG.CreateMessageString));
exchange.getIn().setHeader(WonCamelConstants.DIRECTION_HEADER, URI.create(WonMessageDirection.FROM_OWNER.getResource().getURI().toString()));
String slip = fixedMessageProcessorSlip.evaluate(exchange, String.class);
Assert.assertEquals("bean:createAtomMessageProcessor?method=process", slip);
}
Aggregations