@Test public void testForwardingAMessageAcrossJMSKeepingCustomJMSHeaders() throws Exception { MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class); resultEndpoint.expectedBodiesReceived(expectedBody); AssertionClause firstMessageExpectations = resultEndpoint.message(0); firstMessageExpectations.header("cheese").isEqualTo(123); firstMessageExpectations.header("JMSReplyTo").isEqualTo(replyQueue); firstMessageExpectations.header("JMSCorrelationID").isEqualTo(correlationID); firstMessageExpectations.header("JMSType").isEqualTo(messageType); template.sendBodyAndHeader("activemq:test.a", expectedBody, "cheese", 123); resultEndpoint.assertIsSatisfied(); List<Exchange> list = resultEndpoint.getReceivedExchanges(); Exchange exchange = list.get(0); String replyTo = exchange.getIn().getHeader("JMSReplyTo", String.class); assertEquals("ReplyTo", replyQueue.toString(), replyTo); }
public static <T> void testBody(final AssertionClause clause, final Class<T> bodyClass, final Consumer<T> valueConsumer) { clause.predicate(exchange -> { final T body = exchange.getIn().getBody(bodyClass); valueConsumer.accept(body); return true; }); }
private static <T> void testBody(final AssertionClause clause, final Class<T> bodyClass, final Consumer<T> valueConsumer) { clause.predicate(exchange -> { final T body = exchange.getIn().getBody(bodyClass); valueConsumer.accept(body); return true; }); }
public static void testBody(final AssertionClause clause, final Consumer<DataValue> valueConsumer) { testBody(clause, DataValue.class, valueConsumer); }
private static void testBody(final AssertionClause clause, final Consumer<DataValue> valueConsumer) { testBody(clause, DataValue.class, valueConsumer); }