aldettinger commented on code in PR #9535:
URL: https://github.com/apache/camel-quarkus/pull/9535#discussion_r4640449964
##########
integration-tests/mcp-server/src/test/java/org/apache/camel/quarkus/component/mcp/server/it/McpServerTest.java:
##########
@@ -505,6 +505,51 @@ void testStoppingRefusedResourceKeepsApplicationResource()
{
.thenAssertResults();
}
+ @Test
+ void testAnnotatedResourceWithoutClashCoexistsWithCamelResources() {
+ client().when()
+ .resourcesList(page -> assertThat(resourceUris(page))
+ .contains("camel:///annotated/no-clash",
"camel:///config/app.json"))
+ .resourcesRead("camel:///annotated/no-clash",
+ response ->
assertThat(response.contents().get(0).asText().text())
+
.isEqualTo(QuarkusDefinedResources.NO_CLASH_CONTENT))
+ .thenAssertResults();
+ }
+
+ @Test
+ void testCamelResourceCollidingWithAnnotatedResourceUriIsRefused() {
+
assertThat(routeStatus("annotated-uri-clash-route")).isEqualTo("Started");
+ client().when()
+ .resourcesRead("camel:///annotated/uri-clash",
+ response ->
assertThat(response.contents().get(0).asText().text())
+
.isEqualTo(QuarkusDefinedResources.URI_CLASH_CONTENT))
+ .thenAssertResults();
+
+ // stopping the refused route must leave the annotated resource in
place
+ controlRoute("annotated-uri-clash-route", "stop");
+
assertThat(routeStatus("annotated-uri-clash-route")).isEqualTo("Stopped");
+ try {
+ client().when()
+ .resourcesRead("camel:///annotated/uri-clash",
+ response ->
assertThat(response.contents().get(0).asText().text())
+
.isEqualTo(QuarkusDefinedResources.URI_CLASH_CONTENT))
+ .thenAssertResults();
+ } finally {
+ controlRoute("annotated-uri-clash-route", "start");
Review Comment:
The route id only appears in this test (lines 521-538), and the uri only at
523 and 533, so there is nothing later to leak into.
Beyond that, I don't think a failed restart can go unnoticed here.
`controlRoute` already asserts `statusCode(204)`, and the endpoint calls
`RouteController.startRoute` synchronously and propagates:
```java
@Path("/route/{routeId}/start")
@POST
public void startRoute(@PathParam("routeId") String routeId) throws
Exception {
camelContext.getRouteController().startRoute(routeId);
}
```
so a start failure already fails the test at the `controlRoute` call. The
added assertion would only catch "returned without error but not Started",
which that controller doesn't really produce.
And since this route is refused, it contributes nothing to `resources/list`
in either state, so even a silent failure would not be observable by another
test. The `finally` is just tidiness.
Happy to add it if you would still prefer the symmetry, though note the
split: the three tests that assert `Started` after a restart
(`annotated-clash-route`, `say-hello-route`, `app-config-route`) restart inline
as part of what they assert, while the two that restart in a `finally` as
cleanup (`testStoppingToolRouteKeepsToolOfOtherServer`,
`testStoppingResourceRouteKeepsResourceOfOtherServer`) don't assert either.
This one is in the second group, so if we want the convention it should
probably change in all three places.
--
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]