lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r932963 - in /lucene/dev/trunk/solr/src/test/org/apache/solr: BaseDistributedSearchTestCase.java TestDistributedSearch.java handler/component/DistributedSpellCheckComponentTest.java
Date Sun, 11 Apr 2010 18:04:21 GMT
Author: markrmiller
Date: Sun Apr 11 18:04:21 2010
New Revision: 932963

URL: http://svn.apache.org/viewvc?rev=932963&view=rev
Log:
SOLR-1840, SOLR-1839: DistributedSpellCheckComponentTest fails under stress test

Modified:
    lucene/dev/trunk/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/TestDistributedSearch.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java?rev=932963&r1=932962&r2=932963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java Sun
Apr 11 18:04:21 2010
@@ -13,6 +13,7 @@ import org.apache.solr.common.params.Mod
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.schema.TrieDateField;
 import org.apache.solr.util.AbstractSolrTestCase;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -25,7 +26,7 @@ import java.util.*;
  *
  * @since solr 1.5
  */
-public abstract class BaseDistributedSearchTestCase extends TestCase {
+public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
   public static Random r = new Random(0);
 
   protected int shardCount = 4;
@@ -493,6 +494,7 @@ public abstract class BaseDistributedSea
     }
   }
 
+  @Test
   public void testDistribSearch() throws Exception {
     if (fixShardCount) {
       createServers(shardCount);

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/TestDistributedSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/TestDistributedSearch.java?rev=932963&r1=932962&r2=932963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/TestDistributedSearch.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/TestDistributedSearch.java Sun Apr 11 18:04:21
2010
@@ -17,6 +17,8 @@
 
 package org.apache.solr;
 
+import junit.framework.TestCase;
+
 import org.apache.solr.client.solrj.SolrServerException;
 
 /**
@@ -28,13 +30,6 @@ import org.apache.solr.client.solrj.Solr
  * @since solr 1.3
  */
 public class TestDistributedSearch extends BaseDistributedSearchTestCase {
-  public String getSchemaFile() {
-    return null;
-  }
-
-  public String getSolrConfigFile() {
-    return null;
-  }
 
   String t1="a_t";
   String i1="a_si";
@@ -183,7 +178,7 @@ public class TestDistributedSearch exten
     try {
       // test error produced for field that is invalid for schema
       query("q","*:*", "rows",100, "facet","true", "facet.field",invalidField, "facet.mincount",2);
-      fail("SolrServerException expected for invalid field that is not in schema");
+      TestCase.fail("SolrServerException expected for invalid field that is not in schema");
     } catch (SolrServerException ex) {
       // expected
     }

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java?rev=932963&r1=932962&r2=932963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java
(original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java
Sun Apr 11 18:04:21 2010
@@ -1,7 +1,8 @@
 package org.apache.solr.handler.component;
 
 import org.apache.solr.BaseDistributedSearchTestCase;
-import org.apache.solr.util.AbstractSolrTestCase;
+import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.common.params.ModifiableSolrParams;
 
 /**
  * Test for SpellCheckComponent's distributed querying
@@ -30,6 +31,22 @@ public class DistributedSpellCheckCompon
       System.setProperty("solr.directoryFactory", saveProp);
   }
   
+  private void q(Object... q) throws Exception {
+    final ModifiableSolrParams params = new ModifiableSolrParams();
+
+    for (int i = 0; i < q.length; i += 2) {
+      params.add(q[i].toString(), q[i + 1].toString());
+    }
+
+    controlClient.query(params);
+
+    // query a random server
+    params.set("shards", shards);
+    int which = r.nextInt(clients.size());
+    SolrServer client = clients.get(which);
+    client.query(params);
+  }
+  
   @Override
   public void doTest() throws Exception {
     index(id, "1", "lowerfilt", "toyota");
@@ -51,10 +68,11 @@ public class DistributedSpellCheckCompon
     handle.put("maxScore", SKIPVAL);
     // we care only about the spellcheck results
     handle.put("response", SKIP);
-
-    query("q", "*:*", "fl", "id,lowerfilt", "spellcheck.q","toyata", "spellcheck", "true",
SpellCheckComponent.SPELLCHECK_BUILD, "true", "qt", "spellCheckCompRH", "shards.qt", "spellCheckCompRH");
-    query("q", "*:*", "fl", "id,lowerfilt", "spellcheck.q","toyata", "spellcheck", "true",
SpellCheckComponent.SPELLCHECK_BUILD, "true", "qt", "spellCheckCompRH", "shards.qt", "spellCheckCompRH",
SpellCheckComponent.SPELLCHECK_EXTENDED_RESULTS, "true");
-    query("q", "*:*", "fl", "id,lowerfilt", "spellcheck.q","bluo", "spellcheck", "true",
SpellCheckComponent.SPELLCHECK_BUILD, "true", "qt", "spellCheckCompRH", "shards.qt", "spellCheckCompRH",
SpellCheckComponent.SPELLCHECK_EXTENDED_RESULTS, "true", SpellCheckComponent.SPELLCHECK_COUNT,
"4");
-    query("q", "The quick reb fox jumped over the lazy brown dogs", "fl", "id,lowerfilt",
"spellcheck", "true", SpellCheckComponent.SPELLCHECK_BUILD, "true", "qt", "spellCheckCompRH",
"shards.qt", "spellCheckCompRH", SpellCheckComponent.SPELLCHECK_EXTENDED_RESULTS, "true",
SpellCheckComponent.SPELLCHECK_COUNT, "4", SpellCheckComponent.SPELLCHECK_COLLATE, "true");
+    q("q", "*:*", SpellCheckComponent.SPELLCHECK_BUILD, "true", "qt", "spellCheckCompRH",
"shards.qt", "spellCheckCompRH");
+    
+    query("q", "*:*", "fl", "id,lowerfilt", "spellcheck.q","toyata", "spellcheck", "true",
"qt", "spellCheckCompRH", "shards.qt", "spellCheckCompRH");
+    query("q", "*:*", "fl", "id,lowerfilt", "spellcheck.q","toyata", "spellcheck", "true",
"qt", "spellCheckCompRH", "shards.qt", "spellCheckCompRH", SpellCheckComponent.SPELLCHECK_EXTENDED_RESULTS,
"true");
+    query("q", "*:*", "fl", "id,lowerfilt", "spellcheck.q","bluo", "spellcheck", "true",
"qt", "spellCheckCompRH", "shards.qt", "spellCheckCompRH", SpellCheckComponent.SPELLCHECK_EXTENDED_RESULTS,
"true", SpellCheckComponent.SPELLCHECK_COUNT, "4");
+    query("q", "The quick reb fox jumped over the lazy brown dogs", "fl", "id,lowerfilt",
"spellcheck", "true", "qt", "spellCheckCompRH", "shards.qt", "spellCheckCompRH", SpellCheckComponent.SPELLCHECK_EXTENDED_RESULTS,
"true", SpellCheckComponent.SPELLCHECK_COUNT, "4", SpellCheckComponent.SPELLCHECK_COLLATE,
"true");
   }
 }



Mime
View raw message