You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "epugh (via GitHub)" <gi...@apache.org> on 2023/04/26 15:59:49 UTC

[GitHub] [solr] epugh commented on a diff in pull request #1565: SOLR-13605: HttpSolrClient.Builder.withHttpClient() is useless for the purpose of setting client scoped so/connect timeouts

epugh commented on code in PR #1565:
URL: https://github.com/apache/solr/pull/1565#discussion_r1178092451


##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBuilderTest.java:
##########
@@ -51,6 +52,22 @@ public void testProvidesHttpClientToClient() throws IOException {
     }
   }
 
+  @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-13605")
+  @Test
+  public void testUsesTimeoutProvidedByHttpClient() throws IOException {
+
+    ModifiableSolrParams clientParams = new ModifiableSolrParams();
+    clientParams.set(HttpClientUtil.PROP_SO_TIMEOUT, 12345);
+    clientParams.set(HttpClientUtil.PROP_CONNECTION_TIMEOUT, 67890);
+    HttpClient httpClient = HttpClientUtil.createClient(clientParams);
+    try (HttpSolrClient createdClient =
+        new Builder(ANY_BASE_SOLR_URL).withHttpClient(httpClient).build()) {
+      assertEquals(createdClient.getHttpClient(), httpClient);
+      assertEquals(67890, createdClient.getConnectionTimeout());
+      assertEquals(12345, createdClient.getSocketTimeout());
+    }
+  }

Review Comment:
   i am trying to get it defined in the try/with/resources...



-- 
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-unsubscribe@solr.apache.org

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


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