Skip to content

Commit

Permalink
Add mock DynamicRouteRegistry.class
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <cwperx@amazon.com>
  • Loading branch information
cwperks committed May 17, 2023
1 parent cb1244f commit 5a9c363
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 0 additions & 2 deletions server/src/main/java/org/opensearch/action/ActionModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -1135,8 +1135,6 @@ public void registerDynamicRoute(RestHandler.Route route, RestSendToExtensionAct
requireNonNull(action, "action is required");
Optional<String> routeName = Optional.empty();
if (route instanceof NamedRoute) {
for (ActionType actionType : dynamicActionRegistry.registry.keySet()) {
}
routeName = Optional.of(((NamedRoute) route).name());
if (dynamicActionRegistry.isActionRegistered(routeName.get()) || registeredRestActionNames.contains(routeName.get())) {
throw new IllegalArgumentException("route [" + route + "] already registered");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.junit.Before;
import org.opensearch.Version;
import org.opensearch.action.ActionModule;
import org.opensearch.action.ActionModule.DynamicRouteRegistry;
import org.opensearch.action.admin.cluster.state.ClusterStateResponse;
import org.opensearch.client.node.NodeClient;
import org.opensearch.cluster.ClusterSettingsResponse;
Expand Down Expand Up @@ -168,6 +169,7 @@ public void setup() throws Exception {
new UsageService(),
new IdentityService(Settings.EMPTY, List.of())
);
when(actionModule.getDynamicRouteRegistry()).thenReturn(mock(DynamicRouteRegistry.class));
when(actionModule.getRestController()).thenReturn(restController);
settingsModule = new SettingsModule(Settings.EMPTY, emptyList(), emptyList(), emptySet());
clusterService = createClusterService(threadPool);
Expand Down

0 comments on commit 5a9c363

Please sign in to comment.