Return-Path: Delivered-To: apmail-activemq-camel-commits-archive@locus.apache.org Received: (qmail 21751 invoked from network); 3 Jan 2009 11:27:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Jan 2009 11:27:27 -0000 Received: (qmail 29706 invoked by uid 500); 3 Jan 2009 11:27:27 -0000 Delivered-To: apmail-activemq-camel-commits-archive@activemq.apache.org Received: (qmail 29684 invoked by uid 500); 3 Jan 2009 11:27:27 -0000 Mailing-List: contact camel-commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-dev@activemq.apache.org Delivered-To: mailing list camel-commits@activemq.apache.org Received: (qmail 29675 invoked by uid 99); 3 Jan 2009 11:27:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Jan 2009 03:27:27 -0800 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.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Jan 2009 11:27:24 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9D8F6238896F; Sat, 3 Jan 2009 03:27:03 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r730973 - in /activemq/camel/trunk/camel-core/src/test/java/org/apache/camel: builder/ processor/ processor/onexception/ Date: Sat, 03 Jan 2009 11:26:54 -0000 To: camel-commits@activemq.apache.org From: davsclaus@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090103112703.9D8F6238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davsclaus Date: Sat Jan 3 03:26:52 2009 New Revision: 730973 URL: http://svn.apache.org/viewvc?rev=730973&view=rev Log: CAMEL-1218: polished onException test and wiki samples Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithInFlowExceptionTest.java activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionRouteTest.java Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java?rev=730973&r1=730972&r2=730973&view=diff ============================================================================== --- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java (original) +++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java Sat Jan 3 03:26:52 2009 @@ -166,9 +166,9 @@ .to(ERROR_QUEUE); onException(IOException.class) - .redeliveryDelay(5000L) + .redeliveryDelay(1000L) .maximumRedeliveries(3) - .maximumRedeliveryDelay(30000L) + .maximumRedeliveryDelay(30 * 1000L) .backOffMultiplier(1.0) .useExponentialBackOff() .setHeader(MESSAGE_INFO, constant("Damm somekind of IO exception")) @@ -186,7 +186,7 @@ .setHeader(MESSAGE_INFO, constant("Damm my business is not going to well")) .to(BUSINESS_ERROR_QUEUE); - onException(GeneralSecurityException.class).onException(KeyException.class) + onException(GeneralSecurityException.class, KeyException.class) .maximumRedeliveries(1) .setHeader(MESSAGE_INFO, constant("Damm some security error")) .to(SECURITY_ERROR_QUEUE); Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java?rev=730973&r1=730972&r2=730973&view=diff ============================================================================== --- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java (original) +++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java Sat Jan 3 03:26:52 2009 @@ -62,7 +62,6 @@ return new RouteBuilder() { public void configure() throws Exception { // START SNIPPET: e1 - /* // we do special error handling for when OrderFailedException is thrown onException(OrderFailedException.class) // we mark the exchange as handled so the caller doesn't receive the @@ -72,7 +71,7 @@ // response using java code .bean(OrderService.class, "orderFailed") // and since this is an unit test we use mocks for testing - .to("mock:error");*/ + .to("mock:error"); // this is just the generic error handler where we set the destination // and the number of redeliveries we want to try @@ -80,8 +79,6 @@ // this is our route where we handle orders from("direct:start") - .onException(OrderFailedException.class).handled(true) - .bean(OrderService.class, "orderFailed").to("mock:error").end() // this bean is our order service .bean(OrderService.class, "handleOrder") // this is the destination if the order is OK Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithInFlowExceptionTest.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithInFlowExceptionTest.java?rev=730973&r1=730972&r2=730973&view=diff ============================================================================== --- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithInFlowExceptionTest.java (original) +++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithInFlowExceptionTest.java Sat Jan 3 03:26:52 2009 @@ -29,10 +29,8 @@ onException(ValidationException.class).to("mock:invalid"); from("direct:start"). - onException(ValidationException.class).to("mock:invalid"). - end(). - process(validator). - to("mock:valid"); + process(validator). + to("mock:valid"); } }; } Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionRouteTest.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionRouteTest.java?rev=730973&r1=730972&r2=730973&view=diff ============================================================================== --- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionRouteTest.java (original) +++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionRouteTest.java Sat Jan 3 03:26:52 2009 @@ -104,10 +104,11 @@ return new RouteBuilder() { @Override public void configure() throws Exception { + // START SNIPPET: e1 + // default should errors go to mock:error errorHandler(deadLetterChannel("mock:error")); - // START SNIPPET: e1 // if a MyTechnicalException is thrown we will not try to redeliver and we mark it as handled // so the caller does not get a failure // since we have no to then the exchange will continue to be routed to the normal error handler @@ -119,11 +120,12 @@ onException(MyFunctionalException.class).maximumRedeliveries(0).handled(true).to("bean:myOwnHandler"); // here we route message to our service bean - from("direct:start").choice() - .when().xpath("//type = 'myType'") - .to("bean:myServiceBean") + from("direct:start") + .choice() + .when().xpath("//type = 'myType'").to("bean:myServiceBean") + .end() + .to("mock:result"); // END SNIPPET: e1 - .to("mock:result"); } }; }