camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1438034 - in /camel/branches/camel-2.9.x: ./ camel-core/src/main/java/org/apache/camel/processor/ camel-core/src/test/java/org/apache/camel/processor/ components/camel-spring/src/test/resources/org/apache/camel/spring/processor/
Date Thu, 24 Jan 2013 15:02:24 GMT
Author: ningjiang
Date: Thu Jan 24 15:02:24 2013
New Revision: 1438034

URL: http://svn.apache.org/viewvc?rev=1438034&view=rev
Log:
CAMEL-6005 fixed the issue of using shareUnitOfWork within multicast
Merged revisions 1438031 via svnmerge from 
https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x

................
  r1438031 | ningjiang | 2013-01-24 22:54:42 +0800 (Thu, 24 Jan 2013) | 10 lines
  
  Merged revisions 1438017 via svnmerge from 
  https://svn.apache.org/repos/asf/camel/trunk
  
  ........
    r1438017 | ningjiang | 2013-01-24 22:32:32 +0800 (Thu, 24 Jan 2013) | 1 line
    
    CAMEL-6005 fixed the issue of using shareUnitOfWork within multicast
  ........
................

Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
    camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/processor/MulticastSubUnitOfWorkTest.java
    camel/branches/camel-2.9.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1438017
  Merged /camel/branches/camel-2.10.x:r1438031

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java?rev=1438034&r1=1438033&r2=1438034&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
Thu Jan 24 15:02:24 2013
@@ -869,9 +869,12 @@ public class MulticastProcessor extends 
             } catch (Exception e) {
                 throw ObjectHelper.wrapRuntimeCamelException(e);
             }
-
-            // add to cache
-            errorHandlers.putIfAbsent(key, answer);
+            // here we don't cache the ChildUnitOfWorkProcessor
+            // As the UnitOfWorkProcess will be delegate to the Parent
+            if (!(answer instanceof ChildUnitOfWorkProcessor)) {
+                // add to cache
+                errorHandlers.putIfAbsent(key, answer);
+            }
         } else {
             // and wrap in unit of work processor so the copy exchange also can run under
UoW
             answer = createUnitOfWorkProcessor(routeContext, processor, exchange);

Modified: camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/processor/MulticastSubUnitOfWorkTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/processor/MulticastSubUnitOfWorkTest.java?rev=1438034&r1=1438033&r2=1438034&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/processor/MulticastSubUnitOfWorkTest.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/processor/MulticastSubUnitOfWorkTest.java
Thu Jan 24 15:02:24 2013
@@ -58,6 +58,14 @@ public class MulticastSubUnitOfWorkTest 
 
         assertEquals(4, counter); // 1 first + 3 redeliveries
     }
+    
+    public void testMulticastException() throws Exception {
+        getMockEndpoint("mock:dead").expectedBodiesReceived("Hello", "Hi", "Bye");
+        template.sendBody("direct:e", "Hello");
+        template.sendBody("direct:e", "Hi");
+        template.sendBody("direct:e", "Bye");
+        assertMockEndpointsSatisfied();
+    }
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
@@ -82,6 +90,12 @@ public class MulticastSubUnitOfWorkTest 
                 from("direct:b")
                     .process(new MyProcessor())
                     .to("mock:b");
+                
+                from("direct:e")
+                    .multicast().shareUnitOfWork()
+                        .throwException(new IllegalArgumentException("exception1"))
+                        .throwException(new IllegalArgumentException("exception2"))
+                    .end();
             }
         };
     }

Modified: camel/branches/camel-2.9.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml?rev=1438034&r1=1438033&r2=1438034&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml
(original)
+++ camel/branches/camel-2.9.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml
Thu Jan 24 15:02:24 2013
@@ -24,6 +24,7 @@
 
   <bean id="myPreProcessor" class="org.apache.camel.processor.MulticastSubUnitOfWorkTest$MyPreProcessor"/>
   <bean id="myProcessor" class="org.apache.camel.processor.MulticastSubUnitOfWorkTest$MyProcessor"/>
+  <bean name="anException" class="java.lang.IllegalArgumentException"/>
 
   <!-- START SNIPPET: e1 -->
   <camelContext errorHandlerRef="dlc" xmlns="http://camel.apache.org/schema/spring">
@@ -57,6 +58,14 @@
       <process ref="myProcessor"/>
       <to uri="mock:b"/>
     </route>
+    
+    <route>
+      <from uri="direct:e"/>
+      <multicast shareUnitOfWork="true">
+        <throwException ref="anException"/>
+        <throwException ref="anException"/>
+      </multicast>
+    </route>
 
   </camelContext>
   <!-- END SNIPPET: e1 -->



Mime
View raw message