camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/4] camel git commit: CAMEL-10442: Added unit test
Date Fri, 04 Nov 2016 16:45:24 GMT
CAMEL-10442: Added unit test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/74a816bb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/74a816bb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/74a816bb

Branch: refs/heads/master
Commit: 74a816bbd0046cbc4bfa869b05c56e6a791d07f1
Parents: 4589f74
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Nov 4 16:29:01 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Nov 4 17:44:51 2016 +0100

----------------------------------------------------------------------
 .../camel/processor/MulticastPipelineTest.java  | 56 ++++++++++++++++++++
 1 file changed, 56 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/74a816bb/camel-core/src/test/java/org/apache/camel/processor/MulticastPipelineTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/MulticastPipelineTest.java
b/camel-core/src/test/java/org/apache/camel/processor/MulticastPipelineTest.java
new file mode 100644
index 0000000..d0a2999
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/MulticastPipelineTest.java
@@ -0,0 +1,56 @@
+/**
+ * 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.builder.RouteBuilder;
+import org.apache.camel.util.toolbox.AggregationStrategies;
+
+public class MulticastPipelineTest extends ContextTestSupport {
+
+    public void testMulticastPipeline() throws Exception {
+        getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:b").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:c").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:d").expectedBodiesReceived("Hello World");
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .multicast().aggregationStrategy(AggregationStrategies.groupedExchange())
+                        .pipeline("direct:a", "direct:b")
+                        .pipeline("direct:c", "direct:d")
+                    .end()
+                    .to("mock:result");
+
+                from("direct:a").to("mock:a").setBody().constant("A");
+                from("direct:b").to("mock:b").setBody().constant("B");
+                from("direct:c").to("mock:c").setBody().constant("C");
+                from("direct:d").to("mock:d").setBody().constant("D");
+            }
+        };
+    }
+}


Mime
View raw message