mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Polish "Add service connection for Docker Compose and Testcontainers Artemis"
See gh-39311
This commit is contained in:
parent
f15cd93a35
commit
1f321c4421
@ -26,12 +26,28 @@ import org.springframework.boot.autoconfigure.service.connection.ConnectionDetai
|
||||
*/
|
||||
public interface ArtemisConnectionDetails extends ConnectionDetails {
|
||||
|
||||
/**
|
||||
* Artemis deployment mode, auto-detected by default.
|
||||
* @return the Artemis deployment mode, auto-detected by default
|
||||
*/
|
||||
ArtemisMode getMode();
|
||||
|
||||
/**
|
||||
* Artemis broker url.
|
||||
* @return the Artemis broker url
|
||||
*/
|
||||
String getBrokerUrl();
|
||||
|
||||
/**
|
||||
* Login user of the broker.
|
||||
* @return the login user of the broker
|
||||
*/
|
||||
String getUser();
|
||||
|
||||
/**
|
||||
* Login password of the broker.
|
||||
* @return the login password of the broker
|
||||
*/
|
||||
String getPassword();
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import org.springframework.boot.docker.compose.service.connection.DockerComposeC
|
||||
* {@link ArtemisConnectionDetails} for an {@code artemis} service.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
class ArtemisDockerComposeConnectionDetailsFactory
|
||||
extends DockerComposeConnectionDetailsFactory<ArtemisConnectionDetails> {
|
||||
@ -34,7 +35,7 @@ class ArtemisDockerComposeConnectionDetailsFactory
|
||||
private static final int ACTIVEMQ_PORT = 61616;
|
||||
|
||||
protected ArtemisDockerComposeConnectionDetailsFactory() {
|
||||
super("apache/activemq-classic");
|
||||
super("apache/activemq-artemis");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ import java.util.Map;
|
||||
* Artemis environment details.
|
||||
*
|
||||
* @author Eddú Meléndez
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
class ArtemisEnvironment {
|
||||
|
||||
@ -30,8 +31,8 @@ class ArtemisEnvironment {
|
||||
private final String password;
|
||||
|
||||
ArtemisEnvironment(Map<String, String> env) {
|
||||
this.user = env.get("ACTIVEMQ_CONNECTION_USER");
|
||||
this.password = env.get("ACTIVEMQ_CONNECTION_PASSWORD");
|
||||
this.user = env.get("ARTEMIS_USER");
|
||||
this.password = env.get("ARTEMIS_PASSWORD");
|
||||
}
|
||||
|
||||
String getUser() {
|
||||
|
@ -38,7 +38,7 @@ class ArtemisEnvironmentTests {
|
||||
|
||||
@Test
|
||||
void getUserWhenHasActiveMqUser() {
|
||||
ArtemisEnvironment environment = new ArtemisEnvironment(Map.of("ACTIVEMQ_CONNECTION_USER", "me"));
|
||||
ArtemisEnvironment environment = new ArtemisEnvironment(Map.of("ARTEMIS_USER", "me"));
|
||||
assertThat(environment.getUser()).isEqualTo("me");
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ class ArtemisEnvironmentTests {
|
||||
|
||||
@Test
|
||||
void getPasswordWhenHasActiveMqPassword() {
|
||||
ArtemisEnvironment environment = new ArtemisEnvironment(Map.of("ACTIVEMQ_CONNECTION_PASSWORD", "secret"));
|
||||
ArtemisEnvironment environment = new ArtemisEnvironment(Map.of("ARTEMIS_PASSWORD", "secret"));
|
||||
assertThat(environment.getPassword()).isEqualTo("secret");
|
||||
}
|
||||
|
||||
|
@ -4,5 +4,5 @@ services:
|
||||
ports:
|
||||
- '61616'
|
||||
environment:
|
||||
ACTIVEMQ_CONNECTION_USER: 'root'
|
||||
ACTIVEMQ_CONNECTION_PASSWORD: 'secret'
|
||||
ARTEMIS_USER: 'root'
|
||||
ARTEMIS_PASSWORD: 'secret'
|
||||
|
@ -72,6 +72,9 @@ The following service connections are currently supported:
|
||||
| `ActiveMQConnectionDetails`
|
||||
| Containers named "symptoma/activemq"
|
||||
|
||||
| `ArtemisConnectionDetails`
|
||||
| Containers named "apache/activemq-artemis"
|
||||
|
||||
| `CassandraConnectionDetails`
|
||||
| Containers named "cassandra"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user