Author: ningjiang
Date: Wed Aug 20 00:04:08 2008
New Revision: 687264

URL: http://svn.apache.org/viewvc?rev=687264&view=rev
Log:
CAMEL-836 support to configure the multicast with Spring xml

Added:
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/AppendingProcessor.java
   (with props)
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java
   (with props)
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyOutAggregatingStrategy.java
   (with props)
    
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/MySingleThreadExecutor.java
   (with props)
    
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastAggregatorTest.java
   (with props)
    
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastTest.java
   (with props)
    
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/multicast.xml
   (with props)
    
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/multicastAggregator.xml
   (with props)
Modified:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastType.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastTest.java
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MyAggregationStrategy.java

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastType.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastType.java?rev=687264&r1=687263&r2=687264&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastType.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MulticastType.java
 Wed Aug 20 00:04:08 2008
@@ -42,6 +42,10 @@
 public class MulticastType extends OutputType<ProcessorType> {
     @XmlAttribute(required = false)
     private Boolean parallelProcessing;
+    @XmlAttribute(required = false)
+    private String strategyRef;
+    @XmlAttribute(required = false)
+    private String threadPoolRef;
     @XmlTransient
     private AggregationStrategy aggregationStrategy;
     @XmlTransient
@@ -62,9 +66,16 @@
         return createOutputsProcessor(routeContext);
     }
 
-    protected Processor createCompositeProcessor(List<Processor> list) {
+    protected Processor createCompositeProcessor(RouteContext routeContext, 
List<Processor> list) {
         if (aggregationStrategy == null) {
-            aggregationStrategy = new UseLatestAggregationStrategy();
+            if (strategyRef == null) {
+                aggregationStrategy = new UseLatestAggregationStrategy();
+            } else {
+                aggregationStrategy = routeContext.lookup(strategyRef, 
AggregationStrategy.class);
+            }
+        }
+        if (threadPoolRef != null) {
+            threadPoolExecutor = routeContext.lookup(threadPoolRef, 
ThreadPoolExecutor.class);
         }
         return new MulticastProcessor(list, aggregationStrategy, 
isParallelProcessing(), threadPoolExecutor);
     }

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java?rev=687264&r1=687263&r2=687264&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
 Wed Aug 20 00:04:08 2008
@@ -1626,7 +1626,7 @@
      * to using a [EMAIL PROTECTED] Pipeline} but derived classes could change 
the
      * behaviour
      */
-    protected Processor createCompositeProcessor(List<Processor> list) {
+    protected Processor createCompositeProcessor(RouteContext routeContext, 
List<Processor> list) {
         // return new MulticastProcessor(list);
         return new Pipeline(list);
     }
@@ -1650,7 +1650,7 @@
             if (list.size() == 1) {
                 processor = list.get(0);
             } else {
-                processor = createCompositeProcessor(list);
+                processor = createCompositeProcessor(routeContext, list);
             }
         }
         return processor;

Added: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/AppendingProcessor.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/AppendingProcessor.java?rev=687264&view=auto
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/AppendingProcessor.java
 (added)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/AppendingProcessor.java
 Wed Aug 20 00:04:08 2008
@@ -0,0 +1,45 @@
+/**
+ * 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.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+
+public class AppendingProcessor implements Processor {
+    private String suffixString;
+
+    public AppendingProcessor() {
+        this("+output");
+    }
+
+    public AppendingProcessor(String suffix) {
+        suffixString = suffix;
+    }
+
+    public void setSuffixString(String suffix) {
+        suffixString = suffix;
+    }
+
+    public void process(Exchange exchange) {
+        // lets transform the IN message
+        Message in = exchange.getIn();
+        String body = in.getBody(String.class);
+        in.setBody(body + suffixString);
+    }
+
+}

Propchange: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/AppendingProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/AppendingProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java?rev=687264&view=auto
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java
 (added)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java
 Wed Aug 20 00:04:08 2008
@@ -0,0 +1,53 @@
+/**
+ * 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.Exchange;
+import org.apache.camel.Header;
+import org.apache.camel.Message;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+
+public class BodyInAggregatingStrategy implements AggregationStrategy {
+
+    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
+        Exchange copy = newExchange.copy();
+        Message newIn = copy.getIn();
+        String oldBody = oldExchange.getIn().getBody(String.class);
+        String newBody = newIn.getBody(String.class);
+        newIn.setBody(oldBody + "+" + newBody);
+        Integer old = (Integer) oldExchange.getProperty("aggregated");
+        if (old == null) {
+            old = 1;
+        }
+        copy.setProperty("aggregated", old + 1);
+        return copy;
+    }
+
+    /**
+     * An expression used to determine if the aggregation is complete
+     */
+    public boolean isCompleted(@Header(name = "aggregated")
+                               Integer aggregated) {
+
+        if (aggregated == null) {
+            return false;
+        }
+
+        return aggregated == 3;
+    }
+
+}

Propchange: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyInAggregatingStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyOutAggregatingStrategy.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyOutAggregatingStrategy.java?rev=687264&view=auto
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyOutAggregatingStrategy.java
 (added)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyOutAggregatingStrategy.java
 Wed Aug 20 00:04:08 2008
@@ -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.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+
+public class BodyOutAggregatingStrategy implements AggregationStrategy {
+
+    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
+        Message newOut = newExchange.getOut();
+        String oldBody = oldExchange.getOut().getBody(String.class);
+        String newBody = newOut.getBody(String.class);
+        newOut.setBody(oldBody + "+" + newBody);
+        return newExchange;
+    }
+
+}

Propchange: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyOutAggregatingStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BodyOutAggregatingStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java?rev=687264&r1=687263&r2=687264&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java
 Wed Aug 20 00:04:08 2008
@@ -22,6 +22,7 @@
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
+import org.apache.camel.Header;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
@@ -63,50 +64,6 @@
         assertMockEndpointsSatisifed();
     }
 
-    private class AppendingProcessor implements Processor {
-        private String appendingString;
-
-        public AppendingProcessor(String string) {
-            appendingString = string;
-        }
-
-        public void process(Exchange exchange) {
-            // lets transform the IN message
-            Message in = exchange.getIn();
-            String body = in.getBody(String.class);
-            in.setBody(body + appendingString);
-        }
-    }
-
-    private class BodyOutAggregatingStrategy implements AggregationStrategy {
-
-        public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
-            Message newOut = newExchange.getOut();
-            String oldBody = oldExchange.getOut().getBody(String.class);
-            String newBody = newOut.getBody(String.class);
-            newOut.setBody(oldBody + "+" + newBody);
-            return newExchange;
-        }
-
-    }
-
-    private class BodyInAggregatingStrategy implements AggregationStrategy {
-
-        public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
-            Exchange copy = newExchange.copy();
-            Message newIn = copy.getIn();
-            String oldBody = oldExchange.getIn().getBody(String.class);
-            String newBody = newIn.getBody(String.class);
-            newIn.setBody(oldBody + "+" + newBody);
-            Integer old = (Integer) oldExchange.getProperty("aggregated");
-            if (old == null) {
-                old = 1;
-            }
-            copy.setProperty("aggregated", old + 1);
-            return copy;
-        }
-    }
-
     protected RouteBuilder createRouteBuilder() {
 
         return new RouteBuilder() {
@@ -120,11 +77,11 @@
                 // Multicast the message in a sequential way
                 from("direct:sequential").multicast(new 
BodyOutAggregatingStrategy()).to("direct:x", "direct:y", "direct:z");
 
-                from("direct:x").process(new 
AppendingProcessor("x")).to("direct:aggregater");
-                from("direct:y").process(new 
AppendingProcessor("y")).to("direct:aggregater");
-                from("direct:z").process(new 
AppendingProcessor("z")).to("direct:aggregater");
+                from("direct:x").process(new 
AppendingProcessor("x")).to("direct:aggregator");
+                from("direct:y").process(new 
AppendingProcessor("y")).to("direct:aggregator");
+                from("direct:z").process(new 
AppendingProcessor("z")).to("direct:aggregator");
 
-                from("direct:aggregater").aggregator(header("cheese"), new 
BodyInAggregatingStrategy()).
+                from("direct:aggregator").aggregator(header("cheese"), new 
BodyInAggregatingStrategy()).
                 
completedPredicate(header("aggregated").isEqualTo(3)).to("mock:result");
                 // END SNIPPET: example
             }

Modified: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastTest.java?rev=687264&r1=687263&r2=687264&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastTest.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastTest.java
 Wed Aug 20 00:04:08 2008
@@ -59,14 +59,7 @@
     }
 
     protected RouteBuilder createRouteBuilder() {
-        final Processor processor = new Processor() {
-            public void process(Exchange exchange) {
-                // lets transform the IN message
-                Message in = exchange.getIn();
-                String body = in.getBody(String.class);
-                in.setBody(body + "+output");
-            }
-        };
+        final Processor processor = new AppendingProcessor();
 
         return new RouteBuilder() {
             public void configure() {

Modified: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MyAggregationStrategy.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MyAggregationStrategy.java?rev=687264&r1=687263&r2=687264&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MyAggregationStrategy.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MyAggregationStrategy.java
 Wed Aug 20 00:04:08 2008
@@ -40,6 +40,7 @@
      */
     public boolean isCompleted(@Header(name = "aggregated")
                                Integer aggregated) {
+        System.out.println("calling the isCompleted with aggregated" + 
aggregated);
         if (aggregated == null) {
             return false;
         }

Added: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/MySingleThreadExecutor.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/MySingleThreadExecutor.java?rev=687264&view=auto
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/MySingleThreadExecutor.java
 (added)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/MySingleThreadExecutor.java
 Wed Aug 20 00:04:08 2008
@@ -0,0 +1,29 @@
+/**
+ * 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 java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+public class MySingleThreadExecutor extends ThreadPoolExecutor {
+
+    public MySingleThreadExecutor() {
+        super(1, 1, 0, TimeUnit.MILLISECONDS, new 
ArrayBlockingQueue<Runnable>(10));
+    }
+
+}

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

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

Added: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastAggregatorTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastAggregatorTest.java?rev=687264&view=auto
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastAggregatorTest.java
 (added)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastAggregatorTest.java
 Wed Aug 20 00:04:08 2008
@@ -0,0 +1,31 @@
+/**
+ * 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.MultiCastAggregatorTest;
+
+
+import static 
org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringMulticastAggregatorTest extends MultiCastAggregatorTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, 
"org/apache/camel/spring/processor/multicastAggregator.xml");
+    }
+
+}

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

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

Added: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastTest.java?rev=687264&view=auto
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastTest.java
 (added)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringMulticastTest.java
 Wed Aug 20 00:04:08 2008
@@ -0,0 +1,30 @@
+/**
+ * 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.MulticastTest;
+
+import static 
org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringMulticastTest extends MulticastTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, 
"org/apache/camel/spring/processor/multicast.xml");
+    }
+
+}

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

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

Added: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/multicast.xml
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/multicast.xml?rev=687264&view=auto
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/multicast.xml
 (added)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/multicast.xml
 Wed Aug 20 00:04:08 2008
@@ -0,0 +1,57 @@
+<?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-2.5.xsd
+       http://activemq.apache.org/camel/schema/spring 
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+
+  <!-- START SNIPPET: example -->
+
+  <bean id="attachStringProcessor" 
class="org.apache.camel.processor.AppendingProcessor"/>
+
+  <camelContext id="camel" 
xmlns="http://activemq.apache.org/camel/schema/spring";>
+    <route>
+      <from uri="direct:a"/>
+      <multicast>
+          <to uri="direct:x"/>
+          <to uri="direct:y"/>
+          <to uri="direct:z"/>
+      </multicast>
+    </route>
+    <route>
+      <from uri="direct:x"/>
+      <process ref="attachStringProcessor"/>
+      <to uri="mock:x"/>
+    </route>
+    <route>
+      <from uri="direct:y"/>
+      <process ref="attachStringProcessor"/>
+      <to uri="mock:y"/>
+    </route>
+    <route>
+      <from uri="direct:z"/>
+      <process ref="attachStringProcessor"/>
+      <to uri="mock:z"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+</beans>

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

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

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

Added: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/multicastAggregator.xml
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/multicastAggregator.xml?rev=687264&view=auto
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/multicastAggregator.xml
 (added)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/multicastAggregator.xml
 Wed Aug 20 00:04:08 2008
@@ -0,0 +1,87 @@
+<?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-2.5.xsd
+       http://activemq.apache.org/camel/schema/spring 
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  <!-- START SNIPPET: example -->
+  <camelContext id="camel" 
xmlns="http://activemq.apache.org/camel/schema/spring";>
+    <route>
+      <from uri="direct:parallel"/>
+      <multicast strategyRef="bodyOutAggregatorStrategy" 
parallelProcessing="true" threadPoolRef="mySingleThreadExcutor">
+         <to uri="direct:x"/>
+         <to uri="direct:y"/>
+         <to uri="direct:z"/>
+      </multicast>
+    </route>
+
+    <route>
+      <from uri="direct:sequential"/>
+      <multicast strategyRef="bodyOutAggregatorStrategy">
+         <to uri="direct:x"/>
+         <to uri="direct:y"/>
+         <to uri="direct:z"/>
+      </multicast>
+    </route>
+
+    <route>
+       <from uri="direct:x"/>
+       <process ref="appendingX"/>
+       <to uri="direct:aggregater"/>
+    </route>
+    <route>
+       <from uri="direct:y"/>
+       <process ref="appendingY"/>
+       <to uri="direct:aggregater"/>
+    </route>
+    <route>
+       <from uri="direct:z"/>
+       <process ref="appendingZ"/>
+       <to uri="direct:aggregater"/>
+    </route>
+
+    <route>
+       <from uri="direct:aggregater"/>
+       <aggregator strategyRef="bodyInAggregatorStrategy">
+        <simple>header.cheese</simple>
+        <to uri="mock:result"/>
+        <completedPredicate>
+          <methodCall bean="bodyInAggregatorStrategy" method="isCompleted"/>
+        </completedPredicate>
+      </aggregator>
+    </route>
+  </camelContext>
+
+  <bean id="bodyOutAggregatorStrategy" 
class="org.apache.camel.processor.BodyOutAggregatingStrategy"/>
+  <bean id="bodyInAggregatorStrategy" 
class="org.apache.camel.processor.BodyInAggregatingStrategy"/>
+  <bean id="mySingleThreadExcutor" 
class="org.apache.camel.spring.processor.MySingleThreadExecutor"/>
+
+  <bean id="appendingX" class="org.apache.camel.processor.AppendingProcessor">
+     <property name="suffixString" value="x"/>
+  </bean>
+  <bean id="appendingY" class="org.apache.camel.processor.AppendingProcessor">
+     <property name="suffixString" value="y"/>
+  </bean>
+  <bean id="appendingZ" class="org.apache.camel.processor.AppendingProcessor">
+     <property name="suffixString" value="z"/>
+  </bean>
+  <!-- END SNIPPET: example -->
+</beans>

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

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

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


Reply via email to