fix typo in WebFluxSseIntegrationTests

Signed-off-by: jitokim <pigberger70@gmail.com>
This commit is contained in:
jitokim 2025-04-06 02:10:43 +09:00 • committed by Christian Tzolov
commit 734153a445

View file

@ -52,8 +52,6 @@ public class WebFluxSseIntegrationTests {
private static final int PORT = 8182; private static final int PORT = 8182;
// private static final String MESSAGE_ENDPOINT = "/mcp/message";
private static final String CUSTOM_SSE_ENDPOINT = "/somePath/sse"; private static final String CUSTOM_SSE_ENDPOINT = "/somePath/sse";
private static final String CUSTOM_MESSAGE_ENDPOINT = "/otherPath/mcp/message"; private static final String CUSTOM_MESSAGE_ENDPOINT = "/otherPath/mcp/message";
@ -62,7 +60,7 @@ public class WebFluxSseIntegrationTests {
private WebFluxSseServerTransportProvider mcpServerTransportProvider; private WebFluxSseServerTransportProvider mcpServerTransportProvider;
ConcurrentHashMap<String, McpClient.SyncSpec> clientBulders = new ConcurrentHashMap<>(); ConcurrentHashMap<String, McpClient.SyncSpec> clientBuilders = new ConcurrentHashMap<>();
@BeforeEach @BeforeEach
public void before() { public void before() {
@ -77,11 +75,11 @@ public class WebFluxSseIntegrationTests {
ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler);
this.httpServer = HttpServer.create().port(PORT).handle(adapter).bindNow(); this.httpServer = HttpServer.create().port(PORT).handle(adapter).bindNow();
clientBulders.put("httpclient", clientBuilders.put("httpclient",
McpClient.sync(HttpClientSseClientTransport.builder("http://localhost:" + PORT) McpClient.sync(HttpClientSseClientTransport.builder("http://localhost:" + PORT)
.sseEndpoint(CUSTOM_SSE_ENDPOINT) .sseEndpoint(CUSTOM_SSE_ENDPOINT)
.build())); .build()));
clientBulders.put("webflux", clientBuilders.put("webflux",
McpClient McpClient
.sync(WebFluxSseClientTransport.builder(WebClient.builder().baseUrl("http://localhost:" + PORT)) .sync(WebFluxSseClientTransport.builder(WebClient.builder().baseUrl("http://localhost:" + PORT))
.sseEndpoint(CUSTOM_SSE_ENDPOINT) .sseEndpoint(CUSTOM_SSE_ENDPOINT)
@ -103,7 +101,7 @@ public class WebFluxSseIntegrationTests {
@ValueSource(strings = { "httpclient", "webflux" }) @ValueSource(strings = { "httpclient", "webflux" })
void testCreateMessageWithoutSamplingCapabilities(String clientType) { void testCreateMessageWithoutSamplingCapabilities(String clientType) {
var clientBuilder = clientBulders.get(clientType); var clientBuilder = clientBuilders.get(clientType);
McpServerFeatures.AsyncToolSpecification tool = new McpServerFeatures.AsyncToolSpecification( McpServerFeatures.AsyncToolSpecification tool = new McpServerFeatures.AsyncToolSpecification(
new McpSchema.Tool("tool1", "tool1 description", emptyJsonSchema), (exchange, request) -> { new McpSchema.Tool("tool1", "tool1 description", emptyJsonSchema), (exchange, request) -> {
@ -134,7 +132,7 @@ public class WebFluxSseIntegrationTests {
void testCreateMessageSuccess(String clientType) throws InterruptedException { void testCreateMessageSuccess(String clientType) throws InterruptedException {
// Client // Client
var clientBuilder = clientBulders.get(clientType); var clientBuilder = clientBuilders.get(clientType);
Function<CreateMessageRequest, CreateMessageResult> samplingHandler = request -> { Function<CreateMessageRequest, CreateMessageResult> samplingHandler = request -> {
assertThat(request.messages()).hasSize(1); assertThat(request.messages()).hasSize(1);
@ -203,7 +201,7 @@ public class WebFluxSseIntegrationTests {
@ParameterizedTest(name = "{0} : {displayName} ") @ParameterizedTest(name = "{0} : {displayName} ")
@ValueSource(strings = { "httpclient", "webflux" }) @ValueSource(strings = { "httpclient", "webflux" })
void testRootsSuccess(String clientType) { void testRootsSuccess(String clientType) {
var clientBuilder = clientBulders.get(clientType); var clientBuilder = clientBuilders.get(clientType);
List<Root> roots = List.of(new Root("uri1://", "root1"), new Root("uri2://", "root2")); List<Root> roots = List.of(new Root("uri1://", "root1"), new Root("uri2://", "root2"));
@ -250,7 +248,7 @@ public class WebFluxSseIntegrationTests {
@ValueSource(strings = { "httpclient", "webflux" }) @ValueSource(strings = { "httpclient", "webflux" })
void testRootsWithoutCapability(String clientType) { void testRootsWithoutCapability(String clientType) {
var clientBuilder = clientBulders.get(clientType); var clientBuilder = clientBuilders.get(clientType);
McpServerFeatures.SyncToolSpecification tool = new McpServerFeatures.SyncToolSpecification( McpServerFeatures.SyncToolSpecification tool = new McpServerFeatures.SyncToolSpecification(
new McpSchema.Tool("tool1", "tool1 description", emptyJsonSchema), (exchange, request) -> { new McpSchema.Tool("tool1", "tool1 description", emptyJsonSchema), (exchange, request) -> {
@ -284,7 +282,7 @@ public class WebFluxSseIntegrationTests {
@ParameterizedTest(name = "{0} : {displayName} ") @ParameterizedTest(name = "{0} : {displayName} ")
@ValueSource(strings = { "httpclient", "webflux" }) @ValueSource(strings = { "httpclient", "webflux" })
void testRootsNotifciationWithEmptyRootsList(String clientType) { void testRootsNotifciationWithEmptyRootsList(String clientType) {
var clientBuilder = clientBulders.get(clientType); var clientBuilder = clientBuilders.get(clientType);
AtomicReference<List<Root>> rootsRef = new AtomicReference<>(); AtomicReference<List<Root>> rootsRef = new AtomicReference<>();
var mcpServer = McpServer.sync(mcpServerTransportProvider) var mcpServer = McpServer.sync(mcpServerTransportProvider)
@ -311,7 +309,7 @@ public class WebFluxSseIntegrationTests {
@ParameterizedTest(name = "{0} : {displayName} ") @ParameterizedTest(name = "{0} : {displayName} ")
@ValueSource(strings = { "httpclient", "webflux" }) @ValueSource(strings = { "httpclient", "webflux" })
void testRootsWithMultipleHandlers(String clientType) { void testRootsWithMultipleHandlers(String clientType) {
var clientBuilder = clientBulders.get(clientType); var clientBuilder = clientBuilders.get(clientType);
List<Root> roots = List.of(new Root("uri1://", "root1")); List<Root> roots = List.of(new Root("uri1://", "root1"));
@ -345,7 +343,7 @@ public class WebFluxSseIntegrationTests {
@ValueSource(strings = { "httpclient", "webflux" }) @ValueSource(strings = { "httpclient", "webflux" })
void testRootsServerCloseWithActiveSubscription(String clientType) { void testRootsServerCloseWithActiveSubscription(String clientType) {
var clientBuilder = clientBulders.get(clientType); var clientBuilder = clientBuilders.get(clientType);
List<Root> roots = List.of(new Root("uri1://", "root1")); List<Root> roots = List.of(new Root("uri1://", "root1"));
@ -390,7 +388,7 @@ public class WebFluxSseIntegrationTests {
@ValueSource(strings = { "httpclient", "webflux" }) @ValueSource(strings = { "httpclient", "webflux" })
void testToolCallSuccess(String clientType) { void testToolCallSuccess(String clientType) {
var clientBuilder = clientBulders.get(clientType); var clientBuilder = clientBuilders.get(clientType);
var callResponse = new McpSchema.CallToolResult(List.of(new McpSchema.TextContent("CALL RESPONSE")), null); var callResponse = new McpSchema.CallToolResult(List.of(new McpSchema.TextContent("CALL RESPONSE")), null);
McpServerFeatures.SyncToolSpecification tool1 = new McpServerFeatures.SyncToolSpecification( McpServerFeatures.SyncToolSpecification tool1 = new McpServerFeatures.SyncToolSpecification(
@ -430,7 +428,7 @@ public class WebFluxSseIntegrationTests {
@ValueSource(strings = { "httpclient", "webflux" }) @ValueSource(strings = { "httpclient", "webflux" })
void testToolListChangeHandlingSuccess(String clientType) { void testToolListChangeHandlingSuccess(String clientType) {
var clientBuilder = clientBulders.get(clientType); var clientBuilder = clientBuilders.get(clientType);
var callResponse = new McpSchema.CallToolResult(List.of(new McpSchema.TextContent("CALL RESPONSE")), null); var callResponse = new McpSchema.CallToolResult(List.of(new McpSchema.TextContent("CALL RESPONSE")), null);
McpServerFeatures.SyncToolSpecification tool1 = new McpServerFeatures.SyncToolSpecification( McpServerFeatures.SyncToolSpecification tool1 = new McpServerFeatures.SyncToolSpecification(
@ -500,7 +498,7 @@ public class WebFluxSseIntegrationTests {
@ValueSource(strings = { "httpclient", "webflux" }) @ValueSource(strings = { "httpclient", "webflux" })
void testInitialize(String clientType) { void testInitialize(String clientType) {
var clientBuilder = clientBulders.get(clientType); var clientBuilder = clientBuilders.get(clientType);
var mcpServer = McpServer.sync(mcpServerTransportProvider).build(); var mcpServer = McpServer.sync(mcpServerTransportProvider).build();