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 341bd7d15f72 CAMEL-23208: Small fix of export command + adds test for
Run command (#22071)
341bd7d15f72 is described below
commit 341bd7d15f725b540596dc15e806cc8e3964b01b
Author: JiriOndrusek <[email protected]>
AuthorDate: Thu Apr 9 11:03:44 2026 +0200
CAMEL-23208: Small fix of export command + adds test for Run command
(#22071)
---
.../apache/camel/dsl/jbang/core/commands/Run.java | 20 ++++----
.../camel/dsl/jbang/core/commands/RunTest.java | 57 ++++++++++++++++++++++
2 files changed, 68 insertions(+), 9 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index 5291627fe962..ad3236378e05 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -194,12 +194,12 @@ public class Run extends CamelCommand {
@Option(names = { "--kamelets-version" }, description = "Apache Camel
Kamelets version")
String kameletsVersion;
- @CommandLine.Option(names = { "--quarkus-group-id" }, description =
"Quarkus Platform Maven groupId",
- defaultValue = "io.quarkus.platform")
+ @Option(names = { "--quarkus-group-id" }, description = "Quarkus Platform
Maven groupId",
+ defaultValue = "io.quarkus.platform")
String quarkusGroupId = "io.quarkus.platform";
- @CommandLine.Option(names = { "--quarkus-artifact-id" }, description =
"Quarkus Platform Maven artifactId",
- defaultValue = "quarkus-bom")
+ @Option(names = { "--quarkus-artifact-id" }, description = "Quarkus
Platform Maven artifactId",
+ defaultValue = "quarkus-bom")
String quarkusArtifactId = "quarkus-bom";
@Option(names = { "--quarkus-version" }, description = "Quarkus Platform
version",
@@ -219,8 +219,8 @@ public class Run extends CamelCommand {
split = ",")
List<String> dependencies = new ArrayList<>();
- @CommandLine.Option(names = { "--repo", "--repos" },
- description = "Additional maven repositories (Use
commas to separate multiple repositories)")
+ @Option(names = { "--repo", "--repos" },
+ description = "Additional maven repositories (Use commas to
separate multiple repositories)")
String repositories;
@Option(names = { "--gav" }, description = "The Maven
group:artifact:version (used during exporting)")
@@ -250,8 +250,8 @@ public class Run extends CamelCommand {
description = "Whether to allow automatic downloading JAR
dependencies (over the internet)")
boolean download = true;
- @CommandLine.Option(names = { "--package-scan-jars" }, defaultValue =
"false",
- description = "Whether to automatic package scan JARs
for custom Spring or Quarkus beans making them available for Camel JBang")
+ @Option(names = { "--package-scan-jars" }, defaultValue = "false",
+ description = "Whether to automatic package scan JARs for custom
Spring or Quarkus beans making them available for Camel JBang")
boolean packageScanJars;
@CommandLine.ArgGroup(validate = false, heading = "%nLogging Options:%n")
@@ -274,7 +274,7 @@ public class Run extends CamelCommand {
@Option(names = { "--name" }, defaultValue = "CamelJBang", description =
"The name of the Camel application")
String name;
- @CommandLine.Option(names = { "--exclude" }, description = "Exclude files
by name or pattern")
+ @Option(names = { "--exclude" }, description = "Exclude files by name or
pattern")
List<String> excludes = new ArrayList<>();
// Logging, execution limit, debug, and server options are defined in
their respective @ArgGroup inner classes below
@@ -1131,6 +1131,7 @@ public class Run extends CamelCommand {
eq.quarkusVersion =
PropertyResolver.fromSystemProperty(QUARKUS_VERSION, () -> this.quarkusVersion);
eq.quarkusGroupId =
PropertyResolver.fromSystemProperty(QUARKUS_GROUP_ID, () ->
this.quarkusGroupId);
eq.quarkusArtifactId =
PropertyResolver.fromSystemProperty(QUARKUS_ARTIFACT_ID, () ->
this.quarkusArtifactId);
+ eq.javaVersion = javaVersion;
eq.camelVersion = this.camelVersion;
eq.javaVersion = this.javaVersion;
eq.kameletsVersion = this.kameletsVersion;
@@ -1237,6 +1238,7 @@ public class Run extends CamelCommand {
eq.symbolicLink = this.dev;
eq.mavenWrapper = true;
eq.springBootVersion = this.springBootVersion;
+ eq.javaVersion = this.javaVersion;
eq.camelVersion = this.camelVersion;
eq.camelSpringBootVersion =
PropertyResolver.fromSystemProperty(CAMEL_SPRING_BOOT_VERSION,
() -> this.camelSpringBootVersion != null ?
this.camelSpringBootVersion : this.camelVersion);
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/RunTest.java
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/RunTest.java
new file mode 100644
index 000000000000..e018343a3ef6
--- /dev/null
+++
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/RunTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.commands;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import picocli.CommandLine;
+
+class RunTest {
+
+ @Test
+ public void shouldParseJavaVersionOption() throws Exception {
+ Run command = new Run(new CamelJBangMain());
+ CommandLine.populateCommand(command, "--java-version=17",
"route.yaml");
+
+ Assertions.assertEquals("17", command.javaVersion);
+ }
+
+ @Test
+ public void shouldUseDefaultJavaVersion() throws Exception {
+ Run command = new Run(new CamelJBangMain());
+ CommandLine.populateCommand(command, "route.yaml");
+
+ Assertions.assertEquals("21", command.javaVersion);
+ }
+
+ @Test
+ public void shouldParseJavaVersion11() throws Exception {
+ Run command = new Run(new CamelJBangMain());
+ CommandLine.populateCommand(command, "--java-version=11",
"route.yaml");
+
+ Assertions.assertEquals("11", command.javaVersion);
+ }
+
+ @Test
+ public void shouldParseJavaVersion21() throws Exception {
+ Run command = new Run(new CamelJBangMain());
+ CommandLine.populateCommand(command, "--java-version=21",
"route.yaml");
+
+ Assertions.assertEquals("21", command.javaVersion);
+ }
+}