Class HiveMQTestContainerCore<SELF extends HiveMQTestContainerCore<SELF>>
- java.lang.Object
-
- org.testcontainers.containers.FailureDetectingExternalResource
-
- org.testcontainers.containers.GenericContainer<SELF>
-
- org.testcontainers.containers.FixedHostPortGenericContainer<SELF>
-
- com.hivemq.testcontainer.core.HiveMQTestContainerCore<SELF>
-
- All Implemented Interfaces:
java.lang.AutoCloseable,org.junit.rules.TestRule,org.testcontainers.containers.Container<SELF>,org.testcontainers.containers.ContainerState,org.testcontainers.containers.traits.LinkableContainer,org.testcontainers.containers.wait.strategy.WaitStrategyTarget,org.testcontainers.lifecycle.Startable
public class HiveMQTestContainerCore<SELF extends HiveMQTestContainerCore<SELF>> extends org.testcontainers.containers.FixedHostPortGenericContainer<SELF>
-
-
Field Summary
Fields Modifier and Type Field Description static intCONTROL_CENTER_PORTstatic intDEBUGGING_PORTstatic intMQTT_PORT
-
Constructor Summary
Constructors Constructor Description HiveMQTestContainerCore()HiveMQTestContainerCore(@NotNull java.lang.String image, @NotNull java.lang.String tag)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SELFdisableExtension(@NotNull HiveMQExtension hiveMQExtension)Disables the extension with the corresponding {id}.SELFdisableExtension(@NotNull HiveMQExtension hiveMQExtension, @NotNull java.time.Duration timeout)/** Disables the extension.SELFenableExtension(@NotNull HiveMQExtension hiveMQExtension)Enables the extension.SELFenableExtension(@NotNull HiveMQExtension hiveMQExtension, @NotNull java.time.Duration timeout)Enables the extension.intgetMqttPort()Get the mapped port for the MQTT port of the container.protected voidsignExtension(@NotNull java.lang.String extensionId, @NotNull java.io.File jar)SELFsilent(boolean silent)Determines whether the stdout of the container is printed to System.out.SELFwithControlCenter()Enables connection to the HiveMQ Control Center on host port 8080.SELFwithControlCenter(int controlCenterPort)Enables connection to the HiveMQ Control Center on host port {controlCenterPort}.SELFwithDebugging()Enables the possibility for remote debugging clients to connect on host port 9000.SELFwithDebugging(int debuggingPortHost)Enables the possibility for remote debugging clients to connect.SELFwithExtension(@NotNull HiveMQExtension hiveMQExtension)Wraps the given class and all its subclasses into an extension and puts it into '/opt/hivemq/extensions/{extension-id}' inside the container.SELFwithExtension(@NotNull java.io.File extensionDir)Puts the given extension folder into '/opt/hivemq/extensions/{extension-id}' inside the container.SELFwithFileInExtensionHomeFolder(@NotNull java.io.File file, @NotNull java.lang.String extensionId)Puts the given file into the root of the extension's home '/opt/hivemq/extensions/{extensionId}/'.SELFwithFileInExtensionHomeFolder(@NotNull java.io.File file, @NotNull java.lang.String extensionId, @NotNull java.lang.String pathInExtensionHome)Puts the given file into given subdirectory of the extensions's home '/opt/hivemq/extensions/{id}/{pathInExtensionHome}/' Note: the extension must be loaded before the file is put.SELFwithFileInHomeFolder(@NotNull java.io.File file)Puts the given file into the root of the HiveMQ home folder '/opt/hivemq/'.SELFwithFileInHomeFolder(@NotNull java.io.File file, @NotNull java.lang.String pathInHomeFolder)Puts the given file into the given subdirectory of the HiveMQ home folder '/opt/hivemq/{pathInHomeFolder}'.SELFwithHiveMQConfig(@NotNull java.io.File config)Overwrites the HiveMQ configuration in '/opt/hivemq/conf/' inside the container.SELFwithLicense(@NotNull java.io.File license)Puts the given license into '/opt/hivemq/license/' inside the container.SELFwithLogLevel(@NotNull org.slf4j.event.Level level)Sets the loggingLevelinside the container.-
Methods inherited from class org.testcontainers.containers.FixedHostPortGenericContainer
withFixedExposedPort, withFixedExposedPort
-
Methods inherited from class org.testcontainers.containers.GenericContainer
addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, apply, canBeReused, configure, containerIsCreated, containerIsStarted, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, doStart, equals, failed, fetchDockerDaemonInfo, finished, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerDaemonInfo, 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, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, starting, stop, succeeded, toString, waitingFor, waitUntilContainerStarted, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withFileSystemBind, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectory
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.testcontainers.containers.Container
addFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBind
-
Methods inherited from interface org.testcontainers.containers.ContainerState
copyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunning
-
-
-
-
Field Detail
-
DEBUGGING_PORT
public static final int DEBUGGING_PORT
- See Also:
- Constant Field Values
-
MQTT_PORT
public static final int MQTT_PORT
- See Also:
- Constant Field Values
-
CONTROL_CENTER_PORT
public static final int CONTROL_CENTER_PORT
- See Also:
- Constant Field Values
-
-
Method Detail
-
withDebugging
@NotNull public SELF withDebugging(int debuggingPortHost)
Enables the possibility for remote debugging clients to connect.Must be called before the container is started.
- Parameters:
debuggingPortHost- the host port for debugging clients to connect- Returns:
- self
-
withDebugging
@NotNull public SELF withDebugging()
Enables the possibility for remote debugging clients to connect on host port 9000.Must be called before the container is started.
- Returns:
- self
-
withLogLevel
@NotNull public SELF withLogLevel(@NotNull @NotNull org.slf4j.event.Level level)
Sets the loggingLevelinside the container.Must be called before the container is started.
- Parameters:
level- theLevel- Returns:
- self
-
withExtension
@NotNull public SELF withExtension(@NotNull @NotNull HiveMQExtension hiveMQExtension)
Wraps the given class and all its subclasses into an extension and puts it into '/opt/hivemq/extensions/{extension-id}' inside the container.Must be called before the container is started.
- Parameters:
hiveMQExtension- theHiveMQExtensionof the extension- Returns:
- self
-
withExtension
@NotNull public SELF withExtension(@NotNull @NotNull java.io.File extensionDir)
Puts the given extension folder into '/opt/hivemq/extensions/{extension-id}' inside the container. It must at least contain a valid hivemq-extension.xml and a valid extension.jar in order to be executed.Must be called before the container is started.
- Parameters:
extensionDir- the extension folder on the host machine- Returns:
- self
-
withLicense
@NotNull public SELF withLicense(@NotNull @NotNull java.io.File license)
Puts the given license into '/opt/hivemq/license/' inside the container. It must end with '.lic' or '.elic'.Must be called before the container is started.
- Parameters:
license- the license file on the host machine- Returns:
- self
-
withHiveMQConfig
@NotNull public SELF withHiveMQConfig(@NotNull @NotNull java.io.File config)
Overwrites the HiveMQ configuration in '/opt/hivemq/conf/' inside the container.Must be called before the container is started.
- Parameters:
config- the config file on the host machine- Returns:
- self
-
withFileInExtensionHomeFolder
@NotNull public SELF withFileInExtensionHomeFolder(@NotNull @NotNull java.io.File file, @NotNull @NotNull java.lang.String extensionId)
Puts the given file into the root of the extension's home '/opt/hivemq/extensions/{extensionId}/'. Note: the extension must be loaded before the file is put.Must be called before the container is started.
- Parameters:
file- the file on the host machineextensionId- the extension- Returns:
- self
-
withFileInExtensionHomeFolder
@NotNull public SELF withFileInExtensionHomeFolder(@NotNull @NotNull java.io.File file, @NotNull @NotNull java.lang.String extensionId, @NotNull @NotNull java.lang.String pathInExtensionHome)
Puts the given file into given subdirectory of the extensions's home '/opt/hivemq/extensions/{id}/{pathInExtensionHome}/' Note: the extension must be loaded before the file is put.Must be called before the container is started.
- Parameters:
file- the file on the host machineextensionId- the extensionpathInExtensionHome- the path- Returns:
- self
-
withFileInHomeFolder
@NotNull public SELF withFileInHomeFolder(@NotNull @NotNull java.io.File file)
Puts the given file into the root of the HiveMQ home folder '/opt/hivemq/'.Must be called before the container is started.
- Parameters:
file- the file on the host machine- Returns:
- self
-
withFileInHomeFolder
@NotNull public SELF withFileInHomeFolder(@NotNull @NotNull java.io.File file, @NotNull @NotNull java.lang.String pathInHomeFolder)
Puts the given file into the given subdirectory of the HiveMQ home folder '/opt/hivemq/{pathInHomeFolder}'.Must be called before the container is started.
- Parameters:
file- the file on the host machinepathInHomeFolder- the path- Returns:
- self
-
disableExtension
@NotNull public SELF disableExtension(@NotNull @NotNull HiveMQExtension hiveMQExtension, @NotNull @NotNull java.time.Duration timeout)
/** Disables the extension. This method blocks until the HiveMQ log for successful disabling is consumed or it times out after {timeOut}. Note: Disabling Extensions is a HiveMQ Enterprise feature, it will not work when using HiveMQ Community Edition.This can only be called once the container is started.
- Parameters:
hiveMQExtension- the extensiontimeout- the timeout- Returns:
- self
-
disableExtension
@NotNull public SELF disableExtension(@NotNull @NotNull HiveMQExtension hiveMQExtension)
Disables the extension with the corresponding {id}. This method blocks until the HiveMQ log for successful disabling is consumed or it times out after 60 seconds. Note: Disabling Extensions is a HiveMQ Enterprise feature, it will not work when using HiveMQ Community Edition.This can only be called once the container is started.
- Parameters:
hiveMQExtension- the extension- Returns:
- self
-
enableExtension
@NotNull public SELF enableExtension(@NotNull @NotNull HiveMQExtension hiveMQExtension, @NotNull @NotNull java.time.Duration timeout)
Enables the extension. This method blocks until the HiveMQ log for successful enabling is consumed or it times out after {timeOut}. Note: Enabling Extensions is a HiveMQ Enterprise feature, it will not work when using HiveMQ Community Edition. This can only be called once the container is started.- Parameters:
hiveMQExtension- the extensiontimeout- the timeout- Returns:
- self
-
enableExtension
@NotNull public SELF enableExtension(@NotNull @NotNull HiveMQExtension hiveMQExtension)
Enables the extension. This method blocks until the HiveMQ log for successful enabling is consumed or it times out after {timeOut}. Note: Enabling Extensions is a HiveMQ Enterprise feature, it will not work when using HiveMQ Community Edition. This can only be called once the container is started.- Parameters:
hiveMQExtension- the extension- Returns:
- self
-
silent
@NotNull public SELF silent(boolean silent)
Determines whether the stdout of the container is printed to System.out.- Parameters:
silent- whether the container is silent.- Returns:
- self
-
withControlCenter
@NotNull public SELF withControlCenter()
Enables connection to the HiveMQ Control Center on host port 8080. Note: the control center is a HiveMQ 4 Enterprise feature.Must be called before the container is started.
- Returns:
- self
-
withControlCenter
@NotNull public SELF withControlCenter(int controlCenterPort)
Enables connection to the HiveMQ Control Center on host port {controlCenterPort}. Note: the control center is a HiveMQ 4 Enterprise feature.Must be called before the container is started.
- Parameters:
controlCenterPort- the host post- Returns:
- self
-
getMqttPort
public int getMqttPort()
Get the mapped port for the MQTT port of the container.Must be called after the container is started.
- Returns:
- the port on the host machine for mqtt clients to connect
-
signExtension
protected void signExtension(@NotNull @NotNull java.lang.String extensionId, @NotNull @NotNull java.io.File jar)
-
-