Author: davsclaus
Date: Thu Nov 20 11:41:18 2008
New Revision: 719339

URL: http://svn.apache.org/viewvc?rev=719339&view=rev
Log:
CAMEL-1105: Added unit test

Added:
    
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/RedeliveryPolicyReTest.java
   (contents, props changed)
      - copied, changed from r719280, 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/DeadLetterChannelHandledExampleTest.java
    
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml
   (contents, props changed)
      - copied, changed from r719280, 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/deadLetterChannelHandledExampleTest.xml

Copied: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/RedeliveryPolicyReTest.java
 (from r719280, 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/DeadLetterChannelHandledExampleTest.java)
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/RedeliveryPolicyReTest.java?p2=activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/RedeliveryPolicyReTest.java&p1=activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/DeadLetterChannelHandledExampleTest.java&r1=719280&r2=719339&rev=719339&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/DeadLetterChannelHandledExampleTest.java
 (original)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/RedeliveryPolicyReTest.java
 Thu Nov 20 11:41:18 2008
@@ -17,45 +17,16 @@
 package org.apache.camel.spring.processor.onexception;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.component.mock.MockEndpoint;
 
 import static 
org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
 
 /**
  * Unit test for onException with the spring DSL.
  */
-public class DeadLetterChannelHandledExampleTest extends ContextTestSupport {
-
-    public void testOrderOK() throws Exception {
-        MockEndpoint result = getMockEndpoint("mock:result");
-        result.expectedBodiesReceived("Order OK");
-        result.expectedHeaderReceived("orderid", "123");
-
-        MockEndpoint error = getMockEndpoint("mock:error");
-        error.expectedMessageCount(0);
-
-        Object out = template.requestBodyAndHeader("direct:start", "Order: 
MacBook Pro", "customerid", "444");
-        assertEquals("Order OK", out);
-
-        assertMockEndpointsSatisfied();
-    }
-
-    public void testOrderERROR() throws Exception {
-        MockEndpoint error = getMockEndpoint("mock:error");
-        error.expectedBodiesReceived("Order ERROR");
-        error.expectedHeaderReceived("orderid", "failed");
-
-        MockEndpoint result = getMockEndpoint("mock:result");
-        result.expectedMessageCount(0);
-
-        Object out = template.requestBodyAndHeader("direct:start", "Order: 
kaboom", "customerid", "555");
-        assertEquals("Order ERROR", out);
-
-        assertMockEndpointsSatisfied();
-    }
+public class RedeliveryPolicyReTest extends 
DeadLetterChannelHandledExampleTest {
 
     protected CamelContext createCamelContext() throws Exception {
-        return createSpringCamelContext(this, 
"/org/apache/camel/spring/processor/onexception/deadLetterChannelHandledExampleTest.xml");
+        return createSpringCamelContext(this,
+                
"/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml");
     }
 }
\ No newline at end of file

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/RedeliveryPolicyReTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/RedeliveryPolicyReTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/RedeliveryPolicyReTest.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Copied: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml
 (from r719280, 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/deadLetterChannelHandledExampleTest.xml)
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml?p2=activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml&p1=activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/deadLetterChannelHandledExampleTest.xml&r1=719280&r2=719339&rev=719339&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/deadLetterChannelHandledExampleTest.xml
 (original)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml
 Thu Nov 20 11:41:18 2008
@@ -23,6 +23,11 @@
     ">
 
     <!-- START SNIPPET: e1 -->
+    <!-- here we define our redelivery policy using standard spring style -->
+    <bean id="myRedeliveryPolicy" 
class="org.apache.camel.processor.RedeliveryPolicy">
+        <property name="maximumRedeliveries" value="1"/>
+    </bean>
+
 
     <!-- this is our POJO bean with our business logic defined as a plain 
spring bean -->
     <bean id="orderService" 
class="org.apache.camel.spring.processor.onexception.OrderService"/>
@@ -39,8 +44,9 @@
                 <!-- the exception is full qualified names as plain strings -->
                 <!-- there can be more just add a 2nd, 3rd exception element 
(unbounded) -->
                 
<exception>org.apache.camel.spring.processor.onexception.OrderFailedException</exception>
-                <!-- we can set the redelivery policy here as well -->
-                <redeliveryPolicy maximumRedeliveries="1"/>
+                <exception>java.lang.IllegalArgumentException</exception>
+                <!-- here we reference our redelivy policy -->
+                <redeliveryPolicy ref="myRedeliveryPolicy"/>
                 <!-- mark this as handled -->
                 <handled>
                   <constant>true</constant>

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml


Reply via email to