Skip to content

HiveMQ Testcontainer 1.1.0 Released

by HiveMQ Team
2 min read

HiveMQ Testcontainer 1.1.0

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

  • Automatic packaging and loading of HiveMQ extensions with Maven

  • Enabling and disabling of extensions that are loaded from a file

Loading and packaging a HiveMQ extension Maven project

JUnit 4

@Rule
public final @NotNull HiveMQTestContainerRule extension =
    new HiveMQTestContainerRule()
        .withExtension(new MavenHiveMQExtensionSupplier("path/to/extension/pom.xml").get());

JUnit 5

@RegisterExtension
public final @NotNull HiveMQTestContainerExtension extension =
        new HiveMQTestContainerExtension()
            .withExtension(new MavenHiveMQExtensionSupplier("path/to/extension/pom.xml").get());
            


Using the HiveMQ Testcontainer inside a HiveMQ extension Maven project

If you are using the HiveMQ Testcontainer inside the Maven project of your HiveMQ extension, you can now use MavenHiveMQExtensionSupplier.direct()to load your extension directly into the HiveMQ Testcontainer.

JUnit 4

    @Rule
    public final @NotNull HiveMQTestContainerRule extension =
        new HiveMQTestContainerRule()
            .withExtension(MavenHiveMQExtensionSupplier.direct().get());

JUnit 5

    @RegisterExtension
    public final @NotNull HiveMQTestContainerExtension extension =
        new HiveMQTestContainerExtension()
            .withExtension(MavenHiveMQExtensionSupplier.direct().get());


Enabling and disabling HiveMQ extensions that are loaded from a file

It is now possible to disable and enable the HiveMQ extensions that are loaded from a file during runtime.

JUnit 4

@Rule
public final @NotNull HiveMQTestContainerRule rule =
        new HiveMQTestContainerRule("hivemq/hivemq4", "latest")
            .withExtension(new File("src/test/resources/modifier-extension"));
            
@Test
void test_disable_enable_extension() throws ExecutionException, InterruptedException {
    extension.disableExtension("Modifier Extension", "modifier-extension");
    extension.enableExtension("Modifier Extension", "modifier-extension");
}

JUnit 5

@RegisterExtension
public final @NotNull HiveMQTestContainerExtension extension =
        new HiveMQTestContainerExtension("hivemq/hivemq4", "latest")
            .withExtension(new File("src/test/resources/modifier-extension"));
            
@Test
void test_disable_enable_extension() throws ExecutionException, InterruptedException {
    extension.disableExtension("Modifier Extension", "modifier-extension");
    extension.enableExtension("Modifier Extension", "modifier-extension");
}
    

You can also disable and enable HiveMQ extensions that are loaded as Maven projects:

JUnit 4

@Rule
public final @NotNull HiveMQTestContainerRule rule =
    new HiveMQTestContainerRule()
        .withExtension(MavenHiveMQExtensionSupplier.direct().get());
            
@Test
void test_disable_enable_extension() throws ExecutionException, InterruptedException {
    extension.disableExtension("Maven Extension", "maven-extension");
    extension.enableExtension("Maven Extension", "maven-extension");
}

JUnit 5

@RegisterExtension
public final @NotNull HiveMQTestContainerExtension extension =
    new HiveMQTestContainerExtension()
        .withExtension(MavenHiveMQExtensionSupplier.direct().get());
            
@Test
void test_disable_enable_extension() throws ExecutionException, InterruptedException {
    extension.disableExtension("Maven Extension", "maven-extension");
    extension.enableExtension("Maven Extension", "maven-extension");
}

HiveMQ Team

The HiveMQ team loves writing about MQTT, Sparkplug, Industrial IoT, protocols, how to deploy our platform, and more. We focus on industries ranging from energy, to transportation and logistics, to automotive manufacturing. Our experts are here to help, contact us with any questions.

Related content:

HiveMQ logo
Review HiveMQ on G2