diff --git a/build.gradle b/build.gradle index 798ea0b64..573bfa2f8 100644 --- a/build.gradle +++ b/build.gradle @@ -111,7 +111,7 @@ allprojects { useJUnitPlatform() testLogging { - // showStandardStreams = true + showStandardStreams = true events "skipped", "failed" exceptionFormat = 'full' diff --git a/springwolf-examples/springwolf-amqp-example/src/test/java/io/github/springwolf/examples/amqp/ProducerSystemTest.java b/springwolf-examples/springwolf-amqp-example/src/test/java/io/github/springwolf/examples/amqp/ProducerSystemTest.java index 38554f727..dce74e9f5 100644 --- a/springwolf-examples/springwolf-amqp-example/src/test/java/io/github/springwolf/examples/amqp/ProducerSystemTest.java +++ b/springwolf-examples/springwolf-amqp-example/src/test/java/io/github/springwolf/examples/amqp/ProducerSystemTest.java @@ -4,6 +4,7 @@ import io.github.springwolf.examples.amqp.consumers.ExampleConsumer; import io.github.springwolf.examples.amqp.dtos.ExamplePayloadDto; import io.github.springwolf.plugins.amqp.producer.SpringwolfAmqpProducer; +import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -42,8 +43,10 @@ @DirtiesContext @TestMethodOrder(OrderAnnotation.class) @TestPropertySource(properties = {"spring.rabbitmq.host=localhost"}) +@Slf4j // @Ignore("Uncomment this line if you have issues running this test on your local machine.") public class ProducerSystemTest { + private static final String AMQP_NAME = "amqp"; @Autowired SpringwolfAmqpProducer springwolfAmqpProducer; @@ -52,8 +55,9 @@ public class ProducerSystemTest { ExampleConsumer exampleConsumer; @Container - public static DockerComposeContainer environment = - new DockerComposeContainer<>(new File("docker-compose.yml")).withServices("amqp"); + public static DockerComposeContainer environment = new DockerComposeContainer<>(new File("docker-compose.yml")) + .withServices(AMQP_NAME) + .withLogConsumer(AMQP_NAME, l -> log.debug("amqp: {}", l.getUtf8StringWithoutLineEnding())); @Test @Order(1) diff --git a/springwolf-examples/springwolf-jms-example/src/test/java/io/github/springwolf/examples/jms/ProducerSystemTest.java b/springwolf-examples/springwolf-jms-example/src/test/java/io/github/springwolf/examples/jms/ProducerSystemTest.java index 82d15ea93..06bc6118b 100644 --- a/springwolf-examples/springwolf-jms-example/src/test/java/io/github/springwolf/examples/jms/ProducerSystemTest.java +++ b/springwolf-examples/springwolf-jms-example/src/test/java/io/github/springwolf/examples/jms/ProducerSystemTest.java @@ -4,6 +4,7 @@ import io.github.springwolf.examples.jms.consumers.ExampleConsumer; import io.github.springwolf.examples.jms.dtos.ExamplePayloadDto; import io.github.springwolf.plugins.jms.producer.SpringwolfJmsProducer; +import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -34,8 +35,10 @@ @Testcontainers @DirtiesContext @TestMethodOrder(OrderAnnotation.class) +@Slf4j // @Ignore("Uncomment this line if you have issues running this test on your local machine.") public class ProducerSystemTest { + private static final String APP_JMS = "activemq"; @Autowired SpringwolfJmsProducer springwolfJmsProducer; @@ -45,8 +48,9 @@ public class ProducerSystemTest { @Container public static DockerComposeContainer environment = new DockerComposeContainer<>(new File("docker-compose.yml")) - .withServices("activemq") - .waitingFor("activemq", Wait.forLogMessage(".*Artemis Console available.*", 1)); + .withServices(APP_JMS) + .withLogConsumer(APP_JMS, l -> log.debug("jms: {}", l.getUtf8StringWithoutLineEnding())) + .waitingFor(APP_JMS, Wait.forLogMessage(".*Artemis Console available.*", 1)); @Test @Order(2) diff --git a/springwolf-examples/springwolf-kafka-example/src/test/java/io/github/springwolf/examples/kafka/ProducerSystemTest.java b/springwolf-examples/springwolf-kafka-example/src/test/java/io/github/springwolf/examples/kafka/ProducerSystemTest.java index 717da8efc..8be3d56cc 100644 --- a/springwolf-examples/springwolf-kafka-example/src/test/java/io/github/springwolf/examples/kafka/ProducerSystemTest.java +++ b/springwolf-examples/springwolf-kafka-example/src/test/java/io/github/springwolf/examples/kafka/ProducerSystemTest.java @@ -11,6 +11,7 @@ import io.github.springwolf.examples.kafka.dtos.ExamplePayloadDto; import io.github.springwolf.plugins.kafka.configuration.properties.SpringwolfKafkaConfigProperties; import io.github.springwolf.plugins.kafka.producer.SpringwolfKafkaProducer; +import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.admin.AdminClient; import org.apache.kafka.clients.admin.KafkaAdminClient; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @@ -48,8 +49,11 @@ @Testcontainers @TestPropertySource(properties = {"spring.kafka.bootstrap-servers=localhost:9092"}) @TestMethodOrder(OrderAnnotation.class) +@Slf4j // @Ignore("Uncomment this line if you have issues running this test on your local machine.") public class ProducerSystemTest { + private static final String KAFKA_NAME = "kafka"; + private static final boolean USE_SCHEMA_REGISTRY = false; @Autowired @@ -69,7 +73,8 @@ public class ProducerSystemTest { @Container public static DockerComposeContainer environment = new DockerComposeContainer<>(new File("docker-compose.yml")) - .withServices("kafka", USE_SCHEMA_REGISTRY ? "kafka-schema-registry" : ""); + .withServices(KAFKA_NAME, USE_SCHEMA_REGISTRY ? "kafka-schema-registry" : "") + .withLogConsumer(KAFKA_NAME, l -> log.debug("kafka: {}", l.getUtf8StringWithoutLineEnding())); @Test @Order(1) diff --git a/springwolf-examples/springwolf-sns-example/src/test/java/io/github/springwolf/examples/sns/ApiSystemTest.java b/springwolf-examples/springwolf-sns-example/src/test/java/io/github/springwolf/examples/sns/ApiSystemTest.java index 94ba93faa..415ce0ea0 100644 --- a/springwolf-examples/springwolf-sns-example/src/test/java/io/github/springwolf/examples/sns/ApiSystemTest.java +++ b/springwolf-examples/springwolf-sns-example/src/test/java/io/github/springwolf/examples/sns/ApiSystemTest.java @@ -45,7 +45,7 @@ public class ApiSystemTest { } @Container - public DockerComposeContainer environment = new DockerComposeContainer<>(new File("docker-compose.yml")) + public static DockerComposeContainer environment = new DockerComposeContainer<>(new File("docker-compose.yml")) .withExposedService(APP_NAME, APP_PORT) .withEnv(ENV) .withLogConsumer(APP_NAME, l -> log.debug("APP: {}", l.getUtf8StringWithoutLineEnding())); diff --git a/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/ApiSystemTest.java b/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/ApiSystemTest.java index 4435bab85..e6f6130de 100644 --- a/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/ApiSystemTest.java +++ b/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/ApiSystemTest.java @@ -45,7 +45,7 @@ public class ApiSystemTest { } @Container - public DockerComposeContainer environment = new DockerComposeContainer<>(new File("docker-compose.yml")) + public static DockerComposeContainer environment = new DockerComposeContainer<>(new File("docker-compose.yml")) .withExposedService(APP_NAME, APP_PORT) .withEnv(ENV) .withLogConsumer(APP_NAME, l -> log.debug("APP: {}", l.getUtf8StringWithoutLineEnding())); diff --git a/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/ProducerSystemTest.java b/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/ProducerSystemTest.java index 40c6b76d2..11d0702ec 100644 --- a/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/ProducerSystemTest.java +++ b/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/ProducerSystemTest.java @@ -39,6 +39,7 @@ @Slf4j // @Ignore("Uncomment this line if you have issues running this test on your local machine.") public class ProducerSystemTest { + private static final String LOCALSTACK_NAME = "localstack"; @Autowired SpringwolfSqsProducer springwolfSqsProducer; @@ -60,10 +61,10 @@ public class ProducerSystemTest { @Container public static DockerComposeContainer environment = new DockerComposeContainer<>(new File("docker-compose.yml")) - .withOptions() .withEnv(ENV) - .withLogConsumer("localstack", l -> log.debug("localstack: {}", l.getUtf8StringWithoutLineEnding())) - .waitingFor("localstack", Wait.forLogMessage(".*Ready.*", 1)); + .withServices(LOCALSTACK_NAME) + .withLogConsumer(LOCALSTACK_NAME, l -> log.debug("localstack: {}", l.getUtf8StringWithoutLineEnding())) + .waitingFor(LOCALSTACK_NAME, Wait.forLogMessage(".*Ready.*", 1)); @Test void producerCanUseSpringwolfConfigurationToSendMessage() { diff --git a/springwolf-examples/springwolf-stomp-example/src/test/java/io/github/springwolf/examples/stomp/stomp/ApiSystemTest.java b/springwolf-examples/springwolf-stomp-example/src/test/java/io/github/springwolf/examples/stomp/stomp/ApiSystemTest.java index 9275b47b6..4b01a5fce 100644 --- a/springwolf-examples/springwolf-stomp-example/src/test/java/io/github/springwolf/examples/stomp/stomp/ApiSystemTest.java +++ b/springwolf-examples/springwolf-stomp-example/src/test/java/io/github/springwolf/examples/stomp/stomp/ApiSystemTest.java @@ -43,7 +43,7 @@ public class ApiSystemTest { } @Container - public DockerComposeContainer environment = new DockerComposeContainer<>(new File("docker-compose.yml")) + public static DockerComposeContainer environment = new DockerComposeContainer<>(new File("docker-compose.yml")) .withExposedService(APP_NAME, APP_PORT) .withEnv(ENV) .withLogConsumer(APP_NAME, l -> log.debug("APP: {}", l.getUtf8StringWithoutLineEnding()));