gnodet commented on code in PR #31342:
URL: https://github.com/apache/camel/pull/31342#discussion_r4798657716
##########
components/camel-ai/camel-mcp-server-api/src/test/java/org/apache/camel/component/mcp/server/conformance/McpServerResourceConformanceTestSupport.java:
##########
@@ -301,6 +301,14 @@ void
testResourceTemplateLifecycleSendsListChangedNotifications() throws Excepti
try {
notificationClient.initialize();
+ // the client opens its listening stream asynchronously after
initialize, and a notification sent before
+ // that is dropped by the server: toggle the route until one is
received, then the stream is established
+ await().atMost(10, TimeUnit.SECONDS).until(() -> {
+
context.getRouteController().stopRoute("customer-template-route");
+
context.getRouteController().startRoute("customer-template-route");
+ return notifications.get() > 0;
Review Comment:
**Minor: Consider capturing initial count for robustness**
While the current code works, you could make it more explicit by capturing
the initial notification count before the warm-up loop:
```java
int initialCount = notifications.get(); // should be 0
// Wait for stream to be established
await().atMost(10, TimeUnit.SECONDS).until(() -> {
context.getRouteController().stopRoute("customer-template-route");
context.getRouteController().startRoute("customer-template-route");
return notifications.get() > initialCount;
});
```
This guards against the edge case where notifications might have been
received before this test logic (though unlikely in practice).
Not a blocker—the current code is fine given your thorough testing.
---
_Claude Code on behalf of Guillaume Nodet_
##########
components/camel-ai/camel-mcp-server-api/src/test/java/org/apache/camel/component/mcp/server/conformance/McpServerResourceConformanceTestSupport.java:
##########
@@ -301,6 +301,14 @@ void
testResourceTemplateLifecycleSendsListChangedNotifications() throws Excepti
try {
notificationClient.initialize();
+ // the client opens its listening stream asynchronously after
initialize, and a notification sent before
+ // that is dropped by the server: toggle the route until one is
received, then the stream is established
+ await().atMost(10, TimeUnit.SECONDS).until(() -> {
+
context.getRouteController().stopRoute("customer-template-route");
+
context.getRouteController().startRoute("customer-template-route");
+ return notifications.get() > 0;
+ });
Review Comment:
**Good: Route state after warm-up is deterministic**
After this loop exits, the route is guaranteed to be in the `started` state
(since `startRoute` is the last operation in the lambda). This means the
subsequent `stopRoute` on line 312 will work as expected.
You might consider adding a brief comment about this for future readers:
```java
// Route is now started, and stream is established
int beforeStop = notifications.get();
```
---
_Claude Code on behalf of Guillaume Nodet_
--
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]