This is an automated email from the ASF dual-hosted git repository. acosentino 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 b277a04075f CAMEL-20367: Adds Camel Config tests (#17570) b277a04075f is described below commit b277a04075f12c55f8fe9bdcda856c0746e11040 Author: Jakub Vrubel <52706818+jvru...@users.noreply.github.com> AuthorDate: Wed Mar 26 10:12:51 2025 +0100 CAMEL-20367: Adds Camel Config tests (#17570) --- .../camel/dsl/jbang/it/CamelConfigITCase.java | 57 ++++++++++++++++++++++ .../apache/camel/dsl/jbang/it/ExportITCase.java | 9 ++++ 2 files changed, 66 insertions(+) diff --git a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CamelConfigITCase.java b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CamelConfigITCase.java new file mode 100644 index 00000000000..0f22f54d8e3 --- /dev/null +++ b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CamelConfigITCase.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.it; + +import org.apache.camel.dsl.jbang.it.support.JBangTestSupport; +import org.junit.jupiter.api.Test; + +public class CamelConfigITCase extends JBangTestSupport { + + @Test + public void testCamelSetAndGetConfig() { + execute("config set gav=com.foo:acme:1.0-SNAPSHOT"); + execute("config set runtime=quarkus"); + execute("config set directory=" + mountPoint()); + checkCommandOutputs("config get gav", "com.foo:acme:1.0-SNAPSHOT"); + checkCommandOutputs("config get runtime", "quarkus"); + checkCommandOutputs("config get directory", mountPoint()); + } + + @Test + public void testCamelListConfig() { + execute("config set gav=com.foo:acme:1.0-SNAPSHOT"); + execute("config set runtime=quarkus"); + execute("config set directory=" + mountPoint()); + checkCommandOutputs("config list", + "gav = com.foo:acme:1.0-SNAPSHOT\n" + + "runtime = quarkus\n" + + "directory = " + mountPoint()); + } + + @Test + public void testCamelUnsetConfig() { + execute("config set gav=com.foo:acme:1.0-SNAPSHOT"); + execute("config set runtime=quarkus"); + execute("config set directory=" + mountPoint()); + checkCommandOutputs("config list", + "gav = com.foo:acme:1.0-SNAPSHOT\n" + + "runtime = quarkus\n" + + "directory = " + mountPoint()); + execute("config unset runtime"); + checkCommandDoesNotOutput("config list", "runtime = quarkus"); + } +} diff --git a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/ExportITCase.java b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/ExportITCase.java index 2ca8d9843b1..d923a16f73e 100644 --- a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/ExportITCase.java +++ b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/ExportITCase.java @@ -110,4 +110,13 @@ public class ExportITCase extends JBangTestSupport { mountPoint())); assertFileInDataFolderContains("pom.xml", "<artifactId>camel-quarkus-cli-connector</artifactId>\n"); } + + @Test + public void testExportWithCamelConfig() throws IOException { + execute("config set gav=com.foo:acme:1.0-SNAPSHOT"); + execute("config set runtime=quarkus"); + execute("config set directory=" + mountPoint()); + execute("export"); + assertFileInDataFolderContains("pom.xml", "<groupId>org.apache.camel.quarkus</groupId>"); + } }