Skip to content

Migrate JGroups unit tests from Ant+TestNG to Maven Surefire+TestNG - #1040

Open
akbar1214 wants to merge 6 commits into
belaban:masterfrom
akbar1214:master
Open

Migrate JGroups unit tests from Ant+TestNG to Maven Surefire+TestNG#1040
akbar1214 wants to merge 6 commits into
belaban:masterfrom
akbar1214:master

Conversation

@akbar1214

@akbar1214 akbar1214 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

This PR migrates JGroups unit test execution from the Ant-based TestNG runner to Maven Surefire + TestNG, while keeping the existing directory structure and Ant build intact.
What changed

  • Added a byteman.version property and centralized both byteman and byteman-bmunit dependencies on it.

  • Added 12 TestNG XML suite files under src/test/resources/testng/, mirroring the existing Ant suites:

  • functional, encrypt, byteman, jdbc, stack-independent, time-sensitive, udp, udp-new, tcp, tcp-new, tcp-nio, tcp-nio-new

  • Each suite defines the correct groups, exclusions, parallelism, thread count, and channel.conf parameter where needed.

  • Surefire configuration

    • Replaced the placeholder Surefire config with 12 self-contained executions.
    • Each execution supplies its own suite XML, system properties, port ranges, and JVM arguments.
    • Removed the build.properties dependency and inlined test-relevant properties.
    • Added tests/util as a test source so the custom JUnitXMLReporter listener is available to Surefire.
    • Suppressed the default default-test execution so mvn test runs only the defined suites.
  • Removed maven-antrun-plugin

    • Replaced the Ant-based XML schema generation with exec-maven-plugin.
    • Copied the generated XSD files with maven-resources-plugin.
    • Removed the plugin from .
    • Keystore files are created on demand by the encrypt tests via KeyStoreGenerator, so no separate lifecycle step is needed.

How to run
mvn test # all suites sequentially (ant target all-tests didn't run jdbc which is bit different currently)
mvn surefire:test@ # single suite, e.g. functional, encrypt

Part of JGRP-2499

Create 12 TestNG suite files under src/test/resources/testng/ matching
the Ant test suite configurations:

- functional, encrypt, byteman, jdbc, stack-independent, time-sensitive
- udp, udp-new, tcp, tcp-new, tcp-nio, tcp-nio-new
Add a maven-antrun-plugin execution that runs the existing Ant
make-keystore target during the initialize phase. This ensures the
keystore/ directory is created before tests run, matching the Ant
build behavior without changing the test execution logic.
Configure maven-surefire-plugin with 12 self-contained executions that
mirror the Ant test suite definitions (functional, encrypt, byteman,
jdbc, stack-independent, time-sensitive, udp, udp-new, tcp, tcp-new,
tcp-nio, tcp-nio-new).

Each execution specifies its own TestNG suite XML, groups, thread
count, port ranges, and JVM arguments. The channel.conf parameter is
passed via TestNG <parameter> so it is picked up by @parameters in
ChannelTestBase.

Also:
- Remove the <systemPropertiesFile>build.properties</systemPropertiesFile>
  dependency and inline test properties in each execution.
- Add tests/util as a test source so JUnitXMLReporter is available on
  the Surefire classpath.
- Replaced maven-antrun-plugin with exec-maven-plugin and
  maven-resources-plugin for XML schema generation and XSD handling
- XMLSchemaGenerator now creates output directories when missing
- Suppressed the default Surefire default-test execution so mvn test
  only runs the 12 defined TestNG suite executions
- Removed maven-antrun-plugin from pluginManagement
- Updated migration documentation
@belaban

belaban commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Hi Akbar
thanks for your contribution! I hope to have time to take a look at this this week.

@rhusar

rhusar commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Letting CI run in the meantime - but note this does not actually run the tests.

@akbar1214

Copy link
Copy Markdown
Contributor Author

@belaban by any chance did you get time to look into this ?

@belaban

belaban commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Not yet, it's on my todo list...

@belaban

belaban commented Aug 21, 2026

Copy link
Copy Markdown
Owner

I took a quick look: mvn surefire:test@functional has the right number of tests (1701) but 4 failure compared to 0 with ant.
I noticed that UnicastRequestTest has the following failure:

[ERROR] org.jgroups.blocks.UnicastRequestTest.testMissingResponseDueToMergeViewUnicast -- Time elapsed: 0.136 s <<< FAILURE!
java.util.concurrent.TimeoutException: 
Timeout 10000 kicked in, views are:
A: [A|3] (4) [A, A, B, B]
B: [A|3] (4) [A, A, B, B]

It is almost as if the singleThreaded=true directive is ignored and multiple tests are run in parallel.
I'll investigate more next week...

@belaban

belaban commented Aug 21, 2026

Copy link
Copy Markdown
Owner

This surefire output (HTML file) looks hideous! Is there a way to get output from JUnitXmlReporter instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants