@@ -3,7 +3,9 @@ package graphql.servlet
33import com.fasterxml.jackson.databind.ObjectMapper
44import graphql.Scalars
55import graphql.execution.ExecutionStepInfo
6+ import graphql.execution.MergedField
67import graphql.execution.reactive.SingleSubscriberPublisher
8+ import graphql.language.Field
79import graphql.schema.GraphQLNonNull
810import graphql.servlet.input.GraphQLInvocationInputFactory
911import org.springframework.mock.web.MockHttpServletRequest
@@ -112,7 +114,6 @@ class AbstractGraphQLHttpServletSpec extends Specification {
112114 getResponseContent(). data. echo == " test"
113115 }
114116
115- @Ignore
116117 def " async query over HTTP GET starts async request" () {
117118 setup :
118119 servlet = TestUtils . createDefaultServlet({ env -> env. arguments. arg },{ env -> env. arguments. arg }, { env ->
@@ -284,7 +285,6 @@ class AbstractGraphQLHttpServletSpec extends Specification {
284285 getBatchedResponseContent()[1 ]. data. echo == " test"
285286 }
286287
287- @Ignore
288288 def " deferred query over HTTP GET" () {
289289 setup :
290290 request. addParameter(' query' , ' query { echo(arg:"test") @defer }' )
@@ -369,7 +369,6 @@ class AbstractGraphQLHttpServletSpec extends Specification {
369369 getBatchedResponseContent()[1 ]. errors. size() == 1
370370 }
371371
372- @Ignore
373372 def " subscription query over HTTP GET with variables as string returns data" () {
374373 setup :
375374 request. addParameter(' query' , ' subscription Subscription($arg: String!) { echo(arg: $arg) }' )
@@ -1051,11 +1050,11 @@ class AbstractGraphQLHttpServletSpec extends Specification {
10511050 getBatchedResponseContent()[1 ]. data. echo == " test"
10521051 }
10531052
1054- @Ignore
10551053 def " subscription query over HTTP POST with variables as string returns data" () {
10561054 setup :
10571055 request. setContent(' {"query": "subscription Subscription($arg: String!) { echo(arg: $arg) }", "operationName": "Subscription", "variables": {"arg": "test"}}' . bytes)
10581056 request. setAsyncSupported(true )
1057+ request. setMethod(" POST" )
10591058
10601059 when :
10611060 servlet. doPost(request, response)
@@ -1070,11 +1069,11 @@ class AbstractGraphQLHttpServletSpec extends Specification {
10701069 getSubscriptionResponseContent()[1 ]. data. echo == " Second\n\n test"
10711070 }
10721071
1073- @Ignore
10741072 def " defer query over HTTP POST" () {
10751073 setup :
10761074 request. setContent(' {"query": "subscription Subscription($arg: String!) { echo(arg: $arg) }", "operationName": "Subscription", "variables": {"arg": "test"}}' . bytes)
10771075 request. setAsyncSupported(true )
1076+ request. setMethod(" POST" )
10781077
10791078 when :
10801079 servlet. doPost(request, response)
@@ -1089,7 +1088,6 @@ class AbstractGraphQLHttpServletSpec extends Specification {
10891088 getSubscriptionResponseContent()[1 ]. data. echo == " Second\n\n test"
10901089 }
10911090
1092- @Ignore
10931091 def " deferred query that takes longer than initial results, should still be sent second" () {
10941092 setup :
10951093 servlet = TestUtils . createDefaultServlet({ env ->
@@ -1109,6 +1107,7 @@ class AbstractGraphQLHttpServletSpec extends Specification {
11091107 '''
11101108 ]))
11111109 request. setAsyncSupported(true )
1110+ request. setMethod(" POST" )
11121111
11131112 when :
11141113 servlet. doPost(request, response)
@@ -1230,33 +1229,13 @@ class AbstractGraphQLHttpServletSpec extends Specification {
12301229 resp[1 ]. errors != null
12311230 }
12321231
1233- @Ignore
12341232 def " typeInfo is serialized correctly" () {
1235- expect :
1236- servlet. getConfiguration(). getObjectMapper(). getJacksonMapper(). writeValueAsString(ExecutionStepInfo . newExecutionStepInfo(). type(new GraphQLNonNull (Scalars.GraphQLString )). build()) != " {}"
1237- }
1238-
1239- @Ignore
1240- def " isBatchedQuery check uses buffer length as read limit" () {
12411233 setup :
1242- HttpServletRequest mockRequest = Mock ()
1243- ServletInputStream mockInputStream = Mock ()
1244-
1245- mockInputStream. markSupported() >> true
1246- mockRequest. getInputStream() >> mockInputStream
1247- mockRequest. getMethod() >> " POST"
1248- mockRequest. getParts() >> Collections . emptyList()
1249-
1250- when :
1251- servlet. doPost(mockRequest, response)
1252-
1253- then :
1254- 1 * mockInputStream. mark(128 )
1255-
1256- then :
1257- 1 * mockInputStream. read({ it. length == 128 }) >> -1
1234+ MergedField field = MergedField . newMergedField(). addField(new Field (" test" )). build()
1235+ ExecutionStepInfo stepInfo = ExecutionStepInfo . newExecutionStepInfo(). field(field). type(new GraphQLNonNull (Scalars.GraphQLString )). build()
12581236
1259- then :
1260- 1 * mockInputStream . reset()
1237+ expect :
1238+ servlet . getConfiguration() . getObjectMapper() . getJacksonMapper() . writeValueAsString(stepInfo) != " {} "
12611239 }
1240+
12621241}
0 commit comments