lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r893725 - /lucene/solr/trunk/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
Date Thu, 24 Dec 2009 09:43:15 GMT
Author: shalin
Date: Thu Dec 24 09:43:15 2009
New Revision: 893725

URL: http://svn.apache.org/viewvc?rev=893725&view=rev
Log:
SOLR-1686 -- Support fixing the number of shards in BaseDistributedTestCase

Modified:
    lucene/solr/trunk/src/test/org/apache/solr/BaseDistributedSearchTestCase.java

Modified: lucene/solr/trunk/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/BaseDistributedSearchTestCase.java?rev=893725&r1=893724&r2=893725&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/BaseDistributedSearchTestCase.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/BaseDistributedSearchTestCase.java Thu Dec
24 09:43:15 2009
@@ -26,6 +26,16 @@
 public abstract class BaseDistributedSearchTestCase extends AbstractSolrTestCase {
   public static Random r = new Random(0);
 
+  protected int shardCount = 4;
+  /**
+   * Sub classes can set this flag in their constructor to true if they
+   * want to fix the number of shards to 'shardCount'
+   *
+   * The default is false which means that test will be executed with
+   * 1, 2, 3, ....shardCount number of shards repeatedly
+   */
+  protected boolean fixShardCount = false;
+
   protected JettySolrRunner controlJetty;
   protected List<SolrServer> clients = new ArrayList<SolrServer>();
   protected List<JettySolrRunner> jettys = new ArrayList<JettySolrRunner>();
@@ -492,11 +502,18 @@
   }
 
   public void testDistribSearch() throws Exception {
-    for (int nServers = 1; nServers < 4; nServers++) {
-      createServers(nServers);
+    if (fixShardCount) {
+      createServers(shardCount);
       RandVal.uniqueValues = new HashSet(); //reset random values
       doTest();
       destroyServers();
+    } else {
+      for (int nServers = 1; nServers < shardCount; nServers++) {
+        createServers(nServers);
+        RandVal.uniqueValues = new HashSet(); //reset random values
+        doTest();
+        destroyServers();
+      }
     }
   }
 



Mime
View raw message