tests: get leader to base clase

This commit is contained in:
markrmiller 2016-12-12 10:56:51 -05:00
parent a342d6bba6
commit 38a66f5452
1 changed files with 9 additions and 0 deletions

View File

@ -830,6 +830,15 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
controlClient.add(doc); controlClient.add(doc);
} }
protected ZkCoreNodeProps getLeaderUrlFromZk(String collection, String slice) {
ClusterState clusterState = getCommonCloudSolrClient().getZkStateReader().getClusterState();
ZkNodeProps leader = clusterState.getLeader(collection, slice);
if (leader == null) {
throw new RuntimeException("Could not find leader:" + collection + " " + slice);
}
return new ZkCoreNodeProps(leader);
}
@Override @Override
protected void del(String q) throws Exception { protected void del(String q) throws Exception {
controlClient.deleteByQuery(q); controlClient.deleteByQuery(q);