You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2011/06/09 13:09:15 UTC

svn commit: r1133789 [2/2] - in /camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/component/bean/ camel-core/src/main/java/org/apache/camel/component/seda/ camel-core/src/main/java/org/apache/camel/impl/...

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RecipientListSubUnitOfWorkTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RecipientListSubUnitOfWorkTest.java?rev=1133789&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RecipientListSubUnitOfWorkTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RecipientListSubUnitOfWorkTest.java Thu Jun  9 11:09:13 2011
@@ -0,0 +1,113 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ *
+ */
+public class RecipientListSubUnitOfWorkTest extends ContextTestSupport {
+
+    private static int counter;
+
+    public void testOK() throws Exception {
+        counter = 0;
+
+        getMockEndpoint("mock:dead").expectedMessageCount(0);
+        getMockEndpoint("mock:start").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:b").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+
+        template.sendBodyAndHeader("direct:start", "Hello World", "foo", "direct:a,direct:b");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testError() throws Exception {
+        counter = 0;
+
+        // the DLC should receive the original message which is Bye World
+        getMockEndpoint("mock:dead").expectedBodiesReceived("Bye World");
+        getMockEndpoint("mock:start").expectedBodiesReceived("Bye World");
+        getMockEndpoint("mock:a").expectedBodiesReceived("Donkey was here");
+        getMockEndpoint("mock:b").expectedMessageCount(0);
+        getMockEndpoint("mock:result").expectedMessageCount(0);
+
+        template.sendBodyAndHeader("direct:start", "Bye World", "foo", "direct:a,direct:b");
+
+        assertMockEndpointsSatisfied();
+
+        assertEquals(4, counter); // 1 first + 3 redeliveries
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                errorHandler(deadLetterChannel("mock:dead").useOriginalMessage()
+                        .maximumRedeliveries(3).redeliveryDelay(0));
+
+                from("direct:start")
+                    .to("mock:start")
+                    .process(new MyPreProcessor())
+                    .recipientList(header("foo")).shareUnitOfWork()
+                    .to("mock:result");
+
+                from("direct:a")
+                    .to("mock:a");
+
+                from("direct:b")
+                    .process(new MyProcessor())
+                    .to("mock:b");
+            }
+        };
+    }
+
+    public static class MyPreProcessor implements Processor {
+
+        @Override
+        public void process(Exchange exchange) throws Exception {
+            // if its a bye message then alter it to something with
+            // Donkey to cause a failure in the sub unit of work
+            // but the DLC should still receive the original input
+            String body = exchange.getIn().getBody(String.class);
+            if (body.startsWith("Bye")) {
+                exchange.getIn().setBody("Donkey was here");
+            }
+        }
+    }
+
+    public static class MyProcessor implements Processor {
+
+        @Override
+        public void process(Exchange exchange) throws Exception {
+            String body = exchange.getIn().getBody(String.class);
+            if (body.contains("Donkey")) {
+                counter++;
+                throw new IllegalArgumentException("Donkey not allowed");
+            }
+        }
+    }
+
+
+}

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkTest.java?rev=1133789&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkTest.java Thu Jun  9 11:09:13 2011
@@ -0,0 +1,102 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ *
+ */
+public class SplitSubUnitOfWorkTest extends ContextTestSupport {
+
+    private static int counter;
+
+    public void testOK() throws Exception {
+        counter = 0;
+
+        getMockEndpoint("mock:dead").expectedMessageCount(0);
+        getMockEndpoint("mock:a").expectedBodiesReceived("Tiger,Camel");
+        getMockEndpoint("mock:b").expectedBodiesReceived("Tiger", "Camel");
+        getMockEndpoint("mock:result").expectedBodiesReceived("Tiger,Camel");
+        getMockEndpoint("mock:line").expectedBodiesReceived("Tiger", "Camel");
+
+        template.sendBody("direct:start", "Tiger,Camel");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testError() throws Exception {
+        counter = 0;
+
+        getMockEndpoint("mock:dead").expectedBodiesReceived("Tiger,Donkey,Camel");
+        getMockEndpoint("mock:a").expectedMessageCount(1);
+        getMockEndpoint("mock:b").expectedBodiesReceived("Tiger", "Donkey", "Camel");
+        getMockEndpoint("mock:result").expectedMessageCount(0);
+        getMockEndpoint("mock:line").expectedBodiesReceived("Tiger", "Camel");
+
+        template.sendBody("direct:start", "Tiger,Donkey,Camel");
+
+        assertMockEndpointsSatisfied();
+
+        assertEquals(4, counter); // 1 first + 3 redeliveries
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // START SNIPPET: e1
+                errorHandler(deadLetterChannel("mock:dead").useOriginalMessage()
+                        .maximumRedeliveries(3).redeliveryDelay(0));
+
+                from("direct:start")
+                    .to("mock:a")
+                    // share unit of work in the splitter, which tells Camel to propagate failures from
+                    // processing the splitted messages back to the result of the splitter, which allows
+                    // it to act as a combined unit of work
+                    .split(body().tokenize(",")).shareUnitOfWork()
+                        .to("mock:b")
+                        .to("direct:line")
+                    .end()
+                    .to("mock:result");
+
+                from("direct:line")
+                    .to("log:line")
+                    .process(new MyProcessor())
+                    .to("mock:line");
+                // END SNIPPET: e1
+            }
+        };
+    }
+
+    public static class MyProcessor implements Processor {
+
+        @Override
+        public void process(Exchange exchange) throws Exception {
+            String body = exchange.getIn().getBody(String.class);
+            if (body.contains("Donkey")) {
+                counter++;
+                throw new IllegalArgumentException("Donkey not allowed");
+            }
+        }
+    }
+
+}

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkWithMDCLoggingTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkWithMDCLoggingTest.java?rev=1133789&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkWithMDCLoggingTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkWithMDCLoggingTest.java Thu Jun  9 11:09:13 2011
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.CamelContext;
+
+/**
+ * Test to ensure MDC logging works with sub unit of work.
+ */
+public class SplitSubUnitOfWorkWithMDCLoggingTest extends SplitSubUnitOfWorkTest {
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+        context.setUseMDCLogging(true);
+        return context;
+    }
+
+}

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitTwoSubUnitOfWorkTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitTwoSubUnitOfWorkTest.java?rev=1133789&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitTwoSubUnitOfWorkTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitTwoSubUnitOfWorkTest.java Thu Jun  9 11:09:13 2011
@@ -0,0 +1,124 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ *
+ */
+public class SplitTwoSubUnitOfWorkTest extends ContextTestSupport {
+
+    private static int counter;
+
+    public void testOK() throws Exception {
+        counter = 0;
+
+        getMockEndpoint("mock:dead").expectedMessageCount(0);
+        getMockEndpoint("mock:a").expectedMessageCount(1);
+        getMockEndpoint("mock:b").expectedBodiesReceived("Tiger", "Camel");
+        getMockEndpoint("mock:c").expectedBodiesReceived("Elephant", "Lion");
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+        getMockEndpoint("mock:line").expectedBodiesReceived("Tiger", "Camel", "Elephant", "Lion");
+
+        MyBody body = new MyBody("Tiger,Camel", "Elephant,Lion");
+        template.sendBody("direct:start", body);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testError() throws Exception {
+        counter = 0;
+
+        getMockEndpoint("mock:dead").expectedMessageCount(1);
+        getMockEndpoint("mock:dead").message(0).body().isInstanceOf(MyBody.class);
+        getMockEndpoint("mock:a").expectedMessageCount(1);
+        getMockEndpoint("mock:b").expectedBodiesReceived("Tiger", "Camel");
+        getMockEndpoint("mock:c").expectedBodiesReceived("Elephant", "Donkey");
+        getMockEndpoint("mock:result").expectedMessageCount(0);
+        getMockEndpoint("mock:line").expectedBodiesReceived("Tiger", "Camel", "Elephant");
+
+        MyBody body = new MyBody("Tiger,Camel", "Elephant,Donkey");
+        template.sendBody("direct:start", body);
+
+        assertMockEndpointsSatisfied();
+
+        assertEquals(4, counter); // 1 first + 3 redeliveries
+
+        MyBody dead = getMockEndpoint("mock:dead").getReceivedExchanges().get(0).getIn().getBody(MyBody.class);
+        assertSame("Should be original message in DLC", body, dead);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                errorHandler(deadLetterChannel("mock:dead").useOriginalMessage()
+                        .maximumRedeliveries(3).redeliveryDelay(0));
+
+                from("direct:start")
+                    .to("mock:a")
+                    .split(simple("${body.foo}")).shareUnitOfWork()
+                        .to("mock:b")
+                        .to("direct:line")
+                    .end()
+                    .split(simple("${body.bar}")).shareUnitOfWork()
+                        .to("mock:c")
+                        .to("direct:line")
+                    .end()
+                    .to("mock:result");
+
+                from("direct:line")
+                    .to("log:line")
+                    .process(new Processor() {
+                        @Override
+                        public void process(Exchange exchange) throws Exception {
+                            String body = exchange.getIn().getBody(String.class);
+                            if (body.contains("Donkey")) {
+                                counter++;
+                                throw new IllegalArgumentException("Donkey not allowed");
+                            }
+                        }
+                    })
+                    .to("mock:line");
+            }
+        };
+    }
+
+    public static final class MyBody {
+        private String foo;
+        private String bar;
+
+        private MyBody(String foo, String bar) {
+            this.foo = foo;
+            this.bar = bar;
+        }
+
+        public String getFoo() {
+            return foo;
+        }
+
+        public String getBar() {
+            return bar;
+        }
+    }
+
+}

Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.java?rev=1133789&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.java Thu Jun  9 11:09:13 2011
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.MulticastSubUnitOfWorkTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version 
+ */
+public class SpringMulticastSubUnitOfWorkTest extends MulticastSubUnitOfWorkTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml");
+    }
+}
\ No newline at end of file

Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRecipientListSubUnitOfWorkTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRecipientListSubUnitOfWorkTest.java?rev=1133789&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRecipientListSubUnitOfWorkTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringRecipientListSubUnitOfWorkTest.java Thu Jun  9 11:09:13 2011
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.RecipientListSubUnitOfWorkTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ * @version 
+ */
+public class SpringRecipientListSubUnitOfWorkTest extends RecipientListSubUnitOfWorkTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringRecipientListSubUnitOfWorkTest.xml");
+    }
+}
\ No newline at end of file

Copied: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitSubUnitOfWorkTest.java (from r1133655, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringAOPBeforeTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitSubUnitOfWorkTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitSubUnitOfWorkTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringAOPBeforeTest.java&r1=1133655&r2=1133789&rev=1133789&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringAOPBeforeTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSplitSubUnitOfWorkTest.java Thu Jun  9 11:09:13 2011
@@ -17,15 +17,16 @@
 package org.apache.camel.spring.processor;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.processor.AOPBeforeTest;
+import org.apache.camel.processor.SplitSubUnitOfWorkTest;
+
 import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
 
 /**
  * @version 
  */
-public class SpringAOPBeforeTest extends AOPBeforeTest {
+public class SpringSplitSubUnitOfWorkTest extends SplitSubUnitOfWorkTest {
 
     protected CamelContext createCamelContext() throws Exception {
-        return createSpringCamelContext(this, "org/apache/camel/spring/processor/aopbefore.xml");
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringSplitSubUnitOfWorkTest.xml");
     }
 }
\ No newline at end of file

Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml?rev=1133789&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml Thu Jun  9 11:09:13 2011
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <bean id="myPreProcessor" class="org.apache.camel.processor.MulticastSubUnitOfWorkTest$MyPreProcessor"/>
+  <bean id="myProcessor" class="org.apache.camel.processor.MulticastSubUnitOfWorkTest$MyProcessor"/>
+
+  <!-- START SNIPPET: e1 -->
+  <camelContext errorHandlerRef="dlc" xmlns="http://camel.apache.org/schema/spring">
+
+    <!-- define error handler as DLC, with use original message enabled -->
+    <errorHandler id="dlc" type="DeadLetterChannel" deadLetterUri="mock:dead" useOriginalMessage="true">
+      <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0"/>
+    </errorHandler>
+
+    <route>
+      <from uri="direct:start"/>
+      <to uri="mock:start"/>
+      <process ref="myPreProcessor"/>
+      <!-- share unit of work in the multicast, which tells Camel to propagate failures from
+           processing each of the multicasted messages back to the result of the multicast,
+           which allows it to act as a combined unit of work -->
+      <multicast shareUnitOfWork="true">
+        <to uri="direct:a"/>
+        <to uri="direct:b"/>
+      </multicast>
+      <to uri="mock:result"/>
+    </route>
+
+    <route>
+      <from uri="direct:a"/>
+      <to uri="mock:a"/>
+    </route>
+
+    <route>
+      <from uri="direct:b"/>
+      <process ref="myProcessor"/>
+      <to uri="mock:b"/>
+    </route>
+
+  </camelContext>
+  <!-- END SNIPPET: e1 -->
+
+</beans>

Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRecipientListSubUnitOfWorkTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRecipientListSubUnitOfWorkTest.xml?rev=1133789&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRecipientListSubUnitOfWorkTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringRecipientListSubUnitOfWorkTest.xml Thu Jun  9 11:09:13 2011
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <bean id="myPreProcessor" class="org.apache.camel.processor.RecipientListSubUnitOfWorkTest$MyPreProcessor"/>
+  <bean id="myProcessor" class="org.apache.camel.processor.RecipientListSubUnitOfWorkTest$MyProcessor"/>
+
+  <!-- START SNIPPET: e1 -->
+  <camelContext errorHandlerRef="dlc" xmlns="http://camel.apache.org/schema/spring">
+
+    <!-- define error handler as DLC, with use original message enabled -->
+    <errorHandler id="dlc" type="DeadLetterChannel" deadLetterUri="mock:dead" useOriginalMessage="true">
+      <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0"/>
+    </errorHandler>
+
+    <route>
+      <from uri="direct:start"/>
+      <to uri="mock:start"/>
+      <process ref="myPreProcessor"/>
+      <!-- share unit of work in the recipient list, which tells Camel to propagate failures from
+           processing each of the recipient list messages back to the result of the recipient list,
+           which allows it to act as a combined unit of work -->
+      <recipientList shareUnitOfWork="true">
+        <header>foo</header>
+      </recipientList>
+      <to uri="mock:result"/>
+    </route>
+
+    <route>
+      <from uri="direct:a"/>
+      <to uri="mock:a"/>
+    </route>
+
+    <route>
+      <from uri="direct:b"/>
+      <process ref="myProcessor"/>
+      <to uri="mock:b"/>
+    </route>
+
+  </camelContext>
+  <!-- END SNIPPET: e1 -->
+
+</beans>

Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitSubUnitOfWorkTest.xml (from r1133655, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aopbefore.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitSubUnitOfWorkTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitSubUnitOfWorkTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aopbefore.xml&r1=1133655&r2=1133789&rev=1133789&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aopbefore.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSplitSubUnitOfWorkTest.xml Thu Jun  9 11:09:13 2011
@@ -22,16 +22,39 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-    <!-- START SNIPPET: e1 -->
-    <camelContext xmlns="http://camel.apache.org/schema/spring">
-        <route>
-            <from uri="direct:start"/>
-            <aop beforeUri="mock:before">
-                <transform><constant>Bye World</constant></transform>
-                <to uri="mock:result"/>
-            </aop>
-        </route>
-    </camelContext>
-    <!-- END SNIPPET: e1 -->
+  <bean id="myProcessor" class="org.apache.camel.processor.SplitSubUnitOfWorkTest$MyProcessor"/>
+
+  <!-- START SNIPPET: e1 -->
+  <camelContext errorHandlerRef="dlc" xmlns="http://camel.apache.org/schema/spring">
+
+    <!-- define error handler as DLC, with use original message enabled -->
+    <errorHandler id="dlc" type="DeadLetterChannel" deadLetterUri="mock:dead" useOriginalMessage="true">
+      <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0"/>
+    </errorHandler>
+
+    <route>
+      <from uri="direct:start"/>
+      <to uri="mock:a"/>
+      <!-- share unit of work in the splitter, which tells Camel to propagate failures from
+           processing the splitted messages back to the result of the splitter, which allows
+           it to act as a combined unit of work -->
+      <split shareUnitOfWork="true">
+        <tokenize token=","/>
+        <to uri="mock:b"/>
+        <to uri="direct:line"/>
+      </split>
+      <to uri="mock:result"/>
+    </route>
+
+    <!-- route for processing each splitted line -->
+    <route>
+      <from uri="direct:line"/>
+      <to uri="log:line"/>
+      <process ref="myProcessor"/>
+      <to uri="mock:line"/>
+    </route>
+
+  </camelContext>
+  <!-- END SNIPPET: e1 -->
 
 </beans>