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 fec49c3a6a78 CAMEL-26116: camel-jbang - Export should resolve the 
consumer endpoint of a zookeeper-master: endpoint (#28489)
fec49c3a6a78 is described below

commit fec49c3a6a78f518ca21544d44e58d897446a1f5
Author: Serdar Gökay <[email protected]>
AuthorDate: Mon Oct 26 16:09:26 2026 +0300

    CAMEL-26116: camel-jbang - Export should resolve the consumer endpoint of a 
zookeeper-master: endpoint (#28489)
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 .../camel/dsl/jbang/core/commands/ExportTest.java  | 32 ++++++++++++++++++++++
 .../src/test/resources/zookeeper-master-route.yaml | 22 +++++++++++++++
 .../main/download/DownloadEndpointStrategy.java    |  7 +++--
 3 files changed, 58 insertions(+), 3 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
index b005981a471d..dc3098541c8c 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java
@@ -797,6 +797,38 @@ class ExportTest {
         }
     }
 
+    @ParameterizedTest
+    @MethodSource("runtimeProvider")
+    public void shouldExportZooKeeperMasterDelegate(RuntimeType rt) throws 
Exception {
+        LOG.info("shouldExportZooKeeperMasterDelegate {}", rt);
+        Export command = createCommand(rt, new String[] { 
"src/test/resources/zookeeper-master-route.yaml" },
+                "--gav=examples:route:1.0.0", "--dir=" + workingDir, 
"--quiet");
+        int exit = command.doCall();
+
+        Assertions.assertEquals(0, exit);
+        Model model = readMavenModel();
+
+        // the delegate component of the zookeeper-master endpoint must be 
exported as well (CAMEL-26116)
+        if (rt == RuntimeType.main) {
+            Assertions.assertTrue(
+                    containsDependency(model.getDependencies(), 
"org.apache.camel", "camel-zookeeper-master", null));
+            Assertions.assertTrue(containsDependency(model.getDependencies(), 
"org.apache.camel", "camel-timer", null));
+        } else if (rt == RuntimeType.springBoot) {
+            Assertions.assertTrue(
+                    containsDependency(model.getDependencies(), 
"org.apache.camel.springboot",
+                            "camel-zookeeper-master-starter", null));
+            Assertions.assertTrue(
+                    containsDependency(model.getDependencies(), 
"org.apache.camel.springboot", "camel-timer-starter",
+                            null));
+        } else if (rt == RuntimeType.quarkus) {
+            Assertions.assertTrue(
+                    containsDependency(model.getDependencies(), 
"org.apache.camel.quarkus",
+                            "camel-quarkus-zookeeper-master", null));
+            Assertions.assertTrue(
+                    containsDependency(model.getDependencies(), 
"org.apache.camel.quarkus", "camel-quarkus-timer", null));
+        }
+    }
+
     @ParameterizedTest
     @MethodSource("runtimeProvider")
     public void shouldExportCircuitBreaker(RuntimeType rt) throws Exception {
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/resources/zookeeper-master-route.yaml
 
b/dsl/camel-jbang/camel-jbang-core/src/test/resources/zookeeper-master-route.yaml
new file mode 100644
index 000000000000..b1f68e143ed4
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/resources/zookeeper-master-route.yaml
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+- route:
+    from:
+      uri: zookeeper-master:lock:timer:tick?period=1000
+      steps:
+        - log: "tick"
diff --git 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/DownloadEndpointStrategy.java
 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/DownloadEndpointStrategy.java
index b28a0982cec1..bb2c13b672ab 100644
--- 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/DownloadEndpointStrategy.java
+++ 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/DownloadEndpointStrategy.java
@@ -48,8 +48,9 @@ public class DownloadEndpointStrategy implements 
EndpointStrategy {
             if (name != null) {
                 camelContext.resolveDataFormat(name);
             }
-        } else if (export && "master".equals(scheme) && endpoint instanceof 
StubEndpoint) {
-            // a stubbed master endpoint does not create its delegate 
endpoint, so resolve it here (CAMEL-25186)
+        } else if (export && ("master".equals(scheme) || 
"zookeeper-master".equals(scheme))
+                && endpoint instanceof StubEndpoint) {
+            // a stubbed master endpoint does not create its delegate 
endpoint, so resolve it here (CAMEL-25186, CAMEL-26116)
             String delegateUri = extractDelegateUri(uri);
             if (delegateUri != null) {
                 camelContext.getEndpoint(delegateUri);
@@ -58,7 +59,7 @@ public class DownloadEndpointStrategy implements 
EndpointStrategy {
         return endpoint;
     }
 
-    // extracts the delegate uri the same way as MasterComponent
+    // extracts the delegate uri the same way as MasterComponent (camel-master 
and camel-zookeeper-master)
     private static String extractDelegateUri(String uri) {
         String remaining = 
FileUtil.stripLeadingSeparator(StringHelper.after(uri, ":"));
         String namespace = StringHelper.before(remaining, ":");

Reply via email to