Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
Disable transactional events in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf Ueberfuhr committed Jun 28, 2024
1 parent f8498c9 commit 91879c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import de.sample.schulung.accounts.domain.events.CustomerReplacedEvent;
import de.sample.schulung.accounts.kafka.interceptor.KafkaProducer;
import de.sample.schulung.accounts.kafka.interceptor.KafkaRecord;
import de.sample.schulung.accounts.persistence.transactions.events.ConditionalOnTransactionsDisabled;
import lombok.RequiredArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
Expand All @@ -13,6 +14,7 @@

@Component
@RequiredArgsConstructor
@ConditionalOnTransactionsDisabled
public class CustomerEventsProducer {

private final CustomerEventRecordMapper mapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.test.context.TestPropertySource;

import java.lang.annotation.*;

Expand All @@ -21,6 +22,9 @@
@Target(ElementType.TYPE)
@EnableAutoConfiguration(exclude = KafkaAutoConfiguration.class)
@MockBean(KafkaTemplate.class)
@TestPropertySource(
properties = "application.persistence.enable-transactional-events=false"
)
public @interface AutoConfigureKafkaTemplateMock {

}

0 comments on commit 91879c6

Please sign in to comment.