Avoid override of routes() in BaseRestHandler to respect the default behavior defined in RestHandler (#889)
This commit is contained in:
parent
4906a3c1b0
commit
7241127c1d
|
@ -95,12 +95,6 @@ public abstract class BaseRestHandler implements RestHandler {
|
||||||
*/
|
*/
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public abstract List<Route> routes();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
|
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
|
// prepare the request for execution; has the side effect of touching the request parameters
|
||||||
|
|
|
@ -49,7 +49,6 @@ import org.opensearch.threadpool.ThreadPool;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
@ -87,11 +86,6 @@ public class BaseRestHandlerTests extends OpenSearchTestCase {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "test_one_unconsumed_response_action";
|
return "test_one_unconsumed_response_action";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Route> routes() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final HashMap<String, String> params = new HashMap<>();
|
final HashMap<String, String> params = new HashMap<>();
|
||||||
|
@ -118,11 +112,6 @@ public class BaseRestHandlerTests extends OpenSearchTestCase {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "test_multiple_unconsumed_response_action";
|
return "test_multiple_unconsumed_response_action";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Route> routes() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final HashMap<String, String> params = new HashMap<>();
|
final HashMap<String, String> params = new HashMap<>();
|
||||||
|
@ -159,11 +148,6 @@ public class BaseRestHandlerTests extends OpenSearchTestCase {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "test_unconsumed_did_you_mean_response_action";
|
return "test_unconsumed_did_you_mean_response_action";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Route> routes() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final HashMap<String, String> params = new HashMap<>();
|
final HashMap<String, String> params = new HashMap<>();
|
||||||
|
@ -207,11 +191,6 @@ public class BaseRestHandlerTests extends OpenSearchTestCase {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "test_unconsumed_response_action";
|
return "test_unconsumed_response_action";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Route> routes() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final HashMap<String, String> params = new HashMap<>();
|
final HashMap<String, String> params = new HashMap<>();
|
||||||
|
@ -235,11 +214,6 @@ public class BaseRestHandlerTests extends OpenSearchTestCase {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "test_default_response_action";
|
return "test_default_response_action";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Route> routes() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final HashMap<String, String> params = new HashMap<>();
|
final HashMap<String, String> params = new HashMap<>();
|
||||||
|
@ -275,11 +249,6 @@ public class BaseRestHandlerTests extends OpenSearchTestCase {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "test_cat_response_action";
|
return "test_cat_response_action";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Route> routes() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final HashMap<String, String> params = new HashMap<>();
|
final HashMap<String, String> params = new HashMap<>();
|
||||||
|
@ -310,11 +279,6 @@ public class BaseRestHandlerTests extends OpenSearchTestCase {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "test_consumed_body";
|
return "test_consumed_body";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Route> routes() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
try (XContentBuilder builder = JsonXContent.contentBuilder().startObject().endObject()) {
|
try (XContentBuilder builder = JsonXContent.contentBuilder().startObject().endObject()) {
|
||||||
|
@ -339,11 +303,6 @@ public class BaseRestHandlerTests extends OpenSearchTestCase {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "test_unconsumed_body";
|
return "test_unconsumed_body";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Route> routes() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).build();
|
final RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).build();
|
||||||
|
@ -364,11 +323,6 @@ public class BaseRestHandlerTests extends OpenSearchTestCase {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "test_unconsumed_body";
|
return "test_unconsumed_body";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Route> routes() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
try (XContentBuilder builder = JsonXContent.contentBuilder().startObject().endObject()) {
|
try (XContentBuilder builder = JsonXContent.contentBuilder().startObject().endObject()) {
|
||||||
|
|
|
@ -40,8 +40,6 @@ import org.opensearch.test.OpenSearchTestCase;
|
||||||
import org.opensearch.test.client.NoOpNodeClient;
|
import org.opensearch.test.client.NoOpNodeClient;
|
||||||
import org.opensearch.test.rest.FakeRestRequest;
|
import org.opensearch.test.rest.FakeRestRequest;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -200,11 +198,6 @@ public class UsageServiceTests extends OpenSearchTestCase {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Route> routes() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) {
|
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) {
|
||||||
return channel -> {
|
return channel -> {
|
||||||
|
|
Loading…
Reference in New Issue