Class HiveMQTestContainerCore<SELF extends HiveMQTestContainerCore<SELF>>

    • Constructor Detail

      • HiveMQTestContainerCore

        public HiveMQTestContainerCore()
    • Method Detail

      • waitForExtension

        @NotNull
        public SELF waitForExtension​(@NotNull
                                     @NotNull String extensionName)
        Adds a wait condition for the extension with this name.

        Must be called before the container is started.

        Parameters:
        extensionName - the extension to wait for
        Returns:
        self
      • withDebugging

        @NotNull
        public SELF withDebugging()
        Enables the possibility for remote debugging clients to connect.

        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 MountableFile mountableExtension)
        Puts the given extension folder into '/opt/hivemq/extensions/{directory-name}' inside the container. It must at least contain a valid hivemq-extension.xml and a valid extension.jar in order to be executed. The directory-name is taken from the id defined in the hivemq-extension.xml.

        Must be called before the container is started.

        Parameters:
        mountableExtension - the extension folder on the host machine
        Returns:
        self
      • withoutPrepackagedExtensions

        @NotNull
        public SELF withoutPrepackagedExtensions​(@NotNull
                                                 @NotNull String... extensionIds)
        Removes the specified prepackaged extension folders from '/opt/hivemq/extensions' before the container is built. Note: this creates a custom docker image.

        Must be called before the container is started.

        Parameters:
        extensionIds - the prepackaged extensions to remove
        Returns:
        self
      • withoutPrepackagedExtensions

        @NotNull
        public SELF withoutPrepackagedExtensions()
        Removes all prepackaged extension folders from '/opt/hivemq/extensions' before the container is built. Note: this creates a custom docker image.

        Must be called before the container is started.

        Returns:
        self
      • withLicense

        @NotNull
        public SELF withLicense​(@NotNull
                                @NotNull MountableFile mountableLicense)
        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:
        mountableLicense - the license file on the host machine
        Returns:
        self
      • withHiveMQConfig

        @NotNull
        public SELF withHiveMQConfig​(@NotNull
                                     @NotNull MountableFile mountableConfig)
        Overwrites the HiveMQ configuration in '/opt/hivemq/conf/' inside the container.

        Must be called before the container is started.

        Parameters:
        mountableConfig - the config file on the host machine
        Returns:
        self
      • withFileInExtensionHomeFolder

        @NotNull
        public SELF withFileInExtensionHomeFolder​(@NotNull
                                                  @NotNull MountableFile file,
                                                  @NotNull
                                                  @NotNull 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 MountableFile file,
                                                  @NotNull
                                                  @NotNull String extensionId,
                                                  @NotNull
                                                  @NotNull 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 MountableFile 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 MountableFile mountableFile,
                                         @NotNull
                                         @NotNull 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:
        mountableFile - the file on the host machine
        pathInHomeFolder - the path
        Returns:
        self
      • disableExtension

        public void disableExtension​(@NotNull
                                     @NotNull String extensionName,
                                     @NotNull
                                     @NotNull String extensionDirectory,
                                     @NotNull
                                     @NotNull Duration timeout)
                              throws TimeoutException
        Disables the extension with the given name and extension directory name. 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 the HiveMQ Community Edition.

        This can only be called once the container is started.

        Parameters:
        extensionName - the name of the extension to disable
        extensionDirectory - the name of the extension's directory
        timeout - the timeout
        Throws:
        TimeoutException - if the extension was not disabled within the configured timeout
        Since:
        1.1.0
      • disableExtension

        public void disableExtension​(@NotNull
                                     @NotNull String extensionName,
                                     @NotNull
                                     @NotNull String extensionDirectory)
                              throws TimeoutException
        Disables the extension with the given name and extension directory name. 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 the HiveMQ Community Edition.

        This can only be called once the container is started.

        Parameters:
        extensionName - the name of the extension to disable
        extensionDirectory - the name of the extension's directory
        Throws:
        TimeoutException - if the extension was not disabled within 60 seconds
        Since:
        1.1.0
      • disableExtension

        public void disableExtension​(@NotNull
                                     @NotNull HiveMQExtension hiveMQExtension,
                                     @NotNull
                                     @NotNull Duration timeout)
                              throws TimeoutException
        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 the HiveMQ Community Edition.

        This can only be called once the container is started.

        Parameters:
        hiveMQExtension - the extension
        timeout - the timeout
        Throws:
        TimeoutException - if the extension was not disabled within the configured timeout
        Since:
        1.1.0
      • disableExtension

        public void disableExtension​(@NotNull
                                     @NotNull HiveMQExtension hiveMQExtension)
                              throws TimeoutException
        Disables the extension. 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 the HiveMQ Community Edition.

        This can only be called once the container is started.

        Parameters:
        hiveMQExtension - the extension
        Throws:
        TimeoutException - if the extension was not disabled within 60 seconds
        Since:
        1.1.0
      • enableExtension

        public void enableExtension​(@NotNull
                                    @NotNull String extensionName,
                                    @NotNull
                                    @NotNull String extensionDirectory,
                                    @NotNull
                                    @NotNull Duration timeout)
                             throws TimeoutException
        Enables the extension with the given name and extension directory name. 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 the HiveMQ Community Edition.

        This can only be called once the container is started.

        Parameters:
        extensionName - the name of the extension to disable
        extensionDirectory - the name of the extension's directory
        timeout - the timeout
        Throws:
        TimeoutException - if the extension was not enabled within the configured timeout
        Since:
        1.1.0
      • enableExtension

        public void enableExtension​(@NotNull
                                    @NotNull String extensionName,
                                    @NotNull
                                    @NotNull String extensionDirectory)
                             throws TimeoutException
        Enables the extension with the given name and extension directory name. This method blocks until the HiveMQ log for successful enabling is consumed or it times out after 60 seconds. Note: Enabling Extensions is a HiveMQ Enterprise feature, it will not work when using the HiveMQ Community Edition.

        This can only be called once the container is started.

        Parameters:
        extensionName - the name of the extension to disable
        extensionDirectory - the name of the extension's directory
        Throws:
        TimeoutException - if the extension was not enabled within 60 seconds
        Since:
        1.1.0
      • enableExtension

        public void enableExtension​(@NotNull
                                    @NotNull HiveMQExtension hiveMQExtension,
                                    @NotNull
                                    @NotNull Duration timeout)
                             throws TimeoutException
        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 the HiveMQ Community Edition.

        This can only be called once the container is started.

        Parameters:
        hiveMQExtension - the extension
        timeout - the timeout
        Throws:
        TimeoutException - if the extension was not enabled within the configured timeout
        Since:
        1.1.0
      • enableExtension

        public void enableExtension​(@NotNull
                                    @NotNull HiveMQExtension hiveMQExtension)
                             throws TimeoutException
        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 the HiveMQ Community Edition.

        This can only be called once the container is started.

        Parameters:
        hiveMQExtension - the extension
        Throws:
        TimeoutException - if the extension was not enabled within 60 seconds
        Since:
        1.1.0
      • 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
      • 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