Skip to content

Extract DelegateRefresher to deduplicate JSON resource wrapper logic#1870

Merged
jnioche merged 3 commits intomainfrom
refactor/opensearch-json-resource-wrapper
Apr 7, 2026
Merged

Extract DelegateRefresher to deduplicate JSON resource wrapper logic#1870
jnioche merged 3 commits intomainfrom
refactor/opensearch-json-resource-wrapper

Conversation

@jnioche
Copy link
Copy Markdown
Contributor

@jnioche jnioche commented Apr 6, 2026

Summary

  • Extracts near-identical delegate loading, JSONResource validation, and periodic OpenSearch refresh logic from JSONURLFilterWrapper and JSONResourceWrapper into a new generic DelegateRefresher<T> class
  • Reduces each wrapper from ~180 lines to ~75 lines while preserving all existing behavior
  • Adds 8 unit tests for DelegateRefresher covering delegate loading for both URLFilter and ParseFilter, error cases (missing config, wrong base type, missing JSONResource), and idempotent cleanup

Test plan

  • mvn test -pl external/opensearch -Dtest=DelegateRefresherTest — all 8 new unit tests pass
  • mvn checkstyle:check -pl external/opensearch — 0 violations
  • mvn compile -pl external/opensearch -am — clean compile

🤖 Generated with Claude Code

jnioche and others added 2 commits April 6, 2026 18:25
JSONURLFilterWrapper and JSONResourceWrapper contained near-identical code
for loading a delegate class, validating it implements JSONResource, and
setting up a periodic refresh timer from OpenSearch. This extracts the
shared logic into a generic DelegateRefresher<T> class, reducing each
wrapper from ~180 lines to ~75 lines. Adds 8 unit tests for the new class.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Julien Nioche <julien@digitalpebble.com>
@jnioche jnioche added this to the 3.6.0 milestone Apr 6, 2026
Signed-off-by: Julien Nioche <julien@digitalpebble.com>
@jnioche jnioche merged commit 197f887 into main Apr 7, 2026
2 checks passed
@jnioche jnioche deleted the refactor/opensearch-json-resource-wrapper branch April 7, 2026 17:41
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.

2 participants