Commit Graph

117 Commits

Author SHA1 Message Date
Brian Clozel
6de47bd2d3 Make test classes package private
See gh-1184
2025-04-08 15:27:26 +02:00
Brian Clozel
0d4fe150aa Remove test log reporting in build output 2025-03-12 17:28:55 +01:00
rstoyanchev
bd8a633eac AbstractGraphQlTesterBuilder copies extensions/attributes
Closes gh-1135
2025-03-11 18:14:26 +00:00
rstoyanchev
5682740dee GraphQlTester provides access to underlying response
Closes gh-1131
2025-03-11 18:14:26 +00:00
Stéphane Nicoll
fc55c53abc Avoid usage of JsonExpectationsHelper#assertEquals
This has been deprecated in Spring Framework 6.2.

Closes gh-1107
Signed-off-by: Stéphane Nicoll <stephane.nicoll@broadcom.com>
2025-01-13 10:22:28 +01:00
Brian Clozel
a9a8d0b745 Add fragments support in GraphQlTester
This commit adds support for GraphQL fragments with `GraphQlTester`.
Fragments allow to avoid repetition in GraphQL requests by reusing
field selection sets.

For example, the "releases" fragment can be reused in multiple queries
and make the overall document shorter:

```
query frameworkReleases {
  project(slug: "spring-framework") {
    name
    ...releases
  }
}
query graphqlReleases {
  project(slug: "spring-graphql") {
    name
    ...releases
  }
}

fragment releases on Project {
  releases {
    version
  }
}
```

With this change, `GraphQlTester` accepts fragments as `String` or can
load them by their name using the configured `DocumentSource`, similarly
to the document support.

Closes gh-964
2024-06-03 18:27:19 +02:00
rstoyanchev
4d2cde83e4 Polishing contribution
Closes gh-969
2024-05-21 08:38:40 +01:00
kutlueren
1318ca4316 Allow Map of variables in GraphQlTester
See gh-969
2024-05-21 07:03:15 +01:00
Brian Clozel
c9556035ca Configure interceptors on WebSocketGraphQlTester
This commit adds two new methods on the `WebSocketGraphQlTester` builder
to configure `GraphQlClientInterceptor` instances on the client.
For now, this is only accessible on the WebSocket tester but could be
promoted to a higher level builder in the future.

Closes gh-823
2024-04-19 15:34:07 +02:00
Brian Clozel
d27580f6b3 Add Remote Address to WebGraphQlRequest
This commit makes available the client remote address to various GraphQL
request implementations.

Closes gh-945
2024-04-15 15:37:05 +02:00
Brian Clozel
5f550d5027 Merge branch '1.2.x' 2024-04-05 09:51:43 +02:00
Brian Clozel
2a54ef486d Apply checkstyle changes to spring-graphql-test
See gh-943
2024-04-04 22:06:11 +02:00
Brian Clozel
1f7063c9b4 Add Server-Sent Events transport
Prior to this commit, the WebFlux and WebMVC infrastructure would only
support subscriptions over the WebSocket and RSocket transports.

This commit adds the `GraphQlSseHandler` implementations for both web
frameworks. This handler will send GraphQL responses as as stream of
Server-Sent Events, over an HTTP response with the "text/event-stream"
content type.

This implementation only supports the "Distinct connections mode" and
will reject all operations other than Subscriptions.

This commit also enhances the `HttpGraphQlTransport` client transport to
support subscriptions over this new protocol.

Closes gh-309
2024-02-15 21:09:27 +01:00
rstoyanchev
fb1f0ee0e7 Deserialize HTTP request body to POJO
Closes gh-905
2024-02-08 20:54:55 +00:00
rstoyanchev
78f7df2736 Consistently check errors in GraphQlTester
Closes gh-891
2024-01-30 09:24:26 +00:00
rstoyanchev
d717e80cb9 Minor refactoring in DefaultGraphQlTester 2023-05-07 21:31:53 +01:00
rstoyanchev
21f4520a37 Support nested paths in GraphQlTester
Closes gh-457
2023-05-07 21:19:03 +01:00
rstoyanchev
7fc4df74a6 Add request attributes to WebGraphQlRequest
Closes gh-633
2023-03-14 08:17:02 +00:00
rstoyanchev
66b3c82280 Add cookies to WebGraphQlRequest
Closes gh-626
2023-03-10 16:04:40 +00:00
rstoyanchev
dc90558d9a Configure ExecutionInput in ExecutionGraphQlServiceTester
Closes gh-615
2023-02-16 18:20:45 +00:00
Brian Clozel
d1300f56bf Add reachability metadata for GraphQL client resources
This commit adds reachability metadata for resources loaded by the
`GraphQlClient` and `GraphQlTester` when using the `document("name")`
API variant. This method loads the query file from the classpath at
particular locations, namely `"classpath:graphql-documents/"` and
`"classpath:graphql-test/"` with the `".graphql"` and `".gql"` file
extensions.

This commit adds the relevant resource metadata so that such resources
are loaded in the GraalVM native image at build time when the client or
the tester are reachable through the static analysis.

Fixes gh-575
2022-12-09 15:15:37 +01:00
rstoyanchev
2dafd5dfc7 Merge branch '1.0.x' 2022-11-04 08:40:30 +00:00
Johan Wigert
6004937ad2 Fix typo in Javadoc of GraphQlTester
Closes gh-523
2022-11-04 07:24:34 +00:00
rstoyanchev
ea8fed8800 Merge branch '1.0.x' 2022-10-17 17:44:19 +01:00
rstoyanchev
560c2b53f2 Polishing contribution
Closes gh-507
2022-10-17 16:58:56 +01:00
Koen Punt
da21f7438c Print actual elements in GraphQlTester
See gh-507
2022-10-17 16:32:42 +01:00
rstoyanchev
f680892dfc Switch to io.micrometer:context-propagation library
See gh-459
2022-08-31 21:29:11 +01:00
Brian Clozel
e522beaf5f Upgrade baseline to Java 17 and Jakarata EE 9
Closes gh-426
2022-06-24 15:07:42 +02:00
Brian Clozel
29dcded549 Polish
See gh-371
2022-05-17 09:01:58 +02:00
rstoyanchev
ed8c27923f Fix cyclic dependencies and polishing 2022-05-16 11:58:36 +01:00
Brian Clozel
c2c6ae6547 Expose map of "extensions" in GraphQlRequest
This commit adds support for protocol, vendor specific protocol
extensions in the GraphQL client requests.

Closes gh-371
2022-05-16 11:32:32 +02:00
rstoyanchev
b07e4fdd64 Avoid using JSONPath#getPath()
It does not return the original path and omits expressions.

Closes gh-377
2022-05-13 02:24:04 +01:00
rstoyanchev
8549060d19 Add start and stop for RSocket client and tester
Closes gh-378
2022-05-06 11:17:53 +01:00
Brian Clozel
85ad5bbfb4 Rever to "application/json" as default MIME type
As of #108, the `"application/graphql+json"` media type is supported and
has been made the default.

It seems that it is not ready for adoption now; so while we'll keep
supporting it, this commit reverts back to `"application/json"` as the
default media type for servers and clients.

Closes gh-375
2022-05-04 11:14:10 +02:00
rstoyanchev
218b16e022 JSON config in ExecutionGraphQlServiceTester builder
See gh-345
2022-04-12 15:15:07 +01:00
Brian Clozel
e455ebb3d8 Support application/graphql+json content type
The GraphQL HTTP spec now requires the `"application/graphql+json"`
content type.
This commit applies this type by default in the server and client
implementations. `"application/json"` is still accepted and produced if
requested by clients.

Closes gh-108
2022-04-04 13:34:18 +02:00
rstoyanchev
696f2cd02f Refine documentSource locations
Closes gh-338
2022-04-01 21:39:42 +01:00
rstoyanchev
9289f0a1b5 Add MockExecutionGraphQlService in testFixtures 2022-04-01 06:23:39 +01:00
rstoyanchev
b3f13b978a Refactoring in Client and Tester builder implementations
The default transport-specific client and tester extensions contained
their builder implementations, but it makes more sense the other way
around since the extensions are mainly about the builders they provide.
2022-03-29 14:47:35 +01:00
rstoyanchev
d41ced23c4 Add RSocketGraphQlTester
See gh-339
2022-03-29 11:49:54 +01:00
rstoyanchev
eb9a369f00 Rename ~.web package to ~.server
Now that RSocket is included, it's more obvious it's not just web.

See gh-339
2022-03-28 09:07:47 +01:00
rstoyanchev
6584b88301 Shorten names of [Web|RSocket]GraphQlHandlerInterceptor
See gh-339
2022-03-28 09:07:11 +01:00
rstoyanchev
83001522f6 Refactoring in DefaultGraphQlTester
Align with similar changes in GraphQlClient.
2022-03-21 15:04:53 +00:00
rstoyanchev
4d50ecd6f1 Revise JSON path options in GraphQlTester
Closes gh-278
2022-03-21 11:34:04 +00:00
rstoyanchev
3d638918f4 Polishing
Closes gh-327
2022-03-21 10:05:28 +00:00
Koen Punt
4e63970175 Fix implementation of containsExactly
See gh-327
2022-03-21 10:05:28 +00:00
rstoyanchev
dfff40085c Rename [Web|Socket]Interceptor
Use more qualified names [Web|Socket]GraphQlHandlerInterceptor to
differentiate with ClientGraphQlInterceptor and to align with other
types in the same package.
2022-03-21 09:04:52 +00:00
rstoyanchev
92547de5d0 Add client side interception
Closes gh-332
2022-03-21 04:25:54 +00:00
rstoyanchev
bb4ebf6cb8 Correct names of AbstractDirectTransport and subclasses
See gh-332
2022-03-21 04:24:26 +00:00
rstoyanchev
91e7f285fa Shorten GraphQlResponse[Field|Error] and rename GraphQlService
Rename GraphQlService to ExecutionGraphQlService following the renaming
of the request and response to ExecutionGraphQl[Request|Response].

See gh-332
2022-03-21 04:23:59 +00:00