This is an automated email from the ASF dual-hosted git repository.

luigidemasi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kit.git

commit 055fe0c69d96f5aeb17c765bc530096b84765dbd
Author: Jinal Sarvaiya <[email protected]>
AuthorDate: Fri Nov 6 08:31:02 2026 +0000

    fix: add global config regression tests
---
 .../camel/kit/generator/OpenCodeGeneratorTest.java | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git 
a/kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/OpenCodeGeneratorTest.java
 
b/kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/OpenCodeGeneratorTest.java
index b15fd00c..7bfd50b8 100644
--- 
a/kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/OpenCodeGeneratorTest.java
+++ 
b/kit/camel-kit-core/src/test/java/org/apache/camel/kit/generator/OpenCodeGeneratorTest.java
@@ -5,6 +5,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.attribute.PosixFileAttributeView;
 import java.nio.file.attribute.PosixFilePermission;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Set;
@@ -1183,6 +1184,44 @@ class OpenCodeGeneratorTest {
         }
     }
 
+    @Test
+    void collectMcpServersFromFileHandlesGlobalConfig() throws Exception {
+        Path globalConfig = tempDir.resolve("global-opencode.json");
+        Files.writeString(globalConfig, """
+                {
+                  "mcp": {
+                    "global-probe": {"type": "local", "command": ["echo"], 
"enabled": true}
+                  }
+                }
+                """);
+
+        Set<String> names = new LinkedHashSet<>();
+        OpenCodeGenerator.collectMcpServersFromFile(globalConfig, names);
+        assertTrue(names.contains("global-probe"),
+                "collectMcpServersFromFile must extract servers from 
global-style config");
+    }
+
+    @Test
+    void collectMcpServersFromFileHandlesNativeGlobalConfig() throws Exception 
{
+        Path globalConfig = tempDir.resolve("global-opencode.json");
+        Files.writeString(globalConfig, """
+                {
+                  "mcp": {
+                    "servers": {
+                      "global-native": {"type": "local", "command": ["echo"], 
"enabled": true}
+                    }
+                  }
+                }
+                """);
+
+        Set<String> names = new LinkedHashSet<>();
+        OpenCodeGenerator.collectMcpServersFromFile(globalConfig, names);
+        assertTrue(names.contains("global-native"),
+                "collectMcpServersFromFile must extract servers from native 
mcp.servers format in global config");
+        assertFalse(names.contains("servers"),
+                "collectMcpServersFromFile must not treat native servers 
container as a server");
+    }
+
     @Test
     void shipWorkerDeniesNativeFormatServerNamedType() throws Exception {
         InitContext ctx = createContext();

Reply via email to