ARTEMIS-5997 refactor SimpleAddressManager.getMatchingQueue#6364
Merged
tabish121 merged 1 commit intoapache:mainfrom Apr 14, 2026
Merged
ARTEMIS-5997 refactor SimpleAddressManager.getMatchingQueue#6364tabish121 merged 1 commit intoapache:mainfrom
tabish121 merged 1 commit intoapache:mainfrom
Conversation
tabish121
reviewed
Apr 14, 2026
| SimpleAddressManager am = getSimpleAddressManager(); | ||
| am.addBinding(getLocalQueueBinding(addressName, RoutingType.ANYCAST)); | ||
|
|
||
| assertNotNull(am.getMatchingQueue(addressName, RoutingType.ANYCAST)); |
Contributor
There was a problem hiding this comment.
Returning non-null isn't really checking if it returns what you expect it should, seems like these methods should be a little bit of inspection on what comes back compared to what they added to be sure its doing what it is supposed to do.
| am.addBinding(getLocalQueueBinding(addressName, RoutingType.ANYCAST)); | ||
| am.addBinding(getLocalQueueBinding(addressName, RoutingType.MULTICAST)); | ||
|
|
||
| assertNotNull(am.getMatchingQueue(addressName, RoutingType.ANYCAST)); |
Contributor
There was a problem hiding this comment.
As above it might be good to validate that what it got back matches the indicated preference for routing type
| SimpleAddressManager am = getSimpleAddressManager(); | ||
| am.addBinding(getLocalQueueBinding(addressName, RoutingType.MULTICAST)); | ||
|
|
||
| assertNull(am.getMatchingQueue(addressName, RoutingType.ANYCAST)); |
Contributor
There was a problem hiding this comment.
Similar to above, this returns nothing, but if we gave it good data would it return the thing we expect?
Contributor
Author
There was a problem hiding this comment.
The "good data" variation is tested by testCorrectNameCorrectRoutingTypeSingleQueue.
The getMatchingQueue method on SimpleAddressManager is overloaded, but only one of them is actually necessary. The three-parameter version is only used once and the method that uses it has already performed all the same work. Furthermore, the two-parameter version doesn't actually check the routing-type and the first if statement omits the wild check. This commit: - Removes the unnecessary version of getMatchingQueue - Adds missing checks to the remaining getMatchingQueue - Adds JavaDoc - Adds tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The getMatchingQueue method on SimpleAddressManager is overloaded, but only one of them is actually necessary. The three-parameter version is only used once and the method that uses it has already performed all the same work.
Furthermore, the two-parameter version doesn't actually check the routing-type and the first if statement omits the wild check.
This commit: