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

Sub-events and V2 extensions #2238

Merged
merged 30 commits into from
Jul 5, 2023
Merged

Sub-events and V2 extensions #2238

merged 30 commits into from
Jul 5, 2023

Conversation

tomakehurst
Copy link
Member

This introduces some architectural changes which add the concept of sub-events to ServeEvent, while making the current ServeEvent visible throughout the request processing code.

SubEvents can be used to report information of interest created during request processing e.g. errors thrown by matchers. Adding sub-events in this manner means that this information can be surfaced via the request log part of WireMock's API, whereas currently it is necessary to have access to the log.

The diff report generated by WireMock is now appended as a sub-event so this is visible in the log in addition to the HTTP response.

All of the extension points that affect request processing have been deprecated and replaced with V2 versions that take ServeEvent as a parameter.

References

See discussion in #1512

Submitter checklist

  • The PR request is well described and justified, including the body and the references
  • The PR title represents the desired changelog entry
  • The repository's code style is followed (see the contributing guide)
  • Test coverage that demonstrates that the change works as expected
  • For new features, there's necessary documentation in this pull request or in a subsequent PR to wiremock.org

Tom Akehurst and others added 30 commits June 15, 2023 19:03
… ServeEvent as a method param) extension point and migrated templating to use this
…enters don't need loads of redundant methods
…menters don't need loads of redundant methods
…y can later be attached to the ServeEvent. Modified the core matchers so that they add errors/warnings as sub events (in addition to logging them via notifier()).
…ment) to allow generic listeners to be written then bound to specific request phases + parameters
…n be triggered after the client has returned thus causing a race condition with a straight assertion
… service is created at startup time from which extensions are loaded. This will allow dependency injection to be added in a single place.
…ssible to inject core WireMock service classes.
…factory classes with a WireMockServices parameter
@tomakehurst tomakehurst marked this pull request as ready for review July 5, 2023 10:55
@tomakehurst tomakehurst requested a review from a team as a code owner July 5, 2023 10:55
@tomakehurst tomakehurst merged commit 6e8b845 into master Jul 5, 2023
7 checks passed
@tomakehurst tomakehurst deleted the new-extension-model-spike branch July 5, 2023 16:22
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.

None yet

3 participants