HiveMQ Testcontainer 1.3.0 Released

HiveMQ Testcontainer 1.3.0 Released

author Yannick Weber

Written by Yannick Weber

Category: HiveMQ Testing Test Container MQTT Client

Published: December 16, 2020


The HiveMQ team is pleased to announce the release of HiveMQ Testcontainer 1.3.0. This new version adds the following features:

  • Loading of Gradle-based HiveMQ Extensions
  • API for removing prepacked HiveMQ Extensions

Load an extension from a gradle project

You can package and load an extension from a Gradle project, by providing the location of the Gradle project:

JUnit 4

1
2
3
4
5
@Rule
public final @NotNull HiveMQTestContainerRule rule =
    new HiveMQTestContainerRule()
        .withExtension(new GradleHiveMQExtensionSupplier(new File("path/to/extension/")).get());
        

JUnit 5

1
2
3
4
5
@RegisterExtension
public final @NotNull HiveMQTestContainerExtension extension =
  new HiveMQTestContainerExtension()
      .withExtension(new GradleHiveMQExtensionSupplier(new File("path/to/extension/")).get());
            

If your current project is the HiveMQ Extension you want to load into the HiveMQ Testcontainer, you can simply use:

1
GradleHiveMQExtensionSupplier.direct()

Remove prepackaged HiveMQ Extensions

Since HiveMQ’s 4.4 release, HiveMQ Docker images come with the HiveMQ Extension for Kafka, the HiveMQ Enterprise Bridge Extension and the HiveMQ Enterprise Security Extension. These Extensions are disabled by default, but sometimes you may need to remove them before the container starts.

JUnit4

Remove all prepackaged extensions:

1
2
3
4
@Rule
final HiveMQTestContainerRule container = new HiveMQTestContainerRule("hivemq/hivemq4", "4.4.4")
    .withoutPrepackagedExtensions();
    

Remove specific prepackaged extensions:

1
2
3
4
@Rule
final HiveMQTestContainerRule container = new HiveMQTestContainerRule("hivemq/hivemq4", "4.4.4")
    .withoutPrepackagedExtensions("hivemq-kafka-extension");
        

JUnit5

Remove all prepackaged extensions:

1
2
3
4
@RegisterExtension
final HiveMQTestContainerExtension container = new HiveMQTestContainerExtension("hivemq/hivemq4", "4.4.4")
    .withoutPrepackagedExtensions();
        

Remove specific prepackaged extensions:

1
2
3
4
@RegisterExtension
final HiveMQTestContainerExtension container = new HiveMQTestContainerExtension("hivemq/hivemq4", "4.4.4")
    .withoutPrepackagedExtensions("hivemq-kafka-extension");
    
author Yannick Weber

About Yannick Weber

Yannick is a Senior Software Engineer and one of the core members of HiveMQ’s product development team. He is focusing on quality development of HiveMQ’s many tools and extensions. In addition, he is the maintainer of the HiveMQ module in the testcontainers-java project.

mail icon Contact Yannick
newer posts Trends to watch in 2021 for MQTT and HiveMQ
MQTT Sparkplug Architecture older posts