Skip to content

more event filters #1309

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

Closed
wants to merge 56 commits into from
Closed

more event filters #1309

wants to merge 56 commits into from

Conversation

metacosm
Copy link
Collaborator

@metacosm metacosm commented Jul 1, 2022

  • refactor: share filter handling (wip)

@metacosm metacosm self-assigned this Jul 1, 2022
@metacosm metacosm requested a review from csviri July 1, 2022 12:39
@metacosm metacosm changed the base branch from main to event-filters July 1, 2022 13:01
Note: I don't think that the unit tests are correct, see todos. The
filters should come from the configuration and we shouldn't override
them like is currently done but got through the ConfigurationOverrider
mechanism.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 1, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 58 Code Smells

66.9% 66.9% Coverage
0.4% 0.4% Duplication

@metacosm metacosm marked this pull request as ready for review July 4, 2022 08:08

public void setOnDeleteFilter(BiPredicate<R, Boolean> onDeleteFilter) {
this.onDeleteFilter = onDeleteFilter;
public void initFilters(Predicate<R> onAddFilter, BiPredicate<R, R> onUpdateFilter,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not a very nice API, with all the null values required.

propagateEvent(resource);
}
}

private synchronized void onAddOrUpdate(Operation operation, R newObject, R oldObject,
private synchronized void onAddOrUpdate(ResourceAction operation, R newObject, R oldObject,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The separate Operation was intentional to exclude delete. I don't think this needs to be changed, it is more explicit that way.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That is something completely different from filters.

@@ -25,11 +25,7 @@ default Optional<R> getSecondaryResource(P primary) {

Set<R> getSecondaryResources(P primary);

void setOnAddFilter(Predicate<R> onAddFilter);
Copy link
Collaborator

@csviri csviri Jul 4, 2022

Choose a reason for hiding this comment

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

Why is not initFilters better than having setters?


public void setOnDeleteFilter(BiPredicate<R, Boolean> onDeleteFilter) {
this.onDeleteFilter = onDeleteFilter;
public void initFilters(Predicate<R> onAddFilter, BiPredicate<R, R> onUpdateFilter,
Copy link
Collaborator

Choose a reason for hiding this comment

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

When this is intended to be called? Since it should be afterinitEventSource, but that is called after the event source initialized. Can we add an integration test for this?

Base automatically changed from event-filters to next July 4, 2022 14:35
@metacosm metacosm closed this Jul 13, 2022
@metacosm metacosm deleted the more-event-filters branch July 13, 2022 11:41
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.

2 participants