use of org.springframework.graphql.GraphQlRequest in project spring-graphql by spring-projects.
the class MockWebSocketGraphQlTransportTests method requestStream.
@Test
void requestStream() {
GraphQlRequest request = this.mockServer.expectOperation("{Sub1}").andStream(Flux.just(this.result1, result2));
StepVerifier.create(this.transport.executeSubscription(request)).expectNext(this.result1, result2).expectComplete().verify(TIMEOUT);
assertActualClientMessages(GraphQlMessage.connectionInit(null), GraphQlMessage.subscribe("1", request));
}
use of org.springframework.graphql.GraphQlRequest in project spring-graphql by spring-projects.
the class MockWebSocketGraphQlTransportTests method errorDuringResponseHandling.
@Test
void errorDuringResponseHandling() {
// Response handling errors that close the connection should terminate outstanding requests
TestWebSocketClient client = new TestWebSocketClient(new UnexpectedResponseHandler());
WebSocketGraphQlTransport transport = createTransport(client);
String expectedMessage = "disconnected with CloseStatus[code=1002, reason=null]";
StepVerifier.create(transport.execute(new GraphQlRequest("{Query1}"))).expectErrorSatisfies(ex -> assertThat(ex).hasMessageEndingWith(expectedMessage)).verify(TIMEOUT);
}
Aggregations