Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 35162 invoked from network); 2 Oct 2008 01:24:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Oct 2008 01:24:41 -0000 Received: (qmail 22196 invoked by uid 500); 2 Oct 2008 01:24:39 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 22178 invoked by uid 500); 2 Oct 2008 01:24:39 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Received: (qmail 22167 invoked by uid 99); 2 Oct 2008 01:24:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 18:24:39 -0700 X-ASF-Spam-Status: No, hits=3.2 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.200.168] (HELO wf-out-1314.google.com) (209.85.200.168) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Oct 2008 01:23:39 +0000 Received: by wf-out-1314.google.com with SMTP id 26so862934wfd.26 for ; Wed, 01 Oct 2008 18:24:14 -0700 (PDT) Received: by 10.142.143.14 with SMTP id q14mr3593584wfd.304.1222910654105; Wed, 01 Oct 2008 18:24:14 -0700 (PDT) Received: by 10.143.14.8 with HTTP; Wed, 1 Oct 2008 18:24:14 -0700 (PDT) Message-ID: <56b1dfc30810011824m4069e5f6w92291618307b4e35@mail.gmail.com> Date: Wed, 1 Oct 2008 18:24:14 -0700 From: "Mick Knutson" To: camel-user@activemq.apache.org Subject: Re: Trying to understand how to deal with process() errors and creating an exceptionChannel for bad messages. In-Reply-To: <56b1dfc30809261024r42d6d916me2109c6b848b5ecd@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_66975_20296761.1222910654071" References: <56b1dfc30809251240g256ecd89l874910502ca98c78@mail.gmail.com> <4C1FB9C00D24A140906239533638C4D205716715@EXVS04.exserver.dk> <56b1dfc30809261024r42d6d916me2109c6b848b5ecd@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_66975_20296761.1222910654071 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline So I have gotten a bit further, but not all the way. It appears that if I have a unit test that is overloaded as I can do in TestNG, then I can seemingly re-use the same mock endpoints. Here is a valid test that is overloaded 3 different times: *@Test(groups = {"functional"}) @Parameters({"startEndpointUri", "successEndpointUri", "errorEndpointUri", "messageInputBody"}) public void testCreateInvalidChangeRequest(String startEndpointUri, String successEndpointUri, String errorEndpointUri, String messageInputBody ) throws Exception { MockEndpoint mockSuccessEndpoint = getMockEndpoint(successEndpointUri); MockEndpoint mockFailureEndpoint = getMockEndpoint(errorEndpointUri); mockFailureEndpoint.expectedBodiesReceived(messageInputBody); mockFailureEndpoint.expectedMessageCount(1); mockSuccessEndpoint.expectedMessageCount(0); try { // Create and Send message to input queue camelContext.addRoutes( createRoute(startEndpointUri, changeRequestProcessor, successEndpointUri, errorEndpointUri ) ); producerTemplate.sendBody(startEndpointUri, messageInputBody); Assert.fail("Should have thrown a RuntimeCamelException"); } catch (RuntimeCamelException e) { assertIsInstanceOf(e, RuntimeCamelException.class); } // this is optional. testMocksAreValid(); MockEndpoint.assertIsSatisfied(mockFailureEndpoint, mockSuccessEndpoint); } * Now here is the kicker, when I have another test method in this class running with the same endpoint values: *@Test(groups = {"functional"}) @Parameters({"startEndpointUri", "successEndpointUri", "errorEndpointUri", "messageInputBody"}) public void testCreateValidRequest(String startEndpointUri, String successEndpointUri, String errorEndpointUri, String messageInputBody ) throws Exception { MockEndpoint mockSuccessEndpoint = getMockEndpoint(successEndpointUri); MockEndpoint mockFailureEndpoint = getMockEndpoint(errorEndpointUri); mockSuccessEndpoint.expectedMessageCount(1); mockSuccessEndpoint.message(0).header(Constants.REQUEST_DESTINATION).isEqualTo(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER); mockFailureEndpoint.expectedMessageCount(0); try { // setup RouteBuilder... // Create and Send message to input queue camelContext.addRoutes( createRoute(startEndpointUri, changeRequestProcessor, successEndpointUri, errorEndpointUri ) ); // Create and Send message to input queue producerTemplate.sendBodyAndHeader(startEndpointUri, messageInputBody, Constants.COMMAND_TYPE, Constants.PROVISION); } catch (RuntimeCamelException e) { Assert.fail("Should have thrown a RuntimeCamelException"); } testMocksAreValid(); MockEndpoint.assertIsSatisfied(mockSuccessEndpoint, mockFailureEndpoint); } * * I get the following errors:* * ..... but was: <2>]]> * So the mock:error queue is not getting cleaned up and there is an extra message. So how on earth do I DELETE or RESET or CLEAR this mock? I have spun through each one and ran mock.reset() but that did not help. ------=_Part_66975_20296761.1222910654071--