Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/modules/activemq.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ActiveMQ

Testcontainers module for [ActiveMQ](https://hub.docker.com/r/apache/activemq) and
[Artemis](https://hub.docker.com/r/apache/activemq-artemis).
[Artemis](https://hub.docker.com/r/apache/artemis).

## ActiveMQContainer's usage examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
/**
* Testcontainers implementation for Apache ActiveMQ Artemis.
* <p>
* Supported images: {@code apache/artemis}, {@code apache/activemq-artemis}
* <p>
* Exposed ports:
* <ul>
* <li>Console: 8161</li>
Expand All @@ -24,6 +26,8 @@ public class ArtemisContainer extends GenericContainer<ArtemisContainer> {

private static final DockerImageName DEFAULT_IMAGE = DockerImageName.parse("apache/activemq-artemis");

private static final DockerImageName APACHE_ARTEMIS_IMAGE = DockerImageName.parse("apache/artemis");

private static final int WEB_CONSOLE_PORT = 8161;

// CORE,MQTT,AMQP,HORNETQ,STOMP,OPENWIRE
Expand All @@ -49,7 +53,7 @@ public ArtemisContainer(String image) {

public ArtemisContainer(DockerImageName dockerImageName) {
super(dockerImageName);
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE);
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE, APACHE_ARTEMIS_IMAGE);

withExposedPorts(WEB_CONSOLE_PORT, TCP_PORT, HORNETQ_STOMP_PORT, AMQP_PORT, STOMP_PORT, MQTT_PORT, WS_PORT);
waitingFor(Wait.forLogMessage(".*HTTP Server started.*", 1).withStartupTimeout(Duration.ofMinutes(1)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import lombok.SneakyThrows;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import static org.assertj.core.api.Assertions.assertThat;

Expand All @@ -18,7 +20,7 @@ class ArtemisContainerTest {
void defaultCredentials() {
try (
// container {
ArtemisContainer artemis = new ArtemisContainer("apache/activemq-artemis:2.30.0-alpine")
ArtemisContainer artemis = new ArtemisContainer("apache/activemq-artemis:2.32.0-alpine")
// }
) {
artemis.start();
Expand All @@ -33,7 +35,7 @@ void defaultCredentials() {
void customCredentials() {
try (
// settingCredentials {
ArtemisContainer artemis = new ArtemisContainer("apache/activemq-artemis:2.30.0-alpine")
ArtemisContainer artemis = new ArtemisContainer("apache/activemq-artemis:2.32.0-alpine")
.withUser("testcontainers")
.withPassword("testcontainers")
// }
Expand All @@ -50,7 +52,7 @@ void customCredentials() {
void allowAnonymousLogin() {
try (
// enableAnonymousLogin {
ArtemisContainer artemis = new ArtemisContainer("apache/activemq-artemis:2.30.0-alpine")
ArtemisContainer artemis = new ArtemisContainer("apache/activemq-artemis:2.32.0-alpine")
.withEnv("ANONYMOUS_LOGIN", "true")
// }
) {
Expand All @@ -60,6 +62,15 @@ void allowAnonymousLogin() {
}
}

@ParameterizedTest
@ValueSource(strings = { "apache/activemq-artemis:2.32.0-alpine", "apache/artemis:2.53.0-alpine" })
void compatibility(String image) {
try (ArtemisContainer artemis = new ArtemisContainer(image)) {
artemis.start();
assertFunctionality(artemis, false);
}
}

@SneakyThrows
private void assertFunctionality(ArtemisContainer artemis, boolean anonymousLogin) {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(artemis.getBrokerUrl());
Expand Down
Loading