Polish "Reintroduce support for ActiveMQ"

See gh-35048
This commit is contained in:
Stephane Nicoll
2023-04-18 13:55:37 +02:00
parent 3e9908a797
commit a323bd90a8
21 changed files with 299 additions and 29 deletions

View File

@@ -0,0 +1,44 @@
/*
* Copyright 2012-2023 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.testcontainers;
import org.testcontainers.containers.GenericContainer;
/**
* A {@link GenericContainer} for ActiveMQ.
*
* @author Stephane Nicoll
* @since 3.1.0
*/
public class ActiveMQContainer extends GenericContainer<ActiveMQContainer> {
private static final int DEFAULT_PORT = 61616;
public ActiveMQContainer() {
super(DockerImageNames.activeMq());
addExposedPorts(DEFAULT_PORT);
}
/**
* Return the broker URL to use.
* @return the broker url of the ActiveMQ instance
*/
public String getBrokerUrl() {
return String.format("tcp://" + getHost() + ":" + getMappedPort(DEFAULT_PORT));
}
}

View File

@@ -27,6 +27,8 @@ import org.testcontainers.utility.DockerImageName;
*/
public final class DockerImageNames {
private static final String ACTIVE_MQ_VERSION = "5.18.0";
private static final String CASSANDRA_VERSION = "3.11.10";
private static final String COUCHBASE_VERSION = "6.5.1";
@@ -56,6 +58,15 @@ public final class DockerImageNames {
private DockerImageNames() {
}
/**
* Return a {@link DockerImageName} suitable for running ActiveMQ.
* @return a docker image name for running activeMq
*/
public static DockerImageName activeMq() {
return DockerImageName.parse("symptoma/activemq").withTag(ACTIVE_MQ_VERSION);
}
/**
* Return a {@link DockerImageName} suitable for running Cassandra.
* @return a docker image name for running cassandra