|
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 |
|
@@ -104,17 +105,18 @@ public static void setUpBeforeClass() {
|
104 | 105 | }
|
105 | 106 |
|
106 | 107 | @BeforeEach
|
107 |
| - public void setUp() { |
108 |
| - reactiveKafkaProducerTemplate = new ReactiveKafkaProducerTemplate<>(setupSenderOptionsWithDefaultTopic(), |
| 108 | + public void setUp(TestInfo info) { |
| 109 | + reactiveKafkaProducerTemplate = new ReactiveKafkaProducerTemplate<>(setupSenderOptionsWithDefaultTopic(info), |
109 | 110 | new MessagingMessageConverter());
|
110 | 111 | }
|
111 | 112 |
|
112 |
| - private SenderOptions<Integer, String> setupSenderOptionsWithDefaultTopic() { |
| 113 | + private SenderOptions<Integer, String> setupSenderOptionsWithDefaultTopic(TestInfo info) { |
113 | 114 | Map<String, Object> senderProps =
|
114 | 115 | KafkaTestUtils.producerProps(EmbeddedKafkaCondition.getBroker().getBrokersAsString());
|
115 | 116 | SenderOptions<Integer, String> senderOptions = SenderOptions.create(senderProps);
|
116 | 117 | senderOptions = senderOptions
|
117 |
| - .producerProperty(ProducerConfig.TRANSACTIONAL_ID_CONFIG, "reactive.transaction") |
| 118 | + .producerProperty(ProducerConfig.TRANSACTIONAL_ID_CONFIG, |
| 119 | + "reactive.transaction." + info.getDisplayName().replaceAll("\\(\\)", "")) |
118 | 120 | .producerProperty(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, true);
|
119 | 121 | return senderOptions;
|
120 | 122 | }
|
@@ -279,7 +281,9 @@ public void shouldSendOneRecordTransactionallyViaTemplateAsSenderRecordAndReceiv
|
279 | 281 | .abort()
|
280 | 282 | .then(Mono.error(error))))
|
281 | 283 | .expectErrorMatches(throwable -> throwable instanceof IllegalStateException &&
|
282 |
| - throwable.getMessage().equals("TransactionalId reactive.transaction: Invalid transition " + |
| 284 | + throwable.getMessage().equals("TransactionalId reactive.transaction." |
| 285 | + + "shouldSendOneRecordTransactionallyViaTemplateAsSenderRecord" |
| 286 | + + "AndReceiveItExactlyOnceWithException: Invalid transition " + |
283 | 287 | "attempted from state READY to state ABORTING_TRANSACTION"))
|
284 | 288 | .verify(DEFAULT_VERIFY_TIMEOUT);
|
285 | 289 |
|
|
0 commit comments