Skip to content

Commit

Permalink
Avoid override of routes() in BaseRestHandler to respect the default …
Browse files Browse the repository at this point in the history
…behavior defined in RestHandler (#889)
  • Loading branch information
cliu123 authored Jul 14, 2021
1 parent 4906a3c commit 7241127
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 59 deletions.
6 changes: 0 additions & 6 deletions server/src/main/java/org/opensearch/rest/BaseRestHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ public final long getUsageCount() {
*/
public abstract String getName();

/**
* {@inheritDoc}
*/
@Override
public abstract List<Route> routes();

@Override
public final void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
// prepare the request for execution; has the side effect of touching the request parameters
Expand Down
46 changes: 0 additions & 46 deletions server/src/test/java/org/opensearch/rest/BaseRestHandlerTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

Expand Down Expand Up @@ -87,11 +86,6 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
public String getName() {
return "test_one_unconsumed_response_action";
}

@Override
public List<Route> routes() {
return Collections.emptyList();
}
};

final HashMap<String, String> params = new HashMap<>();
Expand All @@ -118,11 +112,6 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
public String getName() {
return "test_multiple_unconsumed_response_action";
}

@Override
public List<Route> routes() {
return Collections.emptyList();
}
};

final HashMap<String, String> params = new HashMap<>();
Expand Down Expand Up @@ -159,11 +148,6 @@ protected Set<String> responseParams() {
public String getName() {
return "test_unconsumed_did_you_mean_response_action";
}

@Override
public List<Route> routes() {
return Collections.emptyList();
}
};

final HashMap<String, String> params = new HashMap<>();
Expand Down Expand Up @@ -207,11 +191,6 @@ protected Set<String> responseParams() {
public String getName() {
return "test_unconsumed_response_action";
}

@Override
public List<Route> routes() {
return Collections.emptyList();
}
};

final HashMap<String, String> params = new HashMap<>();
Expand All @@ -235,11 +214,6 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
public String getName() {
return "test_default_response_action";
}

@Override
public List<Route> routes() {
return Collections.emptyList();
}
};

final HashMap<String, String> params = new HashMap<>();
Expand Down Expand Up @@ -275,11 +249,6 @@ protected Table getTableWithHeader(RestRequest request) {
public String getName() {
return "test_cat_response_action";
}

@Override
public List<Route> routes() {
return Collections.emptyList();
}
};

final HashMap<String, String> params = new HashMap<>();
Expand Down Expand Up @@ -310,11 +279,6 @@ protected RestChannelConsumer prepareRequest(final RestRequest request, final No
public String getName() {
return "test_consumed_body";
}

@Override
public List<Route> routes() {
return Collections.emptyList();
}
};

try (XContentBuilder builder = JsonXContent.contentBuilder().startObject().endObject()) {
Expand All @@ -339,11 +303,6 @@ protected RestChannelConsumer prepareRequest(final RestRequest request, final No
public String getName() {
return "test_unconsumed_body";
}

@Override
public List<Route> routes() {
return Collections.emptyList();
}
};

final RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).build();
Expand All @@ -364,11 +323,6 @@ protected RestChannelConsumer prepareRequest(final RestRequest request, final No
public String getName() {
return "test_unconsumed_body";
}

@Override
public List<Route> routes() {
return Collections.emptyList();
}
};

try (XContentBuilder builder = JsonXContent.contentBuilder().startObject().endObject()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
import org.opensearch.test.client.NoOpNodeClient;
import org.opensearch.test.rest.FakeRestRequest;

import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;

Expand Down Expand Up @@ -200,11 +198,6 @@ public String getName() {
return name;
}

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) {
return channel -> {
Expand Down

0 comments on commit 7241127

Please sign in to comment.