Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 80352 invoked from network); 23 Aug 2009 12:09:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Aug 2009 12:09:24 -0000 Received: (qmail 54347 invoked by uid 500); 23 Aug 2009 12:09:46 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 54291 invoked by uid 500); 23 Aug 2009 12:09:46 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 54281 invoked by uid 99); 23 Aug 2009 12:09:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Aug 2009 12:09:46 +0000 X-ASF-Spam-Status: No, hits=3.4 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [74.125.78.150] (HELO ey-out-1920.google.com) (74.125.78.150) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Aug 2009 12:09:33 +0000 Received: by ey-out-1920.google.com with SMTP id 13so463601eye.44 for ; Sun, 23 Aug 2009 05:09:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.210.66.18 with SMTP id o18mr3496299eba.59.1251029352429; Sun, 23 Aug 2009 05:09:12 -0700 (PDT) In-Reply-To: <4A911676.6070607@gmail.com> References: <56b1dfc30908221326g352f1be0w39244ad85ca3f009@mail.gmail.com> <4A911676.6070607@gmail.com> Date: Sun, 23 Aug 2009 05:09:12 -0700 Message-ID: <56b1dfc30908230509y328f5134m65dfd55034b4285b@mail.gmail.com> Subject: Re: frustration with multiple mock endpoints in 1 unit test. From: Mick Knutson To: users@camel.apache.org Content-Type: multipart/alternative; boundary=0015174c3d4627ba6d0471cdf8b7 X-Virus-Checked: Checked by ClamAV on apache.org --0015174c3d4627ba6d0471cdf8b7 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Here is the 1 Route file I have: @Override public void configure() throws Exception { log.info("//@@@@@ CLIENT ROUTES @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//"); //from("activemq:Consumer.1.VirtualTopic.Table.1").wireTap("mock://resultAl= lClients").to("mock:resultClient1"); from("seda:resultClient1").wireTap("mock://resultAllClients").to("mock:resu= ltClient1"); from("seda:resultClient2").wireTap("mock://resultAllClients").to("mock:resu= ltClient2"); from("seda:resultClient3").wireTap("mock://resultAllClients").to("mock:resu= ltClient3"); from("seda:resultClient4").wireTap("mock://resultAllClients").to("mock:resu= ltClient4"); from("seda:resultClient5").wireTap("mock://resultAllClients").to("mock:resu= ltClient5"); from("seda:resultClient6").wireTap("mock://resultAllClients").to("mock:resu= ltClient6"); from("seda:resultClient7").wireTap("mock://resultAllClients").to("mock:resu= ltClient7"); from("seda:resultClient8").wireTap("mock://resultAllClients").to("mock:resu= ltClient8"); from("seda:resultClient9").wireTap("mock://resultAllClients").to("mock:resu= ltClient9"); from("seda:resultClient10").wireTap("mock://resultAllClients").to("mock:res= ultClient10"); from("seda:resultClient11").wireTap("mock://resultAllClients").to("mock:res= ultClient11"); } // end configure --- Thank You=85 Mick Knutson, President BASE Logic, Inc. Enterprise Architecture, Design, Mentoring & Agile Consulting p. (866) BLiNC-411: (254-6241-1) f. (415) 685-4233 Website: http://baselogic.com Linked IN: http://linkedin.com/in/mickknutson Vacation Rental: http://tahoe.baselogic.com --- On Sun, Aug 23, 2009 at 3:14 AM, Willem Jiang wrote= : > Hi Mick, > > Can you show me the route rule ? > It will help us to trace the issue :) > > Willem > > > Mick Knutson wrote: > >> I have a unit test that has a wiretap that routes the message to a mock >> endpoint. >> Here is what works: >> >> @EndpointInject(uri =3D "mock:resultAllClients") >> protected MockEndpoint resultAllClients; >> >> @EndpointInject(uri =3D "mock:resultClient1") >> protected MockEndpoint resultClient1; >> @EndpointInject(uri =3D "mock:resultClient2") >> protected MockEndpoint resultClient2; >> @EndpointInject(uri =3D "mock:resultClient3") >> protected MockEndpoint resultClient3; >> @EndpointInject(uri =3D "mock:resultClient4") >> protected MockEndpoint resultClient4; >> >> @Test >> public void testSendBetMessage() throws Exception { >> log.info("Send a test message to Table Service"); >> >> //resultAllClients.expectedMinimumMessageCount(3); >> resultClient1.expectedMessageCount(1); >> resultClient2.expectedMessageCount(1); >> //resultClient3.expectedMessageCount(1); >> //resultClient4.expectedMessageCount(1); >> >> >> // Send the test message to make Server Service create our Status >> Message >> producerTemplate.sendBody("jms:queue:bets", >> ExchangePattern.InOnly, 22); >> >> // now lets assert that the mock endpoint received messages >> resultClient1.assertIsSatisfied(); >> resultClient2.assertIsSatisfied(); >> //resultClient3.assertIsSatisfied(); >> //resultClient4.assertIsSatisfied(); >> >> //resultAllClients.assertIsSatisfied(); >> log.info("XXXXXXXXXX DONE >> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); >> >> } >> >> /*@After >> public void finalizeTests() { >> // resultAllClients.reset(); >> resultClient1.reset(); >> resultClient2.reset(); >> resultClient3.reset(); >> // resultClient4.reset(); >> }*/ >> >> >> >> This is in 1 unit test class and the way it is above has all assertions >> pass. >> If any of the following things change, I get: >> >> java.lang.AssertionError: mock://resultClient1 Received message count. >> Expected: <1> but was: <0> >> >> >> 1. If I uncomment the finalizeTests() method, the error starts. >> >> 2. If I uncomment resultClient3, resultClient4 it might start working, >> then >> randomly it will show up again and I have to comment them out in order f= or >> the test to pass again. >> >> >> Is there some bug/defect in the Mock that I have not googled? >> >> >> >> --- >> Thank You=85 >> >> Mick Knutson, President >> >> BASE Logic, Inc. >> Enterprise Architecture, Design, Mentoring & Agile Consulting >> p. (866) BLiNC-411: (254-6241-1) >> f. (415) 685-4233 >> >> Website: http://baselogic.com >> Linked IN: http://linkedin.com/in/mickknutson >> Vacation Rental: http://tahoe.baselogic.com >> --- >> >> > --0015174c3d4627ba6d0471cdf8b7--