Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)")
Expand Down Expand Up @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -1131,6 +1131,7 @@ protected int runQuarkus() throws Exception {
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;
Expand Down Expand Up @@ -1237,6 +1238,7 @@ protected int runSpringBoot() throws Exception {
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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Loading