Created
November 11, 2021 17:09
-
-
Save schroedermatt/589c87e6d9766308b7fd046847ed1630 to your computer and use it in GitHub Desktop.
Dockerized Quarkus Test Resource
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
public class ContainerKafkaTestResource implements QuarkusTestResourceLifecycleManager { | |
private static final KafkaContainer kafka = new KafkaContainer(); | |
/** | |
* @return A map of system properties that should be set for the running tests | |
*/ | |
@Override | |
public Map<String, String> start() { | |
kafka.start(); | |
Map<String, String> systemProperties = new HashMap<>(); | |
systemProperties.put("kafka.bootstrap.servers", kafka.getBootstrapServers()); | |
systemProperties.put("quarkus.kafka-streams.bootstrap-servers", kafka.getBootstrapServers()); | |
return systemProperties; | |
} | |
@Override | |
public void stop() { | |
kafka.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment