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 2021/07/24 08:30:34 UTC

[camel] 01/02: CAMEL-16802: Added unit test. Thanks to Sergio Penkale for reporting.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.11.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b6d327b3acc7f49584b95d2557b1bddc420f3048
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jul 24 09:41:08 2021 +0200

    CAMEL-16802: Added unit test. Thanks to Sergio Penkale for reporting.
---
 .../camel/processor/Split123ParallelTest.java      | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/Split123ParallelTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/Split123ParallelTest.java
new file mode 100644
index 0000000..999b148
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/Split123ParallelTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.processor.aggregate.StringAggregationStrategy;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+@Disabled("TODO: CAMEL-16802")
+public class Split123ParallelTest extends ContextTestSupport {
+
+    @Test
+    public void testSplitter() throws Exception {
+        getMockEndpoint("mock:foo").expectedBodiesReceivedInAnyOrder("1", "2", "3");
+        getMockEndpoint("mock:result").expectedBodiesReceived("123");
+
+        template.sendBody("direct:start", "1,2,3");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .split(body().tokenize(","), new StringAggregationStrategy()).parallelProcessing()
+                        .to("mock:foo")
+                    .end()
+                    .to("mock:result");
+            }
+        };
+    }
+
+}