Clean up AbstractMcpClientServerIntegrationTests

Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
This commit is contained in:
Daniel Garnier-Moiroux 2026-06-23 10:33:33 +02:00
commit 439dc90d25
2 changed files with 142 additions and 300 deletions

View file

@ -61,12 +61,6 @@ class HttpServletSseIntegrationTests extends AbstractMcpClientServerIntegrationT
catch (Exception e) {
throw new RuntimeException("Failed to start Tomcat", e);
}
clientBuilders
.put("httpclient",
McpClient.sync(HttpClientSseClientTransport.builder("http://localhost:" + PORT)
.sseEndpoint(CUSTOM_SSE_ENDPOINT)
.build()).requestTimeout(Duration.ofHours(10)));
}
@Override
@ -79,6 +73,15 @@ class HttpServletSseIntegrationTests extends AbstractMcpClientServerIntegrationT
return McpServer.sync(this.mcpServerTransportProvider);
}
@Override
protected McpClient.SyncSpec getMcpClientBuilder() {
return McpClient
.sync(HttpClientSseClientTransport.builder("http://localhost:" + PORT)
.sseEndpoint(CUSTOM_SSE_ENDPOINT)
.build())
.requestTimeout(Duration.ofHours(10));
}
@AfterEach
public void after() {
if (mcpServerTransportProvider != null) {
@ -95,10 +98,6 @@ class HttpServletSseIntegrationTests extends AbstractMcpClientServerIntegrationT
}
}
@Override
protected void prepareClients(int port, String mcpEndpoint) {
}
static McpTransportContextExtractor<HttpServletRequest> TEST_CONTEXT_EXTRACTOR = (r) -> McpTransportContext
.create(Map.of("important", "value"));

View file

@ -59,12 +59,6 @@ class HttpServletStreamableIntegrationTests extends AbstractMcpClientServerInteg
catch (Exception e) {
throw new RuntimeException("Failed to start Tomcat", e);
}
clientBuilders
.put("httpclient",
McpClient.sync(HttpClientStreamableHttpTransport.builder("http://localhost:" + PORT)
.endpoint(MESSAGE_ENDPOINT)
.build()).requestTimeout(Duration.ofHours(10)));
}
@Override
@ -77,6 +71,15 @@ class HttpServletStreamableIntegrationTests extends AbstractMcpClientServerInteg
return McpServer.sync(this.mcpServerTransportProvider);
}
@Override
protected McpClient.SyncSpec getMcpClientBuilder() {
return McpClient
.sync(HttpClientStreamableHttpTransport.builder("http://localhost:" + PORT)
.endpoint(MESSAGE_ENDPOINT)
.build())
.requestTimeout(Duration.ofHours(10));
}
@AfterEach
public void after() {
if (mcpServerTransportProvider != null) {
@ -93,10 +96,6 @@ class HttpServletStreamableIntegrationTests extends AbstractMcpClientServerInteg
}
}
@Override
protected void prepareClients(int port, String mcpEndpoint) {
}
static McpTransportContextExtractor<HttpServletRequest> TEST_CONTEXT_EXTRACTOR = (r) -> McpTransportContext
.create(Map.of("important", "value"));