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

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


The following commit(s) were added to refs/heads/camel-4.22.x by this push:
     new f259f7bc0728 [backport camel-4.22.x] CAMEL-25629: camel-jbang - the 
camel.jbang.javaVersion metadata lists Java 25 too (#27828)
f259f7bc0728 is described below

commit f259f7bc0728e201d71b28d3b39b3276cade1055
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed Oct 14 14:47:50 2026 +0200

    [backport camel-4.22.x] CAMEL-25629: camel-jbang - the 
camel.jbang.javaVersion metadata lists Java 25 too (#27828)
    
    Backport of #27810. The camel.jbang.javaVersion entry in the Camel CLI
    configuration metadata (camel-jbang-core and its catalog copy) listed only
    Java 21, while the CLI accepts and completes both 21 and 25. The metadata
    now lists both, and JavaVersionMetadataTest checks that it stays in step
    with JavaVersionCompletionCandidates.
    
    Closes #27828
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
---
 .../jbang/camel-jbang-configuration-metadata.json  |  2 +-
 .../camel-jbang-configuration-metadata.json        |  2 +-
 .../dsl/jbang/core/common/CamelJBangConstants.java |  2 +-
 .../jbang/core/common/JavaVersionMetadataTest.java | 55 ++++++++++++++++++++++
 4 files changed, 58 insertions(+), 3 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/jbang/camel-jbang-configuration-metadata.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/jbang/camel-jbang-configuration-metadata.json
index bd1bdf642d53..e61e0029c60a 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/jbang/camel-jbang-configuration-metadata.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/jbang/camel-jbang-configuration-metadata.json
@@ -21,7 +21,7 @@
     { "name": "camel.jbang.groovyFiles", "required": false, "description": 
"Additional groovy source files to export to src\/main\/resources\/camel-groovy 
directory (Use commas to separate multiple files)", "type": "string", 
"javaType": "String", "secret": false },
     { "name": "camel.jbang.health", "required": false, "description": "Health 
check at \/observe\/health on local HTTP server (port 8080 by default)", 
"type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": 
false, "deprecated": true },
     { "name": "camel.jbang.ignoreLoadingError", "required": false, 
"description": "Whether to ignore route loading and compilation errors (use 
this with care!)", "label": "advanced", "type": "boolean", "javaType": 
"boolean", "defaultValue": false, "secret": false },
-    { "name": "camel.jbang.javaVersion", "required": false, "description": 
"Java version", "type": "enum", "javaType": "String", "defaultValue": "21", 
"secret": false, "enum": [ "21" ] },
+    { "name": "camel.jbang.javaVersion", "required": false, "description": 
"Java version", "type": "enum", "javaType": "String", "defaultValue": "21", 
"secret": false, "enum": [ "21", "25" ] },
     { "name": "camel.jbang.jfr", "required": false, "description": "Enables 
Java Flight Recorder saving recording to disk on exit", "type": "boolean", 
"javaType": "boolean", "defaultValue": false, "secret": false },
     { "name": "camel.jbang.jfr-profile", "required": false, "description": 
"Java Flight Recorder profile to use (such as default or profile)", "type": 
"string", "javaType": "String", "defaultValue": "default", "secret": false },
     { "name": "camel.jbang.jib-maven-plugin-version", "required": false, 
"description": "Version to use for jib-maven-plugin when exporting the 
application", "label": "maven", "type": "string", "javaType": "String", 
"defaultValue": "3.5.2", "secret": false },
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-configuration-metadata.json
 
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-configuration-metadata.json
index bd1bdf642d53..e61e0029c60a 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-configuration-metadata.json
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-configuration-metadata.json
@@ -21,7 +21,7 @@
     { "name": "camel.jbang.groovyFiles", "required": false, "description": 
"Additional groovy source files to export to src\/main\/resources\/camel-groovy 
directory (Use commas to separate multiple files)", "type": "string", 
"javaType": "String", "secret": false },
     { "name": "camel.jbang.health", "required": false, "description": "Health 
check at \/observe\/health on local HTTP server (port 8080 by default)", 
"type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": 
false, "deprecated": true },
     { "name": "camel.jbang.ignoreLoadingError", "required": false, 
"description": "Whether to ignore route loading and compilation errors (use 
this with care!)", "label": "advanced", "type": "boolean", "javaType": 
"boolean", "defaultValue": false, "secret": false },
-    { "name": "camel.jbang.javaVersion", "required": false, "description": 
"Java version", "type": "enum", "javaType": "String", "defaultValue": "21", 
"secret": false, "enum": [ "21" ] },
+    { "name": "camel.jbang.javaVersion", "required": false, "description": 
"Java version", "type": "enum", "javaType": "String", "defaultValue": "21", 
"secret": false, "enum": [ "21", "25" ] },
     { "name": "camel.jbang.jfr", "required": false, "description": "Enables 
Java Flight Recorder saving recording to disk on exit", "type": "boolean", 
"javaType": "boolean", "defaultValue": false, "secret": false },
     { "name": "camel.jbang.jfr-profile", "required": false, "description": 
"Java Flight Recorder profile to use (such as default or profile)", "type": 
"string", "javaType": "String", "defaultValue": "default", "secret": false },
     { "name": "camel.jbang.jib-maven-plugin-version", "required": false, 
"description": "Version to use for jib-maven-plugin when exporting the 
application", "label": "maven", "type": "string", "javaType": "String", 
"defaultValue": "3.5.2", "secret": false },
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/CamelJBangConstants.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/CamelJBangConstants.java
index 6c4789d27729..26063b36bbb9 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/CamelJBangConstants.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/CamelJBangConstants.java
@@ -77,7 +77,7 @@ public final class CamelJBangConstants {
     public static final String PARENT_POM = "camel.jbang.parentPom";
 
     @Metadata(description = "Java version",
-              javaType = "String", enums = "21", defaultValue = "21")
+              javaType = "String", enums = "21,25", defaultValue = "21")
     public static final String JAVA_VERSION = "camel.jbang.javaVersion";
 
     @Metadata(description = "Apache Camel Kamelets version. By default the 
Kamelets are the same version as Camel.",
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/JavaVersionMetadataTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/JavaVersionMetadataTest.java
new file mode 100644
index 000000000000..50fbb3e75099
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/JavaVersionMetadataTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.jbang.core.common;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.json.JsonArray;
+import org.apache.camel.util.json.JsonObject;
+import org.apache.camel.util.json.Jsoner;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+public class JavaVersionMetadataTest {
+
+    @Test
+    public void testJavaVersionEnumMatchesCompletionCandidates() throws 
Exception {
+        List<String> candidates = new ArrayList<>();
+        new JavaVersionCompletionCandidates().forEach(candidates::add);
+
+        JsonObject property = null;
+        try (InputStream is = 
getClass().getResourceAsStream("/META-INF/camel-jbang-configuration-metadata.json"))
 {
+            assertNotNull(is, "camel-jbang-configuration-metadata.json should 
be on the classpath");
+            JsonObject root = (JsonObject) 
Jsoner.deserialize(IOHelper.loadText(is));
+            for (Object o : (JsonArray) root.get("properties")) {
+                JsonObject jo = (JsonObject) o;
+                if 
(CamelJBangConstants.JAVA_VERSION.equals(jo.getString("name"))) {
+                    property = jo;
+                }
+            }
+        }
+        assertNotNull(property, "camel.jbang.javaVersion should be in the 
metadata");
+        // the java versions of camel.jbang.javaVersion are the same as 
offered by --java-version
+        assertEquals(candidates, property.getCollection("enum"));
+        assertEquals("21", property.getString("defaultValue"));
+    }
+}

Reply via email to