Skip to content

feat(integrationtests): base AbstractIntegrationTest class decoupled from Axon Server#4413

Merged
smcvb merged 7 commits intoaxon-5.1.xfrom
test/axoniq-framework-test
Apr 16, 2026
Merged

feat(integrationtests): base AbstractIntegrationTest class decoupled from Axon Server#4413
smcvb merged 7 commits intoaxon-5.1.xfrom
test/axoniq-framework-test

Conversation

@MateuszNaKodach
Copy link
Copy Markdown
Contributor

@MateuszNaKodach MateuszNaKodach commented Apr 14, 2026

Summary

Refactor the integration test hierarchy in integrationtests/ so that the same domain tests (administration, student, course) run against multiple infrastructure backends. Today every base class (AbstractAxonServerIT, AbstractAxonServerIntegrationTest) hard-codes Axon Server; there is no way to verify the same behavior against the framework's in-memory defaults, and there was no extension point for future event stores ( like Postgres/JDBC/JPA). This PR replaces that coupling with a TestInfrastructure strategy and a single infrastructure-agnostic base.

Changes

Infrastructure layer (new)

  • testsuite/AbstractIntegrationTest.java — infrastructure-agnostic base replacing AbstractAxonServerIT/AbstractAxonServerIntegrationTest. Exposes testInfrastructure() and applicationConfigurer() as abstract hooks. createId() uses UUID.randomUUID() to avoid collisions under JUnit's PER_METHOD lifecycle.
  • testsuite/infrastructure/TestInfrastructure.java — strategy with start() / configureInfrastructure(...) / purgeData() / stop().
  • testsuite/infrastructure/AxonServerTestInfrastructure.java — shared static final AxonServerContainer with withReuse(true); stop() is a deliberate no-op (Testcontainers + Ryuk handle JVM-exit cleanup).
  • testsuite/infrastructure/InMemoryTestInfrastructure.java — disables the AxonServer enhancer by FQCN string, not Class reference, so this variant compiles and runs even without axon-server-connector on the classpath.

Domain tests

  • 16 domain test classes made abstract (5 administration, 10 student, 1 course) with thin ...AxonServerIT / ...InMemoryIT leaf pairs (34 leaves total).
  • CommandPayloadConversionIT stays AxonServer-only: SimpleCommandBus does not convert payloads, so there is no in-memory equivalent.
  • purgeEventStorage() call sites renamed to purgeData(), now delegated through the infrastructure strategy.

Legacy cleanup

  • Deleted AbstractAxonServerIT and AbstractAxonServerIntegrationTest.

Test assertion fix

  • MultiEntityCommandHandlingComponentIT / CompoundEntityIdentifierCommandHandlingComponentIT: dropped .isInstanceOf(CommandExecutionException.class) assertions. That wrapper is added by the distributed command bus; SimpleCommandBus surfaces the raw exception. Removing the type check lets the same assertion pass on both backends; the message assertion still validates behavior.

…Axon Server

Replace AbstractAxonServerIT and AbstractAxonServerIntegrationTest with
an infrastructure-agnostic AbstractIntegrationTest base class backed by
a TestInfrastructure strategy interface.

AxonServerTestInfrastructure wraps the existing Testcontainers setup;
InMemoryTestInfrastructure disables the AxonServer enhancer by FQCN
string so the framework's default SimpleCommandBus/InMemoryEventStorageEngine
are used without any container dependency.

All domain test classes in the administration, student, and course subtrees
are made abstract. Each gets a concrete ...AxonServerIT and ...InMemoryIT
leaf that pins the infrastructure. CommandPayloadConversionIT remains
concrete and AxonServer-only since payload conversion is a distributed-bus
concern that has no in-memory equivalent.
…n in AbstractIntegrationTest - less collision risk
Merge the abstract createTestInfrastructure() factory and the cached
testInfrastructure() accessor into a single abstract testInfrastructure()
method. Leaf classes already hold a private static final singleton, so the
cache field (and its teardown bookkeeping) was redundant.

Rename createConfigurer() to applicationConfigurer() to match the noun-style
accessor naming and read more naturally at call sites. Also drop the unused
logger field on AbstractIntegrationTest.
@MateuszNaKodach MateuszNaKodach changed the title Test/axoniq framework test feat(integrationtests): base AbstractIntegrationTest class decopuled from Axon Server Apr 14, 2026
…cause it's thrown by `DistirubtedEventBus` only, not by the `SimpleCommandBus`
@MateuszNaKodach MateuszNaKodach self-assigned this Apr 14, 2026
@MateuszNaKodach MateuszNaKodach added Type: Feature Use to signal an issue is completely new to the project. Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. labels Apr 14, 2026
@MateuszNaKodach MateuszNaKodach added this to the Release 5.1.0 milestone Apr 14, 2026
@MateuszNaKodach MateuszNaKodach marked this pull request as ready for review April 14, 2026 20:44
@MateuszNaKodach MateuszNaKodach requested a review from a team as a code owner April 14, 2026 20:44
@MateuszNaKodach MateuszNaKodach requested review from abuijze, hatzlj, hjohn and smcvb and removed request for a team April 14, 2026 20:44
@sonarqubecloud
Copy link
Copy Markdown

@smcvb smcvb changed the title feat(integrationtests): base AbstractIntegrationTest class decopuled from Axon Server feat(integrationtests): base AbstractIntegrationTest class decoupled from Axon Server Apr 15, 2026
Copy link
Copy Markdown
Contributor

@smcvb smcvb left a comment

Choose a reason for hiding this comment

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

Couple of nits here and there on docs. Biggest pointer is making the abstract test suite classes public, otherwise there's no value in this setup I am afraid. Lastly, it might be good to do a pass through the student, course, and administration domains in this project, to ensure those classes are public as well. I can imagine we may have tests in the future that are specific for Axoniq Framework that require access to the internals too.

* environments where the connector JAR is absent.
*/
private static final String AXON_SERVER_ENHANCER_FQCN =
"org.axonframework.axonserver.connector.AxonServerConfigurationEnhancer";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be

Suggested change
"org.axonframework.axonserver.connector.AxonServerConfigurationEnhancer";
"io.axoniq.framework.axonserver.connector.configuration.AxonServerConfigurationEnhancer";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not yet @smcvb, because it's still in the repostiory. I'm going to change it after the AxonServer removal form THIS repository, or for the transition period I will disable both.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sounds good to me!

…refine AxonServer configuration

Make integration test classes explicitly `public abstract` for clarity. Enhance documentation with `@author` annotations and refine AxonServer enhancer handling by introducing a transitional constant. Update AxonServer container to use the `latest` tag.
@MateuszNaKodach MateuszNaKodach requested a review from smcvb April 16, 2026 08:01
Copy link
Copy Markdown
Contributor

@smcvb smcvb left a comment

Choose a reason for hiding this comment

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

My concerns have been addressed, hence I'm approving this pull request.

@smcvb smcvb merged commit add2e70 into axon-5.1.x Apr 16, 2026
6 of 7 checks passed
@smcvb smcvb deleted the test/axoniq-framework-test branch April 16, 2026 08:58
smcvb added a commit that referenced this pull request Apr 16, 2026
Remove AxonServer specific integration tests again. With #4413 implemented, the test suites can be implemented differently depending on the available infrastructure. As we're moving Axon Server entirely to Axoniq Framework, any Axon Server versions of the integration tests should be ported entirely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. Type: Feature Use to signal an issue is completely new to the project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants