Package org.testcontainers.rabbitmq
Class RabbitMQContainer
java.lang.Object
org.testcontainers.containers.GenericContainer<RabbitMQContainer>
org.testcontainers.rabbitmq.RabbitMQContainer
- All Implemented Interfaces:
AutoCloseable,org.testcontainers.containers.Container<RabbitMQContainer>,org.testcontainers.containers.ContainerState,org.testcontainers.containers.traits.LinkableContainer,org.testcontainers.containers.wait.strategy.WaitStrategyTarget,org.testcontainers.lifecycle.Startable
public class RabbitMQContainer
extends org.testcontainers.containers.GenericContainer<RabbitMQContainer>
Testcontainers implementation for RabbitMQ.
Supported image: rabbitmq
Exposed ports:
- 5671 (AMQPS)
- 5672 (AMQP)
- 15671 (HTTPS)
- 15672 (HTTP)
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.testcontainers.containers.Container
org.testcontainers.containers.Container.ExecResult -
Field Summary
Fields inherited from class org.testcontainers.containers.GenericContainer
CONTAINER_RUNNING_TIMEOUT_SEC, dependencies, dockerClient, INTERNAL_HOST_HOSTNAME, waitStrategyFields inherited from interface org.testcontainers.containers.ContainerState
STATE_HEALTHY -
Constructor Summary
ConstructorsConstructorDescriptionRabbitMQContainer(String dockerImageName) Creates a RabbitMQ container using a specific docker image.RabbitMQContainer(org.testcontainers.utility.DockerImageName dockerImageName) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidcontainerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo) withAdminPassword(String adminPassword) Sets the password for the admin (default iswithAdminUser(String adminUsername) Sets the user for the admin (default iswithRabbitMQConfig(org.testcontainers.utility.MountableFile rabbitMQConf) Overwrites the default RabbitMQ configuration file with the supplied one.withRabbitMQConfigErlang(org.testcontainers.utility.MountableFile rabbitMQConf) Overwrites the default RabbitMQ configuration file with the supplied one.withRabbitMQConfigSysctl(org.testcontainers.utility.MountableFile rabbitMQConf) Overwrites the default RabbitMQ configuration file with the supplied one.Methods inherited from class org.testcontainers.containers.GenericContainer
addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, canBeReused, containerIsCreated, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, getLivenessCheckPortNumbers, getLivenessCheckPorts, getLogConsumers, getNetwork, getNetworkAliases, getNetworkMode, getPortBindings, getShmSize, getStartupAttempts, getStartupCheckStrategy, getTestHostIpAddress, getTmpFsMapping, getVolumesFroms, getWaitStrategy, getWorkingDirectory, hashCode, isHostAccessible, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setContainerDef, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setHostAccessible, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, stop, toString, waitingFor, waitUntilContainerStarted, withAccessToHost, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCopyToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withFileSystemBind, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectoryMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.testcontainers.containers.Container
addFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBindMethods inherited from interface org.testcontainers.containers.ContainerState
copyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, execInContainer, execInContainer, execInContainerWithUser, execInContainerWithUser, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunningMethods inherited from interface org.testcontainers.lifecycle.Startable
close
-
Constructor Details
-
RabbitMQContainer
Creates a RabbitMQ container using a specific docker image.- Parameters:
dockerImageName- The docker image to use.
-
RabbitMQContainer
public RabbitMQContainer(org.testcontainers.utility.DockerImageName dockerImageName)
-
-
Method Details
-
configure
protected void configure()- Overrides:
configurein classorg.testcontainers.containers.GenericContainer<RabbitMQContainer>
-
containerIsStarted
protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo) - Overrides:
containerIsStartedin classorg.testcontainers.containers.GenericContainer<RabbitMQContainer>
-
getAdminPassword
- Returns:
- The admin password for the
adminaccount
-
getAdminUsername
- Returns:
- The admin user for the
adminaccount
-
getAmqpPort
-
getAmqpsPort
-
getHttpsPort
-
getHttpPort
-
getAmqpUrl
- Returns:
- AMQP URL for use with AMQP clients.
-
getAmqpsUrl
- Returns:
- AMQPS URL for use with AMQPS clients.
-
getHttpUrl
- Returns:
- URL of the HTTP management endpoint.
-
getHttpsUrl
- Returns:
- URL of the HTTPS management endpoint.
-
withAdminUser
Sets the user for the admin (default isguest
)- Parameters:
adminUsername- The admin user.- Returns:
- This container.
-
withAdminPassword
Sets the password for the admin (default isguest
)- Parameters:
adminPassword- The admin password.- Returns:
- This container.
-
withRabbitMQConfig
Overwrites the default RabbitMQ configuration file with the supplied one.- Parameters:
rabbitMQConf- The rabbitmq.conf file to use (in sysctl format, don't forget empty line in the end of file)- Returns:
- This container.
-
withRabbitMQConfigSysctl
public RabbitMQContainer withRabbitMQConfigSysctl(org.testcontainers.utility.MountableFile rabbitMQConf) Overwrites the default RabbitMQ configuration file with the supplied one. This function doesn't work with RabbitMQ < 3.7. This function and the Sysctl format is recommended for RabbitMQ >= 3.7- Parameters:
rabbitMQConf- The rabbitmq.config file to use (in sysctl format, don't forget empty line in the end of file)- Returns:
- This container.
-
withRabbitMQConfigErlang
public RabbitMQContainer withRabbitMQConfigErlang(org.testcontainers.utility.MountableFile rabbitMQConf) Overwrites the default RabbitMQ configuration file with the supplied one.- Parameters:
rabbitMQConf- The rabbitmq.config file to use (in erlang format)- Returns:
- This container.
-