bszabo97 commented on code in PR #1182:
URL: https://github.com/apache/solr/pull/1182#discussion_r1126305516


##########
solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java:
##########
@@ -222,109 +217,111 @@ protected void doTestDeleteAction(String 
testCollectionName, String solrUrl) thr
    * Uses the SolrCLI config action to activate soft auto-commits for the 
getting started
    * collection.
    */
+  @SuppressWarnings("unchecked")
   protected void doTestConfigUpdate(String testCollectionName, String solrUrl) 
throws Exception {
     if (!solrUrl.endsWith("/")) solrUrl += "/";
-    String configUrl = solrUrl + testCollectionName + "/config";
-
-    Map<String, Object> configJson = SolrCLI.getJson(configUrl);
-    Object maxTimeFromConfig =
-        SolrCLI.atPath("/config/updateHandler/autoSoftCommit/maxTime", 
configJson);
-    assertNotNull(maxTimeFromConfig);
-    assertEquals(-1L, maxTimeFromConfig);
-
-    String prop = "updateHandler.autoSoftCommit.maxTime";
-    Long maxTime = 3000L;
-    String[] args =
-        new String[] {
-          "-collection", testCollectionName,
-          "-property", prop,
-          "-value", maxTime.toString(),
-          "-solrUrl", solrUrl
-        };
-
-    Map<String, Long> startTimes = 
getSoftAutocommitInterval(testCollectionName);
-
-    SolrCLI.ConfigTool tool = new SolrCLI.ConfigTool();
-    CommandLine cli =
-        
SolrCLI.processCommandLineArgs(SolrCLI.joinCommonAndToolOptions(tool.getOptions()),
 args);
-    log.info("Sending set-property '{}'={} to SolrCLI.ConfigTool.", prop, 
maxTime);
-    assertEquals("Set config property failed!", 0, tool.runTool(cli));
 
-    configJson = SolrCLI.getJson(configUrl);
-    maxTimeFromConfig = 
SolrCLI.atPath("/config/updateHandler/autoSoftCommit/maxTime", configJson);
-    assertNotNull(maxTimeFromConfig);
-    assertEquals(maxTime, maxTimeFromConfig);
+    try (SolrClient solrClient = SolrCLI.getSolrClient(solrUrl)) {
+      NamedList<Object> configJson =
+          solrClient.request(
+              new GenericSolrRequest(
+                  SolrRequest.METHOD.GET,
+                  "/" + testCollectionName + "/config",
+                  new ModifiableSolrParams()));
+      Object maxTimeFromConfig =
+          SolrCLI.atPath(
+              "/updateHandler/autoSoftCommit/maxTime",
+              (Map<String, Object>) configJson.get("config"));
+      assertNotNull(maxTimeFromConfig);
+      assertEquals(-1, maxTimeFromConfig);
+
+      String prop = "updateHandler.autoSoftCommit.maxTime";
+      Integer maxTime = 3000;
+      String[] args =
+          new String[] {
+            "-collection", testCollectionName,
+            "-property", prop,
+            "-value", maxTime.toString(),
+            "-solrUrl", solrUrl
+          };
+
+      Map<String, Integer> startTimes = 
getSoftAutocommitInterval(testCollectionName, solrClient);
+
+      SolrCLI.ConfigTool tool = new SolrCLI.ConfigTool();
+      CommandLine cli =
+          
SolrCLI.processCommandLineArgs(SolrCLI.joinCommonAndToolOptions(tool.getOptions()),
 args);
+      log.info("Sending set-property '{}'={} to SolrCLI.ConfigTool.", prop, 
maxTime);
+      assertEquals("Set config property failed!", 0, tool.runTool(cli));
+
+      configJson =
+          solrClient.request(
+              new GenericSolrRequest(
+                  SolrRequest.METHOD.GET,
+                  "/" + testCollectionName + "/config",
+                  new ModifiableSolrParams()));
+      maxTimeFromConfig =
+          SolrCLI.atPath(
+              "/updateHandler/autoSoftCommit/maxTime",
+              (Map<String, Object>) configJson.get("config"));
+      assertNotNull(maxTimeFromConfig);
+      assertEquals(maxTime, maxTimeFromConfig);
 
-    // Just check that we can access paths with slashes in them both through 
an intermediate method
-    // and explicitly using atPath.

Review Comment:
   These two tests were redundant because they tested the `pathAt` and 
`asString` methods from SolrCLI. In this implementation I only kept the 
`atPath` method so I removed the `asString` test but kept the other. 
   In the new implementation with findRecursive I will also just keep one of 
these tests since the `atPath` method will be removed as well.



-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to