Skip to content

Commit

Permalink
[spring-server] update to use Spring Boot RC1 (ExpediaGroup#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
dariuszkuc committed Oct 4, 2019
1 parent 6bea5f9 commit 32867be
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion graphql-kotlin-spring-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<packaging>jar</packaging>

<properties>
<spring-boot.version>2.2.0.M6</spring-boot.version>
<spring-boot.version>2.2.0.RC1</spring-boot.version>
<reactor.version>3.3.0.RELEASE</reactor.version>
<reactor-kotlin-extensions.version>1.0.0.RELEASE</reactor-kotlin-extensions.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import org.springframework.context.annotation.Configuration
import org.springframework.core.io.Resource
import org.springframework.web.reactive.function.server.RouterFunction
import org.springframework.web.reactive.function.server.ServerResponse
import org.springframework.web.reactive.function.server.bodyValueAndAwait
import org.springframework.web.reactive.function.server.coRouter
import org.springframework.web.reactive.function.server.html
import org.springframework.web.reactive.function.server.bodyAndAwait

/**
* SpringBoot auto configuration for generating Playground Service.
Expand All @@ -48,7 +48,7 @@ class PlaygroundAutoConfiguration(
}
return coRouter {
GET(config.playground.endpoint) {
ok().html().bodyAndAwait(body)
ok().html().bodyValueAndAwait(body)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.springframework.http.HttpMethod
import org.springframework.http.MediaType
import org.springframework.web.reactive.function.server.ServerRequest
import org.springframework.web.reactive.function.server.awaitBody
import org.springframework.web.reactive.function.server.bodyAndAwait
import org.springframework.web.reactive.function.server.bodyValueAndAwait
import org.springframework.web.reactive.function.server.buildAndAwait
import org.springframework.web.reactive.function.server.coRouter
import org.springframework.web.reactive.function.server.json
Expand All @@ -55,13 +55,13 @@ class RoutesConfiguration(
val graphQLRequest = createGraphQLRequest(serverRequest)
if (graphQLRequest != null) {
val graphQLResult = queryHandler.executeQuery(graphQLRequest)
ok().json().bodyAndAwait(graphQLResult)
ok().json().bodyValueAndAwait(graphQLResult)
} else {
badRequest().buildAndAwait()
}
}
GET("/sdl") {
ok().contentType(MediaType.TEXT_PLAIN).bodyAndAwait(schema.print())
ok().contentType(MediaType.TEXT_PLAIN).bodyValueAndAwait(schema.print())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import com.expediagroup.graphql.spring.model.SubscriptionOperationMessage.Server
import com.expediagroup.graphql.spring.model.SubscriptionOperationMessage.ServerMessages.GQL_ERROR
import com.fasterxml.jackson.module.kotlin.convertValue
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
Expand All @@ -46,7 +45,7 @@ import kotlin.test.assertTrue

class ApolloSubscriptionProtocolHandlerTest {

private val objectMapper = jacksonObjectMapper().registerKotlinModule()
private val objectMapper = jacksonObjectMapper()

@Test
fun `Return GQL_CONNECTION_ERROR when payload is not a SubscriptionOperationMessage`() {
Expand Down Expand Up @@ -296,10 +295,9 @@ class ApolloSubscriptionProtocolHandlerTest {
assertNotNull(message)
assertEquals(expected = GQL_ERROR.type, actual = message.type)
assertEquals(expected = "abc", actual = message.id)
val payload = message.payload
assertNotNull(payload)
val graphQLResponse: GraphQLResponse = objectMapper.convertValue(payload)
assertTrue(graphQLResponse.errors?.isNotEmpty() == true)
val response = message.payload as? GraphQLResponse
assertNotNull(response)
assertTrue(response.errors?.isNotEmpty() == true)

verify(exactly = 0) { session.close() }
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

<!-- Dependency Versions -->
<graphql-java.version>13.0</graphql-java.version>
<jackson-module-kotlin.version>2.9.10</jackson-module-kotlin.version>
<jackson-module-kotlin.version>2.10.0</jackson-module-kotlin.version>
<kotlin.version>1.3.50</kotlin.version>
<kotlin-coroutines.version>1.3.2</kotlin-coroutines.version>
<reflections.version>0.9.11</reflections.version>
Expand Down

0 comments on commit 32867be

Please sign in to comment.