File tree Expand file tree Collapse file tree 7 files changed +33
-14
lines changed
mcp-spring/mcp-spring-webflux/src/test/java/io/modelcontextprotocol/client
mcp-test/src/main/java/io/modelcontextprotocol/client
mcp/src/test/java/io/modelcontextprotocol/client Expand file tree Collapse file tree 7 files changed +33
-14
lines changed Original file line number Diff line number Diff line change 44
55package io .modelcontextprotocol .client ;
66
7+ import java .time .Duration ;
8+
79import io .modelcontextprotocol .client .transport .WebFluxSseClientTransport ;
810import io .modelcontextprotocol .spec .ClientMcpTransport ;
911import org .junit .jupiter .api .Timeout ;
@@ -46,4 +48,8 @@ public void onClose() {
4648 container .stop ();
4749 }
4850
51+ protected Duration getInitializationTimeout () {
52+ return Duration .ofSeconds (1 );
53+ }
54+
4955}
Original file line number Diff line number Diff line change 44
55package io .modelcontextprotocol .client ;
66
7+ import java .time .Duration ;
8+
79import io .modelcontextprotocol .client .transport .WebFluxSseClientTransport ;
810import io .modelcontextprotocol .spec .ClientMcpTransport ;
911import org .junit .jupiter .api .Timeout ;
@@ -46,4 +48,8 @@ protected void onClose() {
4648 container .stop ();
4749 }
4850
51+ protected Duration getInitializationTimeout () {
52+ return Duration .ofSeconds (1 );
53+ }
54+
4955}
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ protected Duration getRequestTimeout() {
6363 }
6464
6565 protected Duration getInitializationTimeout () {
66- return Duration .ofSeconds (1 );
66+ return Duration .ofSeconds (2 );
6767 }
6868
6969 @ BeforeEach
@@ -90,10 +90,10 @@ void tearDown() {
9090
9191 @ Test
9292 void testConstructorWithInvalidArguments () {
93- assertThatThrownBy (() -> McpClient .sync (null ).build ()).isInstanceOf (IllegalArgumentException .class )
93+ assertThatThrownBy (() -> McpClient .async (null ).build ()).isInstanceOf (IllegalArgumentException .class )
9494 .hasMessage ("Transport must not be null" );
9595
96- assertThatThrownBy (() -> McpClient .sync (mcpTransport ).requestTimeout (null ).build ())
96+ assertThatThrownBy (() -> McpClient .async (mcpTransport ).requestTimeout (null ).build ())
9797 .isInstanceOf (IllegalArgumentException .class )
9898 .hasMessage ("Request timeout must not be null" );
9999 }
Original file line number Diff line number Diff line change @@ -48,16 +48,18 @@ public abstract class AbstractMcpSyncClientTests {
4848
4949 abstract protected ClientMcpTransport createMcpTransport ();
5050
51- abstract protected void onStart ();
51+ protected void onStart () {
52+ }
5253
53- abstract protected void onClose ();
54+ protected void onClose () {
55+ }
5456
5557 protected Duration getRequestTimeout () {
5658 return Duration .ofSeconds (10 );
5759 }
5860
5961 protected Duration getInitializationTimeout () {
60- return Duration .ofSeconds (1 );
62+ return Duration .ofSeconds (2 );
6163 }
6264
6365 @ BeforeEach
Original file line number Diff line number Diff line change @@ -49,9 +49,11 @@ public abstract class AbstractMcpSyncClientTests {
4949
5050 abstract protected ClientMcpTransport createMcpTransport ();
5151
52- abstract protected void onStart ();
52+ protected void onStart () {
53+ }
5354
54- abstract protected void onClose ();
55+ protected void onClose () {
56+ }
5557
5658 protected Duration getRequestTimeout () {
5759 return Duration .ofSeconds (10 );
Original file line number Diff line number Diff line change 44
55package io .modelcontextprotocol .client ;
66
7+ import java .time .Duration ;
8+
79import io .modelcontextprotocol .client .transport .ServerParameters ;
810import io .modelcontextprotocol .client .transport .StdioClientTransport ;
911import io .modelcontextprotocol .spec .ClientMcpTransport ;
@@ -26,4 +28,8 @@ protected ClientMcpTransport createMcpTransport() {
2628 return new StdioClientTransport (stdioParams );
2729 }
2830
31+ protected Duration getInitializationTimeout () {
32+ return Duration .ofSeconds (6 );
33+ }
34+
2935}
Original file line number Diff line number Diff line change 44
55package io .modelcontextprotocol .client ;
66
7+ import java .time .Duration ;
78import java .util .concurrent .atomic .AtomicReference ;
89
910import io .modelcontextprotocol .client .transport .ServerParameters ;
@@ -44,12 +45,8 @@ void customErrorHandlerShouldReceiveErrors() {
4445 assertThat (receivedError .get ()).isNotNull ().isEqualTo (errorMessage );
4546 }
4647
47- @ Override
48- protected void onStart () {
49- }
50-
51- @ Override
52- protected void onClose () {
48+ protected Duration getInitializationTimeout () {
49+ return Duration .ofSeconds (6 );
5350 }
5451
5552}
You can’t perform that action at this time.
0 commit comments