Refactor handler method#158
Refactor handler method#158dbwiddis merged 21 commits intoopensearch-project:mainfrom mloufra:refactor-handler
Conversation
Signed-off-by: mloufra <mloufra@amazon.com>
Signed-off-by: mloufra <mloufra@amazon.com>
Signed-off-by: mloufra <mloufra@amazon.com>
Signed-off-by: mloufra <mloufra@amazon.com>
Signed-off-by: mloufra <mloufra@amazon.com>
Signed-off-by: mloufra <mloufra@amazon.com>
Signed-off-by: mloufra <mloufra@amazon.com>
dbwiddis
left a comment
There was a problem hiding this comment.
I'm not sure why so many variables were changed to static, and suspect there's a better way to handle whatever challenge that was meant to address.
src/main/java/org/opensearch/sdk/handlers/ExtensionsRestRequestHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/sdk/handlers/OpensearchRequestHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: mloufra <mloufra@amazon.com>
Signed-off-by: mloufra <mloufra@amazon.com>
Signed-off-by: mloufra <mloufra@amazon.com>
Signed-off-by: mloufra <mloufra@amazon.com>
Signed-off-by: mloufra <mloufra@amazon.com>
Signed-off-by: mloufra <mloufra@amazon.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #158 +/- ##
============================================
+ Coverage 63.69% 64.60% +0.90%
- Complexity 90 99 +9
============================================
Files 20 25 +5
Lines 482 500 +18
Branches 18 18
============================================
+ Hits 307 323 +16
- Misses 167 169 +2
Partials 8 8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…Handler Signed-off-by: mloufra <mloufra@amazon.com>
src/main/java/org/opensearch/sdk/handlers/OpensearchRequestHandler.java
Outdated
Show resolved
Hide resolved
| * @return A response to OpenSearch for the corresponding API | ||
| * @throws Exception if the corresponding handler for the request is not present | ||
| */ | ||
| public TransportResponse handleOpenSearchRequest(OpenSearchRequest request) throws Exception { |
There was a problem hiding this comment.
This should be a class for NamedWriteableRegistry and not OpenSearchRequest. Also, we don't need a switch case here. If/else can do the job.
There was a problem hiding this comment.
It used to have a lot more cases before we refactored :-)
There was a problem hiding this comment.
I think we can keep this switch case here, it will easier for others adding more case in the future.
dbwiddis
left a comment
There was a problem hiding this comment.
Looking good with the documentation comments noted!
src/main/java/org/opensearch/sdk/handlers/ExtensionsRestRequestHandler.java
Show resolved
Hide resolved
| * @return A response to OpenSearch for the corresponding API | ||
| * @throws Exception if the corresponding handler for the request is not present | ||
| */ | ||
| public TransportResponse handleOpenSearchRequest(OpenSearchRequest request) throws Exception { |
There was a problem hiding this comment.
It used to have a lot more cases before we refactored :-)
Signed-off-by: mloufra <mloufra@amazon.com>
dbwiddis
left a comment
There was a problem hiding this comment.
LGTM! Any additional requests please put on the linked issue for the next round, so we can merge this. :)
* issue opensearch-project#28 Signed-off-by: mloufra <mloufra@amazon.com> * Update the lastest coomit Signed-off-by: mloufra <mloufra@amazon.com> * Rename the method and fix the conflict Signed-off-by: mloufra <mloufra@amazon.com> * fix merge conflict Signed-off-by: mloufra <mloufra@amazon.com> * Add code coverage report Signed-off-by: mloufra <mloufra@amazon.com> * Rebase the lastest commit Signed-off-by: mloufra <mloufra@amazon.com> * update the lastest commit Signed-off-by: mloufra <mloufra@amazon.com> * refactor class for handler method in ExtensionsRunner Signed-off-by: mloufra <mloufra@amazon.com> * add documentation for handler Signed-off-by: mloufra <mloufra@amazon.com> * fix merge conflict Signed-off-by: mloufra <mloufra@amazon.com> * delete all the static Signed-off-by: mloufra <mloufra@amazon.com> * fix documentation problem Signed-off-by: mloufra <mloufra@amazon.com> * fix NullPointerException bug Signed-off-by: mloufra <mloufra@amazon.com> * change RestResponse to ExtensionRestResponse in ExtensionsRestRequestHandler Signed-off-by: mloufra <mloufra@amazon.com> * change documentation for ExtensionsRunner Signed-off-by: mloufra <mloufra@amazon.com> Signed-off-by: mloufra <mloufra@amazon.com>
* issue opensearch-project#28 Signed-off-by: mloufra <mloufra@amazon.com> * Update the lastest coomit Signed-off-by: mloufra <mloufra@amazon.com> * Rename the method and fix the conflict Signed-off-by: mloufra <mloufra@amazon.com> * fix merge conflict Signed-off-by: mloufra <mloufra@amazon.com> * Add code coverage report Signed-off-by: mloufra <mloufra@amazon.com> * Rebase the lastest commit Signed-off-by: mloufra <mloufra@amazon.com> * update the lastest commit Signed-off-by: mloufra <mloufra@amazon.com> * refactor class for handler method in ExtensionsRunner Signed-off-by: mloufra <mloufra@amazon.com> * add documentation for handler Signed-off-by: mloufra <mloufra@amazon.com> * fix merge conflict Signed-off-by: mloufra <mloufra@amazon.com> * delete all the static Signed-off-by: mloufra <mloufra@amazon.com> * fix documentation problem Signed-off-by: mloufra <mloufra@amazon.com> * fix NullPointerException bug Signed-off-by: mloufra <mloufra@amazon.com> * change RestResponse to ExtensionRestResponse in ExtensionsRestRequestHandler Signed-off-by: mloufra <mloufra@amazon.com> * change documentation for ExtensionsRunner Signed-off-by: mloufra <mloufra@amazon.com> Signed-off-by: mloufra <mloufra@amazon.com>
Description
Create the following five new classes to handle each handler method for refactoring the class in
ExtensionsRunner.java.ExtensionsInitRequestHandlerhandle methodhandleExtensionInitRequestOpensearchRequestHandlerhandle methodhandleOpenSearchRequestExtensionsIndicesModuleRequestHandlerhandle methodhandleIndicesModuleRequestExtensionsIndicesModuleNameRequestHandlerhandle methodhandleIndicesModuleNameRequestExtenionsRestRequestHandlerhandle methodhandleRestExecuteOnExtensionRequestIssues Resolved
#116
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.