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 00eb7c4733bc CAMEL-27962: camel-smooks lazyStartProducer now properly 
binds to endpoint (#31352)
00eb7c4733bc is described below

commit 00eb7c4733bc3806eec678b9874da6347b3b4386
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Dec 4 14:45:45 2026 +0100

    CAMEL-27962: camel-smooks lazyStartProducer now properly binds to endpoint 
(#31352)
    
    The lazyStartProducer option was bound to SmooksProcessor instead of
    SmooksEndpoint, as SmooksComponent set the properties on the processor 
first,
    which consumed the parameter before the endpoint got it.
    
    - Remove the public lazyStartProducer option from SmooksProcessor and add a
      package-private lazyStart setter.
    - The endpoint passes its lazyStartProducer (inherited from DefaultEndpoint)
      to the processor before starting it.
    - Add SmooksLazyStartProducerTest.
    
    Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../camel/component/smooks/SmooksEndpoint.java     |  1 +
 .../camel/component/smooks/SmooksProcessor.java    | 12 ++---
 .../smooks/SmooksLazyStartProducerTest.java        | 56 ++++++++++++++++++++++
 .../component/smooks/SmooksProcessorTest.java      |  4 +-
 4 files changed, 63 insertions(+), 10 deletions(-)

diff --git 
a/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksEndpoint.java
 
b/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksEndpoint.java
index 3d481b2efcd7..5d7b2b689b00 100644
--- 
a/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksEndpoint.java
+++ 
b/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksEndpoint.java
@@ -90,6 +90,7 @@ public class SmooksEndpoint extends DefaultEndpoint {
     @Override
     protected void doStart() throws Exception {
         super.doStart();
+        smooksProcessor.setLazyStart(isLazyStartProducer());
         ServiceHelper.startService(smooksProcessor);
     }
 
diff --git 
a/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksProcessor.java
 
b/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksProcessor.java
index bacee9499e6b..d00b9a6e9dc3 100644
--- 
a/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksProcessor.java
+++ 
b/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksProcessor.java
@@ -89,9 +89,9 @@ public class SmooksProcessor extends ServiceSupport 
implements Processor, CamelC
     private String configUri;
     private String reportPath;
     private Boolean allowExecutionContextFromHeader = false;
-    private Boolean lazyStartProducer = false;
     private boolean allowExternalEntities;
     private boolean hardenXmlInput;
+    private boolean lazyStart;
 
     private final Set<VisitorAppender> visitorAppender = new HashSet<>();
     private final Map<String, Visitor> selectorVisitorMap = new HashMap<>();
@@ -350,12 +350,8 @@ public class SmooksProcessor extends ServiceSupport 
implements Processor, CamelC
             smooks.addVisitor(entry.getValue(), entry.getKey());
     }
 
-    public Boolean getLazyStartProducer() {
-        return lazyStartProducer;
-    }
-
-    public void setLazyStartProducer(Boolean lazyStartProducer) {
-        this.lazyStartProducer = lazyStartProducer;
+    void setLazyStart(boolean lazyStart) {
+        this.lazyStart = lazyStart;
     }
 
     @Override
@@ -376,7 +372,7 @@ public class SmooksProcessor extends ServiceSupport 
implements Processor, CamelC
             addAppender(smooks, visitorAppender);
             addVisitor(smooks, selectorVisitorMap);
 
-            if (!lazyStartProducer) {
+            if (!lazyStart) {
                 smooks.createExecutionContext();
             }
 
diff --git 
a/components/camel-smooks/src/test/java/org/apache/camel/component/smooks/SmooksLazyStartProducerTest.java
 
b/components/camel-smooks/src/test/java/org/apache/camel/component/smooks/SmooksLazyStartProducerTest.java
new file mode 100644
index 000000000000..e5b2e93f66e8
--- /dev/null
+++ 
b/components/camel-smooks/src/test/java/org/apache/camel/component/smooks/SmooksLazyStartProducerTest.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.component.smooks;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class SmooksLazyStartProducerTest extends CamelTestSupport {
+
+    @Test
+    void testLazyStartProducerTrue() throws Exception {
+        SmooksEndpoint endpoint = 
context.getEndpoint("smooks://edi-to-xml-smooks-config.xml?lazyStartProducer=true",
+                SmooksEndpoint.class);
+        assertTrue(endpoint.isLazyStartProducer());
+    }
+
+    @Test
+    void testLazyStartProducerFalse() throws Exception {
+        SmooksEndpoint endpoint = 
context.getEndpoint("smooks://edi-to-xml-smooks-config.xml?lazyStartProducer=false",
+                SmooksEndpoint.class);
+        assertFalse(endpoint.isLazyStartProducer());
+    }
+
+    @Test
+    void testLazyStartProducerDefault() throws Exception {
+        SmooksEndpoint endpoint = 
context.getEndpoint("smooks://edi-to-xml-smooks-config.xml", 
SmooksEndpoint.class);
+        assertFalse(endpoint.isLazyStartProducer());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                // No routes needed for this test
+            }
+        };
+    }
+}
diff --git 
a/components/camel-smooks/src/test/java/org/apache/camel/component/smooks/SmooksProcessorTest.java
 
b/components/camel-smooks/src/test/java/org/apache/camel/component/smooks/SmooksProcessorTest.java
index ea56368d5fe7..8b307ac522f4 100644
--- 
a/components/camel-smooks/src/test/java/org/apache/camel/component/smooks/SmooksProcessorTest.java
+++ 
b/components/camel-smooks/src/test/java/org/apache/camel/component/smooks/SmooksProcessorTest.java
@@ -216,7 +216,7 @@ public class SmooksProcessorTest extends CamelTestSupport {
                 return null;
             }
         });
-        processor.setLazyStartProducer(false);
+        processor.setLazyStart(false);
 
         context.addRoutes(new RouteBuilder() {
             @Override
@@ -251,7 +251,7 @@ public class SmooksProcessorTest extends CamelTestSupport {
                 return null;
             }
         });
-        processor.setLazyStartProducer(true);
+        processor.setLazyStart(true);
 
         context.addRoutes(new RouteBuilder() {
             @Override

Reply via email to