@@ -2,6 +2,7 @@ package graphql.servlet
22
33import com.fasterxml.jackson.databind.ObjectMapper
44import graphql.Scalars
5+ import graphql.analysis.QueryVisitorInlineFragmentEnvironment
56import graphql.execution.ExecutionTypeInfo
67import graphql.execution.instrumentation.ChainedInstrumentation
78import graphql.execution.instrumentation.Instrumentation
@@ -44,7 +45,7 @@ class AbstractGraphQLHttpServletSpec extends Specification {
4445
4546 def createServlet (DataFetcher queryDataFetcher = { env -> env. arguments. arg },
4647 DataFetcher mutationDataFetcher = { env -> env. arguments. arg }) {
47- return SimpleGraphQLHttpServlet . newBuilder(createGraphQlSchema(queryDataFetcher, mutationDataFetcher))
48+ return SimpleGraphQLHttpServlet . newBuilder(createGraphQlSchema(queryDataFetcher, mutationDataFetcher)). build()
4849 }
4950
5051 def createGraphQlSchema (DataFetcher queryDataFetcher = { env -> env. arguments. arg },
@@ -866,13 +867,13 @@ class AbstractGraphQLHttpServletSpec extends Specification {
866867
867868 setup :
868869 Instrumentation expectedInstrumentation = Mock ()
869- GraphQLContext context = new GraphQLContext (Optional . of( request), Optional . of(response) )
870- SimpleGraphQLServlet simpleGraphQLServlet = SimpleGraphQLServlet
871- .builder (createGraphQlSchema())
872- .withInstrumentation(expectedInstrumentation)
873- .build();
870+ GraphQLContext context = new GraphQLContext (request, null , null )
871+ SimpleGraphQLHttpServlet simpleGraphQLServlet = SimpleGraphQLHttpServlet
872+ .newBuilder (createGraphQlSchema())
873+ .withQueryInvoker( GraphQLQueryInvoker . newBuilder() . withInstrumentation(expectedInstrumentation) . build() )
874+ .build()
874875 when :
875- Instrumentation actualInstrumentation = simpleGraphQLServlet. getInstrumentation(context)
876+ Instrumentation actualInstrumentation = simpleGraphQLServlet. getQueryInvoker() . getInstrumentation(context)
876877 then :
877878 actualInstrumentation == expectedInstrumentation;
878879 ! (actualInstrumentation instanceof ChainedInstrumentation )
@@ -883,15 +884,15 @@ class AbstractGraphQLHttpServletSpec extends Specification {
883884
884885 setup :
885886 Instrumentation servletInstrumentation = Mock ()
886- GraphQLContext context = new GraphQLContext (Optional . of( request), Optional . of(response) )
887+ GraphQLContext context = new GraphQLContext (request, null , null )
887888 DataLoaderRegistry dlr = Mock ()
888- context. setDataLoaderRegistry(Optional . of( dlr) )
889- SimpleGraphQLServlet simpleGraphQLServlet = SimpleGraphQLServlet
890- .builder (createGraphQlSchema())
891- .withInstrumentation(servletInstrumentation)
889+ context. setDataLoaderRegistry(dlr)
890+ SimpleGraphQLHttpServlet simpleGraphQLServlet = SimpleGraphQLHttpServlet
891+ .newBuilder (createGraphQlSchema())
892+ .withQueryInvoker( GraphQLQueryInvoker . newBuilder() . withInstrumentation(servletInstrumentation) . build() )
892893 .build();
893894 when :
894- Instrumentation actualInstrumentation = simpleGraphQLServlet. getInstrumentation(context)
895+ Instrumentation actualInstrumentation = simpleGraphQLServlet. getQueryInvoker() . getInstrumentation(context)
895896 then :
896897 actualInstrumentation instanceof ChainedInstrumentation
897898 actualInstrumentation != servletInstrumentation
0 commit comments