madrob commented on code in PR #839:
URL: https://github.com/apache/solr/pull/839#discussion_r866927856


##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java:
##########
@@ -78,28 +78,30 @@ public DocCollection get() {
 
     LBHttpSolrClient mockLbclient = getMockLbHttpSolrClient(responses);
     AtomicInteger lbhttpRequestCount = new AtomicInteger();
-    try (CloudSolrClient cloudClient =
-        new CloudSolrClientBuilder(getStateProvider(livenodes, refs))
-            .withLBHttpSolrClient(mockLbclient)
-            .build()) {
-      livenodes.addAll(ImmutableSet.of("192.168.1.108:7574_solr", 
"192.168.1.108:8983_solr"));
-      ClusterState cs =
-          ClusterState.createFromJson(1, coll1State.getBytes(UTF_8), 
Collections.emptySet());
-      refs.put(collName, new Ref(collName));
-      colls.put(collName, cs.getCollectionOrNull(collName));
-      responses.put(
-          "request",
-          o -> {
-            int i = lbhttpRequestCount.incrementAndGet();
-            if (i == 1) return new ConnectException("TEST");
-            if (i == 2) return new SocketException("TEST");
-            if (i == 3) return new NoHttpResponseException("TEST");
-            return okResponse;
-          });
-      UpdateRequest update = new UpdateRequest().add("id", "123", "desc", 
"Something 0");
-
-      cloudClient.request(update, collName);
-      assertEquals(2, refs.get(collName).getCount());
+    try (ClusterStateProvider clusterStateProvider = 
getStateProvider(livenodes, refs)) {
+      try (CloudSolrClient cloudClient =

Review Comment:
   You can put multiple resources in a single try block separated by a 
semicolon - 
https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html



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