Created
December 22, 2023 14:56
-
-
Save mihaita-tinta/397b52c26d5c67e9959cd15e325486e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mih.playground; | |
import org.springframework.boot.test.context.TestConfiguration; | |
import org.springframework.boot.testcontainers.service.connection.ServiceConnection; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Import; | |
import org.testcontainers.containers.CassandraContainer; | |
import org.testcontainers.containers.KafkaContainer; | |
import org.testcontainers.utility.DockerImageName; | |
@TestConfiguration | |
public class Infrastructure { | |
@Bean | |
@ServiceConnection | |
CassandraContainer<?> cassandraContainer() { | |
return (CassandraContainer) new CassandraContainer(DockerImageName.parse("cassandra:latest")) | |
.withInitScript("schema.cql") | |
.withExposedPorts(9042) | |
.withReuse(true); | |
} | |
@Bean | |
@ServiceConnection | |
KafkaContainer kafkaContainer() { | |
return new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:latest")) | |
.withReuse(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment