Skip to content

[Fix #1240] Avoiding duplicate listeners#1241

Merged
fjtirado merged 1 commit intoserverlessworkflow:mainfrom
fjtirado:Fix_#1240
Mar 18, 2026
Merged

[Fix #1240] Avoiding duplicate listeners#1241
fjtirado merged 1 commit intoserverlessworkflow:mainfrom
fjtirado:Fix_#1240

Conversation

@fjtirado
Copy link
Collaborator

If a listener implemen equals, it will be honored.
Fix #1240

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds test coverage for listener management in the WorkflowApplication, specifically testing the sorting by priority and deduplication of listeners. The PR introduces new test listener implementations and modifies WorkflowApplication to wrap the listeners collection in a LinkedHashSet to enable automatic deduplication while preserving insertion order from the priority-based sorting.

Changes:

  • Add comprehensive test suite for WorkflowExecutionListener sorting and deduplication behavior
  • Introduce test listener implementations with different priority levels to exercise the listener management logic
  • Modify WorkflowApplication to use LinkedHashSet for listeners to ensure deduplication while maintaining priority-based order
  • Add mockito-core test dependency for test infrastructure

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
WorkflowListenerTest.java New test class that verifies listener sorting by priority and deduplication of duplicate listeners
TopPriorityListener.java New test listener implementation with higher priority (DEFAULT_PRIORITY - 1)
MediumPriorityListener.java New test listener implementation with standard priority, includes equals/hashCode for deduplication testing
LowestPriorityListener.java New test listener implementation with lower priority (DEFAULT_PRIORITY + 1)
WorkflowApplication.java Wraps listeners collection in LinkedHashSet to enable deduplication while preserving sorted order
pom.xml Adds mockito-core test dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

If a listener implemen equals, it will be honored.

Signed-off-by: fjtirado <ftirados@redhat.com>
@fjtirado fjtirado merged commit 8a44d11 into serverlessworkflow:main Mar 18, 2026
3 checks passed
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.

Check for listener duplicates

3 participants