diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6672de2d6e7..c423ac8cb3c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -31,7 +31,7 @@ retrofit = "2.9.0" slf4j = "1.7.30" springboot2 = "2.7.18" springboot3 = "3.5.0" -springboot4 = "4.0.0-M3" +springboot4 = "4.0.0-RC1" # Android targetSdk = "34" compileSdk = "34" @@ -165,6 +165,7 @@ springboot3-starter-security = { module = "org.springframework.boot:spring-boot- springboot3-starter-jdbc = { module = "org.springframework.boot:spring-boot-starter-jdbc", version.ref = "springboot3" } springboot3-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator", version.ref = "springboot3" } springboot4-otel = { module = "io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter", version.ref = "otelInstrumentation" } +springboot4-resttestclient = { module = "org.springframework.boot:spring-boot-resttestclient", version.ref = "springboot4" } springboot4-starter = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springboot4" } springboot4-starter-graphql = { module = "org.springframework.boot:spring-boot-starter-graphql", version.ref = "springboot4" } springboot4-starter-quartz = { module = "org.springframework.boot:spring-boot-starter-quartz", version.ref = "springboot4" } diff --git a/sentry-spring-7/build.gradle.kts b/sentry-spring-7/build.gradle.kts index a8071860ad0..8102909afb0 100644 --- a/sentry-spring-7/build.gradle.kts +++ b/sentry-spring-7/build.gradle.kts @@ -75,6 +75,7 @@ dependencies { testImplementation(libs.springboot4.starter.webflux) testImplementation(libs.springboot4.starter.restclient) testImplementation(libs.springboot4.starter.webclient) + testImplementation(libs.springboot4.resttestclient) testImplementation(projects.sentryReactor) } diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt index c216b4595d2..1ed217037a2 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt @@ -40,8 +40,8 @@ class SentrySpringSubscriptionHandlerTest { whenever(parameters.environment).thenReturn(dataFetchingEnvironment) val resultObject = SentrySpringSubscriptionHandler() - .onSubscriptionResult(Flux.error(exception), scopes, exceptionReporter, parameters) - assertThrows { (resultObject as Flux).blockFirst() } + .onSubscriptionResult(Flux.error(exception), scopes, exceptionReporter, parameters) + assertThrows { (resultObject as Flux).blockFirst() } verify(exceptionReporter) .captureThrowable( @@ -77,12 +77,12 @@ class SentrySpringSubscriptionHandlerTest { val resultObject = SentrySpringSubscriptionHandler() .onSubscriptionResult( - Flux.error(wrappedException), + Flux.error(wrappedException), scopes, exceptionReporter, parameters, ) - assertThrows { (resultObject as Flux).blockFirst() } + assertThrows { (resultObject as Flux).blockFirst() } verify(exceptionReporter) .captureThrowable( diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/mvc/SentrySpringIntegrationTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/mvc/SentrySpringIntegrationTest.kt index 1127456cc6c..169ef346865 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/mvc/SentrySpringIntegrationTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/mvc/SentrySpringIntegrationTest.kt @@ -22,7 +22,6 @@ import io.sentry.spring7.tracing.SentryTracingConfiguration import io.sentry.spring7.tracing.SentryTracingFilter import io.sentry.spring7.tracing.SentryTransaction import io.sentry.transport.ITransport -import java.time.Duration import java.util.concurrent.Callable import java.util.concurrent.TimeUnit import kotlin.test.BeforeTest @@ -42,9 +41,9 @@ import org.mockito.kotlin.verify import org.mockito.kotlin.whenever import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.resttestclient.TestRestTemplate import org.springframework.boot.test.context.SpringBootTest -import org.springframework.boot.web.server.test.LocalServerPort -import org.springframework.boot.web.server.test.client.TestRestTemplate +import org.springframework.boot.test.web.server.LocalServerPort import org.springframework.boot.web.servlet.FilterRegistrationBean import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -80,13 +79,15 @@ import org.springframework.web.reactive.function.client.WebClient class SentrySpringIntegrationTest { companion object { + @JvmStatic @BeforeClass - fun `configure awaitlity`() { + fun `configure awaitlity`(): Unit { Awaitility.setDefaultTimeout(500, TimeUnit.MILLISECONDS) } + @JvmStatic @AfterClass - fun `reset awaitility`() { + fun `reset awaitility`(): Unit { Awaitility.reset() } } @@ -230,10 +231,8 @@ class SentrySpringIntegrationTest { restTemplate.getForEntity("http://localhost:$port/throws-handled", String::class.java) - await.during(Duration.ofSeconds(2)).untilAsserted { - verify(transport, never()) - .send(checkEvent { event -> assertThat(event).isNotNull() }, anyOrNull()) - } + verify(transport, never()) + .send(checkEvent { event -> assertThat(event).isNotNull() }, anyOrNull()) } @Test diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebfluxIntegrationTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebfluxIntegrationTest.kt index 2d44b40c27d..a91023b4ba0 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebfluxIntegrationTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebfluxIntegrationTest.kt @@ -27,10 +27,10 @@ import org.mockito.kotlin.whenever import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.ApplicationRunner import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.boot.security.autoconfigure.reactive.ReactiveSecurityAutoConfiguration -import org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration +import org.springframework.boot.security.autoconfigure.SecurityAutoConfiguration +import org.springframework.boot.security.autoconfigure.web.reactive.ReactiveWebSecurityAutoConfiguration import org.springframework.boot.test.context.SpringBootTest -import org.springframework.boot.web.server.test.LocalServerPort +import org.springframework.boot.test.web.server.LocalServerPort import org.springframework.context.annotation.Bean import org.springframework.http.ResponseEntity import org.springframework.test.context.junit4.SpringRunner @@ -136,7 +136,7 @@ class SentryWebfluxIntegrationTest { } @SpringBootApplication( - exclude = [ReactiveSecurityAutoConfiguration::class, SecurityAutoConfiguration::class] + exclude = [ReactiveWebSecurityAutoConfiguration::class, SecurityAutoConfiguration::class] ) open class App { private val transport = mock().also { whenever(it.isHealthy).thenReturn(true) } diff --git a/sentry-spring-boot-4/build.gradle.kts b/sentry-spring-boot-4/build.gradle.kts index 897d59c3c20..96f2f39adab 100644 --- a/sentry-spring-boot-4/build.gradle.kts +++ b/sentry-spring-boot-4/build.gradle.kts @@ -102,6 +102,7 @@ dependencies { testImplementation(libs.springboot4.starter.webflux) testImplementation(libs.springboot4.starter.restclient) testImplementation(libs.springboot4.starter.webclient) + testImplementation(libs.springboot4.resttestclient) } configure { test { java.srcDir("src/test/java") } } diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/it/SentrySpringIntegrationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/it/SentrySpringIntegrationTest.kt index 998dfaaf867..473b60def12 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/it/SentrySpringIntegrationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/it/SentrySpringIntegrationTest.kt @@ -24,9 +24,9 @@ import org.mockito.kotlin.whenever import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.resttestclient.TestRestTemplate import org.springframework.boot.test.context.SpringBootTest -import org.springframework.boot.web.server.test.LocalServerPort -import org.springframework.boot.web.server.test.client.TestRestTemplate +import org.springframework.boot.test.web.server.LocalServerPort import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.http.HttpEntity diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/mvc/SentrySpringIntegrationTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/mvc/SentrySpringIntegrationTest.kt index 6e2ea53fdfd..9630460cd98 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/mvc/SentrySpringIntegrationTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/mvc/SentrySpringIntegrationTest.kt @@ -22,7 +22,6 @@ import io.sentry.spring.jakarta.tracing.SentryTracingConfiguration import io.sentry.spring.jakarta.tracing.SentryTracingFilter import io.sentry.spring.jakarta.tracing.SentryTransaction import io.sentry.transport.ITransport -import java.time.Duration import java.util.concurrent.Callable import java.util.concurrent.TimeUnit import kotlin.test.BeforeTest @@ -230,10 +229,8 @@ class SentrySpringIntegrationTest { restTemplate.getForEntity("http://localhost:$port/throws-handled", String::class.java) - await.during(Duration.ofSeconds(2)).untilAsserted { - verify(transport, never()) - .send(checkEvent { event -> assertThat(event).isNotNull() }, anyOrNull()) - } + verify(transport, never()) + .send(checkEvent { event -> assertThat(event).isNotNull() }, anyOrNull()) } @Test diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/mvc/SentrySpringIntegrationTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/mvc/SentrySpringIntegrationTest.kt index d6c5fd2aa79..63d29dd78db 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/mvc/SentrySpringIntegrationTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/mvc/SentrySpringIntegrationTest.kt @@ -22,7 +22,6 @@ import io.sentry.spring.tracing.SentryTracingConfiguration import io.sentry.spring.tracing.SentryTracingFilter import io.sentry.spring.tracing.SentryTransaction import io.sentry.transport.ITransport -import java.time.Duration import java.util.concurrent.Callable import java.util.concurrent.TimeUnit import kotlin.test.BeforeTest @@ -231,10 +230,8 @@ class SentrySpringIntegrationTest { restTemplate.getForEntity("http://localhost:$port/throws-handled", String::class.java) - await.during(Duration.ofSeconds(2)).untilAsserted { - verify(transport, never()) - .send(checkEvent { event -> assertThat(event).isNotNull() }, anyOrNull()) - } + verify(transport, never()) + .send(checkEvent { event -> assertThat(event).isNotNull() }, anyOrNull()) } @Test