Skip to content

Commit

Permalink
Renames getter to match variable name
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Jun 7, 2023
1 parent d8c3abf commit 66b3f88
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ public void registerDynamicRoute(RestHandler.Route route, RestSendToExtensionAct
if (isActionRegistered(routeName.get()) || registeredActionNames.contains(routeName.get())) {
throw new IllegalArgumentException("route [" + route + "] already registered");
}
legacyActionName = Optional.of(nr.legacyName());
legacyActionName = Optional.of(nr.legacyActionName());
if (!legacyActionName.get().isEmpty()) {
if (isActionRegistered(legacyActionName.get()) || registeredActionNames.contains(legacyActionName.get())) {
throw new IllegalArgumentException("action [" + legacyActionName + "] already registered");
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/org/opensearch/rest/NamedRoute.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public String name() {
* The legacy transport Action name to match against this route to support authorization in REST layer.
* MUST be unique across all Routes
*/
public String legacyName() {
public String legacyActionName() {
return this.legacyActionName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ public void testRestSendToExtensionActionWithNamedRouteAndLegacyActionName() thr
List<Method> methods = routes.stream().map(Route::getMethod).collect(Collectors.toList());
List<String> expectedNames = expected.stream().map(NamedRoute::name).collect(Collectors.toList());
List<String> names = routes.stream().map(r -> ((NamedRoute) r).name()).collect(Collectors.toList());
List<String> expectedLegacyActionNames = expected.stream().map(NamedRoute::legacyName).collect(Collectors.toList());
List<String> legacyActionNames = routes.stream().map(r -> ((NamedRoute) r).legacyName()).collect(Collectors.toList());
List<String> expectedLegacyActionNames = expected.stream().map(NamedRoute::legacyActionName).collect(Collectors.toList());
List<String> legacyActionNames = routes.stream().map(r -> ((NamedRoute) r).legacyActionName()).collect(Collectors.toList());
assertTrue(paths.containsAll(expectedPaths));
assertTrue(expectedPaths.containsAll(paths));
assertTrue(methods.containsAll(expectedMethods));
Expand Down

0 comments on commit 66b3f88

Please sign in to comment.