dsmiley commented on code in PR #3708:
URL: https://github.com/apache/solr/pull/3708#discussion_r2635170955


##########
solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java:
##########
@@ -190,9 +190,23 @@ public static String getQueryResponse(String wt, 
SolrParams params) throws Excep
     p.remove("qt");
     p.set("indent", "true");
 
-    DirectSolrConnection connection = new DirectSolrConnection(h.getCore());
-    String raw = connection.request(path, p, null);
-    return raw;
+    try (EmbeddedSolrServer server =
+        new EmbeddedSolrServer(h.getCoreContainer(), h.getCore().getName())) {
+      QueryRequest query = new QueryRequest(p);
+      if (path != null) {
+        query.setPath(path);
+      }

Review Comment:
   You could remove these 3 lines for `path`, and also remove the 2 lines close 
above that remove `qt` from params.  EmbeddedSolrServer will resolve `qt` 
indirectly.



##########
solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java:
##########
@@ -190,9 +190,23 @@ public static String getQueryResponse(String wt, 
SolrParams params) throws Excep
     p.remove("qt");
     p.set("indent", "true");
 
-    DirectSolrConnection connection = new DirectSolrConnection(h.getCore());
-    String raw = connection.request(path, p, null);
-    return raw;
+    try (EmbeddedSolrServer server =
+        new EmbeddedSolrServer(h.getCoreContainer(), h.getCore().getName())) {
+      QueryRequest query = new QueryRequest(p);
+      if (path != null) {
+        query.setPath(path);
+      }
+
+      if ("json".equals(wt)) {
+        query.setResponseParser(new JsonMapResponseParser());
+        NamedList<Object> rsp = server.request(query);
+        return Utils.toJSONString(rsp);
+      } else {
+        query.setResponseParser(new InputStreamResponseParser(wt));

Review Comment:
   This didn't work for json ?



##########
solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java:
##########
@@ -1362,13 +1362,28 @@ public static String updateJ(String json, SolrParams 
args) throws Exception {
       if (newArgs.get("indent") == null) newArgs.set("indent", "true");
       args = newArgs;
     }
-    DirectSolrConnection connection = new DirectSolrConnection(core);
+
+    LocalSolrQueryRequest req = new LocalSolrQueryRequest(core, args);
+    if (json != null && !json.isEmpty()) {
+      ArrayList<ContentStream> streams = new ArrayList<>();
+      streams.add(new ContentStreamBase.StringStream(json));
+      req.setContentStreams(streams);

Review Comment:
   could be one-liner with List.of



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to