Prior to this commit, we could only test Spring GraphQL applications with a complete application - all application and infrastructure components were involved. While using `@SpringBootTest` is often useful for complete integration tests (with or without a live running server), we often want to write lean integration tests and test slices of our application. Just like `@WebMvcTest` or `@WebFluxTest`, this commit introduces the support for `@GraphQlTest`. This annotation helps us to test a particular slice of our application: a hand-picked selection of `@Controller`, plus `RuntimeWiringConfigurer` and `WebInterceptor` beans. Other `@Component` must be imported or mocked for those tests. This commit also refactors the existing auto-configuration to enable this use case. The `WebGraphQlHandlerAutoConfiguration` now holds the required components for `@GraphQlTest`, while other web-related auto-configurations bring the web framework and transport infrastructures. Closes gh-75
82 lines
2.9 KiB
Groovy
82 lines
2.9 KiB
Groovy
import org.springframework.boot.gradle.plugin.SpringBootPlugin
|
|
|
|
plugins {
|
|
id 'org.springframework.boot' version "${bootVersion}" apply false
|
|
id 'java-library'
|
|
id 'org.springframework.graphql.compiler'
|
|
}
|
|
|
|
group = 'org.springframework.experimental'
|
|
description = "GraphQL Spring Boot Starter"
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
dependencyManagement {
|
|
imports {
|
|
mavenBom SpringBootPlugin.BOM_COORDINATES
|
|
}
|
|
generatedPomCustomization {
|
|
enabled = false
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
api project(':spring-graphql')
|
|
api "com.graphql-java:graphql-java:${graphQlJavaVersion}"
|
|
api 'io.projectreactor:reactor-core'
|
|
api 'org.springframework:spring-context'
|
|
api 'org.springframework.boot:spring-boot-starter'
|
|
|
|
compileOnly 'org.springframework:spring-webflux'
|
|
compileOnly 'org.springframework:spring-webmvc'
|
|
compileOnly 'org.springframework:spring-websocket'
|
|
compileOnly 'javax.servlet:javax.servlet-api'
|
|
compileOnly 'javax.websocket:javax.websocket-api'
|
|
|
|
compileOnly 'io.micrometer:micrometer-core'
|
|
compileOnly 'org.springframework.boot:spring-boot-actuator-autoconfigure'
|
|
|
|
compileOnly 'org.springframework.security:spring-security-config'
|
|
compileOnly 'org.springframework.security:spring-security-web'
|
|
|
|
compileOnly 'com.querydsl:querydsl-core'
|
|
compileOnly 'org.springframework.data:spring-data-commons'
|
|
|
|
compileOnly project(':spring-graphql-test')
|
|
compileOnly 'org.junit.jupiter:junit-jupiter-api'
|
|
compileOnly 'org.springframework.boot:spring-boot-test'
|
|
compileOnly 'org.springframework.boot:spring-boot-test-autoconfigure'
|
|
|
|
compileOnly 'com.google.code.findbugs:jsr305'
|
|
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
|
|
annotationProcessor 'org.springframework.boot:spring-boot-autoconfigure-processor'
|
|
|
|
testImplementation project(':spring-graphql-test')
|
|
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
|
|
testImplementation 'org.springframework:spring-webflux'
|
|
testImplementation 'org.springframework:spring-webmvc'
|
|
testImplementation 'org.springframework:spring-websocket'
|
|
testImplementation 'io.projectreactor:reactor-test'
|
|
testImplementation 'io.projectreactor.netty:reactor-netty'
|
|
testImplementation 'javax.servlet:javax.servlet-api'
|
|
testImplementation 'org.apache.tomcat.embed:tomcat-embed-core'
|
|
testImplementation 'org.apache.tomcat.embed:tomcat-embed-websocket'
|
|
testImplementation 'org.springframework.boot:spring-boot-actuator-autoconfigure'
|
|
testImplementation 'io.micrometer:micrometer-core'
|
|
testImplementation 'org.springframework.security:spring-security-config'
|
|
testImplementation 'org.springframework.security:spring-security-web'
|
|
testImplementation 'org.springframework.security:spring-security-test'
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
testLogging {
|
|
events "passed", "skipped", "failed"
|
|
}
|
|
}
|
|
|
|
apply from: "${rootDir}/gradle/publishing.gradle" |