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");
             }
         };
     }


Reply via email to