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 @@ -27,6 +27,7 @@
import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
import org.apache.camel.dsl.jbang.core.commands.generate.GeneratePlugin;
import org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesPlugin;
import org.apache.camel.dsl.jbang.core.commands.mcp.McpPlugin;
import org.apache.camel.dsl.jbang.core.commands.test.TestPlugin;
import org.apache.camel.dsl.jbang.core.commands.tui.TuiPlugin;
import org.apache.camel.dsl.jbang.core.commands.validate.ValidatePlugin;
Expand All @@ -48,6 +49,8 @@ private record EmbeddedPlugin(Supplier<Plugin> factory, Set<String> commands) {
private static final List<EmbeddedPlugin> PLUGINS = List.of(
new EmbeddedPlugin(GeneratePlugin::new, Set.of("generate")),
new EmbeddedPlugin(KubernetesPlugin::new, Set.of("kubernetes", "k8s")),
// its jar was in the launcher, but camel mcp installed the plugin on first use, in the plugin configuration
new EmbeddedPlugin(McpPlugin::new, Set.of("mcp")),
new EmbeddedPlugin(SelfUpdatePlugin::new, Set.of("self-update")),
new EmbeddedPlugin(TuiPlugin::new, Set.of("tui")),
new EmbeddedPlugin(ValidatePlugin::new, Set.of("validate")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,15 @@ public void aCommandOfAnEmbeddedPluginCreatesOnlyThatPlugin() {
// creating all the commands of the CLI and the plugins costs more than half a second
assertEquals(Set.of("generate"), commandsOf("generate"));
assertEquals(Set.of("kubernetes", "k8s"), commandsOf("k8s", "--help"));
// embedded like the others, so camel mcp does not install it in the plugin configuration on first use
assertEquals(Set.of("mcp"), commandsOf("mcp", "--help"));
assertEquals(Set.of("version"), commandsOf("version"));
}

@Test
public void theHelpCreatesTheCommandsOfAllEmbeddedPlugins() {
assertTrue(commandsOf("--help").containsAll(Set.of("version", "generate", "kubernetes", "self-update", "tui")));
assertTrue(commandsOf("--help")
.containsAll(Set.of("version", "generate", "kubernetes", "mcp", "self-update", "tui", "validate", "test")));
}

private static Set<String> commandsOf(String... args) {
Expand Down
Loading