Skip to content

New Module: HiveMQ - #4797

Merged
kiview merged 67 commits into
testcontainers:masterfrom
hivemq:hivemq-testcontainer
Feb 17, 2022
Merged

New Module: HiveMQ #4797
kiview merged 67 commits into
testcontainers:masterfrom
hivemq:hivemq-testcontainer

Conversation

@AcidSepp

Copy link
Copy Markdown

This brings HiveMQ's official Testcontainer to testcontainers-java.

Features:

  • Testing MQTT 3 and MQTT 5 client applications
  • Integration Testing of HiveMQ Extensions
  • HiveMQ specific WaitStrategy

Comment thread docs/modules/hivemq.md Outdated
@kiview

kiview commented Dec 22, 2021

Copy link
Copy Markdown
Member

@YannickWeber
CI is currently failing with

/home/runner/work/testcontainers-java/testcontainers-java/modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQExtension.java:27: error: cannot access com.hivemq.extension.sdk.api.ExtensionMain
import com.hivemq.extension.sdk.api.ExtensionMain;
                                   ^
  bad class file: /home/runner/.gradle/caches/modules-2/files-2.1/com.hivemq/hivemq-extension-sdk/4.4.4/f0c556c64f5ae71249381038f0f86e5ba7b9c4e9/hivemq-extension-sdk-4.4.4.jar(com/hivemq/extension/sdk/api/ExtensionMain.class)
    class file has wrong version 55.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.

Do you have specific Java requirements? Then we should check out using Gradle's Java Toolchain feature for the HiveMQ module. We currently use JDK8.

@AcidSepp

Copy link
Copy Markdown
Author

@YannickWeber CI is currently failing with

/home/runner/work/testcontainers-java/testcontainers-java/modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQExtension.java:27: error: cannot access com.hivemq.extension.sdk.api.ExtensionMain
import com.hivemq.extension.sdk.api.ExtensionMain;
                                   ^
  bad class file: /home/runner/.gradle/caches/modules-2/files-2.1/com.hivemq/hivemq-extension-sdk/4.4.4/f0c556c64f5ae71249381038f0f86e5ba7b9c4e9/hivemq-extension-sdk-4.4.4.jar(com/hivemq/extension/sdk/api/ExtensionMain.class)
    class file has wrong version 55.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.

Do you have specific Java requirements? Then we should check out using Gradle's Java Toolchain feature for the HiveMQ module. We currently use JDK8.

The problem is that the hivemq-extension-sdk requires Java 11. We solved the problem in the following way:

  • removed the compileOnly dependency on the hivemq-extension-sdk
  • configured gradle to execute the test with Java 11

What this achieves:

  • User that just want to use the HiveMQ Container can use Java 8.
  • Users that want to build HiveMQ Extensions on the fly are required to include the hivemq-extension-sdk as usual and are required to use Java 11 anyway

@kiview

kiview commented Dec 22, 2021

Copy link
Copy Markdown
Member

CI is currently failing in the Javadoc task for the HiveMQ module (https://github.com/testcontainers/testcontainers-java/runs/4609274189?check_suite_focus=true#step:7:70):

/home/runner/work/testcontainers-java/testcontainers-java/modules/hivemq/build/delombok/org/testcontainers/hivemq/HiveMQExtension.java:185: error: reference not found

         * This class MUST implement {@link com.hivemq.extension.sdk.api.ExtensionMain}.
> Task :hivemq:javadoc FAILED
                                            ^
/home/runner/work/testcontainers-java/testcontainers-java/modules/hivemq/build/delombok/org/testcontainers/hivemq/HiveMQExtension.java:189: error: reference not found
         * @throws IllegalArgumentException if the provides class does not implement {@link com.hivemq.extension.sdk.api.ExtensionMain}
                                                                                            ^
/home/runner/work/testcontainers-java/testcontainers-java/modules/hivemq/build/delombok/org/testcontainers/hivemq/HiveMQExtension.java:190: error: reference not found
         * @throws IllegalStateException if {@link com.hivemq.extension.sdk.api.ExtensionMain} is not found in the classpath
                                                   ^
3 errors

Comment thread modules/hivemq/gradle.properties Outdated
Comment thread modules/hivemq/build.gradle.kts Outdated
Comment thread modules/hivemq/gradle.properties Outdated
@kiview kiview mentioned this pull request Jan 11, 2022
Comment thread docs/modules/hivemq.md Outdated
Comment thread modules/hivemq/settings.gradle.kts Outdated
Comment thread modules/hivemq/build.gradle.kts Outdated
Comment thread modules/hivemq/build.gradle Outdated
Comment thread modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java Outdated

@rnorth rnorth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added some comments but will try and have another look tomorrow!

Comment thread docs/modules/hivemq.md Outdated
Comment thread docs/modules/hivemq.md Outdated
Comment thread mkdocs.yml
Comment thread modules/hivemq/.gitignore Outdated
Comment thread modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java Outdated
Comment thread modules/hivemq/src/test/resources/logback-test.xml Outdated
Comment thread modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java Outdated
Comment thread modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java Outdated
Comment thread modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQExtension.java Outdated
Comment thread modules/hivemq/src/test/resources/logback-test.xml Outdated
Comment thread modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java Outdated
alter container command only if prepackaged extensions need to be removed
@kiview kiview mentioned this pull request Feb 17, 2022
@kiview kiview added this to the next milestone Feb 17, 2022
@kiview

kiview commented Feb 17, 2022

Copy link
Copy Markdown
Member

Thanks to everyone involved and especially @YannickWeber for your patience. This was indeed a massive PR, but I am very happy we reworked it together and that we get a great new module into Testcontainers. Thanks!

@kiview
kiview merged commit bfb8cec into testcontainers:master Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants