import org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration;
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import static de.juplo.kafka.chat.backend.persistence.kafka.KafkaChatHomeTest.TOPIC;
-@PropertySource({
+@SpringBootTest(
+ classes = {
+ KafkaServicesConfiguration.class,
+ KafkaAutoConfiguration.class,
+ TaskExecutionAutoConfiguration.class,
+ },
+ properties = {
"chat.backend.services=kafka",
"chat.backend.kafka.client-id-PREFIX=TEST",
"chat.backend.kafka.bootstrap-servers=${spring.embedded.kafka.brokers}",
"chat.backend.kafka.chatroom-channel-topic=" + TOPIC,
"chat.backend.kafka.num-partitions=" + NUM_SHARDS,
})
+@EnableConfigurationProperties(ChatBackendProperties.class)
@EmbeddedKafka(topics = { TOPIC }, partitions = 10)
@Slf4j
public class KafkaChatHomeTest extends ChatHomeWithShardsTestBase
static CompletableFuture<Void> CONSUMER_JOB;
- @TestConfiguration
- @Import({
- KafkaServicesConfiguration.class,
- KafkaAutoConfiguration.class,
- TaskExecutionAutoConfiguration.class,
- })
- @EnableConfigurationProperties(ChatBackendProperties.class)
- static class Configuration
- {
- }
@BeforeAll
public static void sendAndLoadStoredData(
@Autowired KafkaTemplate<String, String> messageTemplate,