Repository navigation
Conversation
|
The code changes look good right now. I think we should test this out based on this branch on ukf-mda in case we need to make further changes before merging this back in. |
philsmart
left a comment
There was a problem hiding this comment.
Small changes in the check class. Looking good though
philsmart
left a comment
There was a problem hiding this comment.
I think we should use anonymous Entity Descriptor XML for tests, see the comments.
philsmart
left a comment
There was a problem hiding this comment.
Approve, but it would be great to have Ian review as well.
iay
left a comment
There was a problem hiding this comment.
I think this looks like a pretty good start. There are some things I think I'd probably want to think about if it were to come in as a proposed contribution to the MDA, though.
- I don't see the benefit of the
STATUS_TYPEwithinStatusMetadataCheckStrategy. It only seems to exist to wrap a restricted class, but those are things you can pass in as first-class objects in Spring configuration so that seems like a layer you could remove. Theenumpart is also redundant, I think, as the parent type is sealed so there's an implicit restriction on the subtypes. - I'd have used
Checkingrather thanCheckin the name, to fit in better with the way other classes in the MDA are named. StatusMetadataFilterStrategyis not a strategy, it does something in isolation. In general, anything which implements theStageinterface should have a name which ends withStage. Something likeStatusMetadataFilteringStagewould probably be more appropriate.- The MDA, and Shibboleth code in general, doesn't use constructor arguments. This is annoying, as very often you'd want to do what you do here and just make all the fields
finalfrom the constructor. However, there's a reason for this which I don't recall in detail but has to do with Spring configuration. I think it's fine to go this route for now but be aware that we'd want to reconsider if and when you want to upstream this, as we'd probably want to match the rest of the MDA components even if it isn't what we'd prefer in isolation. - In general if you see a hard down-cast in modern Java, as in
final StatusMetadata statusMetadata = (StatusMetadata) itemMetadata;then there's probably something smelly about your types. In this case, I think if you applied a more appropriate second type bound to theAbstractItemMetadataSelectionStageparent class ofStatusMetadataFilterStrategyyou wouldn't need this because your types would be correct. Probably changingItemMetadatatoStatusMetadatais what you're looking for there. I haven't tried this ;-)
|
Thanks @iay ! I have made some changes based on your comment. All are very useful, especially the last one regarding the For the suggestion regarding the use of constructor injection. I understand the preference for setter injection, as it fits better with the Spring/Shibboleth component model and generally makes components more configurable. I've pushed an updated version of the code and run the tests locally. If you have some time, could you also take a look at the latest changes and let me know if they look OK? Thanks a lot! |
|
It looks like I was a little unclear. The comment I was making about constructor initialisation vs. property setting for initialisation was aimed at the For the thing that's really just a I actually think we went a bit far with this in the Shibboleth codebase in general, probably due to that Spring thing I keep mentioning. There are a few places where we've ended up having objects with non- One thing in the MDA specifically which pushes some classes away from constructor initialisation towards properties is where a class needs to have an identifier used in status metadata. That has usually meant that they need to be part of the component system, and the |
iay
left a comment
There was a problem hiding this comment.
Some additional thoughts:
StatusMetadataCheckingStrategyimplementsPredicate<DOMElementItem>but you should probably not use the concrete type here butPredicate<Item<Element>>instead.- In general, setting and getting primitives such as booleans are atomic operations, so they don't need to be
@GuardedByorsynchronized. I'm not sure if I've been rigorous about that in the main codebase. - If you implement setters, it makes sense to implement getters as well. Normally I'd actually use the getters for properties inside the code, too, and not the bare fields.
Only the first of these items actually matters at all at this stage.
|
Fixed, please check again. Thanks |
|
Just reviewing this from the ukf context (due to internal changes). We can then ask Ian, in a Shibboleth MDA context, whether we want to try to have the StatusChecker upstreamed (which is a separate conversation and does not have to affect the release of these changes in ukf-mda). So far:
|
| <groupId>uk.org.ukfederation</groupId> | ||
| <artifactId>ukf-mda</artifactId> | ||
| <version>0.10.1-SNAPSHOT</version> | ||
| <version>0.10.2-SNAPSHOT</version> |
There was a problem hiding this comment.
My fault; we can only increment this value once we have tagged 0.10.1. That happens when you follow the Release Process. So that will need to go back to 0.10.1-SNAPSHOT for now.
… attribute with a warning Create new bean 'StatusMetadataCheckingStrategy' to evaluate status metadata against a configurable type and message Create new bean 'StatusMetadataFilteringStage' to matching entries from an item's metadata collection based on a configurable type and message Create test cases Add sample test XMLs Update release note
7b6703c to
603c4de
Compare
Create new bean 'StatusMetadataCheckStrategy' to tests whether the supplied metadata item contains a StatusMetadata of the configured type with a matching status message.