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