mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-05-04 05:17:15 +01:00
a82659c837
Prior to this commit, there was no way to specify the ObservationRegistry that is registered in the given test's ApplicationContext as the one that should be used by Micrometer's ObservationThreadLocalAccessor for context propagation. This commit introduces a TestExecutionListener for Micrometer's ObservationRegistry in the Spring TestContext Framework. Specifically, this listener obtains the ObservationRegistry registered in the test's ApplicationContext, stores it in ObservationThreadLocalAccessor for the duration of each test method execution, and restores the original ObservationRegistry in ObservationThreadLocalAccessor after each test. Co-authored-by: Sam Brannen <sam@sambrannen.com> See gh-30658
114 lines
4.9 KiB
Groovy
114 lines
4.9 KiB
Groovy
description = "Spring TestContext Framework"
|
|
|
|
apply plugin: "kotlin"
|
|
|
|
dependencies {
|
|
api(project(":spring-core"))
|
|
optional(project(":spring-aop"))
|
|
optional(project(":spring-beans"))
|
|
optional(project(":spring-context"))
|
|
optional(project(":spring-jdbc"))
|
|
optional(project(":spring-orm"))
|
|
optional(project(":spring-tx"))
|
|
optional(project(":spring-web"))
|
|
optional(project(":spring-webflux"))
|
|
optional(project(":spring-webmvc"))
|
|
optional(project(":spring-websocket"))
|
|
optional('info.picocli:picocli')
|
|
optional("jakarta.activation:jakarta.activation-api")
|
|
optional("jakarta.el:jakarta.el-api")
|
|
optional("jakarta.inject:jakarta.inject-api")
|
|
optional("jakarta.servlet:jakarta.servlet-api")
|
|
optional("jakarta.servlet.jsp:jakarta.servlet.jsp-api")
|
|
optional("jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api")
|
|
optional("jakarta.xml.bind:jakarta.xml.bind-api")
|
|
optional("jakarta.websocket:jakarta.websocket-api")
|
|
optional("jakarta.websocket:jakarta.websocket-client-api")
|
|
optional("junit:junit")
|
|
optional("org.apache.tomcat.embed:tomcat-embed-core")
|
|
optional("org.junit.platform:junit-platform-launcher") // for AOT processing
|
|
optional("org.junit.jupiter:junit-jupiter-api")
|
|
optional("org.testng:testng")
|
|
optional("org.aspectj:aspectjweaver")
|
|
optional("org.apache.groovy:groovy")
|
|
optional("org.hamcrest:hamcrest")
|
|
optional("net.sourceforge.htmlunit:htmlunit") {
|
|
exclude group: "commons-logging", module: "commons-logging"
|
|
}
|
|
optional("org.seleniumhq.selenium:htmlunit-driver") {
|
|
exclude group: "commons-logging", module: "commons-logging"
|
|
exclude group: "net.bytebuddy", module: "byte-buddy"
|
|
}
|
|
optional("org.seleniumhq.selenium:selenium-java") {
|
|
exclude group: "net.bytebuddy", module: "byte-buddy"
|
|
}
|
|
optional("org.xmlunit:xmlunit-matchers")
|
|
optional("org.skyscreamer:jsonassert")
|
|
optional("com.jayway.jsonpath:json-path")
|
|
optional("org.jetbrains.kotlin:kotlin-reflect")
|
|
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
|
optional("io.projectreactor:reactor-test")
|
|
optional("org.jetbrains.kotlinx:kotlinx-coroutines-core")
|
|
optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
|
|
optional('io.micrometer:context-propagation')
|
|
optional('io.micrometer:micrometer-observation')
|
|
testImplementation(project(":spring-core-test"))
|
|
testImplementation(project(":spring-context-support"))
|
|
testImplementation(project(":spring-oxm"))
|
|
testImplementation(testFixtures(project(":spring-beans")))
|
|
testImplementation(testFixtures(project(":spring-context")))
|
|
testImplementation(testFixtures(project(":spring-core")))
|
|
testImplementation(testFixtures(project(":spring-tx")))
|
|
testImplementation(testFixtures(project(":spring-web")))
|
|
testImplementation("jakarta.annotation:jakarta.annotation-api")
|
|
testImplementation("javax.cache:cache-api")
|
|
testImplementation("jakarta.ejb:jakarta.ejb-api")
|
|
testImplementation("jakarta.interceptor:jakarta.interceptor-api")
|
|
testImplementation("jakarta.mail:jakarta.mail-api")
|
|
testImplementation("org.hibernate:hibernate-core-jakarta")
|
|
testImplementation("org.hibernate:hibernate-validator")
|
|
testImplementation("jakarta.validation:jakarta.validation-api")
|
|
testImplementation("org.junit.platform:junit-platform-testkit")
|
|
testImplementation("com.fasterxml.jackson.core:jackson-databind")
|
|
testImplementation("com.thoughtworks.xstream:xstream")
|
|
testImplementation("com.rometools:rome")
|
|
testImplementation("org.hsqldb:hsqldb")
|
|
testImplementation("org.apache.httpcomponents:httpclient") {
|
|
exclude group: "commons-logging", module: "commons-logging"
|
|
}
|
|
testImplementation("io.projectreactor.netty:reactor-netty-http")
|
|
testImplementation("de.bechte.junit:junit-hierarchicalcontextrunner")
|
|
testRuntimeOnly("org.junit.vintage:junit-vintage-engine") {
|
|
exclude group: "junit", module: "junit"
|
|
}
|
|
testRuntimeOnly("org.junit.support:testng-engine")
|
|
testRuntimeOnly("org.glassfish:jakarta.el")
|
|
testRuntimeOnly("com.sun.xml.bind:jaxb-core")
|
|
testRuntimeOnly("com.sun.xml.bind:jaxb-impl")
|
|
}
|
|
|
|
// Prevent xml-apis from being used so that the corresponding XML APIs from
|
|
// the JDK's `java.xml` module are used instead. This allows spring-test to
|
|
// build in Eclipse IDE which fails to compile if there is a split package
|
|
// between a JDK system module and the unnamed module (for JARs on the
|
|
// classpath).
|
|
configurations.optional {
|
|
exclude group: "xml-apis", module: "xml-apis"
|
|
}
|
|
|
|
test {
|
|
description = "Runs JUnit 4, JUnit Jupiter, and TestNG tests."
|
|
useJUnitPlatform {
|
|
includeEngines "junit-vintage", "junit-jupiter", "testng"
|
|
excludeTags "failing-test-case"
|
|
}
|
|
// We use `include` instead of `filter.includeTestsMatching`, since
|
|
// the latter results in some tests being executed/reported
|
|
// multiple times.
|
|
include(["**/*Tests.class", "**/*Test.class"])
|
|
filter.excludeTestsMatching("*TestCase")
|
|
systemProperty("testGroups", project.properties.get("testGroups"))
|
|
// Java Util Logging for the JUnit Platform.
|
|
// systemProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager")
|
|
}
|