Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2129] Fine tune Repository registration in the AggregateTestFixture #2552

Merged
merged 2 commits into from
Jan 16, 2023

Conversation

smcvb
Copy link
Member

@smcvb smcvb commented Jan 6, 2023

This pull request adjusts two pointers around the AggregateTestFixture's Repository usage:

  1. It ensures the registered Repository is added to the resources collection of the fixture. By adding it to the resources, users are able to wire the Repository inside the aggregate or registered annotated command handling components. Since the framework already does this in a production environment, this adjustment allows the fixture to more closely align with the a production setup,
  2. A FixtureExecutionException is thrown when a RepositoryProvider, ParameterResolverFactory, HandlerDefinition or HandlerEnhancerDefinition is registered while the Repository is already defined for the fixture. Since all four of these components impact the Repository within the fixture, none of these operation should be allowed once the Repository is already retrieved (through AggregateTestFixture#getRepository, as this builds the default Repository) or when a custom version is registered (through AggregateTestFixture#registerRepository).

By doing the above, the pull request resolves #2129.

- Make sure the registered Repository is part of the fixture's resources
 In doing so, users can wire the Repository within the classes being
 tested like they would in a regular system.
- Throw a FixtureExecutionException whenever certain registration
methods are invoked that would impact the constructed outcome of a
Repository. Do this both when a Repository is consciously registered and
 when it is retrieved. The former should force the users to register
 those components earlier *and* on the Repository directly. The latter
 is to guard the user against assuming a wrong format of the Repository.

#2129
- Replace AxonConfigurationException for FixtureExecutionException
- Adjust indentation

#2129
@smcvb smcvb added Priority 4: Would Lowest priority. Would-be-nice to include issues when time allows it. Type: Enhancement Use to signal an issue enhances an already existing feature of the project. Status: In Progress Use to signal this issue is actively worked on. labels Jan 6, 2023
@smcvb smcvb added this to the Release 4.7.0 milestone Jan 6, 2023
@smcvb smcvb requested a review from a team January 6, 2023 13:40
@smcvb smcvb self-assigned this Jan 6, 2023
@smcvb smcvb requested review from gklijs and CodeDrivenMitch and removed request for a team January 6, 2023 13:40
Copy link
Member

@gklijs gklijs left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@smcvb smcvb merged commit c27875f into master Jan 16, 2023
@smcvb smcvb deleted the enhancement/2129/fixture-finalized-validation branch January 16, 2023 12:35
@smcvb smcvb added Status: Resolved Use to signal that work on this issue is done. and removed Status: In Progress Use to signal this issue is actively worked on. labels Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority 4: Would Lowest priority. Would-be-nice to include issues when time allows it. Status: Resolved Use to signal that work on this issue is done. Type: Enhancement Use to signal an issue enhances an already existing feature of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AggregateTestFixture creates EventSourcingRepository and does not invalidate it
3 participants