From f9b84cb8d03c10c796bf979bab2d760b3aa11ba4 Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Tue, 29 Mar 2022 11:17:30 +0100 Subject: [PATCH] Update documentation for RSocketGraphQlTester See gh-339 --- .../src/docs/asciidoc/client.adoc | 6 +-- .../src/docs/asciidoc/testing.adoc | 39 ++++++++++++++----- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/spring-graphql-docs/src/docs/asciidoc/client.adoc b/spring-graphql-docs/src/docs/asciidoc/client.adoc index 170ca46c..80c4d947 100644 --- a/spring-graphql-docs/src/docs/asciidoc/client.adoc +++ b/spring-graphql-docs/src/docs/asciidoc/client.adoc @@ -20,9 +20,9 @@ an instance, you'll need to start from either the <> or the <> extensions. -The main purpose of a `GraphQlClient` extension is to provide a transport specific -`Builder`. There is also a common <> in `GraphQlClient` -with configuration options that apply to any extension. +Each `GraphQlClient` extension provides a transport specific `Builder`. There is also a +shared, base <> in `GraphQlClient` with common options for +all extensions. diff --git a/spring-graphql-docs/src/docs/asciidoc/testing.adoc b/spring-graphql-docs/src/docs/asciidoc/testing.adoc index 8d44df23..9a7ee3af 100644 --- a/spring-graphql-docs/src/docs/asciidoc/testing.adoc +++ b/spring-graphql-docs/src/docs/asciidoc/testing.adoc @@ -6,8 +6,8 @@ include::attributes.adoc[] [[testing]] = Testing -Spring for GraphQL provides dedicated support for testing GraphQL requests over HTTP or -WebSocket, and for testing GraphQL requests executed directly against a server. +Spring for GraphQL provides dedicated support for testing GraphQL requests over HTTP, +WebSocket, and RSocket, as well as for testing directly against a server. To make use of this, add `spring-graphql-test` to your build: @@ -43,14 +43,15 @@ dependencies { independent of and agnostic to the underlying transport. To create an instance, you'll need to choose a specific `GraphQlTester` extension as a starting point. -To test with a client sending requests to a server over a transport, use the -<> or the <> `GraphQlTester` -extensions. For server side tests, executed without any client, use the -<> or the <> extensions. +To test with a client sending requests over a transport, use one of the +<>, <>, or +<> extensions. To test the server without client, +use the<> or <> +extensions. -The main purpose of a `GraphQlTester` extension is to provide a transport specific -`Builder`. There is also a <> in `GraphQlTester` with -common configuration options that apply to any extension. +Each `GraphQlTester` extension provides a transport specific `Builder`. There is also a +shared, base <> in `GraphQlTester` with common options +for all extensions. @@ -148,7 +149,7 @@ from Spring WebFlux to execute GraphQL requests over WebSocket: ---- Once created, `WebSocketGraphQlTester` exposes the same transport agnostic workflow for -request execution as any `GrahQlTeste`. To change any transport details, use `mutate()` +request execution as any `GraphQlTester`. To change any transport details, use `mutate()` on an existing `WebSocketGraphQlTester` to create another with different configuration: [source,java,indent=0,subs="verbatim,quotes"] @@ -174,6 +175,24 @@ connection closed, e.g. after a test runs. +[[testing-rsocketgraphqltester]] +=== RSocket + +`RSocketGraphQlTester` uses `RSocketRequester` from spring-messaging to execute GraphQL +requests over RSocket: + +[source,java,indent=0,subs="verbatim,quotes"] +---- + RSocketGraphQlTester tester = RSocketGraphQlTester.builder() + .webSocket(URI.create("http://localhost:8080/graphql")) + .build(); +---- + +Once created, `RSocketGraphQlTester` exposes the same transport agnostic workflow for +request execution as any `GraphQlTester`. + + + [[testing-graphqlservicetester]] === `GraphQlService`