Add service connection for Docker Compose and Testcontainers ActiveMQ

See gh-39363
This commit is contained in:
Eddú Meléndez
2024-01-31 12:35:13 -05:00
committed by Moritz Halbritter
parent f9363569ab
commit f3e7325064
14 changed files with 416 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ dependencies {
testImplementation("org.awaitility:awaitility")
testImplementation("org.testcontainers:junit-jupiter")
testImplementation("org.testcontainers:activemq")
testImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test"))
testImplementation(project(":spring-boot-project:spring-boot-testcontainers"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.testcontainers.activemq.ActiveMQContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
@@ -29,7 +30,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.system.CapturedOutput;
import org.springframework.boot.test.system.OutputCaptureExtension;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.boot.testsupport.testcontainers.ActiveMQContainer;
import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
import static org.assertj.core.api.Assertions.assertThat;
@@ -46,7 +47,7 @@ class SampleActiveMqTests {
@Container
@ServiceConnection
private static final ActiveMQContainer container = new ActiveMQContainer();
private static final ActiveMQContainer container = new ActiveMQContainer(DockerImageNames.activeMqClassic());
@Autowired
private Producer producer;