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


##########
solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java:
##########
@@ -2871,10 +2871,30 @@ public static LBHttpSolrClient 
getLBHttpSolrClient(String... solrUrls)
     return new LBHttpSolrClient.Builder().withBaseSolrUrls(solrUrls).build();
   }
 
+  /** This method creates a HttpClient from a URL. */
+  public static HttpClient getHttpClient(String url) {
+    return new HttpSolrClient.Builder(url).build().getHttpClient();
+  }
+
   /**
-   * This method <i>may</i> randomize unspecified aspects of the resulting 
SolrClient. Tests that do
-   * not wish to have any randomized behavior should use the {@link
-   * org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * This method creates a basic HttpSolrClient. Tests that want to control 
the creation process
+   * should use the {@link 
org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   */

Review Comment:
   HttpSolrClient and CloudLegacySolrClient are already deprecated and many 
methods that return them are likewise.  It's not clear to me why tests can't 
use the Http2 (Jetty) one; can you tell me?



##########
solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java:
##########
@@ -2871,10 +2871,30 @@ public static LBHttpSolrClient 
getLBHttpSolrClient(String... solrUrls)
     return new LBHttpSolrClient.Builder().withBaseSolrUrls(solrUrls).build();
   }
 
+  /** This method creates a HttpClient from a URL. */
+  public static HttpClient getHttpClient(String url) {
+    return new HttpSolrClient.Builder(url).build().getHttpClient();
+  }
+
   /**
-   * This method <i>may</i> randomize unspecified aspects of the resulting 
SolrClient. Tests that do
-   * not wish to have any randomized behavior should use the {@link
-   * org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * This method creates a basic HttpSolrClient. Tests that want to control 
the creation process
+   * should use the {@link 
org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   */
+  public static HttpSolrClient getHttp1SolrClient(String url) {
+    return new HttpSolrClient.Builder(url).build();
+  }
+
+  /**
+   * This method creates a basic Http2SolrClient. Tests that want to control 
the creation process

Review Comment:
   Fantastic; thanks.  Reduction of stuff from STCJ4 is helpful to a direction 
I'm doing with @joshgog in 
[SOLR-11872](https://issues.apache.org/jira/browse/SOLR-11872)



##########
solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java:
##########
@@ -2886,28 +2906,25 @@ public static HttpSolrClient getHttpSolrClient(
   }
 
   /**
-   * This method <i>may</i> randomize unspecified aspects of the resulting 
SolrClient. Tests that do
-   * not wish to have any randomized behavior should use the {@link
-   * org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * This method creates a basic HttpSolrClient. Tests that want to control 
the creation process
+   * should use the {@link 
org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
    */
   public static HttpSolrClient getHttpSolrClient(
       String url, HttpClient httpClient, ResponseParser responseParser) {
     return new 
Builder(url).withHttpClient(httpClient).withResponseParser(responseParser).build();
   }
 
   /**
-   * This method <i>may</i> randomize unspecified aspects of the resulting 
SolrClient. Tests that do
-   * not wish to have any randomized behavior should use the {@link
-   * org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * This method creates a basic HttpSolrClient. Tests that want to control 
the creation process
+   * should use the {@link 
org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
    */
   public static HttpSolrClient getHttpSolrClient(String url, HttpClient 
httpClient) {
     return new Builder(url).withHttpClient(httpClient).build();
   }
 
   /**
-   * This method <i>may</i> randomize unspecified aspects of the resulting 
SolrClient. Tests that do
-   * not wish to have any randomized behavior should use the {@link
-   * org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
+   * This method creates a basic HttpSolrClient. Tests that want to control 
the creation process
+   * should use the {@link 
org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly

Review Comment:
   Huh; I see you are correct.  But we do want randomization; adding it here 
would be out of scope really.  I suppose the javadoc changes are okay although 
I'd prefer to leave the javadoc be.  It uses the word *may* randomize.  A core 
idea of the randomized testing philosophy is that tests use random-ishly 
configured implementations/settings that a test shouldn't care about.  Very few 
tests should fundamentally care about Apache vs Jetty clients, HTTP2 vs 
HTTP1.1, etc..  Our tests already do similar randomization for other things, 
like the underlying Lucene Directory implementation.  Ideally these utility 
methods would simply return SolrClient but I understand there may be too many 
tests that can accept that today, and would be out of scope here any way.



-- 
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