This is an automated email from the ASF dual-hosted git repository. christophd pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit f5fa395c11d761ef12740e272ca0f087042558e1 Author: Christoph Deppisch <[email protected]> AuthorDate: Thu Nov 12 11:38:45 2026 +0100 CAMEL-26764: Add test for addPlugins with cmd target Pin that a broken legacy plugin without appliesTo does not break addPlugins for the "cmd" target (same code path as "run"). Co-Authored-By: Claude Opus 4.6 <[email protected]> --- .../dsl/jbang/core/common/PluginFilteringTest.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/PluginFilteringTest.java b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/PluginFilteringTest.java index 940179339aa2..f5890f140ada 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/PluginFilteringTest.java +++ b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/PluginFilteringTest.java @@ -385,7 +385,7 @@ class PluginFilteringTest { .doesNotContainKey("beta"); } - // ---- A broken unrelated plugin should not break addPlugins for "run" ---- + // ---- A broken legacy plugin should not break addPlugins for "run" or "cmd" ---- @Test void brokenLegacyPluginDoesNotBreakAddPluginsForRun() throws Exception { @@ -406,6 +406,23 @@ class PluginFilteringTest { .doesNotThrowAnyException(); } + @Test + void brokenLegacyPluginDoesNotBreakAddPluginsForCmd() throws Exception { + Path goodJar = tempDir.resolve("fake-good.jar"); + FakePluginJar.write(goodJar, "good"); + + writeConfig( + buildEntry("good", camelVersion, goodJar, Files.getLastModifiedTime(goodJar).toMillis()), + buildBrokenEntry("broken")); + + CamelJBangMain main = new CamelJBangMain().withPrinter(new StringPrinter()); + CommandTree commandLine = new CommandTree(main); + commandLine.addSubcommand("cmd", new CommandTree(new NoOpCommand())); + + assertThatCode(() -> PluginHelper.addPlugins(commandLine, main, "cmd")) + .doesNotThrowAnyException(); + } + // ---- A built-in command like "version" or "ps" should not trigger plugin loading ---- @Test
