eclipse / microprofile-graphql

microprofile-graphql
Apache License 2.0
100 stars 40 forks source link

Need CDI scoped tests #242

Open andymc12 opened 4 years ago

andymc12 commented 4 years ago

The spec and javadoc indicate that CDI should manage the lifecycle of GraphQL beans.

When testing a new version of SmallRye on Open Liberty, I mistakenly left out the CDI support and the TCK still passed. But Open Liberty functional tests failed indicating that @PostConstruct methods were not being executed in my @ApplicationScoped and @RequestScoped GraphQL beans (POJOs annotated with @GraphQLApi. This means that the implementation was simply loading the GraphQL class, instantiating it and executing the queries/mutations - it wasn't actually managed by CDI.

I think we should add some TCK tests that ensure that CDI lifecycle methods like @PostConstruct, @PreDestroy (if possible), etc. are invoked correctly.

phillip-kruger commented 4 years ago

Yea SmallRye has a default of basic reflection, so you need to use SmallRye-implentation-cdi.

I agree we need some tests for this