Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spring-server] update to use Spring Boot RC1 #421

Merged
merged 1 commit into from
Oct 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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