You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/09/18 17:13:52 UTC

svn commit: r1703881 [4/5] - in /lucene/dev/branches/lucene6780: ./ lucene/ lucene/analysis/ lucene/analysis/common/ lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ lucene/benchmark/ lucene/benchmark/src/test/org/apache/lucene/benc...

Modified: lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/search/similarities/SweetSpotSimilarityFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/search/similarities/SweetSpotSimilarityFactory.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/search/similarities/SweetSpotSimilarityFactory.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/search/similarities/SweetSpotSimilarityFactory.java Fri Sep 18 15:13:49 2015
@@ -18,7 +18,7 @@ package org.apache.solr.search.similarit
  */
 
 import org.apache.lucene.misc.SweetSpotSimilarity;
-import org.apache.lucene.search.similarities.DefaultSimilarity; // jdoc
+import org.apache.lucene.search.similarities.ClassicSimilarity; // jdoc
 import org.apache.lucene.search.similarities.Similarity;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.schema.SimilarityFactory;
@@ -28,7 +28,7 @@ import static org.apache.solr.common.Sol
  * <p>Factory for {@link SweetSpotSimilarity}.</p>
  * <p>
  * <code>SweetSpotSimilarity</code> is an extension of 
- * {@link DefaultSimilarity} that provides additional tuning options for 
+ * {@link ClassicSimilarity} that provides additional tuning options for 
  * specifying the "sweetspot" of optimal <code>tf</code> and 
  * <code>lengthNorm</code> values in the source data.
  * </p>

Modified: lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java Fri Sep 18 15:13:49 2015
@@ -195,9 +195,13 @@ public class SolrDispatchFilter extends
 
     // No need to even create the HttpSolrCall object if this path is excluded.
     if(excludePatterns != null) {
-      String servletPath = ((HttpServletRequest) request).getServletPath();
+      String requestPath = ((HttpServletRequest) request).getServletPath();
+      String extraPath = ((HttpServletRequest)request).getPathInfo();
+      if (extraPath != null) { // In embedded mode, servlet path is empty - include all post-context path here for testing 
+        requestPath += extraPath;
+      }
       for (Pattern p : excludePatterns) {
-        Matcher matcher = p.matcher(servletPath);
+        Matcher matcher = p.matcher(requestPath);
         if (matcher.lookingAt()) {
           chain.doFilter(request, response);
           return;

Modified: lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java Fri Sep 18 15:13:49 2015
@@ -870,6 +870,11 @@ public class DistributedUpdateProcessor
           }
         }
 
+        // If the client specified minRf and we didn't achieve the minRf, don't send recovery and let client retry
+        if (replicationTracker != null && replicationTracker.getAchievedRf() < replicationTracker.minRf) {
+          continue;
+        }
+
         if (cloudDesc.getCoreNodeName().equals(leaderCoreNodeName) && foundErrorNodeInReplicaList) {
           try {
             // if false, then the node is probably not "live" anymore

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java Fri Sep 18 15:13:49 2015
@@ -32,9 +32,9 @@ import org.apache.solr.common.cloud.Repl
 import org.apache.solr.common.cloud.Slice;
 import org.junit.After;
 import org.junit.Before;
-
 import org.apache.commons.lang.StringUtils;
 import org.junit.Test;
+
 import static org.hamcrest.CoreMatchers.*;
 
 import java.io.IOException;
@@ -46,6 +46,8 @@ import java.util.Set;
  */
 public class DistribJoinFromCollectionTest extends AbstractFullDistribZkTestBase {
   
+  final private static String[] scoreModes = {"avg","max","min","total"};
+
   public DistribJoinFromCollectionTest() {
     super();
   }
@@ -119,20 +121,23 @@ public class DistribJoinFromCollectionTe
   private void testJoins(String toColl, String fromColl, Integer toDocId, boolean isScoresTest)
       throws SolrServerException, IOException {
     // verify the join with fromIndex works
-    final String[] scoreModes = {"avg","max","min","total"};
-    String joinQ = "{!join " + anyScoreMode(isScoresTest, scoreModes)
-                   + "from=join_s fromIndex=" + fromColl + " to=join_s}match_s:c";
+    final String fromQ = "match_s:c match_s:not_1_0_score_after_weight_normalization";
+    {
+    final String joinQ = "{!join " + anyScoreMode(isScoresTest)
+                   + "from=join_s fromIndex=" + fromColl + 
+                   " to=join_s}" + fromQ;
     QueryRequest qr = new QueryRequest(params("collection", toColl, "q", joinQ, "fl", "id,get_s,score"));
     QueryResponse rsp = new QueryResponse(cloudClient.request(qr), cloudClient);
     SolrDocumentList hits = rsp.getResults();
-    assertTrue("Expected 1 doc", hits.getNumFound() == 1);
+    assertTrue("Expected 1 doc, got "+hits, hits.getNumFound() == 1);
     SolrDocument doc = hits.get(0);
     assertEquals(toDocId, doc.getFirstValue("id"));
     assertEquals("b", doc.getFirstValue("get_s"));
     assertScore(isScoresTest, doc);
+    }
 
     //negative test before creating an alias
-    checkAbsentFromIndex(fromColl, toColl, isScoresTest, scoreModes);
+    checkAbsentFromIndex(fromColl, toColl, isScoresTest);
 
     // create an alias for the fromIndex and then query through the alias
     String alias = fromColl+"Alias";
@@ -141,46 +146,48 @@ public class DistribJoinFromCollectionTe
     request.setAliasedCollections(fromColl);
     request.process(cloudClient);
 
-    joinQ = "{!join " + anyScoreMode(isScoresTest, scoreModes)
-            + "from=join_s fromIndex=" + alias + " to=join_s}match_s:c";
-    qr = new QueryRequest(params("collection", toColl, "q", joinQ, "fl", "id,get_s,score"));
-    rsp = new QueryResponse(cloudClient.request(qr), cloudClient);
-    hits = rsp.getResults();
-    assertTrue("Expected 1 doc", hits.getNumFound() == 1);
-    doc = hits.get(0);
-    assertEquals(toDocId, doc.getFirstValue("id"));
-    assertEquals("b", doc.getFirstValue("get_s"));
-    assertScore(isScoresTest, doc);
+    {
+      final String joinQ = "{!join " + anyScoreMode(isScoresTest)
+              + "from=join_s fromIndex=" + alias + " to=join_s}"+fromQ;
+      final QueryRequest qr = new QueryRequest(params("collection", toColl, "q", joinQ, "fl", "id,get_s,score"));
+      final QueryResponse rsp = new QueryResponse(cloudClient.request(qr), cloudClient);
+      final SolrDocumentList hits = rsp.getResults();
+      assertTrue("Expected 1 doc", hits.getNumFound() == 1);
+      SolrDocument doc = hits.get(0);
+      assertEquals(toDocId, doc.getFirstValue("id"));
+      assertEquals("b", doc.getFirstValue("get_s"));
+      assertScore(isScoresTest, doc);
+    }
 
     //negative test after creating an alias
-    checkAbsentFromIndex(fromColl, toColl, isScoresTest, scoreModes);
+    checkAbsentFromIndex(fromColl, toColl, isScoresTest);
 
-    // verify join doesn't work if no match in the "from" index
-    joinQ = "{!join " + (anyScoreMode(isScoresTest, scoreModes))
-            + "from=join_s fromIndex=" + fromColl + " to=join_s}match_s:d";
-    qr = new QueryRequest(params("collection", toColl, "q", joinQ, "fl", "id,get_s,score"));
-    rsp = new QueryResponse(cloudClient.request(qr), cloudClient);
-    hits = rsp.getResults();
-    assertTrue("Expected no hits", hits.getNumFound() == 0);
-    assertScore(isScoresTest, doc);
+    {
+      // verify join doesn't work if no match in the "from" index
+      final String joinQ = "{!join " + (anyScoreMode(isScoresTest))
+              + "from=join_s fromIndex=" + fromColl + " to=join_s}match_s:d";
+      final QueryRequest  qr = new QueryRequest(params("collection", toColl, "q", joinQ, "fl", "id,get_s,score"));
+      final QueryResponse  rsp = new QueryResponse(cloudClient.request(qr), cloudClient);
+      final SolrDocumentList hits = rsp.getResults();
+      assertTrue("Expected no hits", hits.getNumFound() == 0);
+    }
   }
 
-  //@Ignore ("SOLR-8026, SOLR-7775") 
   private void assertScore(boolean isScoresTest, SolrDocument doc) {
-    //if (isScoresTest) {
-    //  assertThat(doc.getFirstValue("score").toString(), not("1.0"));
-    //} else {
-    //  assertEquals("1.0", doc.getFirstValue("score").toString());
-    //}
+    if (isScoresTest) {
+      assertThat("score join doesn't return 1.0",doc.getFirstValue("score").toString(), not("1.0"));
+    } else {
+      assertEquals("Solr join has constant score", "1.0", doc.getFirstValue("score").toString());
+    }
   }
 
-  private String anyScoreMode(boolean isScoresTest, String[] scoreModes) {
+  private String anyScoreMode(boolean isScoresTest) {
     return isScoresTest ? "score=" + (scoreModes[random().nextInt(scoreModes.length)]) + " " : "";
   }
 
-  private void checkAbsentFromIndex(String fromColl, String toColl, boolean isScoresTest, String[] scoreModes) throws SolrServerException, IOException {
+  private void checkAbsentFromIndex(String fromColl, String toColl, boolean isScoresTest) throws SolrServerException, IOException {
     final String wrongName = fromColl + "WrongName";
-    final String joinQ = "{!join " + (anyScoreMode(isScoresTest, scoreModes))
+    final String joinQ = "{!join " + (anyScoreMode(isScoresTest))
         + "from=join_s fromIndex=" + wrongName + " to=join_s}match_s:c";
     final QueryRequest qr = new QueryRequest(params("collection", toColl, "q", joinQ, "fl", "id,get_s,score"));
     try {

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java Fri Sep 18 15:13:49 2015
@@ -25,6 +25,7 @@ import org.apache.solr.client.solrj.embe
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.response.CollectionAdminResponse;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
@@ -38,7 +39,6 @@ import org.apache.solr.common.util.Named
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.servlet.SolrDispatchFilter;
-import org.apache.solr.update.UpdateHandler;
 import org.apache.solr.update.UpdateLog;
 import org.apache.solr.util.RTimer;
 import org.junit.Test;
@@ -50,7 +50,6 @@ import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -99,6 +98,12 @@ public class HttpPartitionTest extends A
 
     testLeaderInitiatedRecoveryCRUD();
 
+    // Tests that if we set a minRf that's not satisfied, no recovery is requested, but if minRf is satisfied,
+    // recovery is requested
+    testMinRf();
+
+    waitForThingsToLevelOut(30000);
+
     // test a 1x2 collection
     testRf2();
 
@@ -164,6 +169,90 @@ public class HttpPartitionTest extends A
     }
   }
 
+  protected void testMinRf() throws Exception {
+    // create a collection that has 1 shard and 3 replicas
+    String testCollectionName = "collMinRf_1x3";
+    createCollection(testCollectionName, 1, 3, 1);
+    cloudClient.setDefaultCollection(testCollectionName);
+
+    sendDoc(1, 2);
+
+    List<Replica> notLeaders =
+        ensureAllReplicasAreActive(testCollectionName, "shard1", 1, 3, maxWaitSecsToSeeAllActive);
+    assertTrue("Expected 2 non-leader replicas for collection " + testCollectionName
+            + " but found " + notLeaders.size() + "; clusterState: "
+            + printClusterStateInfo(testCollectionName),
+        notLeaders.size() == 2);
+
+    assertDocsExistInAllReplicas(notLeaders, testCollectionName, 1, 1);
+
+    // Now introduce a network partition between the leader and 1 replica, so a minRf of 2 is still achieved
+    SocketProxy proxy0 = getProxyForReplica(notLeaders.get(0));
+
+    proxy0.close();
+
+    // indexing during a partition
+    int achievedRf = sendDoc(2, 2);
+    assertEquals("Unexpected achieved replication factor", 2, achievedRf);
+
+    Thread.sleep(sleepMsBeforeHealPartition);
+
+    // Verify that the partitioned replica is DOWN
+    ZkStateReader zkr = cloudClient.getZkStateReader();
+    zkr.updateClusterState(); // force the state to be fresh
+    ClusterState cs = zkr.getClusterState();
+    Collection<Slice> slices = cs.getActiveSlices(testCollectionName);
+    Slice slice = slices.iterator().next();
+    Replica partitionedReplica = slice.getReplica(notLeaders.get(0).getName());
+    assertEquals("The partitioned replica did not get marked down",
+        Replica.State.DOWN.toString(), partitionedReplica.getStr(ZkStateReader.STATE_PROP));
+
+    proxy0.reopen();
+
+    notLeaders =
+        ensureAllReplicasAreActive(testCollectionName, "shard1", 1, 3, maxWaitSecsToSeeAllActive);
+
+    // Since minRf is achieved, we expect recovery, so we expect seeing 2 documents
+    assertDocsExistInAllReplicas(notLeaders, testCollectionName, 1, 2);
+
+    // Now introduce a network partition between the leader and both of its replicas, so a minRf of 2 is NOT achieved
+    proxy0 = getProxyForReplica(notLeaders.get(0));
+    proxy0.close();
+    SocketProxy proxy1 = getProxyForReplica(notLeaders.get(1));
+    proxy1.close();
+
+    achievedRf = sendDoc(3, 2);
+    assertEquals("Unexpected achieved replication factor", 1, achievedRf);
+
+    Thread.sleep(sleepMsBeforeHealPartition);
+
+    // Verify that the partitioned replicas are NOT DOWN since minRf wasn't achieved
+    ensureAllReplicasAreActive(testCollectionName, "shard1", 1, 3, 1);
+
+    proxy0.reopen();
+    proxy1.reopen();
+
+    notLeaders =
+        ensureAllReplicasAreActive(testCollectionName, "shard1", 1, 3, maxWaitSecsToSeeAllActive);
+
+    // Check that doc 3 is on the leader but not on the notLeaders
+    Replica leader = cloudClient.getZkStateReader().getLeaderRetry(testCollectionName, "shard1", 10000);
+    HttpSolrClient leaderSolr = getHttpSolrClient(leader, testCollectionName);
+    assertDocExists(leaderSolr, testCollectionName, "3");
+
+    for (Replica notLeader : notLeaders) {
+      HttpSolrClient notLeaderSolr = getHttpSolrClient(notLeader, testCollectionName);
+      assertDocNotExists(notLeaderSolr, testCollectionName, "3");
+    }
+
+    // Retry sending doc 3
+    achievedRf = sendDoc(3, 2);
+    assertEquals("Unexpected achieved replication factor", 3, achievedRf);
+
+    // Now doc 3 should be on all replicas
+    assertDocsExistInAllReplicas(notLeaders, testCollectionName, 1, 3);
+  }
+
   protected void testRf2() throws Exception {
     // create a collection that has 1 shard but 2 replicas
     String testCollectionName = "c8n_1x2";
@@ -480,19 +569,29 @@ public class HttpPartitionTest extends A
       }
     }
   }
-  
+
   protected HttpSolrClient getHttpSolrClient(Replica replica, String coll) throws Exception {
     ZkCoreNodeProps zkProps = new ZkCoreNodeProps(replica);
     String url = zkProps.getBaseUrl() + "/" + coll;
     return new HttpSolrClient(url);
   }
 
-  protected void sendDoc(int docId) throws Exception {
+  protected int sendDoc(int docId) throws Exception {
+    return sendDoc(docId, null);
+  }
+  
+  protected int sendDoc(int docId, Integer minRf) throws Exception {
     SolrInputDocument doc = new SolrInputDocument();
     doc.addField(id, String.valueOf(docId));
     doc.addField("a_t", "hello" + docId);
 
-    sendDocsWithRetry(Collections.singletonList(doc), 2, 3, 100);
+    UpdateRequest up = new UpdateRequest();
+    if (minRf != null) {
+      up.setParam(UpdateRequest.MIN_REPFACT, String.valueOf(minRf));
+    }
+    up.add(doc);
+
+    return cloudClient.getMinAchievedReplicationFactor(cloudClient.getDefaultCollection(), cloudClient.request(up));
   }
 
   /**
@@ -501,13 +600,24 @@ public class HttpPartitionTest extends A
    */
   @SuppressWarnings("rawtypes")
   protected void assertDocExists(HttpSolrClient solr, String coll, String docId) throws Exception {
-    QueryRequest qr = new QueryRequest(params("qt", "/get", "id", docId, "distrib", "false"));
-    NamedList rsp = solr.request(qr);
+    NamedList rsp = realTimeGetDocId(solr, docId);
     String match = JSONTestUtil.matchObj("/id", rsp.get("doc"), new Integer(docId));
     assertTrue("Doc with id=" + docId + " not found in " + solr.getBaseURL()
         + " due to: " + match + "; rsp="+rsp, match == null);
   }
 
+  protected void assertDocNotExists(HttpSolrClient solr, String coll, String docId) throws Exception {
+    NamedList rsp = realTimeGetDocId(solr, docId);
+    String match = JSONTestUtil.matchObj("/id", rsp.get("doc"), new Integer(docId));
+    assertTrue("Doc with id=" + docId + " is found in " + solr.getBaseURL()
+        + " due to: " + match + "; rsp="+rsp, match != null);
+  }
+
+  private NamedList realTimeGetDocId(HttpSolrClient solr, String docId) throws SolrServerException, IOException {
+    QueryRequest qr = new QueryRequest(params("qt", "/get", "id", docId, "distrib", "false"));
+    return solr.request(qr);
+  }
+
   protected int getReplicaPort(Replica replica) {
     String replicaNode = replica.getNodeName();    
     String tmp = replicaNode.substring(replicaNode.indexOf(':')+1);

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java Fri Sep 18 15:13:49 2015
@@ -17,8 +17,10 @@ package org.apache.solr.cloud;
  */
 
 import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.SolrException;
 import org.apache.solr.common.cloud.SolrZkClient;
 import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.core.NodeConfig;
@@ -30,8 +32,6 @@ import org.junit.rules.RuleChain;
 import org.junit.rules.TestRule;
 
 import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.nio.charset.StandardCharsets;
 import java.util.Properties;
 
@@ -50,15 +50,6 @@ public class SolrXmlInZkTest extends Sol
 
   private NodeConfig cfg;
 
-  private SolrDispatchFilter solrDispatchFilter;
-
-  @After
-  public void after() {
-    if (solrDispatchFilter != null) {
-      solrDispatchFilter.destroy();
-    }
-  }
-
   private void setUpZkAndDiskXml(boolean toZk, boolean leaveOnLocal) throws Exception {
     File tmpDir = createTempDir().toFile();
     File solrHome = new File(tmpDir, "home");
@@ -95,13 +86,7 @@ public class SolrXmlInZkTest extends Sol
     props.setProperty("solr.test.sys.prop1", "propone");
     props.setProperty("solr.test.sys.prop2", "proptwo");
 
-    Method method = SolrDispatchFilter.class.getDeclaredMethod("loadNodeConfig", String.class, Properties.class);
-    method.setAccessible(true);
-    if (solrDispatchFilter != null) solrDispatchFilter.destroy();
-    solrDispatchFilter = new SolrDispatchFilter();
-    Object obj = method.invoke(solrDispatchFilter, solrHome.getAbsolutePath(), props);
-    cfg = (NodeConfig) obj;
-
+    cfg = SolrDispatchFilter.loadNodeConfig(solrHome.getAbsolutePath(), props);
     log.info("####SETUP_END " + getTestName());
   }
 
@@ -155,9 +140,9 @@ public class SolrXmlInZkTest extends Sol
       System.setProperty("hostPort", "8787");
       setUpZkAndDiskXml(false, false); // solr.xml not on disk either
       fail("Should have thrown an exception here");
-    } catch (InvocationTargetException ite) {
+    } catch (SolrException solre) {
       assertTrue("Should be failing to create default solr.xml in code",
-          ite.getCause().getMessage().contains("solr.xml does not exist"));
+          solre.getMessage().contains("solr.xml does not exist"));
     } finally {
       closeZK();
     }

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsCollectionsAPIDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsCollectionsAPIDistributedZkTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsCollectionsAPIDistributedZkTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsCollectionsAPIDistributedZkTest.java Fri Sep 18 15:13:49 2015
@@ -37,16 +37,19 @@ import com.carrotsearch.randomizedtestin
 })
 public class HdfsCollectionsAPIDistributedZkTest extends CollectionsAPIDistributedZkTest {
   private static MiniDFSCluster dfsCluster;
+  private static long initialFailLogsCount;
   
   @BeforeClass
   public static void setupClass() throws Exception {
     dfsCluster = HdfsTestUtil.setupClass(createTempDir().toFile().getAbsolutePath());
     System.setProperty("solr.hdfs.blockcache.enabled", "false");
+    initialFailLogsCount = HdfsUpdateLog.INIT_FAILED_LOGS_COUNT.get();
   }
   
   @AfterClass
   public static void teardownClass() throws Exception {
-    assertEquals(0, HdfsUpdateLog.INIT_FAILED_LOGS_COUNT.get());
+    // there should be no new fails from this test
+    assertEquals(0, HdfsUpdateLog.INIT_FAILED_LOGS_COUNT.get() - initialFailLogsCount);
     HdfsTestUtil.teardownClass(dfsCluster);
     System.clearProperty("solr.hdfs.blockcache.enabled");
     dfsCluster = null;

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java Fri Sep 18 15:13:49 2015
@@ -19,9 +19,15 @@ package org.apache.solr.handler;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.List;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.client.solrj.embedded.JettySolrRunner;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.request.SolrPing;
+import org.apache.solr.client.solrj.response.SolrPingResponse;
+import org.apache.solr.cloud.MiniSolrCloudCluster;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.request.SolrQueryRequest;
@@ -30,6 +36,9 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 
 public class PingRequestHandlerTest extends SolrTestCaseJ4 {
+  protected int NUM_SERVERS = 5;
+  protected int NUM_SHARDS = 2;
+  protected int REPLICATION_FACTOR = 2;
 
   private final String fileName = this.getClass().getName() + ".server-enabled";
   private File healthcheckFile = null;
@@ -164,6 +173,48 @@ public class PingRequestHandlerTest exte
     }
   }
 
+ public void testPingInClusterWithNoHealthCheck() throws Exception {
+   
+    File solrXml = new File(SolrTestCaseJ4.TEST_HOME(), "solr-no-core.xml");
+    MiniSolrCloudCluster miniCluster = new MiniSolrCloudCluster(NUM_SERVERS, createTempDir().toFile(), solrXml, buildJettyConfig("/solr"));
+
+    final CloudSolrClient cloudSolrClient = miniCluster.getSolrClient();
+
+    try {
+      assertNotNull(miniCluster.getZkServer());
+      List<JettySolrRunner> jettys = miniCluster.getJettySolrRunners();
+      assertEquals(NUM_SERVERS, jettys.size());
+      for (JettySolrRunner jetty : jettys) {
+        assertTrue(jetty.isRunning());
+      }
+
+      // create collection
+      String collectionName = "testSolrCloudCollection";
+      String configName = "solrCloudCollectionConfig";
+      File configDir = new File(SolrTestCaseJ4.TEST_HOME() + File.separator + "collection1" + File.separator + "conf");
+      miniCluster.uploadConfigDir(configDir, configName);
+      miniCluster.createCollection(collectionName, NUM_SHARDS, REPLICATION_FACTOR, configName, null); 
+   
+      // Send distributed and non-distributed ping query
+      SolrPingWithDistrib reqDistrib = new SolrPingWithDistrib();
+      reqDistrib.setDistrib(true);
+      SolrPingResponse rsp = reqDistrib.process(cloudSolrClient, collectionName);
+      assertEquals(0, rsp.getStatus()); 
+      
+      SolrPing reqNonDistrib = new SolrPing();
+      rsp = reqNonDistrib.process(cloudSolrClient, collectionName);
+      assertEquals(0, rsp.getStatus());   
+
+      // delete the collection we created earlier
+      miniCluster.deleteCollection(collectionName);
+
+    }
+    finally {
+      miniCluster.shutdown();
+    } 
+  }
+
+
   /**
    * Helper Method: Executes the request against the handler, returns 
    * the response, and closes the request.
@@ -181,4 +232,12 @@ public class PingRequestHandlerTest exte
     return rsp;
   }
 
+  class SolrPingWithDistrib extends SolrPing {
+    public SolrPing setDistrib(boolean distrib) {   
+      getParams().add("distrib", distrib ? "true" : "false");
+      return this;    
+    }      
+  }
+  
+
 }

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/handler/admin/SystemInfoHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/handler/admin/SystemInfoHandlerTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/handler/admin/SystemInfoHandlerTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/handler/admin/SystemInfoHandlerTest.java Fri Sep 18 15:13:49 2015
@@ -19,6 +19,7 @@ package org.apache.solr.handler.admin;
 
 import java.lang.management.ManagementFactory;
 import java.lang.management.OperatingSystemMXBean;
+import java.util.Arrays;
 
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.solr.common.util.SimpleOrderedMap;
@@ -26,7 +27,7 @@ import org.apache.solr.common.util.Simpl
 
 public class SystemInfoHandlerTest extends LuceneTestCase {
 
-  public void testMagickGetter() {
+  public void testMagickGetter() throws Exception {
 
     OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
 
@@ -36,14 +37,14 @@ public class SystemInfoHandlerTest exten
     info.add( "version", os.getVersion() );
     info.add( "arch", os.getArch() );
 
-    // make another using addGetterIfAvaliable 
+    // make another using addMXBeanProperties() 
     SimpleOrderedMap<Object> info2 = new SimpleOrderedMap<>();
-    SystemInfoHandler.addGetterIfAvaliable( os, "name", info2 );
-    SystemInfoHandler.addGetterIfAvaliable( os, "version", info2 );
-    SystemInfoHandler.addGetterIfAvaliable( os, "arch", info2 );
-    
+    SystemInfoHandler.addMXBeanProperties( os, OperatingSystemMXBean.class, info2 );
+
     // make sure they got the same thing
-    assertEquals( info.toString(), info2.toString() );
+    for (String p : Arrays.asList("name", "version", "arch")) {
+      assertEquals(info.get(p), info2.get(p));
+    }
   }
 
 }

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java Fri Sep 18 15:13:49 2015
@@ -28,8 +28,9 @@ import org.apache.lucene.analysis.TokenS
 import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.payloads.SpanPayloadCheckQuery;
+import org.apache.lucene.queries.payloads.SpanPayloadCheckQuery;
 import org.apache.lucene.search.spans.SpanTermQuery;
+import org.apache.lucene.util.BytesRef;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.params.HighlightParams;
 import org.apache.solr.handler.component.HighlightComponent;
@@ -1108,7 +1109,7 @@ public class HighlighterTest extends Sol
 
     //Create query matching this payload
     Query query = new SpanPayloadCheckQuery(new SpanTermQuery(new Term(FIELD_NAME, "word")),
-        Collections.singleton(new byte[]{0,0,0,7}));//bytes for integer 7
+        Collections.singletonList(new BytesRef(new byte[]{0, 0, 0, 7})));//bytes for integer 7
 
     //invoke highlight component... the hard way
     final SearchComponent hlComp = h.getCore().getSearchComponent("highlight");

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/schema/DateFieldTest.java Fri Sep 18 15:13:49 2015
@@ -17,28 +17,25 @@
 
 package org.apache.solr.schema;
 
+import java.io.File;
+import java.text.ParseException;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Locale;
+
 import org.apache.lucene.index.StorableField;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.core.SolrResourceLoader;
-import org.apache.solr.util.DateMathParser;
 import org.apache.solr.util.DateFormatUtil;
-import org.junit.BeforeClass;
+import org.apache.solr.util.DateMathParser;
 import org.junit.Ignore;
 
-import java.io.File;
-import java.text.ParseException;
-import java.util.Collections;
-import java.util.Date;
-import java.util.TimeZone;
-import java.util.Locale;
-
 public class DateFieldTest extends SolrTestCaseJ4 {
-  public static TimeZone UTC = DateFormatUtil.UTC;
   private final String testInstanceDir = TEST_HOME() + File.separator + "collection1";
   private final String testConfHome = testInstanceDir + File.separator + "conf"+ File.separator;
   private TrieDateField f = null;
-  private DateMathParser p = new DateMathParser(UTC, Locale.ROOT);
+  private DateMathParser p = new DateMathParser(DateFormatUtil.UTC, Locale.ROOT);
 
   @Override
   public void setUp()  throws Exception {

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/schema/PrimitiveFieldTypeTest.java Fri Sep 18 15:13:49 2015
@@ -25,14 +25,12 @@ import org.junit.Test;
 import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.TimeZone;
 
 /**
  * Tests that defaults are set for Primitive (non-analyzed) fields
  */
 public class PrimitiveFieldTypeTest extends SolrTestCaseJ4 {
   private final String testConfHome = TEST_HOME() + File.separator + "collection1" + File.separator + "conf"+ File.separator; 
-  public static TimeZone UTC = TimeZone.getTimeZone("UTC");
   protected SolrConfig config;
   protected IndexSchema schema;
   protected HashMap<String,String> initMap;

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/TestFiltering.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/TestFiltering.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/TestFiltering.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/TestFiltering.java Fri Sep 18 15:13:49 2015
@@ -21,6 +21,7 @@ package org.apache.solr.search;
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.request.SolrQueryRequest;
@@ -34,7 +35,7 @@ public class TestFiltering extends SolrT
   @BeforeClass
   public static void beforeTests() throws Exception {
     System.setProperty("enable.update.log", "false"); // schema12 doesn't support _version_
-    initCore("solrconfig.xml","schema12.xml");
+    initCore("solrconfig.xml","schema_latest.xml");
   }
 
 
@@ -132,8 +133,79 @@ public class TestFiltering extends SolrT
   }
 
   static String f = "val_i";
+  static String f_s = "val_s";
+  static String f_s(int i) {
+    return String.format(Locale.ROOT, "%05d", i);
+  }
+
+
+  String rangeStr(String field, boolean negative, int l, int u, boolean cache, int cost, boolean exclude) {
+    String topLev="";
+    if (!cache || exclude) {
+      topLev = "{!" + (cache || random().nextBoolean() ? " cache=" + cache : "")
+          + (cost != 0 ? " cost=" + cost : "")
+          + ((exclude) ? " tag=t" : "") + "}";
+    }
+
+    String q = field + ":";
+    String q2 = q;
+
+    String lower1 = "[" + f_s(l);
+    String lower2 = l<=0 ? lower1 : ("{" + f_s(l-1));
+    String upper1 = f_s(u) + "]";
+    String upper2 = f_s(u+1) + "}";
+
+    if (random().nextBoolean()) {
+      q += lower1;
+      q2 += lower2;
+    } else {
+      q += lower2;
+      q2 += lower1;
+    }
+
+    q += " TO ";
+    q2 += " TO ";
+
+    if (random().nextBoolean()) {
+      q += upper1;
+      q2 += upper2;
+    } else {
+      q += upper2;
+      q2 += upper1;
+    }
+
+
+    // String q = field + ":[" + f_s(l) + " TO " + f_s(u) + "]";
+
+    if (negative) {
+      q = "-_query_:\"" + q + "\"";
+      // q = "-" + q; // TODO: need to be encapsulated for some reason?
+    } else {
+      if (random().nextBoolean()) {
+        // try some different query structures - important for testing different code paths
+        switch (random().nextInt(5)) {
+          case 0:
+            q = q + " OR id:RAND"+random().nextInt();
+            break;
+          case 1:
+            q = "id:RAND"+random().nextInt() + " OR " + q;
+            break;
+          case 2:
+            q = "*:* AND " + q;
+            break;
+          case 3:
+            q = q + " AND " + q2;
+            break;
+          case 4:
+            q = q + " OR " + q2;
+            break;
+        }
+      }
+    }
+    return topLev + q;
+  }
 
-  String frangeStr(boolean negative, int l, int u, boolean cache, int cost, boolean exclude) {
+  String frangeStr(String field, boolean negative, int l, int u, boolean cache, int cost, boolean exclude) {
 
     String topLev="";
     if (!cache || exclude) {
@@ -142,7 +214,7 @@ public class TestFiltering extends SolrT
         + ((exclude) ? " tag=t" : "");
     }
 
-    String ret = "{!frange v="+f+" l="+l+" u="+u;
+    String ret = "{!frange v="+field+" l="+l+" u="+u;
     if (negative) {
       ret = "-_query_:\"" + ret + "}\"";
       if (topLev.length()>0) {
@@ -165,7 +237,7 @@ public class TestFiltering extends SolrT
     FixedBitSet[] sets = facetQuery ? new FixedBitSet[]{model.facetQuery} :
         (exclude ? new FixedBitSet[]{model.answer, model.facetQuery} : new FixedBitSet[]{model.answer, model.multiSelect, model.facetQuery});
 
-    if (random().nextInt(100) < 50) {
+    if (random().nextInt(100) < 60) {
       // frange
       int l=0;
       int u=0;
@@ -201,7 +273,10 @@ public class TestFiltering extends SolrT
         }
       }
 
-      return frangeStr(!positive, l, u, cache, cost, exclude);
+      String whichField = random().nextBoolean() ? f : f_s;
+      return random().nextBoolean() ?
+           frangeStr(f, !positive, l, u, cache, cost, exclude)   // todo: frange doesn't work on the string field?
+         :  rangeStr(whichField, !positive, l, u, cache, cost, exclude);
     } else {
       // term or boolean query
       int numWords = FixedBitSet.bits2words(model.indexSize);
@@ -256,16 +331,17 @@ public class TestFiltering extends SolrT
     Model model = new Model();
 
     for (int iiter = 0; iiter<indexIter; iiter++) {
-      model.indexSize = random().nextInt(20 * RANDOM_MULTIPLIER) + 1;
+      model.indexSize = random().nextInt(40 * RANDOM_MULTIPLIER) + 1;
       clearIndex();
 
       for (int i=0; i<model.indexSize; i++) {
         String val = Integer.toString(i);
 
-        assertU(adoc("id",val,f,val));
+        SolrInputDocument doc = sdoc("id", val, f,val, f_s, f_s(i) );
+        updateJ(jsonAdd(doc), null);
         if (random().nextInt(100) < 20) {
           // duplicate doc 20% of the time (makes deletions)
-          assertU(adoc("id",val,f,val));
+          updateJ(jsonAdd(doc), null);
         }
         if (random().nextInt(100) < 10) {
           // commit 10% of the time (forces a new segment)

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java Fri Sep 18 15:13:49 2015
@@ -27,7 +27,7 @@ import java.util.List;
 import java.util.Random;
 
 import org.apache.lucene.index.FieldInvertState;
-import org.apache.lucene.search.similarities.DefaultSimilarity;
+import org.apache.lucene.search.similarities.ClassicSimilarity;
 import org.apache.lucene.search.similarities.TFIDFSimilarity;
 import org.apache.solr.SolrTestCaseJ4;
 import org.junit.BeforeClass;
@@ -326,7 +326,7 @@ public class TestFunctionQuery extends S
     assertQ(req("fl","*,score","q", "{!func}docfreq($field,$value)", "fq","id:6", "field","a_t", "value","cow"), "//float[@name='score']='3.0'");
     assertQ(req("fl","*,score","q", "{!func}termfreq(a_t,cow)", "fq","id:6"), "//float[@name='score']='5.0'");
 
-    TFIDFSimilarity similarity = new DefaultSimilarity();
+    TFIDFSimilarity similarity = new ClassicSimilarity();
 
     // make sure it doesn't get a NPE if no terms are present in a field.
     assertQ(req("fl","*,score","q", "{!func}termfreq(nofield_t,cow)", "fq","id:6"), "//float[@name='score']='0.0'");

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/MockConfigurableSimilarity.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/MockConfigurableSimilarity.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/MockConfigurableSimilarity.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/MockConfigurableSimilarity.java Fri Sep 18 15:13:49 2015
@@ -16,9 +16,9 @@
  */
 package org.apache.solr.search.similarities;
 
-import org.apache.lucene.search.similarities.DefaultSimilarity;
+import org.apache.lucene.search.similarities.ClassicSimilarity;
 
-public class MockConfigurableSimilarity extends DefaultSimilarity {
+public class MockConfigurableSimilarity extends ClassicSimilarity {
   private String passthrough;
 
   public MockConfigurableSimilarity(String passthrough) {

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestDefaultSimilarityFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestDefaultSimilarityFactory.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestDefaultSimilarityFactory.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestDefaultSimilarityFactory.java Fri Sep 18 15:13:49 2015
@@ -17,7 +17,7 @@ package org.apache.solr.search.similarit
  * limitations under the License.
  */
 
-import org.apache.lucene.search.similarities.DefaultSimilarity;
+import org.apache.lucene.search.similarities.ClassicSimilarity;
 import org.apache.lucene.search.similarities.Similarity;
 import org.junit.BeforeClass;
 
@@ -33,14 +33,14 @@ public class TestDefaultSimilarityFactor
   /** default parameters */
   public void testDefaults() throws Exception {
     Similarity sim = getSimilarity("text");
-    assertEquals(DefaultSimilarity.class, sim.getClass());
-    assertEquals(true, ((DefaultSimilarity)sim).getDiscountOverlaps());
+    assertEquals(ClassicSimilarity.class, sim.getClass());
+    assertEquals(true, ((ClassicSimilarity)sim).getDiscountOverlaps());
   }
   /** explicit params */
   public void testParams() throws Exception {
     Similarity sim = getSimilarity("text_overlap");
-    assertEquals(DefaultSimilarity.class, sim.getClass());
-    assertEquals(false, ((DefaultSimilarity)sim).getDiscountOverlaps());
+    assertEquals(ClassicSimilarity.class, sim.getClass());
+    assertEquals(false, ((ClassicSimilarity)sim).getDiscountOverlaps());
   }
 
 }

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestNonDefinedSimilarityFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestNonDefinedSimilarityFactory.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestNonDefinedSimilarityFactory.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestNonDefinedSimilarityFactory.java Fri Sep 18 15:13:49 2015
@@ -17,7 +17,7 @@ package org.apache.solr.search.similarit
  * limitations under the License.
  */
 
-import org.apache.lucene.search.similarities.DefaultSimilarity;
+import org.apache.lucene.search.similarities.ClassicSimilarity;
 import org.apache.lucene.util.Version;
 import org.junit.After;
 
@@ -37,7 +37,7 @@ public class TestNonDefinedSimilarityFac
   public void testCurrent() throws Exception {
     // no sys prop set, rely on LATEST
     initCore("solrconfig-basic.xml","schema-tiny.xml");
-    DefaultSimilarity sim = getSimilarity("text", DefaultSimilarity.class);
+    ClassicSimilarity sim = getSimilarity("text", ClassicSimilarity.class);
     assertEquals(true, sim.getDiscountOverlaps());
   }
 }

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestPerFieldSimilarity.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestPerFieldSimilarity.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestPerFieldSimilarity.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestPerFieldSimilarity.java Fri Sep 18 15:13:49 2015
@@ -18,7 +18,7 @@ package org.apache.solr.search.similarit
  */
 
 import org.apache.lucene.misc.SweetSpotSimilarity;
-import org.apache.lucene.search.similarities.DefaultSimilarity;
+import org.apache.lucene.search.similarities.ClassicSimilarity;
 import org.apache.lucene.search.similarities.Similarity;
 import org.junit.BeforeClass;
 
@@ -59,18 +59,18 @@ public class TestPerFieldSimilarity exte
   /** test a field where no similarity is specified */
   public void testDefaults() throws Exception {
     Similarity sim = getSimilarity("sim3text");
-    assertEquals(DefaultSimilarity.class, sim.getClass());;
+    assertEquals(ClassicSimilarity.class, sim.getClass());;
   }
   
   /** ... and for a dynamic field */
   public void testDefaultsDynamic() throws Exception {
     Similarity sim = getSimilarity("text_sim3");
-    assertEquals(DefaultSimilarity.class, sim.getClass());
+    assertEquals(ClassicSimilarity.class, sim.getClass());
   }
   
   /** test a field that does not exist */
   public void testNonexistent() throws Exception {
     Similarity sim = getSimilarity("sdfdsfdsfdswr5fsdfdsfdsfs");
-    assertEquals(DefaultSimilarity.class, sim.getClass());
+    assertEquals(ClassicSimilarity.class, sim.getClass());
   }
 }

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestSweetSpotSimilarityFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestSweetSpotSimilarityFactory.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestSweetSpotSimilarityFactory.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/search/similarities/TestSweetSpotSimilarityFactory.java Fri Sep 18 15:13:49 2015
@@ -18,7 +18,7 @@ package org.apache.solr.search.similarit
  */
 
 import org.apache.lucene.misc.SweetSpotSimilarity;
-import org.apache.lucene.search.similarities.DefaultSimilarity;
+import org.apache.lucene.search.similarities.ClassicSimilarity;
 import org.apache.lucene.search.similarities.Similarity;
 import org.junit.BeforeClass;
 
@@ -36,7 +36,7 @@ public class TestSweetSpotSimilarityFact
     SweetSpotSimilarity sim = getSimilarity("text", SweetSpotSimilarity.class);
 
     // SSS tf w/defaults should behave just like DS
-    DefaultSimilarity d = new DefaultSimilarity();
+    ClassicSimilarity d = new ClassicSimilarity();
     for (int i = 0; i <=1000; i++) {
       assertEquals("tf: i="+i, d.tf(i), sim.tf(i), 0.0F);
     }
@@ -52,7 +52,7 @@ public class TestSweetSpotSimilarityFact
     SweetSpotSimilarity sim = getSimilarity("text_baseline", 
                                             SweetSpotSimilarity.class);
     
-    DefaultSimilarity d = new DefaultSimilarity();
+    ClassicSimilarity d = new ClassicSimilarity();
 
     // constant up to 6
     for (int i = 1; i <=6; i++) {

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java Fri Sep 18 15:13:49 2015
@@ -18,6 +18,7 @@ package org.apache.solr.security;
  */
 
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -35,6 +36,7 @@ import org.apache.http.message.AbstractH
 import org.apache.http.message.BasicHeader;
 import org.apache.http.util.EntityUtils;
 import org.apache.solr.client.solrj.SolrRequest;
+import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
@@ -163,19 +165,19 @@ public class BasicAuthIntegrationTest ex
     } catch (HttpSolrClient.RemoteSolrException e) {
 
     }
+    cloudSolrClient.request(new CollectionAdminRequest.Reload()
+        .setCollectionName(defaultCollName)
+        .setBasicAuthCredentials("harry", "HarryIsUberCool"));
 
-   /* httpPost = new HttpPost(baseUrl + "/admin/authorization");
-    setBasicAuthHeader(httpPost, "harry", "HarryIsUberCool");
-    httpPost.setEntity(new ByteArrayEntity(Utils.toJSON(singletonMap("delete-permission", "collection-admin-edit"))));
-    r = cl.execute(httpPost); //cleanup so that the super class does not need to pass on credentials
+    try {
+      cloudSolrClient.request(new CollectionAdminRequest.Reload()
+          .setCollectionName(defaultCollName)
+          .setBasicAuthCredentials("harry", "Cool12345"));
+      fail("This should not succeed");
+    } catch (HttpSolrClient.RemoteSolrException e) {
+
+    }
 
-    for (Slice  slice : zkStateReader.getClusterState().getCollection(defaultCollName).getSlices()) {
-      //ensure that all nodes have removed the collection-admin-edit permission
-      for (Replica replica : slice.getReplicas()) {
-        baseUrl = replica.getStr(BASE_URL_PROP);
-        verifySecurityStatus(cl, baseUrl + "/admin/authorization", "authorization/permissions[2]/name", null, 20);
-      }
-    }*/
   }
 
   public static void verifySecurityStatus(HttpClient cl, String url, String objPath, Object expected, int count) throws Exception {

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java Fri Sep 18 15:13:49 2015
@@ -24,7 +24,7 @@ import org.apache.lucene.index.Indexable
 import org.apache.lucene.index.LeafReader;
 import org.apache.lucene.index.NumericDocValues;
 import org.apache.lucene.index.SlowCompositeReaderWrapper;
-import org.apache.lucene.search.similarities.DefaultSimilarity;
+import org.apache.lucene.search.similarities.ClassicSimilarity;
 import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrDocument;
@@ -352,11 +352,11 @@ public class DocumentBuilderTest extends
       SolrIndexSearcher searcher = req.getSearcher();
       LeafReader reader = SlowCompositeReaderWrapper.wrap(searcher.getTopReaderContext().reader());
 
-      assertTrue("similarity doesn't extend DefaultSimilarity, " + 
+      assertTrue("similarity doesn't extend ClassicSimilarity, " + 
                  "config or defaults have changed since test was written",
-                 searcher.getSimilarity(true) instanceof DefaultSimilarity);
+                 searcher.getSimilarity(true) instanceof ClassicSimilarity);
 
-      DefaultSimilarity sim = (DefaultSimilarity) searcher.getSimilarity(true);
+      ClassicSimilarity sim = (ClassicSimilarity) searcher.getSimilarity(true);
       
       NumericDocValues titleNorms = reader.getNormValues("title");
       NumericDocValues fooNorms = reader.getNormValues("foo_t");
@@ -380,7 +380,7 @@ public class DocumentBuilderTest extends
   /**
    * Given a length, and boost returns the expected encoded norm 
    */
-  private static byte expectedNorm(final DefaultSimilarity sim,
+  private static byte expectedNorm(final ClassicSimilarity sim,
                                    final int length, final float boost) {
     return (byte) sim.encodeNormValue(boost / ((float) Math.sqrt(length)));
   }

Modified: lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java Fri Sep 18 15:13:49 2015
@@ -17,6 +17,8 @@
 
 package org.apache.solr.util;
 
+import static org.apache.solr.util.DateFormatUtil.UTC;
+
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.solr.util.DateMathParser;
 
@@ -26,10 +28,6 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.TimeZone;
 import java.util.Locale;
-import java.util.Arrays;
-import java.util.Set;
-import java.util.HashSet;
-
 import java.util.Map;
 import java.util.HashMap;
 import java.text.ParseException;
@@ -39,8 +37,6 @@ import java.text.ParseException;
  */
 public class DateMathParserTest extends LuceneTestCase {
 
-  public static TimeZone UTC = TimeZone.getTimeZone("UTC");
-  
   /**
    * A formatter for specifying every last nuance of a Date for easy
    * refernece in assertion statements

Modified: lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java (original)
+++ lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java Fri Sep 18 15:13:49 2015
@@ -45,6 +45,21 @@ public abstract class SolrRequest<T exte
   private ResponseParser responseParser;
   private StreamingResponseCallback callback;
   private Set<String> queryParams;
+
+  private String basicAuthUser, basicAuthPwd;
+
+  public SolrRequest setBasicAuthCredentials(String user, String password) {
+    this.basicAuthUser = user;
+    this.basicAuthPwd = password;
+    return this;
+  }
+
+  public String getBasicAuthUser(){
+    return basicAuthUser;
+  }
+  public String getBasicAuthPassword(){
+    return basicAuthPwd;
+  }
   
   //---------------------------------------------------------
   //---------------------------------------------------------

Modified: lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java (original)
+++ lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java Fri Sep 18 15:13:49 2015
@@ -19,8 +19,11 @@ package org.apache.solr.client.solrj.bea
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.util.SuppressForbidden;
 
 import java.lang.reflect.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.*;
 import java.util.regex.Pattern;
 import java.util.concurrent.ConcurrentHashMap;
@@ -123,6 +126,7 @@ public class DocumentObjectBinder {
     return fields;
   }
 
+  @SuppressForbidden(reason = "Needs access to possibly private @Field annotated fields/methods")
   private List<DocField> collectInfo(Class clazz) {
     List<DocField> fields = new ArrayList<>();
     Class superClazz = clazz;
@@ -136,7 +140,7 @@ public class DocumentObjectBinder {
     boolean childFieldFound = false;
     for (AccessibleObject member : members) {
       if (member.isAnnotationPresent(Field.class)) {
-        member.setAccessible(true);
+        AccessController.doPrivileged((PrivilegedAction<Void>) () -> { member.setAccessible(true); return null; });
         DocField df = new DocField(member);
         if (df.child != null) {
           if (childFieldFound)

Modified: lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java (original)
+++ lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java Fri Sep 18 15:13:49 2015
@@ -17,6 +17,29 @@ package org.apache.solr.client.solrj.imp
  * limitations under the License.
  */
 
+import java.io.IOException;
+import java.net.ConnectException;
+import java.net.SocketException;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
 import org.apache.http.NoHttpResponseException;
 import org.apache.http.client.HttpClient;
 import org.apache.http.conn.ConnectTimeoutException;
@@ -56,29 +79,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
 
-import java.io.IOException;
-import java.net.ConnectException;
-import java.net.SocketException;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
 import static org.apache.solr.common.params.CommonParams.AUTHC_PATH;
 import static org.apache.solr.common.params.CommonParams.AUTHZ_PATH;
 import static org.apache.solr.common.params.CommonParams.COLLECTIONS_HANDLER_PATH;
@@ -683,7 +683,7 @@ public class CloudSolrClient extends Sol
 
     long end = System.nanoTime();
 
-    RouteResponse rr =  condenseResponse(shardResponses, (long)((end - start)/1000000));
+    RouteResponse rr = condenseResponse(shardResponses, (int) TimeUnit.MILLISECONDS.convert(end - start, TimeUnit.NANOSECONDS));
     rr.setRouteResponses(shardResponses);
     rr.setRoutes(routes);
     return rr;
@@ -721,7 +721,7 @@ public class CloudSolrClient extends Sol
     return urlMap;
   }
 
-  public RouteResponse condenseResponse(NamedList response, long timeMillis) {
+  public RouteResponse condenseResponse(NamedList response, int timeMillis) {
     RouteResponse condensed = new RouteResponse();
     int status = 0;
     Integer rf = null;

Modified: lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java (original)
+++ lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java Fri Sep 18 15:13:49 2015
@@ -51,6 +51,7 @@ import org.apache.solr.common.SolrExcept
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.SolrParams;
+import org.apache.solr.common.util.Base64;
 import org.apache.solr.common.util.ContentStream;
 import org.apache.solr.common.util.ExecutorUtil;
 import org.apache.solr.common.util.NamedList;
@@ -61,6 +62,7 @@ import org.slf4j.MDC;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
 import java.net.ConnectException;
 import java.net.SocketTimeoutException;
 import java.nio.charset.StandardCharsets;
@@ -75,6 +77,8 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
+
 /**
  * A SolrClient implementation that talks directly to a Solr server via HTTP
  *
@@ -230,10 +234,21 @@ public class HttpSolrClient extends Solr
     return request(request, processor, null);
   }
   
-  public NamedList<Object> request(final SolrRequest request, final ResponseParser processor, String collection) throws SolrServerException, IOException {
-    return executeMethod(createMethod(request, collection),processor);
+  public NamedList<Object> request(final SolrRequest request, final ResponseParser processor, String collection)
+      throws SolrServerException, IOException {
+    HttpRequestBase method = createMethod(request, collection);
+    setBasicAuthHeader(request, method);
+    return executeMethod(method, processor);
   }
-  
+
+  private void setBasicAuthHeader(SolrRequest request, HttpRequestBase method) throws UnsupportedEncodingException {
+    if (request.getBasicAuthUser() != null && request.getBasicAuthPassword() != null) {
+      String userPass = request.getBasicAuthUser() + ":" + request.getBasicAuthPassword();
+      String encoded = Base64.byteArrayToBase64(userPass.getBytes(UTF_8));
+      method.setHeader(new BasicHeader("Authorization", "Basic " + encoded));
+    }
+  }
+
   /**
    * @lucene.experimental
    */

Modified: lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.java (original)
+++ lucene/dev/branches/lucene6780/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZooKeeper.java Fri Sep 18 15:13:49 2015
@@ -22,9 +22,12 @@ import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.SocketAddress;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
 
+import org.apache.solr.common.util.SuppressForbidden;
 import org.apache.zookeeper.ClientCnxn;
 import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.ZooKeeper;
@@ -55,34 +58,40 @@ public class SolrZooKeeper extends ZooKe
       @Override
       public void run() {
         try {
-          final ClientCnxn cnxn = getConnection();
-          synchronized (cnxn) {
-            try {
-              final Field sendThreadFld = cnxn.getClass().getDeclaredField("sendThread");
-              sendThreadFld.setAccessible(true);
-              Object sendThread = sendThreadFld.get(cnxn);
-              if (sendThread != null) {
-                Method method = sendThread.getClass().getDeclaredMethod("testableCloseSocket");
-                method.setAccessible(true);
-                try {
-                  method.invoke(sendThread);
-                } catch (InvocationTargetException e) {
-                  // is fine
-                }
+          AccessController.doPrivileged((PrivilegedAction<Void>) this::closeZookeeperChannel);
+        } finally {
+          spawnedThreads.remove(this);
+        }
+      }
+      
+      @SuppressForbidden(reason = "Hack for Zookeper needs access to private methods.")
+      private Void closeZookeeperChannel() {
+        final ClientCnxn cnxn = getConnection();
+        synchronized (cnxn) {
+          try {
+            final Field sendThreadFld = cnxn.getClass().getDeclaredField("sendThread");
+            sendThreadFld.setAccessible(true);
+            Object sendThread = sendThreadFld.get(cnxn);
+            if (sendThread != null) {
+              Method method = sendThread.getClass().getDeclaredMethod("testableCloseSocket");
+              method.setAccessible(true);
+              try {
+                method.invoke(sendThread);
+              } catch (InvocationTargetException e) {
+                // is fine
               }
-            } catch (Exception e) {
-              throw new RuntimeException("Closing Zookeeper send channel failed.", e);
             }
+          } catch (Exception e) {
+            throw new RuntimeException("Closing Zookeeper send channel failed.", e);
           }
-        } finally {
-          spawnedThreads.remove(this);
         }
+        return null; // Void
       }
     };
     spawnedThreads.add(t);
     t.start();
   }
-
+  
   @Override
   public synchronized void close() throws InterruptedException {
     for (Thread t : spawnedThreads) {

Modified: lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java (original)
+++ lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java Fri Sep 18 15:13:49 2015
@@ -25,10 +25,9 @@ import junit.framework.Assert;
 import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
+import org.apache.solr.client.solrj.embedded.SolrExampleStreamingTest.ErrorTrackingConcurrentUpdateSolrClient;
 import org.apache.solr.client.solrj.impl.BinaryResponseParser;
-import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient;
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient.RemoteSolrException;
 import org.apache.solr.client.solrj.impl.NoOpResponseParser;
 import org.apache.solr.client.solrj.impl.XMLResponseParser;
 import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
@@ -48,7 +47,6 @@ import org.apache.solr.client.solrj.resp
 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.params.AnalysisParams;
 import org.apache.solr.common.params.CommonParams;
@@ -61,7 +59,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
-import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -458,27 +455,18 @@ abstract public class SolrExampleTests e
       } catch (Throwable t) {
         Assert.fail("should have thrown a SolrException! not: " + t);
       }
-    } else if (client instanceof ConcurrentUpdateSolrClient) {
+    } else if (client instanceof ErrorTrackingConcurrentUpdateSolrClient) {
       //XXX concurrentupdatesolrserver reports errors differently
-      ConcurrentUpdateSolrClient concurrentClient = (ConcurrentUpdateSolrClient) client;
-      Field field = getConcurrentClientExceptionField(concurrentClient);
-      field.set(concurrentClient, null);
+      ErrorTrackingConcurrentUpdateSolrClient concurrentClient = (ErrorTrackingConcurrentUpdateSolrClient) client;
+      concurrentClient.lastError = null;
       concurrentClient.add(doc);
       concurrentClient.blockUntilFinished();
-      Throwable lastError = (Throwable)field.get(concurrentClient);
-      assertNotNull("Should throw exception!", lastError); //XXX 
+      assertNotNull("Should throw exception!", concurrentClient.lastError); 
     } else {
       log.info("Ignoring update test for client:" + client.getClass().getName());
     }
   }
   
-  private static Field getConcurrentClientExceptionField(Object cs)
-      throws SecurityException, NoSuchFieldException, IllegalArgumentException {
-    Field field = cs.getClass().getDeclaredField("lastError");
-    field.setAccessible(true);
-    return field;
-  }
-
   @Test
   public void testAugmentFields() throws Exception
   {    
@@ -1639,7 +1627,9 @@ abstract public class SolrExampleTests e
         fail("Operation should throw an exception!");
       } else {
         client.commit(); //just to be sure the client has sent the doc
-        assertTrue("ConcurrentUpdateSolrClient did not report an error", ((Throwable) getConcurrentClientExceptionField(client).get(client)).getMessage().contains("Conflict"));
+        ErrorTrackingConcurrentUpdateSolrClient concurrentClient = (ErrorTrackingConcurrentUpdateSolrClient) client;
+        assertNotNull("ConcurrentUpdateSolrClient did not report an error", concurrentClient.lastError);
+        assertTrue("ConcurrentUpdateSolrClient did not report an error", concurrentClient.lastError.getMessage().contains("Conflict"));
       }
     } catch (SolrException se) {
       assertTrue("No identifiable error message", se.getMessage().contains("version conflict for unique"));

Modified: lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java Fri Sep 18 15:13:49 2015
@@ -46,6 +46,19 @@ public class SolrExampleStreamingTest ex
   public static void beforeTest() throws Exception {
     createJetty(legacyExampleCollection1SolrHome());
   }
+  
+  public class ErrorTrackingConcurrentUpdateSolrClient extends ConcurrentUpdateSolrClient {
+    public Throwable lastError = null;
+
+    public ErrorTrackingConcurrentUpdateSolrClient(String solrServerUrl, int queueSize, int threadCount) {
+      super(solrServerUrl, queueSize, threadCount);
+    }
+    
+    @Override
+    public void handleError(Throwable ex) {
+      handledException = lastError = ex;
+    }
+  }
 
   @Override
   public SolrClient createNewSolrClient()
@@ -54,15 +67,7 @@ public class SolrExampleStreamingTest ex
       // setup the server...
       String url = jetty.getBaseUrl().toString() + "/collection1";
       // smaller queue size hits locks more often
-      ConcurrentUpdateSolrClient concurrentClient = new ConcurrentUpdateSolrClient( url, 2, 5 ) {
-        
-        public Throwable lastError = null;
-        @Override
-        public void handleError(Throwable ex) {
-          handledException = lastError = ex;
-        }
-      };
-
+      ConcurrentUpdateSolrClient concurrentClient = new ErrorTrackingConcurrentUpdateSolrClient( url, 2, 5 );
       concurrentClient.setParser(new XMLResponseParser());
       concurrentClient.setRequestWriter(new RequestWriter());
       return concurrentClient;

Modified: lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java (original)
+++ lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java Fri Sep 18 15:13:49 2015
@@ -22,6 +22,7 @@ import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.lucene.util.LuceneTestCase.Slow;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
@@ -29,6 +30,7 @@ import org.apache.solr.client.solrj.requ
 import org.apache.solr.client.solrj.request.QueryRequest;
 import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.UpdateResponse;
 import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
 import org.apache.solr.cloud.AbstractZkTestCase;
 import org.apache.solr.common.SolrDocumentList;
@@ -110,6 +112,7 @@ public class CloudSolrClientTest extends
 
   @Test
   public void test() throws Exception {
+    testParallelUpdateQTime();
     checkCollectionParameters();
     allTests();
     stateVersionParamTest();
@@ -118,6 +121,18 @@ public class CloudSolrClientTest extends
     preferLocalShardsTest();
   }
 
+  private void testParallelUpdateQTime() throws Exception {
+    UpdateRequest req = new UpdateRequest();
+    for (int i=0; i<10; i++)  {
+      SolrInputDocument doc = new SolrInputDocument();
+      doc.addField("id", String.valueOf(TestUtil.nextInt(random(), 1000, 1100)));
+      req.add(doc);
+    }
+    UpdateResponse response = req.process(cloudClient);
+    // See SOLR-6547, we just need to ensure that no exception is thrown here
+    assertTrue(response.getQTime() >= 0);
+  }
+
   private void testOverwriteOption() throws Exception, SolrServerException,
       IOException {
     String collectionName = "overwriteCollection";

Modified: lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/common/cloud/TestZkConfigManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/common/cloud/TestZkConfigManager.java?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/common/cloud/TestZkConfigManager.java (original)
+++ lucene/dev/branches/lucene6780/solr/solrj/src/test/org/apache/solr/common/cloud/TestZkConfigManager.java Fri Sep 18 15:13:49 2015
@@ -51,6 +51,7 @@ public class TestZkConfigManager extends
   @AfterClass
   public static void shutdownZkServer() throws IOException, InterruptedException {
     zkServer.shutdown();
+    zkServer = null;
   }
 
   @Test

Modified: lucene/dev/branches/lucene6780/solr/webapp/web/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/webapp/web/WEB-INF/web.xml?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/webapp/web/WEB-INF/web.xml (original)
+++ lucene/dev/branches/lucene6780/solr/webapp/web/WEB-INF/web.xml Fri Sep 18 15:13:49 2015
@@ -56,7 +56,7 @@
     -->
     <init-param>
       <param-name>excludePatterns</param-name>
-      <param-value>/css/*,/js/*,/img/*,/tpl/*</param-value>
+      <param-value>/css/.+,/js/.+,/img/.+,/tpl/.+</param-value>
     </init-param>
   </filter>
 
@@ -152,6 +152,11 @@
   </servlet-mapping>
 
   <servlet-mapping>
+    <servlet-name>LoadAdminUI</servlet-name>
+    <url-pattern>/index.html</url-pattern>
+  </servlet-mapping>
+
+  <servlet-mapping>
     <servlet-name>SolrRestApi</servlet-name>
     <url-pattern>/schema/*</url-pattern>
   </servlet-mapping>

Modified: lucene/dev/branches/lucene6780/solr/webapp/web/admin.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/webapp/web/admin.html?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/webapp/web/admin.html (original)
+++ lucene/dev/branches/lucene6780/solr/webapp/web/admin.html Fri Sep 18 15:13:49 2015
@@ -79,6 +79,10 @@ limitations under the License.
                 
       </div>
 
+      <div class="other-ui-link">
+        <a href="/solr/index.html">New UI</a><a href="http://lucene.apache.org/ui-change.html">&nbsp;<span class="help"></span></a>
+      </div>
+
       <div id="content-wrapper">
         <div id="content">
                   

Modified: lucene/dev/branches/lucene6780/solr/webapp/web/css/angular/common.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/webapp/web/css/angular/common.css?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/webapp/web/css/angular/common.css (original)
+++ lucene/dev/branches/lucene6780/solr/webapp/web/css/angular/common.css Fri Sep 18 15:13:49 2015
@@ -747,3 +747,16 @@ pre.syntax .tex .formula
 #exception .show-exception a:hover {
   color: #333;
 }
+
+.other-ui-link {
+  margin: 0px;
+  position: absolute;
+  right: 0px;
+  top: -20px;
+}
+
+.other-ui-link span {
+  background-image: url( ../../img/ico/information-white.png );
+  right: 0px;
+  padding-left: 16px;
+}
\ No newline at end of file

Modified: lucene/dev/branches/lucene6780/solr/webapp/web/css/styles/common.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/webapp/web/css/styles/common.css?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/webapp/web/css/styles/common.css (original)
+++ lucene/dev/branches/lucene6780/solr/webapp/web/css/styles/common.css Fri Sep 18 15:13:49 2015
@@ -699,3 +699,16 @@ pre.syntax .tex .formula
   -webkit-box-shadow: 1px 1px 0 #d8d8d8;
   color: #333;
 }
+
+.other-ui-link {
+  margin: 0px;
+  position: absolute;
+  right: 0px;
+  top: -20px;
+}
+
+.other-ui-link span {
+  background-image: url( ../../img/ico/information-white.png );
+  right: 0px;
+  padding-left: 16px;
+}
\ No newline at end of file

Modified: lucene/dev/branches/lucene6780/solr/webapp/web/index.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/webapp/web/index.html?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/webapp/web/index.html (original)
+++ lucene/dev/branches/lucene6780/solr/webapp/web/index.html Fri Sep 18 15:13:49 2015
@@ -119,6 +119,10 @@ limitations under the License.
         <div class="exception">{{exception.msg}}</div>
       </div>
 
+      <div class="other-ui-link">
+        <a href="/solr/">Original UI</a><a href="http://lucene.apache.org/ui-change.html">&nbsp;<span class="help"></span></a>
+      </div>
+
       <div id="content-wrapper">
         <div ng-view id="content">
 

Modified: lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/app.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/app.js?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/app.js (original)
+++ lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/app.js Fri Sep 18 15:13:49 2015
@@ -194,10 +194,8 @@ solrAdminApp.config([
             browser.locale = match[1] + '_' + match[3];
         }
 
-        var result= ( input || 0 ).toString().replace(/\B(?=(\d{3})+(?!\d))/g,
+        return ( input || 0 ).toString().replace(/\B(?=(\d{3})+(?!\d))/g,
             sep[ browser.locale ] || sep[ browser.language ] || sep['_']);
-        console.log(result);
-        return result;
     };
 })
 .filter('orderObjectBy', function() {
@@ -294,7 +292,7 @@ solrAdminApp.config([
     if (activeRequests == 0) {
       $rootScope.$broadcast('loadingStatusInactive');
     }
-    if (rejection.config.params.doNotIntercept) {
+    if (rejection.config.headers.doNotIntercept) {
         return rejection;
     }
     if (rejection.status === 0) {
@@ -405,6 +403,9 @@ solrAdminApp.controller('MainController'
     $location.url("/" + collection.name + "/collection-overview")
   }
 
+  $scope.$on('$routeChangeStart', function() {
+      $rootScope.exceptions = {};
+  });
 });
 
 

Modified: lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/dataimport.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/dataimport.js?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/dataimport.js (original)
+++ lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/dataimport.js Fri Sep 18 15:13:49 2015
@@ -192,6 +192,11 @@ solrAdminApp.controller('DataImportContr
             $cookies.dataimport_autorefresh = $scope.autorefresh ? true : null;
             if ($scope.autorefresh) {
                 $scope.refreshTimeout = $interval($scope.refreshStatus, dataimport_timeout);
+                var onRouteChangeOff = $scope.$on('$routeChangeStart', function() {
+                    $interval.cancel($scope.refreshTimeout);
+                    onRouteChangeOff();
+                });
+
             } else if ($scope.refreshTimeout) {
                 $interval.cancel($scope.refreshTimeout);
             }

Modified: lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/documents.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/documents.js?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/documents.js (original)
+++ lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/documents.js Fri Sep 18 15:13:49 2015
@@ -116,7 +116,7 @@ solrAdminApp.controller('DocumentsContro
                     $scope.responseStatus = failure;
                 };
                 if (contentType == "json") {
-                  Update.postJson(params, postData, callack, failure);
+                  Update.postJson(params, postData, callback, failure);
                 } else if (contentType == "xml") {
                   Update.postXml(params, postData, callback, failure);
                 } else if (contentType == "csv") {

Modified: lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/logging.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/logging.js?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/logging.js (original)
+++ lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/logging.js Fri Sep 18 15:13:49 2015
@@ -71,7 +71,11 @@ solrAdminApp.controller('LoggingControll
         }
       */
       });
-      $timeout($scope.refresh, 10000);
+      $scope.timeout = $timeout($scope.refresh, 10000);
+      var onRouteChangeOff = $scope.$on('$routeChangeStart', function() {
+        $timeout.cancel($scope.timeout);
+        onRouteChangeOff();
+      });
     };
     $scope.refresh();
 

Modified: lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/query.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/query.js?rev=1703881&r1=1703880&r2=1703881&view=diff
==============================================================================
--- lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/query.js (original)
+++ lucene/dev/branches/lucene6780/solr/webapp/web/js/angular/controllers/query.js Fri Sep 18 15:13:49 2015
@@ -30,6 +30,10 @@ solrAdminApp.controller('QueryController
     $scope.spellcheck = {spellcheck:"on"};
     $scope.qt = "/select";
 
+    if ($location.search().q) {
+      $scope.query.q = $location.search()["q"];
+    }
+
     $scope.doQuery = function() {
       var params = {};
 
@@ -71,10 +75,9 @@ solrAdminApp.controller('QueryController
         copy(params, $scope.filters[filter]);
       }
 
-      params.doNotIntercept=true;
       params.core = $routeParams.core;
       params.handler = qt;
-      var url = "/solr/" + $routeParams.core + qt + "?" + Query.url(params);
+      var url = Query.url(params);
       Query.query(params, function(data) {
         $scope.lang = $scope.query.wt;
         $scope.response = data;