mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Harmonize Docker compose and testcontainers support for RabbitMQ
Given that the prefix for such support refers to the name of the service, it should have been RabbitMq, not Rabbit. This was already applied in the newly introduced AMQP 1.0 support, and this commit adapts the existing support for consistency. Closes gh-49664
This commit is contained in:
+6
-5
@@ -25,14 +25,14 @@ import org.springframework.boot.testsupport.container.TestImage;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link RabbitDockerComposeConnectionDetailsFactory} and
|
||||
* {@link RabbitStreamDockerComposeConnectionDetailsFactory} when used in combination.
|
||||
* Integration tests for {@link RabbitMqDockerComposeConnectionDetailsFactory} and
|
||||
* {@link RabbitMqStreamDockerComposeConnectionDetailsFactory} when used in combination.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
class RabbitAndRabbitStreamDockerComposeConnectionDetailsFactoryIntegrationTests {
|
||||
class RabbitMqAndRabbitMqStreamDockerComposeConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
@DockerComposeTest(composeFile = "rabbit-and-rabbit-stream-separate-services-compose.yaml",
|
||||
@DockerComposeTest(composeFile = "rabbitmq-and-rabbitmq-stream-separate-services-compose.yaml",
|
||||
image = TestImage.RABBITMQ)
|
||||
void runCreatesConnectionDetailsFromSeparateServices(RabbitConnectionDetails connectionDetails,
|
||||
RabbitStreamConnectionDetails streamConnectionDetails) {
|
||||
@@ -40,7 +40,8 @@ class RabbitAndRabbitStreamDockerComposeConnectionDetailsFactoryIntegrationTests
|
||||
assertConnectionDetails(streamConnectionDetails);
|
||||
}
|
||||
|
||||
@DockerComposeTest(composeFile = "rabbit-and-rabbit-stream-single-service-compose.yaml", image = TestImage.RABBITMQ)
|
||||
@DockerComposeTest(composeFile = "rabbitmq-and-rabbitmq-stream-single-service-compose.yaml",
|
||||
image = TestImage.RABBITMQ)
|
||||
void runCreatesConnectionDetailsFromSingleService(RabbitConnectionDetails connectionDetails,
|
||||
RabbitStreamConnectionDetails streamConnectionDetails) {
|
||||
assertConnectionDetails(connectionDetails);
|
||||
+4
-4
@@ -25,22 +25,22 @@ import org.springframework.boot.testsupport.container.TestImage;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link RabbitDockerComposeConnectionDetailsFactory}.
|
||||
* Integration tests for {@link RabbitMqDockerComposeConnectionDetailsFactory}.
|
||||
*
|
||||
* @author Moritz Halbritter
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
* @author Scott Frederick
|
||||
*/
|
||||
class RabbitDockerComposeConnectionDetailsFactoryIntegrationTests {
|
||||
class RabbitMqDockerComposeConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
@DockerComposeTest(composeFile = "rabbit-compose.yaml", image = TestImage.RABBITMQ)
|
||||
@DockerComposeTest(composeFile = "rabbitmq-compose.yaml", image = TestImage.RABBITMQ)
|
||||
void runCreatesConnectionDetails(RabbitConnectionDetails connectionDetails) {
|
||||
assertConnectionDetails(connectionDetails);
|
||||
assertThat(connectionDetails.getSslBundle()).isNull();
|
||||
}
|
||||
|
||||
@DockerComposeTest(composeFile = "rabbit-ssl-compose.yaml", image = TestImage.RABBITMQ,
|
||||
@DockerComposeTest(composeFile = "rabbitmq-ssl-compose.yaml", image = TestImage.RABBITMQ,
|
||||
additionalResources = { "../../ca.crt", "../../server.crt", "../../server.key", "../../client.crt",
|
||||
"../../client.key", "rabbitmq-ssl.conf" })
|
||||
void runWithSslCreatesConnectionDetails(RabbitConnectionDetails connectionDetails) {
|
||||
+4
-4
@@ -24,18 +24,18 @@ import org.springframework.boot.testsupport.container.TestImage;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link RabbitStreamDockerComposeConnectionDetailsFactory}.
|
||||
* Integration tests for {@link RabbitMqStreamDockerComposeConnectionDetailsFactory}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
class RabbitStreamDockerComposeConnectionDetailsFactoryIntegrationTests {
|
||||
class RabbitMqStreamDockerComposeConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
@DockerComposeTest(composeFile = "rabbit-stream-compose.yaml", image = TestImage.RABBITMQ)
|
||||
@DockerComposeTest(composeFile = "rabbitmq-stream-compose.yaml", image = TestImage.RABBITMQ)
|
||||
void runCreatesConnectionDetails(RabbitStreamConnectionDetails connectionDetails) {
|
||||
assertConnectionDetails(connectionDetails);
|
||||
}
|
||||
|
||||
@DockerComposeTest(composeFile = "rabbit-stream-ssl-compose.yaml", image = TestImage.RABBITMQ,
|
||||
@DockerComposeTest(composeFile = "rabbitmq-stream-ssl-compose.yaml", image = TestImage.RABBITMQ,
|
||||
additionalResources = { "../../ca.crt", "../../server.crt", "../../server.key", "../../client.crt",
|
||||
"../../client.key", "rabbitmq-stream-ssl.conf" })
|
||||
void runWithSslCreatesConnectionDetails(RabbitStreamConnectionDetails connectionDetails) {
|
||||
+5
-4
@@ -25,15 +25,16 @@ import org.springframework.boot.testsupport.container.TestImage;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link RabbitDockerComposeConnectionDetailsFactory} and
|
||||
* {@link RabbitStreamDockerComposeConnectionDetailsFactory} when using a single service
|
||||
* Integration tests for {@link RabbitMqDockerComposeConnectionDetailsFactory} and
|
||||
* {@link RabbitMqStreamDockerComposeConnectionDetailsFactory} when using a single service
|
||||
* for standard and stream-based messaging.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
class SingleServiceRabbitAndRabbitStreamDockerComposeConnectionDetailsFactoryIntegrationTests {
|
||||
class SingleServiceRabbitAndRabbitMqStreamDockerComposeConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
@DockerComposeTest(composeFile = "rabbit-and-rabbit-stream-single-service-compose.yaml", image = TestImage.RABBITMQ)
|
||||
@DockerComposeTest(composeFile = "rabbitmq-and-rabbitmq-stream-single-service-compose.yaml",
|
||||
image = TestImage.RABBITMQ)
|
||||
void runCreatesConnectionDetails(RabbitConnectionDetails connectionDetails,
|
||||
RabbitStreamConnectionDetails streamConnectionDetails) {
|
||||
assertConnectionDetails(connectionDetails);
|
||||
+1
-1
@@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
* @deprecated since 4.0.0 for removal in 4.2.0 in favor of
|
||||
* {@link RabbitContainerConnectionDetailsFactoryIntegrationTests}.
|
||||
* {@link RabbitMqContainerConnectionDetailsFactoryIntegrationTests}.
|
||||
*/
|
||||
@SpringJUnitConfig
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link RabbitContainerConnectionDetailsFactory}.
|
||||
* Tests for {@link RabbitMqContainerConnectionDetailsFactory}.
|
||||
*
|
||||
* @author Moritz Halbritter
|
||||
* @author Andy Wilkinson
|
||||
@@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@SpringJUnitConfig
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
class RabbitContainerConnectionDetailsFactoryIntegrationTests {
|
||||
class RabbitMqContainerConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
@Container
|
||||
@ServiceConnection
|
||||
+5
-5
@@ -36,8 +36,8 @@ import org.springframework.boot.rabbitmq.autoconfigure.EnvironmentBuilderCustomi
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitAutoConfiguration;
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitStreamConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitContainerConnectionDetailsFactory.RabbitMqContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitStreamContainerConnectionDetailsFactory.RabbitMqStreamContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitMqContainerConnectionDetailsFactory.RabbitMqContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitMqStreamContainerConnectionDetailsFactory.RabbitMqStreamContainerConnectionDetails;
|
||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
||||
import org.springframework.boot.testsupport.container.TestImage;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -50,8 +50,8 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link RabbitStreamContainerConnectionDetailsFactory} with a single container
|
||||
* that's only used for streams.
|
||||
* Tests for {@link RabbitMqStreamContainerConnectionDetailsFactory} with a single
|
||||
* container that's only used for streams.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
* @author Andy Wilkinson
|
||||
@@ -60,7 +60,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@TestPropertySource(
|
||||
properties = { "spring.rabbitmq.stream.name=stream.queue1", "spring.rabbitmq.listener.type=stream" })
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
class RabbitStreamContainerConnectionDetailsFactoryIntegrationTests {
|
||||
class RabbitMqStreamContainerConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
private static final int RABBITMQ_STREAMS_PORT = 5552;
|
||||
|
||||
+4
-4
@@ -37,8 +37,8 @@ import org.springframework.boot.rabbitmq.autoconfigure.EnvironmentBuilderCustomi
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitAutoConfiguration;
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitStreamConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitContainerConnectionDetailsFactory.RabbitMqContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitStreamContainerConnectionDetailsFactory.RabbitMqStreamContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitMqContainerConnectionDetailsFactory.RabbitMqContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitMqStreamContainerConnectionDetailsFactory.RabbitMqStreamContainerConnectionDetails;
|
||||
import org.springframework.boot.testcontainers.service.connection.PemKeyStore;
|
||||
import org.springframework.boot.testcontainers.service.connection.PemTrustStore;
|
||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
||||
@@ -53,7 +53,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link RabbitStreamContainerConnectionDetailsFactory} with SSL.
|
||||
* Tests for {@link RabbitMqStreamContainerConnectionDetailsFactory} with SSL.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
* @author Andy Wilkinson
|
||||
@@ -62,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@TestPropertySource(
|
||||
properties = { "spring.rabbitmq.stream.name=stream.queue1", "spring.rabbitmq.listener.type=stream" })
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
class RabbitStreamWithSslContainerConnectionDetailsFactoryIntegrationTests {
|
||||
class RabbitMqStreamWithSslContainerConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
private static final int RABBITMQ_STREAMS_TLS_PORT = 5551;
|
||||
|
||||
+4
-4
@@ -40,8 +40,8 @@ import org.springframework.boot.rabbitmq.autoconfigure.EnvironmentBuilderCustomi
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitAutoConfiguration;
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitStreamConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitContainerConnectionDetailsFactory.RabbitMqContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitStreamContainerConnectionDetailsFactory.RabbitMqStreamContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitMqContainerConnectionDetailsFactory.RabbitMqContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitMqStreamContainerConnectionDetailsFactory.RabbitMqStreamContainerConnectionDetails;
|
||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
||||
import org.springframework.boot.testsupport.container.TestImage;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -54,7 +54,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link RabbitStreamContainerConnectionDetailsFactory} with two containers,
|
||||
* Tests for {@link RabbitMqStreamContainerConnectionDetailsFactory} with two containers,
|
||||
* one for streams and one for standard messaging.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
@@ -64,7 +64,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@TestPropertySource(
|
||||
properties = { "spring.rabbitmq.stream.name=stream.queue1", "spring.rabbitmq.listener.type=stream" })
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
class SeparateContainersRabbitAndRabbitStreamContainerConnectionDetailsFactoryIntegrationTests {
|
||||
class SeparateContainersRabbitMqAndRabbitMqStreamContainerConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
private static final int RABBITMQ_STREAMS_PORT = 5552;
|
||||
|
||||
+5
-5
@@ -40,8 +40,8 @@ import org.springframework.boot.rabbitmq.autoconfigure.EnvironmentBuilderCustomi
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitAutoConfiguration;
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.autoconfigure.RabbitStreamConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitContainerConnectionDetailsFactory.RabbitMqContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitStreamContainerConnectionDetailsFactory.RabbitMqStreamContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitMqContainerConnectionDetailsFactory.RabbitMqContainerConnectionDetails;
|
||||
import org.springframework.boot.rabbitmq.testcontainers.RabbitMqStreamContainerConnectionDetailsFactory.RabbitMqStreamContainerConnectionDetails;
|
||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
||||
import org.springframework.boot.testsupport.container.TestImage;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -54,8 +54,8 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link RabbitStreamContainerConnectionDetailsFactory} with a single container
|
||||
* used for both streams and standard messaging.
|
||||
* Tests for {@link RabbitMqStreamContainerConnectionDetailsFactory} with a single
|
||||
* container used for both streams and standard messaging.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
* @author Andy Wilkinson
|
||||
@@ -64,7 +64,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@TestPropertySource(
|
||||
properties = { "spring.rabbitmq.stream.name=stream.queue1", "spring.rabbitmq.listener.type=stream" })
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
class SingleContainerRabbitAndRabbitStreamContainerConnectionDetailsFactoryIntegrationTests {
|
||||
class SingleContainerRabbitAndRabbitMqStreamContainerConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
private static final int RABBITMQ_STREAMS_PORT = 5552;
|
||||
|
||||
+4
-4
@@ -33,12 +33,12 @@ import org.springframework.boot.ssl.SslBundle;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
class RabbitDockerComposeConnectionDetailsFactory
|
||||
class RabbitMqDockerComposeConnectionDetailsFactory
|
||||
extends DockerComposeConnectionDetailsFactory<RabbitConnectionDetails> {
|
||||
|
||||
private static final int RABBITMQ_PORT = 5672;
|
||||
|
||||
protected RabbitDockerComposeConnectionDetailsFactory() {
|
||||
protected RabbitMqDockerComposeConnectionDetailsFactory() {
|
||||
super("rabbitmq");
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class RabbitDockerComposeConnectionDetailsFactory
|
||||
static class RabbitDockerComposeConnectionDetails extends DockerComposeConnectionDetails
|
||||
implements RabbitConnectionDetails {
|
||||
|
||||
private final RabbitEnvironment environment;
|
||||
private final RabbitMqEnvironment environment;
|
||||
|
||||
private final List<Address> addresses;
|
||||
|
||||
@@ -68,7 +68,7 @@ class RabbitDockerComposeConnectionDetailsFactory
|
||||
|
||||
protected RabbitDockerComposeConnectionDetails(RunningService service) {
|
||||
super(service);
|
||||
this.environment = new RabbitEnvironment(service.env());
|
||||
this.environment = new RabbitMqEnvironment(service.env());
|
||||
this.sslBundle = getSslBundle(service);
|
||||
this.addresses = List.of(new Address(service.host(), service.ports().get(RABBITMQ_PORT)));
|
||||
}
|
||||
+2
-2
@@ -28,13 +28,13 @@ import org.jspecify.annotations.Nullable;
|
||||
* @author Phillip Webb
|
||||
* @author Scott Frederick
|
||||
*/
|
||||
class RabbitEnvironment {
|
||||
class RabbitMqEnvironment {
|
||||
|
||||
private final @Nullable String username;
|
||||
|
||||
private final @Nullable String password;
|
||||
|
||||
RabbitEnvironment(Map<String, @Nullable String> env) {
|
||||
RabbitMqEnvironment(Map<String, @Nullable String> env) {
|
||||
this.username = env.getOrDefault("RABBITMQ_DEFAULT_USER", env.getOrDefault("RABBITMQ_USERNAME", "guest"));
|
||||
this.password = env.getOrDefault("RABBITMQ_DEFAULT_PASS", env.getOrDefault("RABBITMQ_PASSWORD", "guest"));
|
||||
}
|
||||
+4
-4
@@ -35,10 +35,10 @@ import org.springframework.boot.ssl.SslBundle;
|
||||
* @author Scott Frederick
|
||||
* @author Jay Choi
|
||||
*/
|
||||
class RabbitStreamDockerComposeConnectionDetailsFactory
|
||||
class RabbitMqStreamDockerComposeConnectionDetailsFactory
|
||||
extends DockerComposeConnectionDetailsFactory<RabbitStreamConnectionDetails> {
|
||||
|
||||
protected RabbitStreamDockerComposeConnectionDetailsFactory() {
|
||||
protected RabbitMqStreamDockerComposeConnectionDetailsFactory() {
|
||||
super("rabbitmq");
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class RabbitStreamDockerComposeConnectionDetailsFactory
|
||||
|
||||
private static final int STREAMS_TLS_PORT = 5551;
|
||||
|
||||
private final RabbitEnvironment environment;
|
||||
private final RabbitMqEnvironment environment;
|
||||
|
||||
private final String host;
|
||||
|
||||
@@ -74,7 +74,7 @@ class RabbitStreamDockerComposeConnectionDetailsFactory
|
||||
|
||||
protected RabbitStreamDockerComposeConnectionDetails(RunningService service) {
|
||||
super(service);
|
||||
this.environment = new RabbitEnvironment(service.env());
|
||||
this.environment = new RabbitMqEnvironment(service.env());
|
||||
this.host = service.host();
|
||||
this.sslBundle = getSslBundle(service);
|
||||
this.port = service.ports().get((this.sslBundle != null) ? STREAMS_TLS_PORT : STREAMS_PORT);
|
||||
+1
-1
@@ -37,7 +37,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
* @deprecated since 4.0.0 for removal in 4.2.0 in favor of
|
||||
* {@link RabbitContainerConnectionDetailsFactory}.
|
||||
* {@link RabbitMqContainerConnectionDetailsFactory}.
|
||||
*/
|
||||
@Deprecated(since = "4.0.0", forRemoval = true)
|
||||
class DeprecatedRabbitContainerConnectionDetailsFactory
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
class RabbitContainerConnectionDetailsFactory
|
||||
class RabbitMqContainerConnectionDetailsFactory
|
||||
extends ContainerConnectionDetailsFactory<RabbitMQContainer, RabbitConnectionDetails> {
|
||||
|
||||
@Override
|
||||
+2
-2
@@ -33,10 +33,10 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
|
||||
* @author Eddú Meléndez
|
||||
* @author Jay Choi
|
||||
*/
|
||||
class RabbitStreamContainerConnectionDetailsFactory
|
||||
class RabbitMqStreamContainerConnectionDetailsFactory
|
||||
extends ContainerConnectionDetailsFactory<RabbitMQContainer, RabbitStreamConnectionDetails> {
|
||||
|
||||
RabbitStreamContainerConnectionDetailsFactory() {
|
||||
RabbitMqStreamContainerConnectionDetailsFactory() {
|
||||
super(ANY_CONNECTION_NAME, "org.springframework.rabbit.stream.producer.RabbitStreamTemplate");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Connection Details Factories
|
||||
org.springframework.boot.autoconfigure.service.connection.ConnectionDetailsFactory=\
|
||||
org.springframework.boot.rabbitmq.docker.compose.RabbitDockerComposeConnectionDetailsFactory,\
|
||||
org.springframework.boot.rabbitmq.docker.compose.RabbitStreamDockerComposeConnectionDetailsFactory,\
|
||||
org.springframework.boot.rabbitmq.docker.compose.RabbitMqDockerComposeConnectionDetailsFactory,\
|
||||
org.springframework.boot.rabbitmq.docker.compose.RabbitMqStreamDockerComposeConnectionDetailsFactory,\
|
||||
org.springframework.boot.rabbitmq.testcontainers.DeprecatedRabbitContainerConnectionDetailsFactory,\
|
||||
org.springframework.boot.rabbitmq.testcontainers.RabbitContainerConnectionDetailsFactory,\
|
||||
org.springframework.boot.rabbitmq.testcontainers.RabbitStreamContainerConnectionDetailsFactory
|
||||
org.springframework.boot.rabbitmq.testcontainers.RabbitMqContainerConnectionDetailsFactory,\
|
||||
org.springframework.boot.rabbitmq.testcontainers.RabbitMqStreamContainerConnectionDetailsFactory
|
||||
|
||||
|
||||
+14
-14
@@ -24,48 +24,48 @@ import org.junit.jupiter.api.Test;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link RabbitEnvironment}.
|
||||
* Tests for {@link RabbitMqEnvironment}.
|
||||
*
|
||||
* @author Moritz Halbritter
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
* @author Scott Frederick
|
||||
*/
|
||||
class RabbitEnvironmentTests {
|
||||
class RabbitMqEnvironmentTests {
|
||||
|
||||
@Test
|
||||
void getUsernameWhenNoRabbitmqDefaultUser() {
|
||||
RabbitEnvironment environment = new RabbitEnvironment(Collections.emptyMap());
|
||||
void getUsernameWhenNoRabbitMqDefaultUser() {
|
||||
RabbitMqEnvironment environment = new RabbitMqEnvironment(Collections.emptyMap());
|
||||
assertThat(environment.getUsername()).isEqualTo("guest");
|
||||
}
|
||||
|
||||
@Test
|
||||
void getUsernameWhenHasRabbitmqDefaultUser() {
|
||||
RabbitEnvironment environment = new RabbitEnvironment(Map.of("RABBITMQ_DEFAULT_USER", "me"));
|
||||
void getUsernameWhenHasRabbitMqDefaultUser() {
|
||||
RabbitMqEnvironment environment = new RabbitMqEnvironment(Map.of("RABBITMQ_DEFAULT_USER", "me"));
|
||||
assertThat(environment.getUsername()).isEqualTo("me");
|
||||
}
|
||||
|
||||
@Test
|
||||
void getUsernameWhenHasRabbitmqUsername() {
|
||||
RabbitEnvironment environment = new RabbitEnvironment(Map.of("RABBITMQ_USERNAME", "me"));
|
||||
void getUsernameWhenHasRabbitMqUsername() {
|
||||
RabbitMqEnvironment environment = new RabbitMqEnvironment(Map.of("RABBITMQ_USERNAME", "me"));
|
||||
assertThat(environment.getUsername()).isEqualTo("me");
|
||||
}
|
||||
|
||||
@Test
|
||||
void getUsernameWhenNoRabbitmqDefaultPass() {
|
||||
RabbitEnvironment environment = new RabbitEnvironment(Collections.emptyMap());
|
||||
void getUsernameWhenNoRabbitMqDefaultPass() {
|
||||
RabbitMqEnvironment environment = new RabbitMqEnvironment(Collections.emptyMap());
|
||||
assertThat(environment.getPassword()).isEqualTo("guest");
|
||||
}
|
||||
|
||||
@Test
|
||||
void getUsernameWhenHasRabbitmqDefaultPass() {
|
||||
RabbitEnvironment environment = new RabbitEnvironment(Map.of("RABBITMQ_DEFAULT_PASS", "secret"));
|
||||
void getUsernameWhenHasRabbitMqDefaultPass() {
|
||||
RabbitMqEnvironment environment = new RabbitMqEnvironment(Map.of("RABBITMQ_DEFAULT_PASS", "secret"));
|
||||
assertThat(environment.getPassword()).isEqualTo("secret");
|
||||
}
|
||||
|
||||
@Test
|
||||
void getUsernameWhenHasRabbitmqPassword() {
|
||||
RabbitEnvironment environment = new RabbitEnvironment(Map.of("RABBITMQ_PASSWORD", "secret"));
|
||||
void getUsernameWhenHasRabbitMqPassword() {
|
||||
RabbitMqEnvironment environment = new RabbitMqEnvironment(Map.of("RABBITMQ_PASSWORD", "secret"));
|
||||
assertThat(environment.getPassword()).isEqualTo("secret");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user