diff --git a/kogito-quarkus-examples/dmn-drools-quarkus-metrics/src/test/java/org/kie/kogito/examples/quarkus/GrafanaDockerComposeIT.java b/kogito-quarkus-examples/dmn-drools-quarkus-metrics/src/test/java/org/kie/kogito/examples/quarkus/GrafanaDockerComposeIT.java index fc0a4a1f76..1146edb561 100644 --- a/kogito-quarkus-examples/dmn-drools-quarkus-metrics/src/test/java/org/kie/kogito/examples/quarkus/GrafanaDockerComposeIT.java +++ b/kogito-quarkus-examples/dmn-drools-quarkus-metrics/src/test/java/org/kie/kogito/examples/quarkus/GrafanaDockerComposeIT.java @@ -26,7 +26,7 @@ import org.kie.kogito.testcontainers.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testcontainers.containers.DockerComposeContainer; +import org.testcontainers.containers.ComposeContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -54,11 +54,11 @@ public class GrafanaDockerComposeIT { private static final String PROJECT_ARTIFACT_ID = ProjectMetadataProvider.getProjectArtifactId(); @Container - public static DockerComposeContainer environment; + public static ComposeContainer environment; static { try { - environment = new DockerComposeContainer(new File(GrafanaDockerComposeIT.class.getClassLoader().getResource("./docker-compose.yml").toURI())) + environment = new ComposeContainer(new File(GrafanaDockerComposeIT.class.getClassLoader().getResource("./docker-compose.yml").toURI())) .withExposedService("grafana_1", GRAFANA_PORT, Wait.forListeningPort().withStartupTimeout(STARTUP_MINUTES_TIMEOUT)) .withLogConsumer("grafana_1", new Slf4jLogConsumer(LOGGER)) .withExposedService("hello_1", KOGITO_APPLICATION_PORT, Wait.forListeningPort().withStartupTimeout(STARTUP_MINUTES_TIMEOUT)) @@ -69,9 +69,7 @@ public class GrafanaDockerComposeIT { .withStartupTimeout(STARTUP_MINUTES_TIMEOUT)) .withLogConsumer("prometheus_1", new Slf4jLogConsumer(LOGGER)) .withPull(false) - .withLocalCompose(true) - //See https://github.com/testcontainers/testcontainers-java/issues/4565 - .withOptions("--compatibility"); + .withLocalCompose(true); } catch (URISyntaxException e) { throw new RuntimeException(e); } diff --git a/kogito-quarkus-examples/process-outbox-mongodb-quarkus/src/test/java/org/kie/kogito/quarkus/outbox/OutboxIT.java b/kogito-quarkus-examples/process-outbox-mongodb-quarkus/src/test/java/org/kie/kogito/quarkus/outbox/OutboxIT.java index 5832a8f472..958497ee3d 100644 --- a/kogito-quarkus-examples/process-outbox-mongodb-quarkus/src/test/java/org/kie/kogito/quarkus/outbox/OutboxIT.java +++ b/kogito-quarkus-examples/process-outbox-mongodb-quarkus/src/test/java/org/kie/kogito/quarkus/outbox/OutboxIT.java @@ -29,7 +29,7 @@ import org.kie.kogito.test.quarkus.kafka.KafkaTestClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testcontainers.containers.DockerComposeContainer; +import org.testcontainers.containers.ComposeContainer; import org.testcontainers.containers.output.OutputFrame; import org.testcontainers.containers.output.Slf4jLogConsumer; @@ -56,7 +56,7 @@ public class OutboxIT { private static final int DEBEZIUM_PORT = 8083; //@Container - private static DockerComposeContainer COMPOSE; + private static ComposeContainer COMPOSE; private int kogitoPort; private int debeziumPort; @@ -69,7 +69,7 @@ public class OutboxIT { // if (!path.toFile().exists()) { // path = Paths.get("docker-compose.yml"); // } - // COMPOSE = new DockerComposeContainer(path.toFile()); + // COMPOSE = new ComposeContainer(path.toFile()); // COMPOSE.withPull(false); // COMPOSE.withServices("kafka", "mongodb", "connect", "sidecar", "kogito"); // COMPOSE.withExposedService("kogito", KOGITO_PORT); diff --git a/kogito-springboot-examples/dmn-drools-springboot-metrics/src/test/java/org/kie/kogito/examples/springboot/GrafanaDockerComposeIT.java b/kogito-springboot-examples/dmn-drools-springboot-metrics/src/test/java/org/kie/kogito/examples/springboot/GrafanaDockerComposeIT.java index 871de1ab3d..efa2d71db2 100644 --- a/kogito-springboot-examples/dmn-drools-springboot-metrics/src/test/java/org/kie/kogito/examples/springboot/GrafanaDockerComposeIT.java +++ b/kogito-springboot-examples/dmn-drools-springboot-metrics/src/test/java/org/kie/kogito/examples/springboot/GrafanaDockerComposeIT.java @@ -26,7 +26,7 @@ import org.kie.kogito.testcontainers.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testcontainers.containers.DockerComposeContainer; +import org.testcontainers.containers.ComposeContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -54,11 +54,11 @@ public class GrafanaDockerComposeIT { private static final String PROJECT_ARTIFACT_ID = ProjectMetadataProvider.getProjectArtifactId(); @Container - public static DockerComposeContainer environment; + public static ComposeContainer environment; static { try { - environment = new DockerComposeContainer(new File(GrafanaDockerComposeIT.class.getClassLoader().getResource("./docker-compose.yml").toURI())) + environment = new ComposeContainer(new File(GrafanaDockerComposeIT.class.getClassLoader().getResource("./docker-compose.yml").toURI())) .withExposedService("grafana_1", GRAFANA_PORT, Wait.forListeningPort().withStartupTimeout(STARTUP_MINUTES_TIMEOUT)) .withLogConsumer("grafana_1", new Slf4jLogConsumer(LOGGER)) .withExposedService("hello_1", KOGITO_APPLICATION_PORT, Wait.forListeningPort().withStartupTimeout(STARTUP_MINUTES_TIMEOUT)) @@ -69,9 +69,7 @@ public class GrafanaDockerComposeIT { .withStartupTimeout(STARTUP_MINUTES_TIMEOUT)) .withLogConsumer("prometheus_1", new Slf4jLogConsumer(LOGGER)) .withPull(false) - .withLocalCompose(true) - //See https://github.com/testcontainers/testcontainers-java/issues/4565 - .withOptions("--compatibility"); + .withLocalCompose(true); } catch (URISyntaxException e) { throw new RuntimeException(e); } diff --git a/kogito-springboot-examples/process-outbox-mongodb-springboot/src/test/java/org/kie/kogito/springboot/outbox/OutboxIT.java b/kogito-springboot-examples/process-outbox-mongodb-springboot/src/test/java/org/kie/kogito/springboot/outbox/OutboxIT.java index 1379657c3d..5925f258b2 100644 --- a/kogito-springboot-examples/process-outbox-mongodb-springboot/src/test/java/org/kie/kogito/springboot/outbox/OutboxIT.java +++ b/kogito-springboot-examples/process-outbox-mongodb-springboot/src/test/java/org/kie/kogito/springboot/outbox/OutboxIT.java @@ -18,20 +18,27 @@ */ package org.kie.kogito.springboot.outbox; +import java.nio.file.Path; +import java.nio.file.Paths; import java.time.Duration; import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.kie.kogito.test.springboot.kafka.KafkaTestClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testcontainers.containers.DockerComposeContainer; +import org.testcontainers.containers.ComposeContainer; import org.testcontainers.containers.output.OutputFrame; import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.containers.wait.strategy.Wait; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; import com.jayway.jsonpath.JsonPath; @@ -42,7 +49,7 @@ import static org.hamcrest.Matchers.hasSize; import static org.junit.jupiter.api.Assertions.assertTrue; -//@Testcontainers +@Testcontainers public class OutboxIT { private static final Logger LOGGER = LoggerFactory.getLogger(OutboxIT.class); @@ -55,8 +62,8 @@ public class OutboxIT { private static final int KAFKA_PORT = 9092; private static final int DEBEZIUM_PORT = 8083; - //@Container - private static DockerComposeContainer COMPOSE; + @Container + private static ComposeContainer COMPOSE; private int kogitoPort; private int debeziumPort; @@ -65,33 +72,31 @@ public class OutboxIT { private KafkaTestClient kafkaClient; static { - // Path path = Paths.get("../../docker-compose.yml"); - // if (!path.toFile().exists()) { - // path = Paths.get("docker-compose.yml"); - // } - // COMPOSE = new DockerComposeContainer<>(path.toFile()); - // COMPOSE.withPull(false); - // COMPOSE.withServices("kafka", "mongodb", "connect", "sidecar", "kogito"); - // COMPOSE.withExposedService("kogito", KOGITO_PORT); - // COMPOSE.withExposedService("kafka", KAFKA_PORT); - // COMPOSE.withExposedService("connect", DEBEZIUM_PORT); - // COMPOSE.withLogConsumer("kafka", logger()); - // COMPOSE.withLogConsumer("connect", logger()); - // COMPOSE.withLogConsumer("sidecar", logger()); - // COMPOSE.withLogConsumer("kogito", logger()); - // COMPOSE.waitingFor("kafka", Wait.forListeningPort()); - // COMPOSE.waitingFor("sidecar", Wait.forListeningPort()); - // COMPOSE.waitingFor("kogito", Wait.forListeningPort()); - // COMPOSE.withLocalCompose(true); - // //See https://github.com/testcontainers/testcontainers-java/issues/4565 - // COMPOSE.withOptions("--compatibility"); + Path path = Paths.get("../../docker-compose.yml"); + if (!path.toFile().exists()) { + path = Paths.get("docker-compose.yml"); + } + COMPOSE = new ComposeContainer(path.toFile()); + COMPOSE.withPull(false); + COMPOSE.withServices("kafka", "mongodb", "connect", "sidecar", "kogito"); + COMPOSE.withExposedService("kogito", KOGITO_PORT); + COMPOSE.withExposedService("kafka", KAFKA_PORT); + COMPOSE.withExposedService("connect", DEBEZIUM_PORT); + COMPOSE.withLogConsumer("kafka", logger()); + COMPOSE.withLogConsumer("connect", logger()); + COMPOSE.withLogConsumer("sidecar", logger()); + COMPOSE.withLogConsumer("kogito", logger()); + COMPOSE.waitingFor("kafka", Wait.forListeningPort()); + COMPOSE.waitingFor("sidecar", Wait.forListeningPort()); + COMPOSE.waitingFor("kogito", Wait.forListeningPort()); + COMPOSE.withLocalCompose(true); } private static Consumer logger() { return new Slf4jLogConsumer(LOGGER); } - // @BeforeEach + @BeforeEach void setup() { kogitoPort = COMPOSE.getServicePort("kogito", KOGITO_PORT); debeziumPort = COMPOSE.getServicePort("connect", DEBEZIUM_PORT); @@ -99,7 +104,7 @@ void setup() { kafkaClient = new KafkaTestClient("localhost:" + kafkaPort); } - // @AfterEach + @AfterEach void close() { if (kafkaClient != null) { kafkaClient.shutdown();