示例#1
0
  public void testCopyFromSameHeadersInstance() {
    Exchange exchange = new DefaultExchange(context);

    Message in = exchange.getIn();
    Map<String, Object> headers = in.getHeaders();
    headers.put("foo", 123);

    Message out = new DefaultMessage();
    out.setBody("Bye World");
    out.setHeaders(headers);

    out.copyFrom(in);

    assertEquals(123, headers.get("foo"));
    assertEquals(123, in.getHeader("foo"));
    assertEquals(123, out.getHeader("foo"));
  }
 private void setResultToMessage(Message message, Map<String, Object> serviceResult) {
   message.setHeaders(serviceResult);
 }