|
37 | 37 | import org.junit.jupiter.api.BeforeAll;
|
38 | 38 | import org.junit.jupiter.api.BeforeEach;
|
39 | 39 | import org.junit.jupiter.api.Test;
|
| 40 | +import org.junit.jupiter.api.TestInfo; |
40 | 41 | import org.reactivestreams.Publisher;
|
41 | 42 | import org.reactivestreams.Subscription;
|
42 | 43 |
|
@@ -102,17 +103,18 @@ public static void setUpBeforeClass() {
|
102 | 103 | }
|
103 | 104 |
|
104 | 105 | @BeforeEach
|
105 |
| - public void setUp() { |
106 |
| - reactiveKafkaProducerTemplate = new ReactiveKafkaProducerTemplate<>(setupSenderOptionsWithDefaultTopic(), |
| 106 | + public void setUp(TestInfo info) { |
| 107 | + reactiveKafkaProducerTemplate = new ReactiveKafkaProducerTemplate<>(setupSenderOptionsWithDefaultTopic(info), |
107 | 108 | new MessagingMessageConverter());
|
108 | 109 | }
|
109 | 110 |
|
110 |
| - private SenderOptions<Integer, String> setupSenderOptionsWithDefaultTopic() { |
| 111 | + private SenderOptions<Integer, String> setupSenderOptionsWithDefaultTopic(TestInfo info) { |
111 | 112 | Map<String, Object> senderProps =
|
112 | 113 | KafkaTestUtils.producerProps(EmbeddedKafkaCondition.getBroker().getBrokersAsString());
|
113 | 114 | SenderOptions<Integer, String> senderOptions = SenderOptions.create(senderProps);
|
114 | 115 | senderOptions = senderOptions
|
115 |
| - .producerProperty(ProducerConfig.TRANSACTIONAL_ID_CONFIG, "reactive.transaction") |
| 116 | + .producerProperty(ProducerConfig.TRANSACTIONAL_ID_CONFIG, |
| 117 | + "reactive.transaction." + info.getDisplayName().replaceAll("\\(\\)", "")) |
116 | 118 | .producerProperty(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, true);
|
117 | 119 | return senderOptions;
|
118 | 120 | }
|
@@ -270,7 +272,9 @@ public void shouldSendOneRecordTransactionallyViaTemplateAsSenderRecordAndReceiv
|
270 | 272 | .abort()
|
271 | 273 | .then(Mono.error(error))))
|
272 | 274 | .expectErrorMatches(throwable -> throwable instanceof IllegalStateException &&
|
273 |
| - throwable.getMessage().equals("TransactionalId reactive.transaction: Invalid transition " + |
| 275 | + throwable.getMessage().equals("TransactionalId reactive.transaction." |
| 276 | + + "shouldSendOneRecordTransactionallyViaTemplateAsSenderRecord" |
| 277 | + + "AndReceiveItExactlyOnceWithException: Invalid transition " + |
274 | 278 | "attempted from state READY to state ABORTING_TRANSACTION"))
|
275 | 279 | .verify(DEFAULT_VERIFY_TIMEOUT);
|
276 | 280 |
|
|
0 commit comments