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

gnodet pushed a commit to branch backport/28252-to-camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a7a5186d2e358e952d79fcc6072298dee094baf3
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Oct 22 20:52:35 2026 +0000

    [backport camel-4.22.x] CAMEL-25875: camel-milo - a sessionTimeout 
configured on the component reaches its endpoints
---
 .../milo/client/MiloClientConfiguration.java       |  1 +
 .../milo/SessionTimeoutConfigurationTest.java      | 58 ++++++++++++++++++++++
 2 files changed, 59 insertions(+)

diff --git 
a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConfiguration.java
 
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConfiguration.java
index 9303da7d1fad..2ce0a525c176 100644
--- 
a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConfiguration.java
+++ 
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConfiguration.java
@@ -141,6 +141,7 @@ public class MiloClientConfiguration implements Cloneable {
         this.applicationUri = other.applicationUri;
         this.productUri = other.productUri;
         this.requestTimeout = other.requestTimeout;
+        this.sessionTimeout = other.sessionTimeout;
         this.channelLifetime = other.channelLifetime;
         this.sessionName = other.sessionName;
         this.maxPendingPublishRequests = other.maxPendingPublishRequests;
diff --git 
a/components/camel-milo/src/test/java/org/apache/camel/component/milo/SessionTimeoutConfigurationTest.java
 
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/SessionTimeoutConfigurationTest.java
new file mode 100644
index 000000000000..8f2b79b35a7d
--- /dev/null
+++ 
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/SessionTimeoutConfigurationTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.milo;
+
+import org.apache.camel.component.milo.browse.MiloBrowseComponent;
+import org.apache.camel.component.milo.browse.MiloBrowseEndpoint;
+import org.apache.camel.component.milo.client.MiloClientComponent;
+import org.apache.camel.component.milo.client.MiloClientEndpoint;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * A session timeout configured on the component reaches its endpoints.
+ */
+public class SessionTimeoutConfigurationTest extends CamelTestSupport {
+
+    private static final String SERVER = "opc.tcp://localhost:4840";
+
+    @Test
+    void clientComponentSetsTheDefaultSessionTimeoutOfItsEndpoints() {
+        context.getComponent("milo-client", 
MiloClientComponent.class).getConfiguration().setSessionTimeout(30_000L);
+
+        assertEquals(30_000L,
+                context.getEndpoint("milo-client:" + SERVER, 
MiloClientEndpoint.class).getConfiguration()
+                        .getSessionTimeout());
+        assertEquals(45_000L,
+                context.getEndpoint("milo-client:" + SERVER + 
"?sessionTimeout=45000", MiloClientEndpoint.class)
+                        .getConfiguration().getSessionTimeout());
+    }
+
+    @Test
+    void browseComponentSetsTheDefaultSessionTimeoutOfItsEndpoints() {
+        context.getComponent("milo-browse", 
MiloBrowseComponent.class).getConfiguration().setSessionTimeout(30_000L);
+
+        assertEquals(30_000L,
+                context.getEndpoint("milo-browse:" + SERVER, 
MiloBrowseEndpoint.class).getConfiguration()
+                        .getSessionTimeout());
+        assertEquals(45_000L,
+                context.getEndpoint("milo-browse:" + SERVER + 
"?sessionTimeout=45000", MiloBrowseEndpoint.class)
+                        .getConfiguration().getSessionTimeout());
+    }
+}

Reply via email to