Merge branch '3.5.x' into 4.0.x

Closes gh-49869
This commit is contained in:
Moritz Halbritter
2026-04-02 11:12:20 +02:00
8 changed files with 87 additions and 8 deletions
@@ -87,7 +87,7 @@ The following service connections are currently supported:
| Containers named "symptoma/activemq", "apache/activemq-classic" or "apache/activemq"
| javadoc:org.springframework.boot.artemis.autoconfigure.ArtemisConnectionDetails[]
| Containers named "apache/activemq-artemis"
| Containers named "apache/activemq-artemis" or "apache/artemis"
| javadoc:org.springframework.boot.cassandra.autoconfigure.CassandraConnectionDetails[]
| Containers named "cassandra"
@@ -27,9 +27,18 @@ import static org.assertj.core.api.Assertions.assertThat;
* Integration tests for {@link ArtemisDockerComposeConnectionDetailsFactory}.
*
* @author Eddú Meléndez
* @author Moritz Halbritter
*/
class ArtemisDockerComposeConnectionDetailsFactoryIntegrationTests {
@DockerComposeTest(composeFile = "artemis-compose.yaml", image = TestImage.ARTEMIS_LEGACY)
void runCreatesConnectionDetailsWithLegacyImage(ArtemisConnectionDetails connectionDetails) {
assertThat(connectionDetails.getMode()).isEqualTo(ArtemisMode.NATIVE);
assertThat(connectionDetails.getBrokerUrl()).isNotNull().startsWith("tcp://");
assertThat(connectionDetails.getUser()).isEqualTo("root");
assertThat(connectionDetails.getPassword()).isEqualTo("secret");
}
@DockerComposeTest(composeFile = "artemis-compose.yaml", image = TestImage.ARTEMIS)
void runCreatesConnectionDetails(ArtemisConnectionDetails connectionDetails) {
assertThat(connectionDetails.getMode()).isEqualTo(ArtemisMode.NATIVE);
@@ -22,7 +22,6 @@ import java.util.List;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.testcontainers.activemq.ArtemisContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
@@ -31,6 +30,7 @@ import org.springframework.boot.artemis.autoconfigure.ArtemisAutoConfiguration;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.jms.autoconfigure.JmsAutoConfiguration;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.boot.testsupport.container.ArtemisLegacyContainer;
import org.springframework.boot.testsupport.container.TestImage;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -51,7 +51,7 @@ class ArtemisContainerConnectionDetailsFactoryIntegrationTests {
@Container
@ServiceConnection
static final ArtemisContainer artemis = TestImage.container(ArtemisContainer.class);
static final ArtemisLegacyContainer artemis = TestImage.container(ArtemisLegacyContainer.class);
@Autowired
private JmsClient jmsClient;
@@ -37,7 +37,7 @@ class ArtemisDockerComposeConnectionDetailsFactory
private static final int ACTIVEMQ_PORT = 61616;
protected ArtemisDockerComposeConnectionDetailsFactory() {
super("apache/activemq-artemis");
super(new String[] { "apache/activemq-artemis", "apache/artemis" });
}
@Override
@@ -21,7 +21,6 @@ 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.ArtemisContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
@@ -30,6 +29,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.container.ArtemisLegacyContainer;
import org.springframework.boot.testsupport.container.TestImage;
import static org.assertj.core.api.Assertions.assertThat;
@@ -47,7 +47,7 @@ class SampleArtemisTests {
@Container
@ServiceConnection
private static final ArtemisContainer container = TestImage.container(ArtemisContainer.class);
private static final ArtemisLegacyContainer container = TestImage.container(ArtemisLegacyContainer.class);
@Autowired
private Producer producer;
@@ -0,0 +1,32 @@
/*
* Copyright 2012-present 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.testsupport.container;
import org.testcontainers.utility.DockerImageName;
/**
* An {@link org.testcontainers.activemq.ArtemisContainer} for {@code apache/artemis}.
*
* @author Moritz Halbritter
*/
public final class ArtemisContainer extends org.testcontainers.activemq.ArtemisContainer {
public ArtemisContainer(DockerImageName dockerImageName) {
super(dockerImageName);
}
}
@@ -0,0 +1,33 @@
/*
* Copyright 2012-present 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.testsupport.container;
import org.testcontainers.activemq.ArtemisContainer;
import org.testcontainers.utility.DockerImageName;
/**
* An {@link ArtemisContainer} for {@code apache/activemq-artemis}.
*
* @author Moritz Halbritter
*/
public final class ArtemisLegacyContainer extends ArtemisContainer {
public ArtemisLegacyContainer(DockerImageName dockerImageName) {
super(dockerImageName);
}
}
@@ -25,7 +25,6 @@ import java.util.function.Supplier;
import com.redis.testcontainers.RedisContainer;
import com.redis.testcontainers.RedisStackContainer;
import org.testcontainers.activemq.ArtemisContainer;
import org.testcontainers.cassandra.CassandraContainer;
import org.testcontainers.containers.Container;
import org.testcontainers.containers.GenericContainer;
@@ -83,7 +82,13 @@ public enum TestImage {
/**
* A container image suitable for testing Artemis.
*/
ARTEMIS("apache/activemq-artemis", "2.34.0", () -> ArtemisContainer.class),
ARTEMIS("apache/artemis", "2.53.0", () -> ArtemisContainer.class),
/**
* A container image suitable for testing Artemis using the legacy
* {@code apache/activemq-artemis} image.
*/
ARTEMIS_LEGACY("apache/activemq-artemis", "2.34.0", () -> ArtemisLegacyContainer.class),
/**
* A container image suitable for testing Cassandra.