Address review comments
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
parent
914a14a92a
commit
264a0c9041
5 changed files with 13 additions and 10 deletions
|
|
@ -129,7 +129,8 @@ public abstract class AbstractMcpAsyncClientTests {
|
|||
|
||||
@Test
|
||||
void testPing() {
|
||||
StepVerifier.create(mcpAsyncClient.initialize().then(mcpAsyncClient.ping())).verifyComplete();
|
||||
StepVerifier.create(mcpAsyncClient.initialize().then(mcpAsyncClient.ping())).consumeNextWith(callToolResult -> {
|
||||
}).verifyComplete();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -369,13 +369,12 @@ public class McpAsyncClient {
|
|||
|
||||
/**
|
||||
* Sends a ping request to the server.
|
||||
* @return A Mono that completes when the server responds to the ping
|
||||
* @return A Mono that completes with the server's ping response
|
||||
*/
|
||||
public Mono<Void> ping() {
|
||||
public Mono<Object> ping() {
|
||||
return this.withInitializationCheck("pinging the server", initializedResult -> this.mcpSession
|
||||
.sendRequest(McpSchema.METHOD_PING, null, new TypeReference<Object>() {
|
||||
})
|
||||
.then());
|
||||
}));
|
||||
}
|
||||
|
||||
// --------------------------
|
||||
|
|
|
|||
|
|
@ -179,10 +179,11 @@ public class McpSyncClient implements AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Send a synchronous ping request to the server.
|
||||
* Send a synchronous ping request.
|
||||
* @return
|
||||
*/
|
||||
public void ping() {
|
||||
this.delegate.ping().block();
|
||||
public Object ping() {
|
||||
return this.delegate.ping().block();
|
||||
}
|
||||
|
||||
// --------------------------
|
||||
|
|
|
|||
|
|
@ -130,7 +130,8 @@ public abstract class AbstractMcpAsyncClientTests {
|
|||
|
||||
@Test
|
||||
void testPing() {
|
||||
StepVerifier.create(mcpAsyncClient.initialize().then(mcpAsyncClient.ping())).verifyComplete();
|
||||
StepVerifier.create(mcpAsyncClient.initialize().then(mcpAsyncClient.ping())).consumeNextWith(callToolResult -> {
|
||||
}).verifyComplete();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import io.modelcontextprotocol.client.transport.StdioClientTransport;
|
|||
import io.modelcontextprotocol.spec.ClientMcpTransport;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.Timeout;
|
||||
import reactor.core.publisher.Sinks;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
@ -40,7 +41,7 @@ class StdioMcpSyncClientTests extends AbstractMcpSyncClientTests {
|
|||
((StdioClientTransport) mcpTransport).setStdErrorHandler(error -> receivedError.set(error));
|
||||
|
||||
String errorMessage = "Test error";
|
||||
((StdioClientTransport) mcpTransport).getErrorSink().emitNext(errorMessage, null);
|
||||
((StdioClientTransport) mcpTransport).getErrorSink().emitNext(errorMessage, Sinks.EmitFailureHandler.FAIL_FAST);
|
||||
|
||||
assertThat(receivedError.get()).isNotNull().isEqualTo(errorMessage);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue