Last active
October 1, 2020 20:27
-
-
Save robertoduessmann/e4d7c81bb4de001c044365c144a364d8 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
| public class ContainersSetupIT { | |
| public static PostgreSQLContainer postgres = new PostgreSQLContainer("postgres:12.2") | |
| .withDatabaseName("financial"); | |
| public static KafkaContainer kafka = new KafkaContainer(); | |
| public static class Initializer implements | |
| ApplicationContextInitializer<ConfigurableApplicationContext> { | |
| @Override | |
| public void initialize(ConfigurableApplicationContext context) { | |
| postgres.start(); | |
| kafka.start(); | |
| System.setProperty("DB_URL", postgres.getContainerIpAddress()); | |
| System.setProperty("DB_PORT", | |
| postgres.getMappedPort(PostgreSQLContainer.POSTGRESQL_PORT).toString()); | |
| System.setProperty("DB_USERNAME", postgres.getUsername()); | |
| System.setProperty("DB_PASSWORD", postgres.getPassword()); | |
| System.setProperty("KAFKA_BOOTSTRAP_SERVERS", kafka.getBootstrapServers()); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment