File tree Expand file tree Collapse file tree 3 files changed +26
-8
lines changed
src/test/kotlin/io/sentry/spring/jakarta/kafka Expand file tree Collapse file tree 3 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -256,14 +256,6 @@ public final class io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostPro
256256 public fun postProcessAfterInitialization (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
257257}
258258
259- public final class io/sentry/spring/jakarta/kafka/SentryProducerInterceptor : org/apache/kafka/clients/producer/ProducerInterceptor {
260- public fun <init> (Lio/sentry/IScopes;)V
261- public fun close ()V
262- public fun configure (Ljava/util/Map;)V
263- public fun onAcknowledgement (Lorg/apache/kafka/clients/producer/RecordMetadata;Ljava/lang/Exception;)V
264- public fun onSend (Lorg/apache/kafka/clients/producer/ProducerRecord;)Lorg/apache/kafka/clients/producer/ProducerRecord;
265- }
266-
267259public final class io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptor : org/springframework/kafka/listener/RecordInterceptor {
268260 public fun <init> (Lio/sentry/IScopes;)V
269261 public fun <init> (Lio/sentry/IScopes;Lorg/springframework/kafka/listener/RecordInterceptor;)V
@@ -273,6 +265,14 @@ public final class io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptor :
273265 public fun success (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Lorg/apache/kafka/clients/consumer/Consumer;)V
274266}
275267
268+ public final class io/sentry/spring/jakarta/kafka/SentryProducerInterceptor : org/apache/kafka/clients/producer/ProducerInterceptor {
269+ public fun <init> (Lio/sentry/IScopes;)V
270+ public fun close ()V
271+ public fun configure (Ljava/util/Map;)V
272+ public fun onAcknowledgement (Lorg/apache/kafka/clients/producer/RecordMetadata;Ljava/lang/Exception;)V
273+ public fun onSend (Lorg/apache/kafka/clients/producer/ProducerRecord;)Lorg/apache/kafka/clients/producer/ProducerRecord;
274+ }
275+
276276public class io/sentry/spring/jakarta/opentelemetry/SentryOpenTelemetryAgentWithoutAutoInitConfiguration {
277277 public fun <init> ()V
278278 public fun sentryOpenTelemetryOptionsConfiguration ()Lio/sentry/Sentry$OptionsConfiguration;
Original file line number Diff line number Diff line change @@ -3,11 +3,14 @@ package io.sentry.spring.jakarta.kafka
33import io.sentry.BaggageHeader
44import io.sentry.IScopes
55import io.sentry.ISentryLifecycleToken
6+ import io.sentry.Sentry
67import io.sentry.SentryOptions
78import io.sentry.SentryTraceHeader
89import io.sentry.SentryTracer
910import io.sentry.TransactionContext
11+ import io.sentry.test.initForTest
1012import java.nio.charset.StandardCharsets
13+ import kotlin.test.AfterTest
1114import kotlin.test.BeforeTest
1215import kotlin.test.Test
1316import kotlin.test.assertEquals
@@ -30,6 +33,7 @@ class SentryKafkaRecordInterceptorTest {
3033
3134 @BeforeTest
3235 fun setup () {
36+ initForTest { it.dsn = " https://key@sentry.io/proj" }
3337 scopes = mock()
3438 consumer = mock()
3539 lifecycleToken = mock()
@@ -51,6 +55,11 @@ class SentryKafkaRecordInterceptorTest {
5155 whenever(forkedScopes.startTransaction(any<TransactionContext >(), any())).thenReturn(tx)
5256 }
5357
58+ @AfterTest
59+ fun teardown () {
60+ Sentry .close()
61+ }
62+
5463 private fun createRecord (
5564 topic : String = "my-topic",
5665 headers : RecordHeaders = RecordHeaders (),
Original file line number Diff line number Diff line change 11package io.sentry.spring.jakarta.kafka
22
33import io.sentry.IScopes
4+ import io.sentry.Sentry
45import io.sentry.SentryOptions
56import io.sentry.SentryTraceHeader
67import io.sentry.SentryTracer
78import io.sentry.TransactionContext
9+ import io.sentry.test.initForTest
810import java.nio.charset.StandardCharsets
11+ import kotlin.test.AfterTest
912import kotlin.test.BeforeTest
1013import kotlin.test.Test
1114import kotlin.test.assertEquals
@@ -25,6 +28,7 @@ class SentryProducerInterceptorTest {
2528
2629 @BeforeTest
2730 fun setup () {
31+ initForTest { it.dsn = " https://key@sentry.io/proj" }
2832 scopes = mock()
2933 options =
3034 SentryOptions ().apply {
@@ -34,6 +38,11 @@ class SentryProducerInterceptorTest {
3438 whenever(scopes.options).thenReturn(options)
3539 }
3640
41+ @AfterTest
42+ fun teardown () {
43+ Sentry .close()
44+ }
45+
3746 private fun createTransaction (): SentryTracer {
3847 val tx = SentryTracer (TransactionContext (" tx" , " op" ), scopes)
3948 whenever(scopes.span).thenReturn(tx)
You can’t perform that action at this time.
0 commit comments