@Test public void testMergeReply() throws Exception { AdaptrisMessage reply = new DefaultMessageFactory().newMessage("hello world", StandardCharsets.UTF_8.name()); reply.addMessageHeader("hello", "world"); reply.addObjectHeader("goodbye", "cruel world"); AdaptrisMessage original = new DefaultMessageFactory().newMessage(); AdaptrisMessage msg = mergeReply(reply, original); assertSame(original, msg); assertEquals("hello world", msg.getContent()); assertEquals(StandardCharsets.UTF_8.name(), msg.getContentEncoding()); assertTrue(msg.headersContainsKey("hello")); assertTrue(msg.getObjectHeaders().containsKey("goodbye")); }
protected AdaptrisMessage mergeReply(AdaptrisMessage reply, AdaptrisMessage msg) throws ProduceException { if (reply == msg) { return msg; } copyReplyContents(reply, msg); if (!shouldIgnoreReplyMetadata()) { reply.getMetadata().forEach((e) -> msg.addMetadata(e)); msg.getObjectHeaders().putAll(reply.getObjectHeaders()); } Optional.ofNullable(reply.getContentEncoding()).ifPresent((s) -> msg.setContentEncoding(s)); return msg; }
RequestReplyProducerBase extends AdaptrisMessageProducerImp { protected AdaptrisMessage mergeReply(AdaptrisMessage reply, AdaptrisMessage msg) throws ProduceException { if (reply == msg) { return msg; } copyReplyContents(reply, msg); if (!shouldIgnoreReplyMetadata()) { reply.getMetadata().forEach((e) -> msg.addMetadata(e)); msg.getObjectHeaders().putAll(reply.getObjectHeaders()); } Optional.ofNullable(reply.getContentEncoding()).ifPresent((s) -> msg.setContentEncoding(s)); return msg; } }
RequestReplyProducerBase extends AdaptrisMessageProducerImp { protected AdaptrisMessage mergeReply(AdaptrisMessage reply, AdaptrisMessage msg) throws ProduceException { if (reply == msg) { return msg; } copyReplyContents(reply, msg); if (!shouldIgnoreReplyMetadata()) { reply.getMetadata().forEach((e) -> msg.addMetadata(e)); msg.getObjectHeaders().putAll(reply.getObjectHeaders()); } Optional.ofNullable(reply.getContentEncoding()).ifPresent((s) -> msg.setContentEncoding(s)); return msg; }  }
RequestReplyProducerBase extends AdaptrisMessageProducerImp { protected AdaptrisMessage mergeReply(AdaptrisMessage reply, AdaptrisMessage msg) throws ProduceException { if (reply == msg) { return msg; } copyReplyContents(reply, msg); if (!shouldIgnoreReplyMetadata()) { reply.getMetadata().forEach((e) -> msg.addMetadata(e)); msg.getObjectHeaders().putAll(reply.getObjectHeaders()); } Optional.ofNullable(reply.getContentEncoding()).ifPresent((s) -> msg.setContentEncoding(s)); return msg; }   }
RequestReplyProducerBase extends AdaptrisMessageProducerImp { protected AdaptrisMessage mergeReply(AdaptrisMessage reply, AdaptrisMessage msg) throws ProduceException { if (reply == msg) { return msg; } copyReplyContents(reply, msg); if (!shouldIgnoreReplyMetadata()) { reply.getMetadata().forEach((e) -> msg.addMetadata(e)); msg.getObjectHeaders().putAll(reply.getObjectHeaders()); } Optional.ofNullable(reply.getContentEncoding()).ifPresent((s) -> msg.setContentEncoding(s)); return msg; }    }