You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/09/01 14:34:47 UTC

[lucene-solr] 02/02: @666 Minor cleanup.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 991d0c3c434c94cd0d1621b52979c85b1c5c3bfa
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Sep 1 09:18:52 2020 -0500

    @666 Minor cleanup.
---
 .../solrj/impl/CloudSolrClientCacheTest.java       | 54 +++++++++++++---------
 1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
index 763c8de..08a535b 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
@@ -102,7 +102,7 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {
       cloudClient.request(update, collName);
       assertEquals(2, refs.get(collName).getCount());
     }
-
+    mockLbclient.close();
   }
 
 
@@ -125,28 +125,7 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {
 
   private ClusterStateProvider getStateProvider(Set<String> livenodes,
                                                                 Map<String, ClusterState.CollectionRef> colls) {
-    return new DelegatingClusterStateProvider(null) {
-      @Override
-      public ClusterState.CollectionRef getState(String collection) {
-        return colls.get(collection);
-      }
-
-      @Override
-      public Set<String> getLiveNodes() {
-        return livenodes;
-      }
-
-      @Override
-      public List<String> resolveAlias(String collection) {
-        return Collections.singletonList(collection);
-      }
-
-      @Override
-      public <T> T getClusterProperty(String propertyName, T def) {
-        return def;
-      }
-    };
-
+    return new MyDelegatingClusterStateProvider(colls, livenodes);
   }
 
 
@@ -187,5 +166,34 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {
       "            'node_name':'192.168.1.108:7574_solr',\n" +
       "            'state':'active'}}}}}}";
 
+  private static class MyDelegatingClusterStateProvider extends DelegatingClusterStateProvider {
+    private final Map<String,ClusterState.CollectionRef> colls;
+    private final Set<String> livenodes;
+
+    public MyDelegatingClusterStateProvider(Map<String,ClusterState.CollectionRef> colls, Set<String> livenodes) {
+      super(null);
+      this.colls = colls;
+      this.livenodes = livenodes;
+    }
+
+    @Override
+    public ClusterState.CollectionRef getState(String collection) {
+      return colls.get(collection);
+    }
 
+    @Override
+    public Set<String> getLiveNodes() {
+      return livenodes;
+    }
+
+    @Override
+    public List<String> resolveAlias(String collection) {
+      return Collections.singletonList(collection);
+    }
+
+    @Override
+    public <T> T getClusterProperty(String propertyName, T def) {
+      return def;
+    }
+  }
 }