ramu11 commented on code in PR #29454:
URL: https://github.com/apache/camel/pull/29454#discussion_r4514891651


##########
components/camel-ai/camel-mcp-server/src/test/java/org/apache/camel/component/mcp/server/stdio/StdioMcpServerEngineTest.java:
##########
@@ -80,6 +87,28 @@ void toolAddedBeforeStartIsQueuedWithoutNpe() {
         assertThatCode(() -> 
engine.toolRemoved("queued_tool")).doesNotThrowAnyException();
     }
 
+    @Test
+    void promptAddedBeforeStartIsFlushedWhenServerStarts() throws Exception {
+        StdioMcpServerEngine engine = new StdioMcpServerEngine();
+        engine.initialize(new 
org.apache.camel.component.mcp.server.McpServerInfo(
+                "test", "1.0", "/mcp", 0, 0, null, null, null, null, null));
+        engine.setTransportStreams(new ByteArrayInputStream(new byte[0]), new 
ByteArrayOutputStream());
+        engine.promptAdded(samplePrompt("queued_prompt", "Queued before 
start"));
+
+        assertThatCode(engine::start).doesNotThrowAnyException();
+        engine.stop();
+    }
+
+    @Test
+    void promptRemovedBeforeStartRemovesItFromPendingQueue() {
+        StdioMcpServerEngine engine = new StdioMcpServerEngine();
+        engine.initialize(new 
org.apache.camel.component.mcp.server.McpServerInfo(
+                "test", "1.0", "/mcp", 0, 0, null, null, null, null, null));
+
+        engine.promptAdded(samplePrompt("ephemeral_prompt", "Removed before 
start"));
+        assertThatCode(() -> 
engine.promptRemoved("ephemeral_prompt")).doesNotThrowAnyException();

Review Comment:
   addressed



##########
components/camel-ai/camel-mcp-server/src/test/java/org/apache/camel/component/mcp/server/stdio/StdioMcpServerEngineTest.java:
##########
@@ -80,6 +87,28 @@ void toolAddedBeforeStartIsQueuedWithoutNpe() {
         assertThatCode(() -> 
engine.toolRemoved("queued_tool")).doesNotThrowAnyException();
     }
 
+    @Test
+    void promptAddedBeforeStartIsFlushedWhenServerStarts() throws Exception {
+        StdioMcpServerEngine engine = new StdioMcpServerEngine();
+        engine.initialize(new 
org.apache.camel.component.mcp.server.McpServerInfo(
+                "test", "1.0", "/mcp", 0, 0, null, null, null, null, null));
+        engine.setTransportStreams(new ByteArrayInputStream(new byte[0]), new 
ByteArrayOutputStream());
+        engine.promptAdded(samplePrompt("queued_prompt", "Queued before 
start"));
+
+        assertThatCode(engine::start).doesNotThrowAnyException();
+        engine.stop();
+    }
+
+    @Test
+    void promptRemovedBeforeStartRemovesItFromPendingQueue() {
+        StdioMcpServerEngine engine = new StdioMcpServerEngine();
+        engine.initialize(new 
org.apache.camel.component.mcp.server.McpServerInfo(
+                "test", "1.0", "/mcp", 0, 0, null, null, null, null, null));

Review Comment:
   addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to