This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new b3512c3ab27c CAMEL-22920: added unit test
b3512c3ab27c is described below
commit b3512c3ab27c856c3931fc3b098c82672ad76c82
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Feb 2 20:59:14 2026 +0100
CAMEL-22920: added unit test
---
.../component/kamelet/KameletEipSplitTest.java | 61 +++++++++++++++++++++
.../apache/camel/dsl/yaml/SplitKameletTest.groovy | 62 ++++++++++++++++++++++
.../test/resources/kamelets/mySplit.kamelet.yaml | 38 +++++++++++++
3 files changed, 161 insertions(+)
diff --git
a/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletEipSplitTest.java
b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletEipSplitTest.java
new file mode 100644
index 000000000000..a258014d195a
--- /dev/null
+++
b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletEipSplitTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.component.kamelet;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+public class KameletEipSplitTest extends CamelTestSupport {
+
+ @Test
+ public void testSplit() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("A@B@C");
+ getMockEndpoint("mock:line").expectedBodiesReceived("A", "B", "C");
+
+ template.sendBody("direct:start", "A@B@C");
+
+ MockEndpoint.assertIsSatisfied(context);
+ }
+
+ // **********************************************
+ //
+ // test set-up
+ //
+ // **********************************************
+
+ @Override
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ routeTemplate("split").templateParameter("myExpression")
+ .from("kamelet:source")
+ .split().simple("{{myExpression}}")
+ .to("mock:line")
+ .end()
+ .to("kamelet:sink");
+
+ from("direct:start")
+ .kamelet("split?myExpression=${body.split('@')}")
+ .to("mock:result");
+ }
+ };
+ }
+}
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/SplitKameletTest.groovy
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/SplitKameletTest.groovy
new file mode 100644
index 000000000000..fb36a0de1ec6
--- /dev/null
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/SplitKameletTest.groovy
@@ -0,0 +1,62 @@
+/*
+ * 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.dsl.yaml
+
+import org.apache.camel.component.mock.MockEndpoint
+import org.apache.camel.dsl.yaml.support.YamlTestSupport
+
+class SplitKameletTest extends YamlTestSupport {
+
+ @Override
+ def doSetup() {
+ context.start()
+ }
+
+ def "split"() {
+ setup:
+ loadRoutes '''
+ - from:
+ uri: "direct:route"
+ steps:
+ - to:
+ uri: kamelet
+ parameters:
+ templateId: mySplit
+ myExpression: "${body.split('@')}"
+ - to:
+ uri: mock:done
+
+ '''
+
+ withMock('mock:split') {
+ expectedMessageCount 3
+ expectedBodiesReceived 'a', 'b', 'c'
+ }
+ withMock('mock:done') {
+ expectedMessageCount 1
+ }
+
+ when:
+ withTemplate {
+ to('direct:route').withBody('a@b@c').send()
+ }
+
+ then:
+ MockEndpoint.assertIsSatisfied(context)
+ }
+
+}
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/resources/kamelets/mySplit.kamelet.yaml
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/resources/kamelets/mySplit.kamelet.yaml
new file mode 100644
index 000000000000..31c7d7e6b2ba
--- /dev/null
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/resources/kamelets/mySplit.kamelet.yaml
@@ -0,0 +1,38 @@
+#
+# 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.
+#
+
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: mySplit
+spec:
+ definition:
+ properties:
+ myExpression:
+ title: The Expression
+ type: string
+ template:
+ from:
+ uri: "kamelet:source"
+ steps:
+ - split:
+ expression:
+ simple:
+ expression: "{{myExpression}}"
+ steps:
+ - to:
+ uri: mock:split