Class HiveMQTestContainerCore<SELF extends 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>
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.testcontainers.containers.GenericContainer

        org.testcontainers.containers.GenericContainer.AbstractWaitStrategy
      • Nested classes/interfaces inherited from interface org.testcontainers.containers.Container

        org.testcontainers.containers.Container.ExecResult
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CONTROL_CENTER_PORT  
      static int DEBUGGING_PORT  
      static int MQTT_PORT  
      • Fields inherited from class org.testcontainers.containers.GenericContainer

        CONTAINER_RUNNING_TIMEOUT_SEC, containerId, containerName, dependencies, dockerClient, dockerDaemonInfo, INTERNAL_HOST_HOSTNAME, waitStrategy
      • Fields inherited from interface org.testcontainers.containers.ContainerState

        STATE_HEALTHY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SELF disableExtension​(@NotNull HiveMQExtension hiveMQExtension)
      Disables the extension with the corresponding {id}.
      SELF disableExtension​(@NotNull HiveMQExtension hiveMQExtension, @NotNull java.time.Duration timeout)
      /** Disables the extension.
      SELF enableExtension​(@NotNull HiveMQExtension hiveMQExtension)
      Enables the extension.
      SELF enableExtension​(@NotNull HiveMQExtension hiveMQExtension, @NotNull java.time.Duration timeout)
      Enables the extension.
      int getMqttPort()
      Get the mapped port for the MQTT port of the container.
      protected void signExtension​(@NotNull java.lang.String extensionId, @NotNull java.io.File jar)  
      SELF silent​(boolean silent)
      Determines whether the stdout of the container is printed to System.out.
      SELF withControlCenter()
      Enables connection to the HiveMQ Control Center on host port 8080.
      SELF withControlCenter​(int controlCenterPort)
      Enables connection to the HiveMQ Control Center on host port {controlCenterPort}.
      SELF withDebugging()
      Enables the possibility for remote debugging clients to connect on host port 9000.
      SELF withDebugging​(int debuggingPortHost)
      Enables the possibility for remote debugging clients to connect.
      SELF withExtension​(@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.
      SELF withExtension​(@NotNull java.io.File extensionDir)
      Puts the given extension folder into '/opt/hivemq/extensions/{extension-id}' inside the container.
      SELF withFileInExtensionHomeFolder​(@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}/'.
      SELF withFileInExtensionHomeFolder​(@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.
      SELF withFileInHomeFolder​(@NotNull java.io.File file)
      Puts the given file into the root of the HiveMQ home folder '/opt/hivemq/'.
      SELF withFileInHomeFolder​(@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}'.
      SELF withHiveMQConfig​(@NotNull java.io.File config)
      Overwrites the HiveMQ configuration in '/opt/hivemq/conf/' inside the container.
      SELF withLicense​(@NotNull java.io.File license)
      Puts the given license into '/opt/hivemq/license/' inside the container.
      SELF withLogLevel​(@NotNull org.slf4j.event.Level level)
      Sets the logging Level inside 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
      • Methods inherited from interface org.testcontainers.lifecycle.Startable

        close
    • Constructor Detail

      • HiveMQTestContainerCore

        public HiveMQTestContainerCore()
      • HiveMQTestContainerCore

        public HiveMQTestContainerCore​(@NotNull
                                       @NotNull java.lang.String image,
                                       @NotNull
                                       @NotNull java.lang.String tag)
    • 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 logging Level inside the container.

        Must be called before the container is started.

        Parameters:
        level - the Level
        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 - the HiveMQExtension of 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 machine
        extensionId - 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 machine
        extensionId - the extension
        pathInExtensionHome - 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 machine
        pathInHomeFolder - 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 extension
        timeout - 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 extension
        timeout - 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)