lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r906586 - in /lucene/solr/branches/cloud/src/test/org/apache/solr: BaseDistributedSearchTestCase.java cloud/BasicDistributedZkTest.java
Date Thu, 04 Feb 2010 18:04:01 GMT
Author: yonik
Date: Thu Feb  4 18:04:00 2010
New Revision: 906586

URL: http://svn.apache.org/viewvc?rev=906586&view=rev
Log:
test with shards=shard ids

Modified:
    lucene/solr/branches/cloud/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
    lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java

Modified: lucene/solr/branches/cloud/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/org/apache/solr/BaseDistributedSearchTestCase.java?rev=906586&r1=906585&r2=906586&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
(original)
+++ lucene/solr/branches/cloud/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
Thu Feb  4 18:04:00 2010
@@ -159,6 +159,11 @@
     shards = sb.toString();
   }
 
+
+  protected void setDistributedParams(ModifiableSolrParams params) {
+    params.set("shards", getShardsString());
+  }
+
   protected String getShardsString() {
     if (deadServers == null) return shards;
     
@@ -294,8 +299,8 @@
 
     final QueryResponse controlRsp = controlClient.query(params);
 
+    setDistributedParams(params);
     // query a random server
-    params.set("shards", getShardsString());
     int which = r.nextInt(clients.size());
     SolrServer client = clients.get(which);
     QueryResponse rsp = client.query(params);

Modified: lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java?rev=906586&r1=906585&r2=906586&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
(original)
+++ lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
Thu Feb  4 18:04:00 2010
@@ -21,6 +21,7 @@
 
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
+import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.core.CoreDescriptor;
 import org.apache.solr.core.SolrCore;
 
@@ -56,7 +57,25 @@
   String oddField="oddField_s";
   String missingField="missing_but_valid_field_t";
   String invalidField="invalid_field_not_in_schema";
-  
+
+  @Override
+  protected void setDistributedParams(ModifiableSolrParams params) {
+    // super.setDistributedParams(params);
+
+    // TODO: this doesn't work yet because of the extra shards in the collection from
+    // localhost:8983 and control_shardId
+    // params.set("distrib","true");
+
+    // use shard ids rather than physical locations
+    StringBuilder sb = new StringBuilder();
+    for (int i=0; i<nServers; i++) {
+      if (i>0) sb.append(',');
+      sb.append("shardId"+(i+3));
+    }
+    params.set("shards",sb.toString());
+    params.set("distrib","true");
+  }
+
   protected void createServers(int numShards) throws Exception {
     controlJetty = createJetty(testDir, "control", "control_shardId");
     controlClient = createNewSolrServer(controlJetty.getLocalPort());
@@ -73,8 +92,9 @@
     shards = sb.toString();
   }
 
+  int nServers;
   public void testDistribSearch() throws Exception {
-    for (int nServers = 3; nServers < 4; nServers++) {
+    for (nServers = 3; nServers < 4; nServers++) {
       printLayout();
       createServers(nServers);
       RandVal.uniqueValues = new HashSet(); //reset random values



Mime
View raw message