This commit applies the `java-test-fixtures` to the project modules and
starts moving common infrastructure to the testFixtures configuration.
See gh-217
This commit is a follow up of 2e4158c and makes the following changes:
* the id is now a mandatory attribute for `WebInput` and `RequestInput`
* a consistent IdGenerator strategy is configured for all requests
Closes gh-183
Prior to this commit, the `WebInput` would hold an `id` attribute that
correlate the request and response messages on a multiplexed connection.
This commit moves this concept directly to the `RequestInput` so that it
can be used as an `ExecutionId` for all types of transports, if
availble.
This id was already set on the `WebInput` in the WebFlux case with the
id coming from the exchange, but it also creates an id and set it for
the MVC case. This id is then propagated to GraphQL's `ExecutionInput`.
See gh-183
After the introduction of the `@GraphQlTest` annotation, this commit
adds further refinements to the testing infrastructure.
Now, `@GraphQlTest` is completely independent of any web framework and
contributes a `GraphQlTester` component.
`@SpringBootTest` integration tests with mock servers only require an
`@AutoConfigureWebGraphQlTest` to get a `WebGraphQlTester` component.
Closes gh-75
Prior to this commit, we could only test Spring GraphQL applications
with a complete application - all application and infrastructure
components were involved. While using `@SpringBootTest` is often useful
for complete integration tests (with or without a live running server),
we often want to write lean integration tests and test slices of our
application.
Just like `@WebMvcTest` or `@WebFluxTest`, this commit introduces the
support for `@GraphQlTest`. This annotation helps us to test a
particular slice of our application: a hand-picked selection of
`@Controller`, plus `RuntimeWiringConfigurer` and `WebInterceptor`
beans.
Other `@Component` must be imported or mocked for those tests.
This commit also refactors the existing auto-configuration to enable
this use case. The `WebGraphQlHandlerAutoConfiguration` now holds the
required components for `@GraphQlTest`, while other web-related
auto-configurations bring the web framework and transport
infrastructures.
Closes gh-75
Also separate RequestStrategy from WebRequestStrategy since those are
delegated to internally and never used as a hierarchy. The generics
required to make them extend from each other bring no benefit.
This commit applies the Compiler Conventions Gradle plugin to the
project modules and fix the issues raised by the compiler linter.
This commit also moves version management to the main build file for a
few dependencies, aligning the versions in the process.
It doesn't cause any issues but noticed from logging output that when
WebTestClient is used, we are serializing all of it, rather than just
the RequestInput properties.
The errorType field on GraphQLError is specific to GraphQL Java and when
serialized via GraphqlErrorHelper#toSpecification it becomes an
extension with the key "classification".
This commit ensures that we correctly deserialize back to errorType from
the "classification" extension but unfortunately that's limited to the
ErrorClassification enums that we know of.
This commit refactors the project build to better share dependency
management definitions between modules.
This also upgrades the project to Spring Boot 2.5.0.
Closes gh-45
Following revisions in the spec
https://github.com/graphql/graphql-spec/pull/777, this commit applies
similar changes to type and method names where feasible.
The chief exception for now is the use of "query" for request input
since that is what it is called in the JSON for GraphQL over HTTP.