Search in sources :

Example 1 with CompositeApi

use of org.apache.solr.api.V2HttpCall.CompositeApi in project lucene-solr by apache.

the class TestApiFramework method invoke.

private SolrQueryResponse invoke(PluginBag<SolrRequestHandler> reqHandlers, String path, String fullPath, SolrRequest.METHOD method, CoreContainer mockCC) {
    HashMap<String, String> parts = new HashMap<>();
    boolean containerHandlerLookup = mockCC.getRequestHandlers() == reqHandlers;
    path = path == null ? fullPath : path;
    Api api = null;
    if (containerHandlerLookup) {
        api = V2HttpCall.getApiInfo(reqHandlers, path, "GET", fullPath, parts);
    } else {
        api = V2HttpCall.getApiInfo(mockCC.getRequestHandlers(), fullPath, "GET", fullPath, parts);
        if (api == null)
            api = new CompositeApi(null);
        if (api instanceof CompositeApi) {
            CompositeApi compositeApi = (CompositeApi) api;
            api = V2HttpCall.getApiInfo(reqHandlers, path, "GET", fullPath, parts);
            compositeApi.add(api);
            api = compositeApi;
        }
    }
    SolrQueryResponse rsp = new SolrQueryResponse();
    LocalSolrQueryRequest req = new LocalSolrQueryRequest(null, new MapSolrParams(new HashMap<>())) {

        @Override
        public List<CommandOperation> getCommands(boolean validateInput) {
            return Collections.emptyList();
        }
    };
    api.call(req, rsp);
    return rsp;
}
Also used : LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest) SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) MapSolrParams(org.apache.solr.common.params.MapSolrParams) HashMap(java.util.HashMap) CommandOperation(org.apache.solr.common.util.CommandOperation) CompositeApi(org.apache.solr.api.V2HttpCall.CompositeApi) CompositeApi(org.apache.solr.api.V2HttpCall.CompositeApi) Api(org.apache.solr.api.Api)

Aggregations

HashMap (java.util.HashMap)1 Api (org.apache.solr.api.Api)1 CompositeApi (org.apache.solr.api.V2HttpCall.CompositeApi)1 MapSolrParams (org.apache.solr.common.params.MapSolrParams)1 CommandOperation (org.apache.solr.common.util.CommandOperation)1 LocalSolrQueryRequest (org.apache.solr.request.LocalSolrQueryRequest)1 SolrQueryResponse (org.apache.solr.response.SolrQueryResponse)1