-
Notifications
You must be signed in to change notification settings - Fork 35
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
Issue311 improve hook searching #613
base: develop
Are you sure you want to change the base?
Conversation
Add the tests to cover new implementations lto cover HookHandlerSearch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed on the phone, you should also add some integration tests in the gateleen-test
module. Where is the documentation of this new API feature?
gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java
Outdated
Show resolved
Hide resolved
gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java
Outdated
Show resolved
Hide resolved
gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java
Outdated
Show resolved
Hide resolved
gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java
Outdated
Show resolved
Hide resolved
gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java
Outdated
Show resolved
Hide resolved
gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java
Outdated
Show resolved
Hide resolved
Add new tests for HookHandler Create testes with storage
- Verifies successful listener search when multiple listeners are present in storage. - Ensures correct retrieval of a single listener from storage. - Tests failure case when searching for a non-existent listener among multiple listeners. - Ensures proper handling of search when no listeners are registered in storage.
…istener is found for a given query parameter.
…eners registered. - Test for handling searches with no matching listeners, returning an empty list. - Test for handling searches when no listeners are registered, ensuring an empty list is returned. - Fix hookHandler Search
…tory. It checks if the destination of each item contains the query string (queryParam), adding matching items to the result.
- improve listeners tests
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #613 +/- ##
=============================================
+ Coverage 48.44% 49.08% +0.63%
- Complexity 1862 1907 +45
=============================================
Files 238 238
Lines 11953 12049 +96
Branches 1261 1276 +15
=============================================
+ Hits 5791 5914 +123
+ Misses 5659 5626 -33
- Partials 503 509 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
4fdab6c
to
4004646
Compare
gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java
Outdated
Show resolved
Hide resolved
gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java
Outdated
Show resolved
Hide resolved
gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java
Outdated
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteListingTest.java
Outdated
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteListingTest.java
Outdated
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteListingTest.java
Outdated
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteListingTest.java
Outdated
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteListingTest.java
Outdated
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteListingTest.java
Outdated
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteListingTest.java
Outdated
Show resolved
Hide resolved
improve validation url to preserve the previous functionality
create a buildRouteConfig create GETRequest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be an issue in the implementation of route searching. When listing the routes with
GET /playground/server/hooks/v1/registrations/routes
you get the following response
{
"routes": [
"+playground+server+destination1+_hooks+routes+http+myhook54"
]
}
However when you add the search query parameter like this
GET /playground/server/hooks/v1/registrations/routes?q=r1
you get the following response
{
"routes": [
"/playground/server/destination1"
]
}
The response should still be the same. This is the case for listeners hooks but not for route hooks.
gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java
Outdated
Show resolved
Hide resolved
gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java
Outdated
Show resolved
Hide resolved
gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java
Outdated
Show resolved
Hide resolved
gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java
Outdated
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java
Outdated
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java
Outdated
Show resolved
Hide resolved
gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteListingTest.java
Outdated
Show resolved
Hide resolved
…h and new implementation to search with parameters Add more unit tests
Fix route search with parameters Update readme with more information about search with query parameters create a hookIdentify to get a requestUrl when search using parameters Add more unit and integrate testes improve code implementations
Clear unused code.
improve testes organize code remove unused variables
Documentation for the Hook Search API (Listeners and Routes)
Available Endpoints
Query Parameter
Both endpoints support the q query parameter, which is used to filter the search results.
Example Request:
GET /registrations/listeners?q=myDestination
GET /registrations/routes?q=myDestination
Response Structure
Example Response - Searching for Listeners:
Example Response - Searching for Routes:
Key Features
Separate Endpoints for Listeners and Routes: The API provides distinct endpoints for Listeners and Routes searches, ensuring optimized search results based on specific hook types.
String-Based Search: The API looks for matches in the destination field of both Listeners and Routes. It searches for any substring match rather than an exact match, making the search more flexible.
Optimized Search Logic: The API uses efficient search mechanisms internally to quickly find results across registered listeners or routes, reducing response time even with large datasets.
Example Workflow
A client wants to find all Listeners with a destination that contains the string "myDestination". They make the following request:
GET /registrations/listeners?q=myDestination
The API returns a JSON object containing the identifiers of matching Listeners: