lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject [01/26] lucene-solr:starburst: The Star Burst Upgrade - a work in progress - the branch gets replaced often.
Date Sun, 29 Jul 2018 15:08:23 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/starburst [created] 74a9b54c3


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
index c92329c..582350b 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
@@ -16,6 +16,8 @@
  */
 package org.apache.solr.cloud;
 
+import static org.apache.solr.common.util.Utils.makeMap;
+
 import java.io.File;
 import java.io.IOException;
 import java.lang.invoke.MethodHandles;
@@ -36,6 +38,7 @@ import java.util.Properties;
 import java.util.Random;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.UnaryOperator;
 
@@ -47,7 +50,7 @@ import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettyConfig;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.impl.Http2SolrClient;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.CoreAdminRequest;
 import org.apache.solr.client.solrj.request.QueryRequest;
@@ -56,10 +59,12 @@ import org.apache.solr.client.solrj.response.CollectionAdminResponse;
 import org.apache.solr.client.solrj.response.CoreAdminResponse;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.client.solrj.response.RequestStatusState;
+import org.apache.solr.cloud.ZkController.NotInClusterStateException;
 import org.apache.solr.cloud.api.collections.OverseerCollectionMessageHandler;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.cloud.ClusterState;
 import org.apache.solr.common.cloud.DocCollection;
@@ -97,8 +102,6 @@ import org.noggit.JSONWriter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.solr.common.util.Utils.makeMap;
-
 /**
  * TODO: we should still test this works as a custom update chain as well as
  * what we test now - the default update chain
@@ -126,6 +129,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
 
   protected CloudSolrClient controlClientCloud;  // cloud version of the control client
   protected volatile CloudSolrClient cloudClient;
+  
   protected List<SolrClient> coreClients = new ArrayList<>();
   
   protected List<CloudJettyRunner> cloudJettys = new ArrayList<>();
@@ -253,7 +257,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
         }
       }
     }
-    if (useTlogReplicas()) {
+    if (false) {
       log.info("Will use {} replicas unless explicitly asked otherwise", Replica.Type.TLOG);
     } else {
       log.info("Will use {} replicas unless explicitly asked otherwise", Replica.Type.NRT);
@@ -321,7 +325,8 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
           .setCreateNodeSet(controlJetty.getNodeName())
           .process(client).getStatus());
       }
-    controlClient = new HttpSolrClient.Builder(controlJetty.getBaseUrl() + "/control_collection").build();
+    controlClient = new Http2SolrClient.Builder(controlJetty.getBaseUrl() + "/control_collection")
+        .withHttpClient(getHttpClient()).build();
     if (sliceCount <= 0) {
       // for now, just create the cloud client for the control if we don't
       // create the normal cloud client.
@@ -347,26 +352,24 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
 
   }
 
-  public static void waitForCollection(ZkStateReader reader, String collection, int slices) throws Exception {
+  public static void waitForCollection(ZkStateReader zkStateReader, String collection, int slices) throws Exception {
     // wait until shards have started registering...
-    int cnt = 30;
-    while (!reader.getClusterState().hasCollection(collection)) {
-      if (cnt == 0) {
-        throw new RuntimeException("timeout waiting for collection in cluster state: collection=" + collection);
-      }
-      cnt--;
-      Thread.sleep(500);
-    }
-    cnt = 30;
-    
-    while (reader.getClusterState().getCollection(collection).getSlices().size() < slices) {
-      if (cnt == 0) {
-        throw new RuntimeException("timeout waiting for collection shards to come up: collection="+collection
-            + ", slices.expected="+slices+ " slices.actual= " + reader.getClusterState().getCollection(collection).getSlices().size()
-            + " slices : "+ reader.getClusterState().getCollection(collection).getSlices() );
-      }
-      cnt--;
-      Thread.sleep(500);
+    try {
+      zkStateReader.waitForState(collection, 15, TimeUnit.SECONDS, (n, c) -> {
+        if (c == null)
+          return false;
+        
+        
+        if (c.getSlices().size() < slices) {
+          return false;
+        }
+        
+        return true;
+      });
+    } catch (TimeoutException | InterruptedException e) {
+      throw new NotInClusterStateException(ErrorCode.SERVER_ERROR, "timeout waiting for collection shards to come up: collection="+collection
+          + ", slices.expected="+slices+ " slices.actual= " + zkStateReader.getClusterState().getCollection(collection).getSlices().size()
+          + " slices : "+ zkStateReader.getClusterState().getCollection(collection).getSlices() );
     }
   }
 
@@ -384,15 +387,15 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
     List<JettySolrRunner> jettys = new ArrayList<>();
     List<SolrClient> clients = new ArrayList<>();
     StringBuilder sb = new StringBuilder();
-
     assertEquals(0, CollectionAdminRequest
         .createCollection(DEFAULT_COLLECTION, "conf1", sliceCount, 1)
         .setStateFormat(Integer.parseInt(getStateFormat()))
         .setCreateNodeSet("")
         .process(cloudClient).getStatus());
-    
+    System.out.println("done create collection");
     int numOtherReplicas = numJettys - getPullReplicaCount() * sliceCount;
     for (int i = 1; i <= numJettys; i++) {
+      System.out.println("create jetty " + i);
       if (sb.length() > 0) sb.append(',');
       int cnt = this.jettyIntCntr.incrementAndGet();
 
@@ -405,7 +408,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
       CollectionAdminResponse response;
       if (numOtherReplicas > 0) {
         numOtherReplicas--;
-        if (useTlogReplicas()) {
+        if (false) {
           log.info("create jetty {} in directory {} of type {}", i, jettyDir, Replica.Type.TLOG);
           j = createJetty(jettyDir, useJettyDataDir ? getDataDir(testDir + "/jetty"
               + cnt) : null, null, "solrconfig.xml", null, Replica.Type.TLOG);
@@ -418,6 +421,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
           log.info("create jetty {} in directory {} of type {}", i, jettyDir, Replica.Type.NRT);
           j = createJetty(jettyDir, useJettyDataDir ? getDataDir(testDir + "/jetty"
               + cnt) : null, null, "solrconfig.xml", null, null);
+          System.out.println("add replica to collection");
           response = CollectionAdminRequest
               .addReplicaToShard(DEFAULT_COLLECTION, "shard"+((i%sliceCount)+1))
               .setNode(j.getNodeName())
@@ -428,6 +432,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
         log.info("create jetty {} in directory {} of type {}", i, jettyDir, Replica.Type.PULL);
         j = createJetty(jettyDir, useJettyDataDir ? getDataDir(testDir + "/jetty"
             + cnt) : null, null, "solrconfig.xml", null, Replica.Type.PULL);
+        System.out.println("add pull replica to collection");
         response = CollectionAdminRequest
             .addReplicaToShard(DEFAULT_COLLECTION, "shard"+((i%sliceCount)+1))
             .setNode(j.getNodeName())
@@ -435,7 +440,8 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
             .process(cloudClient);
       }
       jettys.add(j);
-      assertTrue(response.isSuccess());
+      System.out.println("add jetty " + j);
+      assertTrue(response.toString(), response.isSuccess());
       String coreName = response.getCollectionCoresStatus().keySet().iterator().next();
       coreClients.add(createNewSolrClient(coreName, j.getLocalPort()));
       SolrClient client = createNewSolrClient(j.getLocalPort());
@@ -445,29 +451,33 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
     this.jettys.addAll(jettys);
     this.clients.addAll(clients);
 
-    int numReplicas = getTotalReplicas(DEFAULT_COLLECTION);
     int expectedNumReplicas = numJettys;
 
     // now wait until we see that the number of shards in the cluster state
-    // matches what we expect
-    int retries = 0;
-    while (numReplicas != expectedNumReplicas) {
-      numReplicas = getTotalReplicas(DEFAULT_COLLECTION);
-      if (numReplicas == expectedNumReplicas) break;
-      if (retries++ == 60) {
-        printLayoutOnTearDown = true;
-        fail("Number of replicas in the state does not match what we set:" + numReplicas + " vs " + expectedNumReplicas);
-      }
-      Thread.sleep(500);
+    // matches what we expect    
+    AtomicInteger nReplicas = new AtomicInteger();
+    try {
+      cloudClient.getZkStateReader().waitForState(DEFAULT_COLLECTION, 30, TimeUnit.SECONDS, (n, c) -> {
+        if (c == null)
+          return false;
+        int numReplicas = getTotalReplicas(c.getName());
+        nReplicas.set(numReplicas);
+        if (numReplicas == expectedNumReplicas) return true;
+
+        return false;
+      });
+    } catch (TimeoutException | InterruptedException e) {
+      throw new NotInClusterStateException(ErrorCode.SERVER_ERROR,
+          "Number of replicas in the state does not match what we set:" + nReplicas + " vs " + expectedNumReplicas);
     }
-    
+
     ZkStateReader zkStateReader = cloudClient.getZkStateReader();
     // make sure we have a leader for each shard
     for (int i = 1; i <= sliceCount; i++) {
       zkStateReader.getLeaderRetry(DEFAULT_COLLECTION, "shard" + i, 10000);
     }
 
-    if (numReplicas > 0) {
+    if (numJettys > 0) {
       updateMappingsFromZk(this.jettys, this.clients);
     }
 
@@ -510,6 +520,8 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
         .withServlets(getExtraServlets())
         .withFilters(getExtraRequestFilters())
         .withSSLConfig(sslConfig)
+        .withHttpClient(getHttpClient())
+        .withJettyQtp(getQtp())
         .build();
 
     Properties props = new Properties();
@@ -541,6 +553,8 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
         .withServlets(getExtraServlets())
         .withFilters(getExtraRequestFilters())
         .withSSLConfig(sslConfig)
+        .withHttpClient(getHttpClient())
+        .withJettyQtp(getQtp())
         .build();
 
     Properties props = new Properties();
@@ -559,6 +573,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
     }
     props.setProperty("coreRootDirectory", solrHome.toPath().resolve("cores").toAbsolutePath().toString());
     
+    assert jettyconfig.qtp != null;
     JettySolrRunner jetty = new JettySolrRunner(solrHome.getPath(), props, jettyconfig);
     jetty.start();
 
@@ -580,6 +595,8 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
         .withServlets(getExtraServlets())
         .withFilters(getExtraRequestFilters())
         .withSSLConfig(sslConfig)
+        .withHttpClient(getHttpClient())
+        .withJettyQtp(getQtp())
         .build();
 
     Properties props = new Properties();
@@ -692,7 +709,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
       // we find out state by simply matching ports...
       for (Slice slice : coll.getSlices()) {
         for (Replica replica : slice.getReplicas()) {
-          int port = new URI(((HttpSolrClient) client).getBaseURL())
+          int port = new URI(((Http2SolrClient) client).getBaseURL())
               .getPort();
 
           if (replica.getStr(ZkStateReader.BASE_URL_PROP).contains(":" + port)) {
@@ -806,7 +823,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
         Throwable rootCause = SolrException.getRootCause(exc);
         if (++numRetries <= maxRetries) {
           log.warn("ERROR: " + rootCause + " ... Sleeping for " + waitBeforeRetry + " seconds before re-try ...");
-          Thread.sleep(waitBeforeRetry * 1000L);
+          //Thread.sleep(waitBeforeRetry * 1000L);
         } else {
           log.error("No more retries available! Add batch failed due to: " + rootCause);
           throw exc;
@@ -855,7 +872,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
     }
     controlClient.add(doc);
     
-    HttpSolrClient client = (HttpSolrClient) clients
+    Http2SolrClient client = (Http2SolrClient) clients
         .get(serverNumber);
 
     UpdateRequest ureq = new UpdateRequest();
@@ -891,6 +908,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
 
   @Override
   protected void del(String q) throws Exception {
+    System.out.println("control base url:" + ((Http2SolrClient)controlClient).getBaseURL());
     controlClient.deleteByQuery(q);
     cloudClient.deleteByQuery(q);
 
@@ -1426,7 +1444,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
         Map<String,Replica> theShards = slice.getValue().getReplicasMap();
         for (Map.Entry<String,Replica> shard : theShards.entrySet()) {
           String shardName = new URI(
-              ((HttpSolrClient) client.solrClient).getBaseURL()).getPort()
+              ((Http2SolrClient) client.solrClient).getBaseURL()).getPort()
               + "_solr_";
           if (verbose && shard.getKey().endsWith(shardName)) {
             System.err.println("shard:" + slice.getKey());
@@ -1444,7 +1462,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
         count = client.solrClient.query(query).getResults().getNumFound();
       }
 
-      if (verbose) System.err.println("client docs:" + count + "\n\n");
+      if (verbose) System.err.println( ((Http2SolrClient) client.solrClient).getBaseURL() + " client docs:" + count + "\n\n");
     }
     if (verbose) System.err.println("control docs:"
         + controlClient.query(new SolrQuery("*:*")).getResults().getNumFound()
@@ -1500,7 +1518,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
       }
       cnt++;
       if (cnt > 30) break;
-      Thread.sleep(2000);
+      Thread.sleep(1000);
     } while (retry);
   }
 
@@ -1563,13 +1581,10 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
     if (commonCloudSolrClient != null) {
       commonCloudSolrClient.close();
     }
-    if (controlClient != null) {
-      controlClient.close();
-    }
     if (cloudClient != null) {
       cloudClient.close();
     }
-    if (controlClientCloud != null) {
+    if (controlClientCloud != null && controlClientCloud != cloudClient) {
       controlClientCloud.close();
     }
     super.distribTearDown();
@@ -1669,7 +1684,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
 
     CollectionAdminResponse res = new CollectionAdminResponse();
     if (client == null) {
-      final String baseUrl = getBaseUrl((HttpSolrClient) clients.get(clientIndex));
+      final String baseUrl = getBaseUrl((Http2SolrClient) clients.get(clientIndex));
       try (SolrClient adminClient = createNewSolrClient("", baseUrl)) {
         res.setResponse(adminClient.request(request));
       }
@@ -1683,8 +1698,8 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
   protected CollectionAdminResponse createCollection(Map<String,List<Integer>> collectionInfos,
       String collectionName, String configSetName, int numShards, int replicationFactor, int maxShardsPerNode, SolrClient client, String createNodeSetStr) throws SolrServerException, IOException {
 
-    int numNrtReplicas = useTlogReplicas()?0:replicationFactor;
-    int numTlogReplicas = useTlogReplicas()?replicationFactor:0;
+    int numNrtReplicas = replicationFactor;
+    int numTlogReplicas = 0;
     return createCollection(collectionInfos, collectionName,
         Utils.makeMap(
             OverseerCollectionMessageHandler.NUM_SLICES, numShards,
@@ -1699,8 +1714,8 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
   protected CollectionAdminResponse createCollection(Map<String, List<Integer>> collectionInfos,
                                                      String collectionName, int numShards, int replicationFactor, int maxShardsPerNode, SolrClient client, String createNodeSetStr, String configName) throws SolrServerException, IOException {
 
-    int numNrtReplicas = useTlogReplicas()?0:replicationFactor;
-    int numTlogReplicas = useTlogReplicas()?replicationFactor:0;
+    int numNrtReplicas = replicationFactor;
+    int numTlogReplicas = 0;
     return createCollection(collectionInfos, collectionName,
         Utils.makeMap(
             OverseerCollectionMessageHandler.NUM_SLICES, numShards,
@@ -1726,7 +1741,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
       // setup the server...
       String baseUrl = buildUrl(port);
       String url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + coreName;
-      HttpSolrClient client = getHttpSolrClient(url, DEFAULT_CONNECTION_TIMEOUT, 60000);
+      Http2SolrClient client = getHttpSolrClient(url, DEFAULT_CONNECTION_TIMEOUT, 60000);
       return client;
     } catch (Exception ex) {
       throw new RuntimeException(ex);
@@ -1738,7 +1753,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
       // setup the server...
       String baseUrl = buildUrl(port);
       String url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + coreName;
-      HttpSolrClient client = getHttpSolrClient(url, connectionTimeoutMillis, socketTimeoutMillis);
+      Http2SolrClient client = getHttpSolrClient(url, connectionTimeoutMillis, socketTimeoutMillis);
       return client;
     } catch (Exception ex) {
       throw new RuntimeException(ex);
@@ -1748,7 +1763,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
   protected SolrClient createNewSolrClient(String collection, String baseUrl) {
     try {
       // setup the server...
-      HttpSolrClient client = getHttpSolrClient(baseUrl + "/" + collection, DEFAULT_CONNECTION_TIMEOUT, 60000);
+      Http2SolrClient client = getHttpSolrClient(baseUrl + "/" + collection, DEFAULT_CONNECTION_TIMEOUT, 60000);
       return client;
     }
     catch (Exception ex) {
@@ -1756,7 +1771,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
     }
   }
   
-  protected String getBaseUrl(HttpSolrClient client) {
+  protected String getBaseUrl(Http2SolrClient client) {
     return client .getBaseURL().substring(
         0, client.getBaseURL().length()
             - DEFAULT_COLLECTION.length() - 1);
@@ -1862,7 +1877,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
     throw new RuntimeException("Could not find a live node for collection:" + collection);
   }
 
- public static void waitForNon403or404or503(HttpSolrClient collectionClient)
+ public static void waitForNon403or404or503(Http2SolrClient collectionClient)
       throws Exception {
     SolrException exp = null;
     final TimeOut timeout = new TimeOut(30, TimeUnit.SECONDS, TimeSource.NANO_TIME);
@@ -1882,7 +1897,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
       if (!missing) {
         return;
       }
-      Thread.sleep(50);
+      Thread.sleep(1000);
     }
 
     fail("Could not find the new collection - " + exp.code() + " : " + collectionClient.getBaseURL());
@@ -1900,8 +1915,8 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
                                   int numShards ) throws Exception {
     int maxShardsPerNode = ((((numShards+1) * replicationFactor) / getCommonCloudSolrClient()
         .getZkStateReader().getClusterState().getLiveNodes().size())) + 1;
-    int numNrtReplicas = useTlogReplicas()?0:replicationFactor;
-    int numTlogReplicas = useTlogReplicas()?replicationFactor:0;
+    int numNrtReplicas = replicationFactor;
+    int numTlogReplicas = 0;
     Map<String, Object> props = makeMap(
         ZkStateReader.MAX_SHARDS_PER_NODE, maxShardsPerNode,
         ZkStateReader.NRT_REPLICAS, numNrtReplicas,
@@ -1928,24 +1943,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
   }
 
   protected Replica getShardLeader(String testCollectionName, String shardId, int timeoutSecs) throws Exception {
-    Replica leader = null;
-    long timeout = System.nanoTime() + TimeUnit.NANOSECONDS.convert(timeoutSecs, TimeUnit.SECONDS);
-    while (System.nanoTime() < timeout) {
-      Replica tmp = null;
-      try {
-        tmp = cloudClient.getZkStateReader().getLeaderRetry(testCollectionName, shardId);
-      } catch (Exception exc) {}
-      if (tmp != null && "active".equals(tmp.getStr(ZkStateReader.STATE_PROP))) {
-        leader = tmp;
-        break;
-      }
-      Thread.sleep(1000);
-    }
-    assertNotNull("Could not find active leader for " + shardId + " of " +
-        testCollectionName + " after "+timeoutSecs+" secs; clusterState: " +
-        printClusterStateInfo(testCollectionName), leader);
-
-    return leader;
+    return cloudClient.getZkStateReader().getLeaderRetry(testCollectionName, shardId);
   }
 
   protected List<Replica> ensureAllReplicasAreActive(String testCollectionName, String shardId, int shards, int rf, int maxWaitSecs) throws Exception {
@@ -2038,7 +2036,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
     ZkCoreNodeProps coreProps = new ZkCoreNodeProps(replica);
     String coreName = coreProps.getCoreName();
     boolean reloadedOk = false;
-    try (HttpSolrClient client = getHttpSolrClient(coreProps.getBaseUrl())) {
+    try (Http2SolrClient client = getHttpSolrClient(coreProps.getBaseUrl())) {
       CoreAdminResponse statusResp = CoreAdminRequest.getStatus(coreName, client);
       long leaderCoreStartTime = statusResp.getStartTime(coreName).getTime();
 
@@ -2169,7 +2167,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
   }
 
   protected long getIndexVersion(Replica replica) throws IOException {
-    try (HttpSolrClient client = new HttpSolrClient.Builder(replica.getCoreUrl()).build()) {
+    try (Http2SolrClient client = new Http2SolrClient.Builder(replica.getCoreUrl()).withHttpClient(getHttpClient()).build()) {
       ModifiableSolrParams params = new ModifiableSolrParams();
       params.set("qt", "/replication");
       params.set(ReplicationHandler.COMMAND, ReplicationHandler.CMD_SHOW_COMMITS);
@@ -2203,7 +2201,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
   }
 
   protected void logReplicationDetails(Replica replica, StringBuilder builder) throws IOException {
-    try (HttpSolrClient client = new HttpSolrClient.Builder(replica.getCoreUrl()).build()) {
+    try (Http2SolrClient client = new Http2SolrClient.Builder(replica.getCoreUrl()).build()) {
       ModifiableSolrParams params = new ModifiableSolrParams();
       params.set("qt", "/replication");
       params.set(ReplicationHandler.COMMAND, ReplicationHandler.CMD_DETAILS);
@@ -2252,7 +2250,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
 
   protected void setupRestTestHarnesses() {
     for (final SolrClient client : clients) {
-      RestTestHarness harness = new RestTestHarness(() -> ((HttpSolrClient) client).getBaseURL());
+      RestTestHarness harness = new RestTestHarness(() -> ((Http2SolrClient) client).getBaseURL());
       restTestHarnesses.add(harness);
     }
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java b/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java
index 71e1b43..f35a86e 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java
@@ -658,12 +658,12 @@ public class ChaosMonkey {
         jetty.start();
       } catch (Exception e2) {
         jetty.stop();
-        Thread.sleep(10000);
+        Thread.sleep(5000);
         try {
           jetty.start();
         } catch (Exception e3) {
           jetty.stop();
-          Thread.sleep(30000);
+          Thread.sleep(15000);
           try {
             jetty.start();
           } catch (Exception e4) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
index 6c28eba..b81efa7 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
@@ -16,7 +16,6 @@
  */
 package org.apache.solr.cloud;
 
-import javax.servlet.Filter;
 import java.io.IOException;
 import java.lang.invoke.MethodHandles;
 import java.nio.charset.Charset;
@@ -38,12 +37,16 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import javax.servlet.Filter;
+
 import org.apache.solr.client.solrj.embedded.JettyConfig;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.embedded.SSLConfig;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.impl.CloudSolrClient.Builder;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.util.SolrInternalHttpClient;
+import org.apache.solr.client.solrj.util.SolrQueuedThreadPool;
 import org.apache.solr.common.cloud.Aliases;
 import org.apache.solr.common.cloud.Replica;
 import org.apache.solr.common.cloud.SolrZkClient;
@@ -110,6 +113,8 @@ public class MiniSolrCloudCluster {
   
   private final AtomicInteger nodeIds = new AtomicInteger();
 
+  private SolrInternalHttpClient httpClient;
+
   /**
    * Create a MiniSolrCloudCluster with default solr.xml
    *
@@ -137,8 +142,8 @@ public class MiniSolrCloudCluster {
    */
   public MiniSolrCloudCluster(int numServers, String hostContext, Path baseDir, String solrXml,
       SortedMap<ServletHolder, String> extraServlets,
-      SortedMap<Class<? extends Filter>, String> extraRequestFilters) throws Exception {
-    this(numServers, hostContext, baseDir, solrXml, extraServlets, extraRequestFilters, null);
+      SortedMap<Class<? extends Filter>, String> extraRequestFilters, SolrInternalHttpClient httpClient, SolrQueuedThreadPool qtp) throws Exception {
+    this(numServers, hostContext, baseDir, solrXml, extraServlets, extraRequestFilters, null, httpClient, qtp);
   }
 
   /**
@@ -157,12 +162,14 @@ public class MiniSolrCloudCluster {
   public MiniSolrCloudCluster(int numServers, String hostContext, Path baseDir, String solrXml,
       SortedMap<ServletHolder, String> extraServlets,
       SortedMap<Class<? extends Filter>, String> extraRequestFilters,
-      SSLConfig sslConfig) throws Exception {
+      SSLConfig sslConfig, SolrInternalHttpClient httpClient, SolrQueuedThreadPool qtp) throws Exception {
     this(numServers, baseDir, solrXml, JettyConfig.builder()
         .setContext(hostContext)
         .withSSLConfig(sslConfig)
         .withFilters(extraRequestFilters)
         .withServlets(extraServlets)
+        .withHttpClient(httpClient)
+        .withJettyQtp(qtp)
         .build());
   }
 
@@ -215,6 +222,7 @@ public class MiniSolrCloudCluster {
       ZkTestServer zkTestServer, Optional<String> securityJson) throws Exception {
 
     Objects.requireNonNull(securityJson);
+    this.httpClient = jettyConfig.httpClient;
     this.baseDir = Objects.requireNonNull(baseDir);
     this.jettyConfig = Objects.requireNonNull(jettyConfig);
 
@@ -368,6 +376,8 @@ public class MiniSolrCloudCluster {
         .withServlets(extraServlets)
         .withFilters(extraRequestFilters)
         .withSSLConfig(sslConfig)
+        .withHttpClient(httpClient)
+        .withJettyQtp(jettyConfig.qtp)
         .build());
   }
 
@@ -387,7 +397,7 @@ public class MiniSolrCloudCluster {
   public JettySolrRunner startJettySolrRunner(String name, String hostContext, JettyConfig config) throws Exception {
     Path runnerPath = createInstancePath(name);
     String context = getHostContextSuitableForServletContext(hostContext);
-    JettyConfig newConfig = JettyConfig.builder(config).setContext(context).build();
+    JettyConfig newConfig = JettyConfig.builder(config).setContext(context).withJettyQtp(jettyConfig.qtp).build();
     JettySolrRunner jetty = new JettySolrRunner(runnerPath.toString(), newConfig);
     jetty.start();
     jettys.add(jetty);
@@ -447,12 +457,11 @@ public class MiniSolrCloudCluster {
 
   /** Delete all collections (and aliases) */
   public void deleteAllCollections() throws Exception {
-    try (ZkStateReader reader = new ZkStateReader(solrClient.getZkStateReader().getZkClient())) {
-      reader.createClusterStateWatchersAndUpdate(); // up to date aliases & collections
-      reader.aliasesManager.applyModificationAndExportToZk(aliases -> Aliases.EMPTY);
-      for (String collection : reader.getClusterState().getCollectionStates().keySet()) {
-        CollectionAdminRequest.deleteCollection(collection).process(solrClient);
-      }
+    ZkStateReader reader = solrClient.getZkStateReader();
+    reader.createClusterStateWatchersAndUpdate(); // up to date aliases & collections
+    reader.aliasesManager.applyModificationAndExportToZk(aliases -> Aliases.EMPTY);
+    for (String collection : reader.getClusterState().getCollectionStates().keySet()) {
+      CollectionAdminRequest.deleteCollection(collection).process(solrClient);
     }
   }
 
@@ -461,8 +470,9 @@ public class MiniSolrCloudCluster {
    */
   public void shutdown() throws Exception {
     try {
-    
+      
       IOUtils.closeQuietly(solrClient);
+
       // accept no new tasks
       executorLauncher.shutdown();
       List<Callable<JettySolrRunner>> shutdowns = new ArrayList<>(jettys.size());
@@ -501,7 +511,7 @@ public class MiniSolrCloudCluster {
   }
   
   protected CloudSolrClient buildSolrClient() {
-    return new Builder(Collections.singletonList(getZkServer().getZkAddress()), Optional.empty())
+    return new Builder(Collections.singletonList(getZkServer().getZkAddress()), Optional.empty()).withHttpClient(httpClient)
         .build();
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java b/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java
index a4c3b6d..ae9b8c2 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java
@@ -38,7 +38,7 @@ import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettyConfig;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.impl.Http2SolrClient;
 import org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider;
 import org.apache.solr.client.solrj.request.CoreAdminRequest;
 import org.apache.solr.client.solrj.request.CoreStatus;
@@ -267,7 +267,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
    */
   protected static void waitForState(String message, String collection, CollectionStatePredicate predicate) {
     AtomicReference<DocCollection> state = new AtomicReference<>();
-    AtomicReference<Set<String>> liveNodesLastSeen = new AtomicReference<>();
+    AtomicReference<Set<String>> liveNodesLastSeen = new AtomicReference<>(Collections.emptySet());
     try {
       cluster.getSolrClient().waitForState(collection, DEFAULT_TIMEOUT, TimeUnit.SECONDS, (n, c) -> {
         state.set(c);
@@ -347,7 +347,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
    */
   protected static CoreStatus getCoreStatus(Replica replica) throws IOException, SolrServerException {
     JettySolrRunner jetty = cluster.getReplicaJetty(replica);
-    try (HttpSolrClient client = getHttpSolrClient(jetty.getBaseUrl().toString(), cluster.getSolrClient().getHttpClient())) {
+    try (Http2SolrClient client = getHttpSolrClient(jetty.getBaseUrl().toString(), cluster.getSolrClient().getHttpClient())) {
       return CoreAdminRequest.getCoreStatus(replica.getCoreName(), client);
     }
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
index 216d3fe..ad6723f 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
@@ -16,7 +16,28 @@
  */
 package org.apache.solr.cloud;
 
-import com.google.common.util.concurrent.AtomicLongMap;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.lang.invoke.MethodHandles;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+
+import javax.management.JMException;
+
 import org.apache.solr.common.cloud.SolrZkClient;
 import org.apache.solr.common.util.TimeSource;
 import org.apache.solr.util.TimeOut;
@@ -38,26 +59,7 @@ import org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.management.JMException;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.lang.invoke.MethodHandles;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.SocketChannel;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
+import com.google.common.util.concurrent.AtomicLongMap;
 
 public class ZkTestServer {
   public static final int TICK_TIME = 1000;
@@ -334,11 +336,9 @@ public class ZkTestServer {
      * @throws IOException If there is a low-level I/O error.
      */
     protected void shutdown() throws IOException {
-      zooKeeperServer.shutdown();
+      zooKeeperServer.shutdown(false);
       ZKDatabase zkDb = zooKeeperServer.getZKDatabase();
-      if (cnxnFactory != null && cnxnFactory.getLocalPort() != 0) {
-        waitForServerDown(getZkHost() + ":" + getPort(), 5000);
-      }
+
       if (cnxnFactory != null) {
         cnxnFactory.shutdown();
         try {
@@ -347,9 +347,14 @@ public class ZkTestServer {
           Thread.currentThread().interrupt();
         }
       }
+
       if (zkDb != null) {
         zkDb.close();
       }
+      
+      if (cnxnFactory != null && cnxnFactory.getLocalPort() != 0) {
+        waitForServerDown(getZkHost() + ":" + getPort(), 5000);
+      }
     }
 
     public int getLocalPort() {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/handler/component/TrackingShardHandlerFactory.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/handler/component/TrackingShardHandlerFactory.java b/solr/test-framework/src/java/org/apache/solr/handler/component/TrackingShardHandlerFactory.java
index 8b440a2..600f62f 100644
--- a/solr/test-framework/src/java/org/apache/solr/handler/component/TrackingShardHandlerFactory.java
+++ b/solr/test-framework/src/java/org/apache/solr/handler/component/TrackingShardHandlerFactory.java
@@ -44,6 +44,10 @@ import org.apache.solr.core.CoreContainer;
  */
 public class TrackingShardHandlerFactory extends HttpShardHandlerFactory {
 
+  public TrackingShardHandlerFactory() {
+    super();
+  }
+
   private Queue<ShardRequestAndParams> queue;
 
   /**

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/util/BadZookeeperThreadsFilter.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/util/BadZookeeperThreadsFilter.java b/solr/test-framework/src/java/org/apache/solr/util/BadZookeeperThreadsFilter.java
deleted file mode 100644
index f9bd870..0000000
--- a/solr/test-framework/src/java/org/apache/solr/util/BadZookeeperThreadsFilter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.util;
-
-import com.carrotsearch.randomizedtesting.ThreadFilter;
-
-public class BadZookeeperThreadsFilter implements ThreadFilter {
-
-  @Override
-  public boolean reject(Thread t) {
-    String name = t.getName();
-    
-    StackTraceElement [] stack = t.getStackTrace();
-    if (name.startsWith("Thread-") && stack.length > 1 && stack[stack.length - 2].getClassName().equals("org.apache.zookeeper.Login$1")) {
-      return true; // see ZOOKEEPER-2100
-    }
-
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/util/DOMUtilTestBase.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/util/DOMUtilTestBase.java b/solr/test-framework/src/java/org/apache/solr/util/DOMUtilTestBase.java
index 61a3007..6f05404 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/DOMUtilTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/DOMUtilTestBase.java
@@ -18,18 +18,19 @@ package org.apache.solr.util;
 
 
 import java.io.StringReader;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathFactory;
 
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.solr.SolrTestCaseJ4;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
 
-public abstract class DOMUtilTestBase extends LuceneTestCase {
+public abstract class DOMUtilTestBase extends SolrTestCaseJ4 {
   
   private DocumentBuilder builder;
   private static final XPathFactory xpathFactory = XPathFactory.newInstance();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java b/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java
index 12cad01..652cedd 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java
@@ -15,8 +15,16 @@
  * limitations under the License.
  */
 package org.apache.solr.util;
+import java.io.IOException;
+import java.lang.invoke.MethodHandles;
+import java.util.Map;
+import java.util.SortedMap;
+
+import javax.xml.xpath.XPathExpressionException;
+
 import org.apache.solr.JSONTestUtil;
 import org.apache.solr.SolrJettyTestBase;
+import org.apache.solr.client.solrj.impl.Http2SolrClient;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.MultiMapSolrParams;
 import org.apache.solr.common.util.StrUtils;
@@ -27,12 +35,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
 
-import javax.xml.xpath.XPathExpressionException;
-import java.io.IOException;
-import java.lang.invoke.MethodHandles;
-import java.util.Map;
-import java.util.SortedMap;
-
 abstract public class RestTestBase extends SolrJettyTestBase {
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   protected static RestTestHarness restTestHarness;
@@ -220,11 +222,13 @@ abstract public class RestTestBase extends SolrJettyTestBase {
     query = setParam(query, "wt", "json");
     request = path + '?' + setParam(query, "indent", "on");
 
-    String response;
+    String response = null;
     boolean failed = true;
     try {
       response = restTestHarness.query(request);
       failed = false;
+    } catch (Http2SolrClient.RemoteExecutionException e) {
+
     } finally {
       if (failed) {
         log.error("REQUEST FAILED: " + request);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/java/org/apache/solr/util/RestTestHarness.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/util/RestTestHarness.java b/solr/test-framework/src/java/org/apache/solr/util/RestTestHarness.java
index 2769d9b..78c1a7b 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/RestTestHarness.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/RestTestHarness.java
@@ -15,33 +15,28 @@
  * limitations under the License.
  */
 package org.apache.solr.util;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
 import java.io.Closeable;
 import java.io.IOException;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 
-import org.apache.http.HttpEntity;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpPut;
-import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.util.EntityUtils;
-import org.apache.solr.client.solrj.impl.HttpClientUtil;
-import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.client.solrj.impl.Http2SolrClient;
+import org.apache.solr.client.solrj.impl.Http2SolrClient.SimpleResponse;
 
 /**
  * Facilitates testing Solr's REST API via a provided embedded Jetty
  */
 public class RestTestHarness extends BaseTestHarness implements Closeable {
   private RESTfulServerProvider serverProvider;
-  private CloseableHttpClient httpClient = HttpClientUtil.createClient(new
-      ModifiableSolrParams());
+  private Http2SolrClient httpClient = new Http2SolrClient.Builder("").withHttpClient(SolrTestCaseJ4.getHttpClient()).build();
   
   public RestTestHarness(RESTfulServerProvider serverProvider) {
     this.serverProvider = serverProvider;
@@ -104,11 +99,11 @@ public class RestTestHarness extends BaseTestHarness implements Closeable {
    * @exception Exception any exception in the response.
    */
   public String query(String request) throws Exception {
-    return getResponse(new HttpGet(getBaseURL() + request));
+    return getResponse(getBaseURL() + request);
   }
 
   public String adminQuery(String request) throws Exception {
-    return getResponse(new HttpGet(getAdminURL() + request));
+    return getResponse(getAdminURL() + request);
   }
 
   /**
@@ -119,12 +114,12 @@ public class RestTestHarness extends BaseTestHarness implements Closeable {
    * @param content The content to include with the PUT request
    * @return The response to the PUT request
    */
-  public String put(String request, String content) throws IOException {
+  public String put(String request, String content) throws Exception {
     HttpPut httpPut = new HttpPut(getBaseURL() + request);
     httpPut.setEntity(new StringEntity(content, ContentType.create(
         "application/json", StandardCharsets.UTF_8)));
     
-    return getResponse(httpPut);
+    return getPutResponse(getBaseURL() + request, content);
   }
 
   /**
@@ -134,9 +129,8 @@ public class RestTestHarness extends BaseTestHarness implements Closeable {
    * @param request the URL path and optional query params
    * @return The response to the DELETE request
    */
-  public String delete(String request) throws IOException {
-    HttpDelete httpDelete = new HttpDelete(getBaseURL() + request);
-    return getResponse(httpDelete);
+  public String delete(String request) throws Exception {
+    return getDeleteResponse(getBaseURL() + request);
   }
 
   /**
@@ -147,12 +141,12 @@ public class RestTestHarness extends BaseTestHarness implements Closeable {
    * @param content The content to include with the POST request
    * @return The response to the POST request
    */
-  public String post(String request, String content) throws IOException {
+  public String post(String request, String content) throws Exception {
     HttpPost httpPost = new HttpPost(getBaseURL() + request);
     httpPost.setEntity(new StringEntity(content, ContentType.create(
         "application/json", StandardCharsets.UTF_8)));
     
-    return getResponse(httpPost);
+    return getPostResponse(getBaseURL() + request, content);
   }
 
 
@@ -209,18 +203,28 @@ public class RestTestHarness extends BaseTestHarness implements Closeable {
   /**
    * Executes the given request and returns the response.
    */
-  private String getResponse(HttpUriRequest request) throws IOException {
-    HttpEntity entity = null;
-    try {
-      entity = httpClient.execute(request, HttpClientUtil.createNewHttpClientRequestContext()).getEntity();
-      return EntityUtils.toString(entity, StandardCharsets.UTF_8);
-    } finally {
-      EntityUtils.consumeQuietly(entity);
-    }
+  private String getResponse(String url) throws Exception {
+    SimpleResponse rsp = httpClient.httpGet(url);
+//    if (rsp.status != 200) {
+//      throw new Http2SolrClient.RemoteSolrException(url, rsp.status, rsp.asString, null);
+//    }
+    return rsp.asString;
+  }
+  
+  private String getDeleteResponse(String url) throws Exception {
+    return httpClient.httpDelete(url);
+  }
+  
+  private String getPutResponse(String url, String json) throws Exception {
+    return httpClient.httpPut(url, json.getBytes(), "application/json");
+  }
+  
+  private String getPostResponse(String url, String json) throws Exception {
+    return httpClient.httpPost(url, json.getBytes(), "application/json").asString;
   }
 
   @Override
   public void close() throws IOException {
-    HttpClientUtil.close(httpClient);
+    httpClient.close();
   }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java b/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java
index ac1c5e1..c54028e 100644
--- a/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java
+++ b/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java
@@ -20,8 +20,8 @@ package org.apache.solr.cloud;
 import java.io.IOException;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.embedded.JettyConfig;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.util.RevertDefaultThreadHandlerRule;
@@ -30,8 +30,10 @@ import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.junit.rules.TestRule;
 
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+
 @LuceneTestCase.SuppressSysoutChecks(bugUrl = "Solr logs to JUL")
-public class MiniSolrCloudClusterTest extends LuceneTestCase {
+public class MiniSolrCloudClusterTest extends SolrTestCaseJ4 {
 
   @ClassRule
   public static TestRule solrClassRules = RuleChain.outerRule(
@@ -45,7 +47,7 @@ public class MiniSolrCloudClusterTest extends LuceneTestCase {
 
     MiniSolrCloudCluster cluster = null;
     try {
-      cluster = new MiniSolrCloudCluster(3, createTempDir(), JettyConfig.builder().build()) {
+      cluster = new MiniSolrCloudCluster(3, createTempDir(), JettyConfig.builder().withJettyQtp(getQtp()).withHttpClient(getHttpClient()).build()) {
         @Override
         public JettySolrRunner startJettySolrRunner(String name, String context, JettyConfig config) throws Exception {
           if (jettyIndex.incrementAndGet() != 2)
@@ -71,7 +73,7 @@ public class MiniSolrCloudClusterTest extends LuceneTestCase {
 
     AtomicInteger jettyIndex = new AtomicInteger();
 
-    MiniSolrCloudCluster cluster = new MiniSolrCloudCluster(3, createTempDir(), JettyConfig.builder().build()) {
+    MiniSolrCloudCluster cluster = new MiniSolrCloudCluster(3, createTempDir(), JettyConfig.builder().withJettyQtp(getQtp()).withHttpClient(getHttpClient()).build()) {
       @Override
       public JettySolrRunner stopJettySolrRunner(JettySolrRunner jetty) throws Exception {
         JettySolrRunner j = super.stopJettySolrRunner(jetty);
@@ -98,7 +100,7 @@ public class MiniSolrCloudClusterTest extends LuceneTestCase {
     JettyConfig.Builder jettyConfig = JettyConfig.builder();
     jettyConfig.waitForLoadingCoresToFinish(null);
     jettyConfig.withFilter(JettySolrRunner.DebugFilter.class, "*");
-    MiniSolrCloudCluster cluster = new MiniSolrCloudCluster(random().nextInt(3) + 1, createTempDir(), jettyConfig.build());
+    MiniSolrCloudCluster cluster = new MiniSolrCloudCluster(random().nextInt(3) + 1, createTempDir(), jettyConfig.withJettyQtp(getQtp()).build());
     cluster.shutdown();
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74a9b54c/starburst.jpeg
----------------------------------------------------------------------
diff --git a/starburst.jpeg b/starburst.jpeg
new file mode 100644
index 0000000..429f39f
Binary files /dev/null and b/starburst.jpeg differ


Mime
View raw message