Return-Path: Delivered-To: apmail-camel-dev-archive@www.apache.org Received: (qmail 39231 invoked from network); 13 Jan 2010 16:26:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jan 2010 16:26:07 -0000 Received: (qmail 18585 invoked by uid 500); 13 Jan 2010 16:26:06 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 18544 invoked by uid 500); 13 Jan 2010 16:26:06 -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 18534 invoked by uid 500); 13 Jan 2010 16:26:06 -0000 Delivered-To: apmail-activemq-camel-dev@activemq.apache.org Received: (qmail 18531 invoked by uid 99); 13 Jan 2010 16:26:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jan 2010 16:26:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jan 2010 16:26:04 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 749D7234C052 for ; Wed, 13 Jan 2010 08:25:43 -0800 (PST) Message-ID: <484678721.931263399943476.JavaMail.jira@brutus.apache.org> Date: Wed, 13 Jan 2010 16:25:43 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: camel-dev@activemq.apache.org Subject: [jira] Commented: (CAMEL-2357) ExchangeNotifierBuilder - Add a builder to building exchange notification predicates to be used for testing In-Reply-To: <844981960.901263399823541.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/CAMEL-2357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56891#action_56891 ] Claus Ibsen commented on CAMEL-2357: ------------------------------------ Btw the from is optional you can do {code} ExchangeNotifierBuilder builder = new ExchangeNotifierBuilder(context) .whenExchangeDone(5) .not().whenExchangeFailed(1) .create(); {code} Just to indicate any 5 done but none should be failed. And the from is using wildcard matching just like the interceptors so you can do {{from("jms*")}} to indicate any JMS. > ExchangeNotifierBuilder - Add a builder to building exchange notification predicates to be used for testing > ----------------------------------------------------------------------------------------------------------- > > Key: CAMEL-2357 > URL: https://issues.apache.org/activemq/browse/CAMEL-2357 > Project: Apache Camel > Issue Type: New Feature > Components: camel-core > Affects Versions: 2.1.0 > Reporter: Claus Ibsen > Assignee: Claus Ibsen > Fix For: 2.2.0 > > > When doing unit testing and you do not use mocks or the likes to test when X number of message have completed etc. > Then we need some other form to do that and a fairly lightweight and simple builder can offer this in a intuitive way. > {code} > ExchangeNotifierBuilder builder = new ExchangeNotifierBuilder(context) > .from("direct:foo").whenExchangeDone(5) > .create(); > {code} > And you can stack with operations such as *and, or, not* etc: > {code} > ExchangeNotifierBuilder builder = new ExchangeNotifierBuilder(context) > .from("direct:foo").whenExchangeDone(5) > .or().from("direct:bar").whenExchangeDone(7) > .create(); > {code} > Then you just assert whether it matched and there should be methods to wait as well > {code} > assertEquals(true, builder.matches()); > {code} > As well as a method to invoke a callback when its matching. > On top we can add to the builder so you can do fine grained expressions to indicate when this message is complete, or when 5 messages with header amount > 100 is complete etc. > Basically if we can tap in the other builders then you would be able to archive that -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.