diff --git a/springwolf-examples/springwolf-sns-example/build.gradle b/springwolf-examples/springwolf-sns-example/build.gradle index ae18a7295..6a09a4f84 100644 --- a/springwolf-examples/springwolf-sns-example/build.gradle +++ b/springwolf-examples/springwolf-sns-example/build.gradle @@ -10,7 +10,7 @@ plugins { dependencyManagement { imports { - mavenBom "io.awspring.cloud:spring-cloud-aws-dependencies:3.1.0" + mavenBom "io.awspring.cloud:spring-cloud-aws-dependencies:3.1.1" } } diff --git a/springwolf-examples/springwolf-sqs-example/build.gradle b/springwolf-examples/springwolf-sqs-example/build.gradle index 25c7e50b8..3cf07786b 100644 --- a/springwolf-examples/springwolf-sqs-example/build.gradle +++ b/springwolf-examples/springwolf-sqs-example/build.gradle @@ -10,7 +10,7 @@ plugins { dependencyManagement { imports { - mavenBom "io.awspring.cloud:spring-cloud-aws-dependencies:3.1.0" + mavenBom "io.awspring.cloud:spring-cloud-aws-dependencies:3.1.1" } } diff --git a/springwolf-examples/springwolf-sqs-example/docker-compose.yml b/springwolf-examples/springwolf-sqs-example/docker-compose.yml index 81224db07..94e8770fe 100644 --- a/springwolf-examples/springwolf-sqs-example/docker-compose.yml +++ b/springwolf-examples/springwolf-sqs-example/docker-compose.yml @@ -12,7 +12,7 @@ services: - localstack localstack: - image: localstack/localstack:2.2.0 + image: localstack/localstack:3.3.0 environment: - DEBUG=${DEBUG-} - AWS_REGION=eu-central-1 @@ -21,10 +21,10 @@ services: - "4566:4566" # LocalStack Gateway # - "4510-4559:4510-4559" # external services port range volumes: - - "${TMPDIR:-/tmp/localstack}:/tmp/localstack" + - "${TMPDIR:-/tmp/localstack}:/var/lib/localstack" - "/var/run/docker.sock:/var/run/docker.sock" localstack_setup: - image: localstack/localstack:2.2.0 + image: localstack/localstack:3.3.0 links: - localstack depends_on: @@ -33,4 +33,4 @@ services: entrypoint: [ "bash", "-c", " awslocal --endpoint-url=http://localstack:4566 sqs create-queue --queue-name another-queue --region eu-central-1; awslocal --endpoint-url=http://localstack:4566 sqs create-queue --queue-name example-queue --region eu-central-1; - " ] \ No newline at end of file + " ] 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 76f8cd0f5..40c6b76d2 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 @@ -4,19 +4,24 @@ import io.github.springwolf.examples.sqs.consumers.ExampleConsumer; import io.github.springwolf.examples.sqs.dtos.ExamplePayloadDto; import io.github.springwolf.plugins.sqs.producer.SpringwolfSqsProducer; -import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; -import org.junit.jupiter.api.Order; +import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestMethodOrder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.test.annotation.DirtiesContext; import org.testcontainers.containers.DockerComposeContainer; +import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; import static io.github.springwolf.examples.sqs.dtos.ExamplePayloadDto.ExampleEnum.FOO1; import static org.mockito.Mockito.timeout; @@ -31,7 +36,7 @@ webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @Testcontainers @DirtiesContext -@TestMethodOrder(OrderAnnotation.class) +@Slf4j // @Ignore("Uncomment this line if you have issues running this test on your local machine.") public class ProducerSystemTest { @@ -41,12 +46,26 @@ public class ProducerSystemTest { @SpyBean ExampleConsumer exampleConsumer; + private static final Map ENV = new HashMap<>(); + + static { + try (InputStream input = new FileInputStream(".env")) { + var properties = new Properties(); + properties.load(input); + properties.forEach((key, value) -> ENV.put(String.valueOf(key), String.valueOf(value))); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + @Container - public static DockerComposeContainer environment = - new DockerComposeContainer<>(new File("docker-compose.yml")).withServices("localstack"); + 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)); @Test - @Order(2) void producerCanUseSpringwolfConfigurationToSendMessage() { // given ExamplePayloadDto payload = new ExamplePayloadDto(); diff --git a/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/SqsTestContainerExtension.java b/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/SqsTestContainerExtension.java index b0bfd79d4..a3df1427e 100644 --- a/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/SqsTestContainerExtension.java +++ b/springwolf-examples/springwolf-sqs-example/src/test/java/io/github/springwolf/examples/sqs/SqsTestContainerExtension.java @@ -21,7 +21,7 @@ public class SqsTestContainerExtension implements BeforeAllCallback, ExtensionCo private static volatile boolean started = false; static LocalStackContainer localStack = - new LocalStackContainer(DockerImageName.parse("localstack/localstack:2.2.0")).withServices(SQS); + new LocalStackContainer(DockerImageName.parse("localstack/localstack:3.3.0")).withServices(SQS); @Override public void beforeAll(ExtensionContext extensionContext) throws Exception { diff --git a/springwolf-plugins/springwolf-sns-plugin/build.gradle b/springwolf-plugins/springwolf-sns-plugin/build.gradle index b04185a4e..331b6c31a 100644 --- a/springwolf-plugins/springwolf-sns-plugin/build.gradle +++ b/springwolf-plugins/springwolf-sns-plugin/build.gradle @@ -8,7 +8,7 @@ plugins { dependencyManagement { imports { - mavenBom "io.awspring.cloud:spring-cloud-aws-dependencies:3.1.0" + mavenBom "io.awspring.cloud:spring-cloud-aws-dependencies:3.1.1" } } diff --git a/springwolf-plugins/springwolf-sqs-plugin/build.gradle b/springwolf-plugins/springwolf-sqs-plugin/build.gradle index e918a01db..526a5482a 100644 --- a/springwolf-plugins/springwolf-sqs-plugin/build.gradle +++ b/springwolf-plugins/springwolf-sqs-plugin/build.gradle @@ -8,7 +8,7 @@ plugins { dependencyManagement { imports { - mavenBom "io.awspring.cloud:spring-cloud-aws-dependencies:3.1.0" + mavenBom "io.awspring.cloud:spring-cloud-aws-dependencies:3.1.1" } }