Return-Path: X-Original-To: apmail-camel-dev-archive@www.apache.org Delivered-To: apmail-camel-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EBD0C6212 for ; Tue, 28 Jun 2011 16:20:39 +0000 (UTC) Received: (qmail 99060 invoked by uid 500); 28 Jun 2011 16:20:39 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 98839 invoked by uid 500); 28 Jun 2011 16:20:38 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 98825 invoked by uid 99); 28 Jun 2011 16:20:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jun 2011 16:20:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jun 2011 16:20:37 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 3F2EA4377EB for ; Tue, 28 Jun 2011 16:20:17 +0000 (UTC) Date: Tue, 28 Jun 2011 16:20:17 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: dev@camel.apache.org Message-ID: <223672855.2226.1309278017255.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <613663262.1845.1309271477194.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (CAMEL-4159) MockEndpoint.expectedHeaderReceived checks only one header MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-4159?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1305= 6608#comment-13056608 ]=20 Claus Ibsen commented on CAMEL-4159: ------------------------------------ Running full tests. Will get the last pieces polished later today / tomorro= w morning. > MockEndpoint.expectedHeaderReceived checks only one header > ---------------------------------------------------------- > > Key: CAMEL-4159 > URL: https://issues.apache.org/jira/browse/CAMEL-4159 > Project: Camel > Issue Type: Improvement > Components: camel-core > Affects Versions: 2.7.0 > Reporter: S=C3=B8ren Markert > Assignee: Claus Ibsen > Priority: Minor > Fix For: 2.8.0 > > > The method MockEndpoint.expectedHeaderReceived sets one header key and on= e header value to check. Subsequent calls to the same method overwrites the= key and value. As a (non-expert) user of the MockEndpoint, I would expect = this method to work somewhat along the lines of Map.put, so that multiple h= eaders can be expected. Alternatively, replace it with MockEndpoint.expecte= dHeadersReceived(Map headers) or something like that. > MockEndpoint.expectedPropertyReceived has the same issue. > The unit test below demonstrates the bug. Have fun :) > {code} > import java.util.HashMap; > import org.apache.camel.Produce; > import org.apache.camel.ProducerTemplate; > import org.apache.camel.builder.RouteBuilder; > import org.apache.camel.component.mock.MockEndpoint; > import org.apache.camel.test.CamelTestSupport; > public class MockEndpointTest extends CamelTestSupport { > =09@Produce(uri =3D "direct:input") > =09protected ProducerTemplate input; > =09protected MockEndpoint resultEndpoint; > =09@Override > =09protected RouteBuilder createRouteBuilder() throws Exception { > =09 return new RouteBuilder() { > public void configure() { > =09resultEndpoint =3D new MockEndpoint("mock:result"); > =09resultEndpoint.setCamelContext(getContext()); > =09 > =09from("direct:input") > =09=09.inOnly("log:output?showHeaders=3Dtrue") > =09=09.to(resultEndpoint); > } > }; > =09} > =09 > =09public void testStuff() throws Exception { > =09=09HashMap headers =3D new HashMap(); > //=09=09headers.put("h1", "hello"); > =09=09headers.put("h2", "world"); > =09=09resultEndpoint.expectedHeaderReceived("h1", "hello"); > =09=09resultEndpoint.expectedHeaderReceived("h2", "world"); > =09=09 > =09=09input.sendBodyAndHeaders(null, headers); > =09=09 > =09=09resultEndpoint.expectedMessageCount(1); > =09=09resultEndpoint.assertIsNotSatisfied(); > =09} > } > {code} -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira