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 f9022045bd9 CAMEL-18821: Added unit test
f9022045bd9 is described below

commit f9022045bd9b991df2629021c2d38da1744ce0f2
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Jul 2 09:10:02 2024 +0200

    CAMEL-18821: Added unit test
---
 .../interceptor/TransactedMulticastTest.java       | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git 
a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/interceptor/TransactedMulticastTest.java
 
b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/interceptor/TransactedMulticastTest.java
new file mode 100644
index 00000000000..c6b5f4e7cae
--- /dev/null
+++ 
b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/interceptor/TransactedMulticastTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.interceptor;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class TransactedMulticastTest extends 
TransactionClientDataSourceSupport {
+
+    @Test
+    @Timeout(value = 10)
+    public void testMulticast() throws Exception {
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+        getMockEndpoint("mock:test1").expectedMessageCount(1);
+        getMockEndpoint("mock:test2").expectedMessageCount(1);
+
+        String response = template.requestBody("direct:start", "Hello World", 
String.class);
+        assertEquals("Hi !!!", response);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").routeId("route1")
+                        .transacted()
+                        .to("direct:route2")
+                        .log("will never get here")
+                        .to("mock:result")
+                        .setBody(constant("Hi !!!"));
+
+                from("direct:route2").routeId("route2")
+                        .multicast()
+                        .to("mock:test1")
+                        .to("mock:test2");
+            }
+        };
+    }
+}

Reply via email to