SOLR-10405: v2 API introspect response contains multiple copies of the experimental format WARNING

This commit is contained in:
Cao Manh Dat 2017-05-13 15:11:56 +07:00
parent 4f93056ce7
commit 9fa04ecc95
4 changed files with 12 additions and 2 deletions

View File

@ -105,6 +105,8 @@ Bug Fixes
* SOLR-10411: v2 Collection API "modify" command specification's replicationFactor property is incorrectly typed as string,
should be integer (Cao Manh Dat)
* SOLR-10405: v2 API introspect response contains multiple copies of the experimental format WARNING (Cao Manh Dat)
Optimizations
----------------------

View File

@ -37,7 +37,6 @@ import org.apache.solr.common.util.Utils;
import org.apache.solr.common.util.ValidatingJsonMap;
import org.apache.solr.core.PluginBag;
import org.apache.solr.core.PluginInfo;
import org.apache.solr.handler.RequestHandlerUtils;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.request.SolrRequestHandler;
import org.apache.solr.response.SolrQueryResponse;
@ -177,7 +176,6 @@ public class ApiBag {
List l = (List) rsp.getValues().get("spec");
if (l == null) rsp.getValues().add("spec", l = new ArrayList());
l.add(result);
RequestHandlerUtils.addExperimentalFormatWarning(rsp);
}
}

View File

@ -38,6 +38,7 @@ import org.apache.solr.common.util.ValidatingJsonMap;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.PluginBag;
import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.RequestHandlerUtils;
import org.apache.solr.logging.MDCLoggingContext;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.request.SolrRequestHandler;
@ -221,6 +222,7 @@ public class V2HttpCall extends HttpSolrCall {
}
}
}
RequestHandlerUtils.addExperimentalFormatWarning(rsp);
}
});
getSubPathApi(requestHandlers,path, fullPath, (CompositeApi) api);

View File

@ -61,6 +61,14 @@ public class V2ApiIntegrationTest extends SolrCloudTestCase {
assertEquals("Command not found!", Utils.getObjectByPath(result, false, "/spec[0]/commands/XXXX"));
}
@Test
public void testSingleWarning() throws Exception {
NamedList resp = cluster.getSolrClient().request(
new V2Request.Builder("/c/"+COLL_NAME+"/_introspect").build());
List warnings = resp.getAll("WARNING");
assertEquals(1, warnings.size());
}
@Test
public void testCollectionsApi() throws Exception {
CloudSolrClient client = cluster.getSolrClient();