You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2014/12/31 15:05:50 UTC
svn commit: r1648697 [13/13] - in /lucene/dev/trunk/solr: ./
contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/
contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/
contrib/map-reduce/src/java/org/apache/solr/hadoo...
Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java?rev=1648697&r1=1648696&r2=1648697&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java (original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java Wed Dec 31 14:05:48 2014
@@ -25,7 +25,6 @@ import org.apache.solr.client.solrj.resp
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SpellingParams;
-import org.apache.solr.util.ExternalPaths;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -47,34 +46,34 @@ public class TestSpellCheckResponse exte
@Test
public void testSpellCheckResponse() throws Exception {
- getSolrServer();
- server.deleteByQuery("*:*");
- server.commit(true, true);
+ getSolrClient();
+ client.deleteByQuery("*:*");
+ client.commit(true, true);
SolrInputDocument doc = new SolrInputDocument();
doc.setField("id", "111");
doc.setField(field, "Samsung");
- server.add(doc);
- server.commit(true, true);
+ client.add(doc);
+ client.commit(true, true);
SolrQuery query = new SolrQuery("*:*");
query.set(CommonParams.QT, "/spell");
query.set("spellcheck", true);
query.set(SpellingParams.SPELLCHECK_Q, "samsang");
QueryRequest request = new QueryRequest(query);
- SpellCheckResponse response = request.process(server).getSpellCheckResponse();
+ SpellCheckResponse response = request.process(client).getSpellCheckResponse();
Assert.assertEquals("samsung", response.getFirstSuggestion("samsang"));
}
@Test
public void testSpellCheckResponse_Extended() throws Exception {
- getSolrServer();
- server.deleteByQuery("*:*");
- server.commit(true, true);
+ getSolrClient();
+ client.deleteByQuery("*:*");
+ client.commit(true, true);
SolrInputDocument doc = new SolrInputDocument();
doc.setField("id", "111");
doc.setField(field, "Samsung");
- server.add(doc);
- server.commit(true, true);
+ client.add(doc);
+ client.commit(true, true);
SolrQuery query = new SolrQuery("*:*");
query.set(CommonParams.QT, "/spell");
@@ -82,7 +81,7 @@ public class TestSpellCheckResponse exte
query.set(SpellingParams.SPELLCHECK_Q, "samsang");
query.set(SpellingParams.SPELLCHECK_EXTENDED_RESULTS, true);
QueryRequest request = new QueryRequest(query);
- SpellCheckResponse response = request.process(server).getSpellCheckResponse();
+ SpellCheckResponse response = request.process(client).getSpellCheckResponse();
assertEquals("samsung", response.getFirstSuggestion("samsang"));
SpellCheckResponse.Suggestion sug = response.getSuggestion("samsang");
@@ -106,30 +105,30 @@ public class TestSpellCheckResponse exte
@Test
public void testSpellCheckCollationResponse() throws Exception {
- getSolrServer();
- server.deleteByQuery("*:*");
- server.commit(true, true);
+ getSolrClient();
+ client.deleteByQuery("*:*");
+ client.commit(true, true);
SolrInputDocument doc = new SolrInputDocument();
doc.setField("id", "0");
doc.setField("name", "faith hope and love");
- server.add(doc);
+ client.add(doc);
doc = new SolrInputDocument();
doc.setField("id", "1");
doc.setField("name", "faith hope and loaves");
- server.add(doc);
+ client.add(doc);
doc = new SolrInputDocument();
doc.setField("id", "2");
doc.setField("name", "fat hops and loaves");
- server.add(doc);
+ client.add(doc);
doc = new SolrInputDocument();
doc.setField("id", "3");
doc.setField("name", "faith of homer");
- server.add(doc);
+ client.add(doc);
doc = new SolrInputDocument();
doc.setField("id", "4");
doc.setField("name", "fat of homer");
- server.add(doc);
- server.commit(true, true);
+ client.add(doc);
+ client.commit(true, true);
//Test Backwards Compatibility
SolrQuery query = new SolrQuery("name:(+fauth +home +loane)");
@@ -138,8 +137,8 @@ public class TestSpellCheckResponse exte
query.set(SpellingParams.SPELLCHECK_COUNT, 10);
query.set(SpellingParams.SPELLCHECK_COLLATE, true);
QueryRequest request = new QueryRequest(query);
- SpellCheckResponse response = request.process(server).getSpellCheckResponse();
- response = request.process(server).getSpellCheckResponse();
+ SpellCheckResponse response = request.process(client).getSpellCheckResponse();
+ response = request.process(client).getSpellCheckResponse();
assertTrue("name:(+faith +hope +loaves)".equals(response.getCollatedResult()));
//Test Expanded Collation Results
@@ -147,7 +146,7 @@ public class TestSpellCheckResponse exte
query.set(SpellingParams.SPELLCHECK_MAX_COLLATION_TRIES, 10);
query.set(SpellingParams.SPELLCHECK_MAX_COLLATIONS, 2);
request = new QueryRequest(query);
- response = request.process(server).getSpellCheckResponse();
+ response = request.process(client).getSpellCheckResponse();
assertTrue("name:(+faith +hope +love)".equals(response.getCollatedResult()) || "name:(+faith +hope +loaves)".equals(response.getCollatedResult()));
List<Collation> collations = response.getCollatedResults();
@@ -178,7 +177,7 @@ public class TestSpellCheckResponse exte
}
query.set(SpellingParams.SPELLCHECK_COLLATE_EXTENDED_RESULTS, false);
- response = request.process(server).getSpellCheckResponse();
+ response = request.process(client).getSpellCheckResponse();
{
collations = response.getCollatedResults();
assertEquals(2, collations.size());
Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java?rev=1648697&r1=1648696&r2=1648697&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java Wed Dec 31 14:05:48 2014
@@ -17,31 +17,15 @@ package org.apache.solr;
* limitations under the License.
*/
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
import junit.framework.Assert;
-
import org.apache.commons.io.FileUtils;
import org.apache.lucene.util.Constants;
import org.apache.lucene.util.TestUtil;
+import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrResponse;
-import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.client.solrj.impl.HttpSolrServer;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.client.solrj.response.UpdateResponse;
@@ -59,6 +43,21 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
/**
* Helper base class for distributed search test cases
*
@@ -185,7 +184,7 @@ public abstract class BaseDistributedSea
protected boolean fixShardCount = false;
protected JettySolrRunner controlJetty;
- protected List<SolrServer> clients = new ArrayList<>();
+ protected List<SolrClient> clients = new ArrayList<>();
protected List<JettySolrRunner> jettys = new ArrayList<>();
protected String context;
@@ -193,7 +192,7 @@ public abstract class BaseDistributedSea
protected String shards;
protected String[] shardsArr;
protected File testDir;
- protected SolrServer controlClient;
+ protected SolrClient controlClient;
// to stress with higher thread counts and requests, make sure the junit
// xml formatter is not being used (all output will be buffered before
@@ -293,7 +292,7 @@ public abstract class BaseDistributedSea
protected void createServers(int numShards) throws Exception {
controlJetty = createControlJetty();
- controlClient = createNewSolrServer(controlJetty.getLocalPort());
+ controlClient = createNewSolrClient(controlJetty.getLocalPort());
shardsArr = new String[numShards];
StringBuilder sb = new StringBuilder();
@@ -303,7 +302,7 @@ public abstract class BaseDistributedSea
testDir + "/shard" + i + "/data", null, getSolrConfigFile(),
getSchemaFile());
jettys.add(j);
- clients.add(createNewSolrServer(j.getLocalPort()));
+ clients.add(createNewSolrClient(j.getLocalPort()));
String shardStr = buildUrl(j.getLocalPort());
shardsArr[i] = shardStr;
sb.append(shardStr);
@@ -342,9 +341,9 @@ public abstract class BaseDistributedSea
protected void destroyServers() throws Exception {
controlJetty.stop();
- ((HttpSolrServer) controlClient).shutdown();
+ ((HttpSolrClient) controlClient).shutdown();
for (JettySolrRunner jetty : jettys) jetty.stop();
- for (SolrServer client : clients) ((HttpSolrServer) client).shutdown();
+ for (SolrClient client : clients) ((HttpSolrClient) client).shutdown();
clients.clear();
jettys.clear();
}
@@ -387,15 +386,15 @@ public abstract class BaseDistributedSea
return null;
}
- protected SolrServer createNewSolrServer(int port) {
+ protected SolrClient createNewSolrClient(int port) {
try {
- // setup the server...
- HttpSolrServer s = new HttpSolrServer(buildUrl(port));
- s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
- s.setSoTimeout(90000);
- s.setDefaultMaxConnectionsPerHost(100);
- s.setMaxTotalConnections(100);
- return s;
+ // setup the client...
+ HttpSolrClient client = new HttpSolrClient(buildUrl(port));
+ client.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
+ client.setSoTimeout(90000);
+ client.setDefaultMaxConnectionsPerHost(100);
+ client.setMaxTotalConnections(100);
+ return client;
}
catch (Exception ex) {
throw new RuntimeException(ex);
@@ -438,7 +437,7 @@ public abstract class BaseDistributedSea
controlClient.add(doc);
int which = (doc.getField(id).toString().hashCode() & 0x7fffffff) % clients.size();
- SolrServer client = clients.get(which);
+ SolrClient client = clients.get(which);
client.add(doc);
}
@@ -446,38 +445,38 @@ public abstract class BaseDistributedSea
* Indexes the document in both the control client and the specified client asserting
* that the respones are equivilent
*/
- protected UpdateResponse indexDoc(SolrServer server, SolrParams params, SolrInputDocument... sdocs) throws IOException, SolrServerException {
+ protected UpdateResponse indexDoc(SolrClient client, SolrParams params, SolrInputDocument... sdocs) throws IOException, SolrServerException {
UpdateResponse controlRsp = add(controlClient, params, sdocs);
- UpdateResponse specificRsp = add(server, params, sdocs);
+ UpdateResponse specificRsp = add(client, params, sdocs);
compareSolrResponses(specificRsp, controlRsp);
return specificRsp;
}
- protected UpdateResponse add(SolrServer server, SolrParams params, SolrInputDocument... sdocs) throws IOException, SolrServerException {
+ protected UpdateResponse add(SolrClient client, SolrParams params, SolrInputDocument... sdocs) throws IOException, SolrServerException {
UpdateRequest ureq = new UpdateRequest();
ureq.setParams(new ModifiableSolrParams(params));
for (SolrInputDocument sdoc : sdocs) {
ureq.add(sdoc);
}
- return ureq.process(server);
+ return ureq.process(client);
}
- protected UpdateResponse del(SolrServer server, SolrParams params, Object... ids) throws IOException, SolrServerException {
+ protected UpdateResponse del(SolrClient client, SolrParams params, Object... ids) throws IOException, SolrServerException {
UpdateRequest ureq = new UpdateRequest();
ureq.setParams(new ModifiableSolrParams(params));
for (Object id: ids) {
ureq.deleteById(id.toString());
}
- return ureq.process(server);
+ return ureq.process(client);
}
- protected UpdateResponse delQ(SolrServer server, SolrParams params, String... queries) throws IOException, SolrServerException {
+ protected UpdateResponse delQ(SolrClient client, SolrParams params, String... queries) throws IOException, SolrServerException {
UpdateRequest ureq = new UpdateRequest();
ureq.setParams(new ModifiableSolrParams(params));
for (String q: queries) {
ureq.deleteByQuery(q);
}
- return ureq.process(server);
+ return ureq.process(client);
}
protected void index_specific(int serverNumber, Object... fields) throws Exception {
@@ -487,20 +486,20 @@ public abstract class BaseDistributedSea
}
controlClient.add(doc);
- SolrServer client = clients.get(serverNumber);
+ SolrClient client = clients.get(serverNumber);
client.add(doc);
}
protected void del(String q) throws Exception {
controlClient.deleteByQuery(q);
- for (SolrServer client : clients) {
+ for (SolrClient client : clients) {
client.deleteByQuery(q);
}
}// serial commit...
protected void commit() throws Exception {
controlClient.commit();
- for (SolrServer client : clients) {
+ for (SolrClient client : clients) {
client.commit();
}
}
@@ -508,7 +507,7 @@ public abstract class BaseDistributedSea
protected QueryResponse queryServer(ModifiableSolrParams params) throws SolrServerException {
// query a random server
int which = r.nextInt(clients.size());
- SolrServer client = clients.get(which);
+ SolrClient client = clients.get(which);
QueryResponse rsp = client.query(params);
return rsp;
}
@@ -570,7 +569,7 @@ public abstract class BaseDistributedSea
public void run() {
for (int j = 0; j < stress; j++) {
int which = r.nextInt(clients.size());
- SolrServer client = clients.get(which);
+ SolrClient client = clients.get(which);
try {
QueryResponse rsp = client.query(new ModifiableSolrParams(params));
if (verifyStress) {
@@ -592,13 +591,13 @@ public abstract class BaseDistributedSea
return rsp;
}
- public QueryResponse queryAndCompare(SolrParams params, SolrServer... servers) throws SolrServerException {
- return queryAndCompare(params, Arrays.<SolrServer>asList(servers));
+ public QueryResponse queryAndCompare(SolrParams params, SolrClient... clients) throws SolrServerException {
+ return queryAndCompare(params, Arrays.<SolrClient>asList(clients));
}
- public QueryResponse queryAndCompare(SolrParams params, Iterable<SolrServer> servers) throws SolrServerException {
+ public QueryResponse queryAndCompare(SolrParams params, Iterable<SolrClient> clients) throws SolrServerException {
QueryResponse first = null;
- for (SolrServer server : servers) {
- QueryResponse rsp = server.query(new ModifiableSolrParams(params));
+ for (SolrClient client : clients) {
+ QueryResponse rsp = client.query(new ModifiableSolrParams(params));
if (first == null) {
first = rsp;
} else {
Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java?rev=1648697&r1=1648696&r2=1648697&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java Wed Dec 31 14:05:48 2014
@@ -17,19 +17,12 @@ package org.apache.solr;
* limitations under the License.
*/
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.OutputStreamWriter;
-import java.util.Properties;
-import java.util.SortedMap;
-
import org.apache.commons.io.FileUtils;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.client.solrj.impl.HttpSolrServer;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.util.ExternalPaths;
import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.AfterClass;
@@ -37,6 +30,11 @@ import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
+import java.io.OutputStreamWriter;
+import java.util.Properties;
+import java.util.SortedMap;
+
abstract public class SolrJettyTestBase extends SolrTestCaseJ4
{
@@ -50,7 +48,7 @@ abstract public class SolrJettyTestBase
public static JettySolrRunner jetty;
public static int port;
- public static SolrServer server = null;
+ public static SolrClient client = null;
public static String context;
public static JettySolrRunner createJetty(String solrHome, String configFile, String schemaFile, String context,
@@ -87,36 +85,36 @@ abstract public class SolrJettyTestBase
jetty.stop();
jetty = null;
}
- if (server != null) server.shutdown();
- server = null;
+ if (client != null) client.shutdown();
+ client = null;
}
- public SolrServer getSolrServer() {
+ public SolrClient getSolrClient() {
{
- if (server == null) {
- server = createNewSolrServer();
+ if (client == null) {
+ client = createNewSolrClient();
}
- return server;
+ return client;
}
}
/**
- * Create a new solr server.
+ * Create a new solr client.
* If createJetty was called, an http implementation will be created,
* otherwise an embedded implementation will be created.
* Subclasses should override for other options.
*/
- public SolrServer createNewSolrServer() {
+ public SolrClient createNewSolrClient() {
if (jetty != null) {
try {
- // setup the server...
+ // setup the client...
String url = jetty.getBaseUrl().toString() + "/" + "collection1";
- HttpSolrServer s = new HttpSolrServer( url );
- s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
- s.setDefaultMaxConnectionsPerHost(100);
- s.setMaxTotalConnections(100);
- return s;
+ HttpSolrClient client = new HttpSolrClient( url );
+ client.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
+ client.setDefaultMaxConnectionsPerHost(100);
+ client.setMaxTotalConnections(100);
+ return client;
}
catch( Exception ex ) {
throw new RuntimeException( ex );
Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java?rev=1648697&r1=1648696&r2=1648697&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java Wed Dec 31 14:05:48 2014
@@ -102,7 +102,7 @@ public abstract class AbstractDistribZkT
System.clearProperty(ZkStateReader.NUM_SHARDS_PROP);
}
- controlClient = createNewSolrServer(controlJetty.getLocalPort());
+ controlClient = createNewSolrClient(controlJetty.getLocalPort());
StringBuilder sb = new StringBuilder();
for (int i = 1; i <= numShards; i++) {
@@ -112,7 +112,7 @@ public abstract class AbstractDistribZkT
setupJettySolrHome(jettyHome);
JettySolrRunner j = createJetty(jettyHome, null, "shard" + (i + 2));
jettys.add(j);
- clients.add(createNewSolrServer(j.getLocalPort()));
+ clients.add(createNewSolrClient(j.getLocalPort()));
sb.append(buildUrl(j.getLocalPort()));
}
Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java?rev=1648697&r1=1648696&r2=1648697&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java Wed Dec 31 14:05:48 2014
@@ -17,40 +17,16 @@ package org.apache.solr.cloud;
* limitations under the License.
*/
-import static org.apache.solr.cloud.OverseerCollectionProcessor.CREATE_NODE_SET;
-import static org.apache.solr.cloud.OverseerCollectionProcessor.NUM_SLICES;
-import static org.apache.solr.cloud.OverseerCollectionProcessor.SHARDS_PROP;
-import static org.apache.solr.common.cloud.ZkNodeProps.makeMap;
-import static org.apache.solr.common.cloud.ZkStateReader.REPLICATION_FACTOR;
-import static org.apache.solr.common.cloud.ZkStateReader.MAX_SHARDS_PER_NODE;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
import org.apache.commons.io.FilenameUtils;
import org.apache.http.params.CoreConnectionPNames;
import org.apache.lucene.util.LuceneTestCase.Slow;
+import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrRequest;
-import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.client.solrj.impl.CloudSolrServer;
-import org.apache.solr.client.solrj.impl.HttpSolrServer;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.CollectionAdminResponse;
@@ -88,6 +64,30 @@ import org.noggit.JSONWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static org.apache.solr.cloud.OverseerCollectionProcessor.CREATE_NODE_SET;
+import static org.apache.solr.cloud.OverseerCollectionProcessor.NUM_SLICES;
+import static org.apache.solr.cloud.OverseerCollectionProcessor.SHARDS_PROP;
+import static org.apache.solr.common.cloud.ZkNodeProps.makeMap;
+import static org.apache.solr.common.cloud.ZkStateReader.MAX_SHARDS_PER_NODE;
+import static org.apache.solr.common.cloud.ZkStateReader.REPLICATION_FACTOR;
+
/**
* TODO: we should still test this works as a custom update chain as well as
* what we test now - the default update chain
@@ -115,8 +115,8 @@ public abstract class AbstractFullDistri
String missingField = "ignore_exception__missing_but_valid_field_t";
protected int sliceCount;
- protected CloudSolrServer controlClientCloud; // cloud version of the control client
- protected volatile CloudSolrServer cloudClient;
+ protected CloudSolrClient controlClientCloud; // cloud version of the control client
+ protected volatile CloudSolrClient cloudClient;
protected List<CloudJettyRunner> cloudJettys = new ArrayList<>();
protected Map<String,List<CloudJettyRunner>> shardToJetty = new HashMap<>();
@@ -162,14 +162,14 @@ public abstract class AbstractFullDistri
}
static class CloudSolrServerClient {
- SolrServer solrClient;
+ SolrClient solrClient;
String shardName;
int port;
public ZkNodeProps info;
public CloudSolrServerClient() {}
- public CloudSolrServerClient(SolrServer client) {
+ public CloudSolrServerClient(SolrClient client) {
this.solrClient = client;
}
@@ -259,13 +259,13 @@ public abstract class AbstractFullDistri
shardToJetty, shardToLeaderJetty);
}
- protected CloudSolrServer createCloudClient(String defaultCollection) {
- CloudSolrServer server = new CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
- server.setParallelUpdates(random().nextBoolean());
- if (defaultCollection != null) server.setDefaultCollection(defaultCollection);
- server.getLbServer().getHttpClient().getParams()
+ protected CloudSolrClient createCloudClient(String defaultCollection) {
+ CloudSolrClient client = new CloudSolrClient(zkServer.getZkAddress(), random().nextBoolean());
+ client.setParallelUpdates(random().nextBoolean());
+ if (defaultCollection != null) client.setDefaultCollection(defaultCollection);
+ client.getLbClient().getHttpClient().getParams()
.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 30000);
- return server;
+ return client;
}
@Override
@@ -287,7 +287,7 @@ public abstract class AbstractFullDistri
// "shard1"
- controlClient = createNewSolrServer(controlJetty.getLocalPort());
+ controlClient = createNewSolrClient(controlJetty.getLocalPort());
if (sliceCount <= 0) {
// for now, just create the cloud client for the control if we don't
@@ -372,7 +372,7 @@ public abstract class AbstractFullDistri
*/
protected List<JettySolrRunner> createJettys(int numJettys, boolean checkCreatedVsState) throws Exception {
List<JettySolrRunner> jettys = new ArrayList<>();
- List<SolrServer> clients = new ArrayList<>();
+ List<SolrClient> clients = new ArrayList<>();
StringBuilder sb = new StringBuilder();
if (getStateFormat() == 2) {
@@ -399,7 +399,7 @@ public abstract class AbstractFullDistri
JettySolrRunner j = createJetty(jettyDir, useJettyDataDir ? getDataDir(testDir + "/jetty"
+ cnt) : null, null, "solrconfig.xml", null);
jettys.add(j);
- SolrServer client = createNewSolrServer(j.getLocalPort());
+ SolrClient client = createNewSolrClient(j.getLocalPort());
clients.add(client);
}
@@ -447,7 +447,7 @@ public abstract class AbstractFullDistri
}
- protected SolrServer startCloudJetty(String collection, String shard) throws Exception {
+ protected SolrClient startCloudJetty(String collection, String shard) throws Exception {
// TODO: use the collection string!!!!
collection = DEFAULT_COLLECTION;
@@ -461,7 +461,7 @@ public abstract class AbstractFullDistri
org.apache.commons.io.FileUtils.copyDirectory(new File(getSolrHome()), jettyDir);
JettySolrRunner j = createJetty(jettyDir, testDir + "/jetty" + cnt, shard, "solrconfig.xml", null);
jettys.add(j);
- SolrServer client = createNewSolrServer(j.getLocalPort());
+ SolrClient client = createNewSolrClient(j.getLocalPort());
clients.add(client);
int retries = 60;
@@ -628,11 +628,11 @@ public abstract class AbstractFullDistri
return solrHome;
}
- protected void updateMappingsFromZk(List<JettySolrRunner> jettys, List<SolrServer> clients) throws Exception {
+ protected void updateMappingsFromZk(List<JettySolrRunner> jettys, List<SolrClient> clients) throws Exception {
updateMappingsFromZk(jettys, clients, false);
}
- protected void updateMappingsFromZk(List<JettySolrRunner> jettys, List<SolrServer> clients, boolean allowOverSharding) throws Exception {
+ protected void updateMappingsFromZk(List<JettySolrRunner> jettys, List<SolrClient> clients, boolean allowOverSharding) throws Exception {
ZkStateReader zkStateReader = cloudClient.getZkStateReader();
zkStateReader.updateClusterState(true);
cloudJettys.clear();
@@ -642,13 +642,13 @@ public abstract class AbstractFullDistri
DocCollection coll = clusterState.getCollection(DEFAULT_COLLECTION);
List<CloudSolrServerClient> theClients = new ArrayList<>();
- for (SolrServer client : clients) {
+ for (SolrClient client : clients) {
// find info for this client in zk
nextClient:
// we find out state by simply matching ports...
for (Slice slice : coll.getSlices()) {
for (Replica replica : slice.getReplicas()) {
- int port = new URI(((HttpSolrServer) client).getBaseURL())
+ int port = new URI(((HttpSolrClient) client).getBaseURL())
.getPort();
if (replica.getStr(ZkStateReader.BASE_URL_PROP).contains(":" + port)) {
@@ -783,7 +783,7 @@ public abstract class AbstractFullDistri
}
controlClient.add(doc);
- HttpSolrServer client = (HttpSolrServer) clients
+ HttpSolrClient client = (HttpSolrClient) clients
.get(serverNumber);
UpdateRequest ureq = new UpdateRequest();
@@ -792,7 +792,7 @@ public abstract class AbstractFullDistri
ureq.process(client);
}
- protected void index_specific(SolrServer client, Object... fields)
+ protected void index_specific(SolrClient client, Object... fields)
throws Exception {
SolrInputDocument doc = new SolrInputDocument();
for (int i = 0; i < fields.length; i += 2) {
@@ -1025,7 +1025,7 @@ public abstract class AbstractFullDistri
public QueryResponse queryAndCompareReplicas(SolrParams params, String shard)
throws Exception {
- ArrayList<SolrServer> shardClients = new ArrayList<>(7);
+ ArrayList<SolrClient> shardClients = new ArrayList<>(7);
updateMappingsFromZk(jettys, clients);
ZkStateReader zkStateReader = cloudClient.getZkStateReader();
@@ -1275,7 +1275,7 @@ public abstract class AbstractFullDistri
try {
CloudJettyRunner cjetty = shardToJetty.get(s).get(i);
ZkNodeProps props = cjetty.info;
- SolrServer client = cjetty.client.solrClient;
+ SolrClient client = cjetty.client.solrClient;
boolean active = props.getStr(ZkStateReader.STATE_PROP).equals(
ZkStateReader.ACTIVE);
if (active) {
@@ -1310,7 +1310,7 @@ public abstract class AbstractFullDistri
}
}
- protected SolrServer getClient(String nodeName) {
+ protected SolrClient getClient(String nodeName) {
for (CloudJettyRunner cjetty : cloudJettys) {
CloudSolrServerClient client = cjetty.client;
if (client.shardName.equals(nodeName)) {
@@ -1354,7 +1354,7 @@ public abstract class AbstractFullDistri
Map<String,Replica> theShards = slice.getValue().getReplicasMap();
for (Map.Entry<String,Replica> shard : theShards.entrySet()) {
String shardName = new URI(
- ((HttpSolrServer) client.solrClient).getBaseURL()).getPort()
+ ((HttpSolrClient) client.solrClient).getBaseURL()).getPort()
+ "_solr_";
if (verbose && shard.getKey().endsWith(shardName)) {
System.err.println("shard:" + slice.getKey());
@@ -1536,11 +1536,11 @@ public abstract class AbstractFullDistri
if (VERBOSE || printLayoutOnTearDown) {
super.printLayout();
}
- if (commondCloudSolrServer != null) {
- commondCloudSolrServer.shutdown();
+ if (commondCloudSolrClient != null) {
+ commondCloudSolrClient.shutdown();
}
if (controlClient != null) {
- ((HttpSolrServer) controlClient).shutdown();
+ ((HttpSolrClient) controlClient).shutdown();
}
if (cloudClient != null) {
cloudClient.shutdown();
@@ -1587,12 +1587,12 @@ public abstract class AbstractFullDistri
return createCollection(null, collectionName, numShards, replicationFactor, maxShardsPerNode, null, null);
}
- protected CollectionAdminResponse createCollection(Map<String,List<Integer>> collectionInfos, String collectionName, Map<String,Object> collectionProps, SolrServer client) throws SolrServerException, IOException{
+ protected CollectionAdminResponse createCollection(Map<String,List<Integer>> collectionInfos, String collectionName, Map<String,Object> collectionProps, SolrClient client) throws SolrServerException, IOException{
return createCollection(collectionInfos, collectionName, collectionProps, client, null);
}
// TODO: Use CollectionAdminRequest#createCollection() instead of a raw request
- protected CollectionAdminResponse createCollection(Map<String, List<Integer>> collectionInfos, String collectionName, Map<String, Object> collectionProps, SolrServer client, String confSetName) throws SolrServerException, IOException{
+ protected CollectionAdminResponse createCollection(Map<String, List<Integer>> collectionInfos, String collectionName, Map<String, Object> collectionProps, SolrClient client, String confSetName) throws SolrServerException, IOException{
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("action", CollectionAction.CREATE.toString());
for (Map.Entry<String, Object> entry : collectionProps.entrySet()) {
@@ -1629,12 +1629,12 @@ public abstract class AbstractFullDistri
CollectionAdminResponse res = new CollectionAdminResponse();
if (client == null) {
- final String baseUrl = getBaseUrl((HttpSolrServer) clients.get(clientIndex));
- SolrServer server = createNewSolrServer("", baseUrl);
+ final String baseUrl = getBaseUrl((HttpSolrClient) clients.get(clientIndex));
+ SolrClient adminClient = createNewSolrClient("", baseUrl);
try {
- res.setResponse(server.request(request));
+ res.setResponse(adminClient.request(request));
} finally {
- if (server != null) server.shutdown();
+ if (adminClient != null) adminClient.shutdown();
}
} else {
res.setResponse(client.request(request));
@@ -1644,7 +1644,7 @@ public abstract class AbstractFullDistri
protected CollectionAdminResponse createCollection(Map<String,List<Integer>> collectionInfos,
- String collectionName, int numShards, int replicationFactor, int maxShardsPerNode, SolrServer client, String createNodeSetStr) throws SolrServerException, IOException {
+ String collectionName, int numShards, int replicationFactor, int maxShardsPerNode, SolrClient client, String createNodeSetStr) throws SolrServerException, IOException {
return createCollection(collectionInfos, collectionName,
ZkNodeProps.makeMap(
@@ -1656,7 +1656,7 @@ public abstract class AbstractFullDistri
}
protected CollectionAdminResponse createCollection(Map<String, List<Integer>> collectionInfos,
- String collectionName, int numShards, int replicationFactor, int maxShardsPerNode, SolrServer client, String createNodeSetStr, String configName) throws SolrServerException, IOException {
+ String collectionName, int numShards, int replicationFactor, int maxShardsPerNode, SolrClient client, String createNodeSetStr, String configName) throws SolrServerException, IOException {
return createCollection(collectionInfos, collectionName,
ZkNodeProps.makeMap(
@@ -1668,37 +1668,37 @@ public abstract class AbstractFullDistri
}
@Override
- protected SolrServer createNewSolrServer(int port) {
+ protected SolrClient createNewSolrClient(int port) {
try {
// setup the server...
String baseUrl = buildUrl(port);
String url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + DEFAULT_COLLECTION;
- HttpSolrServer s = new HttpSolrServer(url);
- s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
- s.setSoTimeout(60000);
- s.setDefaultMaxConnectionsPerHost(100);
- s.setMaxTotalConnections(100);
- return s;
+ HttpSolrClient client = new HttpSolrClient(url);
+ client.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
+ client.setSoTimeout(60000);
+ client.setDefaultMaxConnectionsPerHost(100);
+ client.setMaxTotalConnections(100);
+ return client;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
- protected SolrServer createNewSolrServer(String collection, String baseUrl) {
+ protected SolrClient createNewSolrClient(String collection, String baseUrl) {
try {
// setup the server...
- HttpSolrServer s = new HttpSolrServer(baseUrl + "/" + collection);
- s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
- s.setDefaultMaxConnectionsPerHost(100);
- s.setMaxTotalConnections(100);
- return s;
+ HttpSolrClient client = new HttpSolrClient(baseUrl + "/" + collection);
+ client.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
+ client.setDefaultMaxConnectionsPerHost(100);
+ client.setMaxTotalConnections(100);
+ return client;
}
catch (Exception ex) {
throw new RuntimeException(ex);
}
}
- protected String getBaseUrl(HttpSolrServer client) {
+ protected String getBaseUrl(HttpSolrClient client) {
return client .getBaseURL().substring(
0, client.getBaseURL().length()
- DEFAULT_COLLECTION.length() - 1);
@@ -1711,7 +1711,7 @@ public abstract class AbstractFullDistri
}
private String checkCollectionExpectations(String collectionName, List<Integer> numShardsNumReplicaList, List<String> nodesAllowedToRunShards) {
- ClusterState clusterState = getCommonCloudSolrServer().getZkStateReader().getClusterState();
+ ClusterState clusterState = getCommonCloudSolrClient().getZkStateReader().getClusterState();
int expectedSlices = numShardsNumReplicaList.get(0);
// The Math.min thing is here, because we expect replication-factor to be reduced to if there are not enough live nodes to spread all shards of a collection over different nodes
@@ -1766,20 +1766,20 @@ public abstract class AbstractFullDistri
}
}
- private CloudSolrServer commondCloudSolrServer;
+ private CloudSolrClient commondCloudSolrClient;
- protected CloudSolrServer getCommonCloudSolrServer() {
+ protected CloudSolrClient getCommonCloudSolrClient() {
synchronized (this) {
- if (commondCloudSolrServer == null) {
- commondCloudSolrServer = new CloudSolrServer(zkServer.getZkAddress(),
+ if (commondCloudSolrClient == null) {
+ commondCloudSolrClient = new CloudSolrClient(zkServer.getZkAddress(),
random().nextBoolean());
- commondCloudSolrServer.getLbServer().setConnectionTimeout(30000);
- commondCloudSolrServer.setParallelUpdates(random().nextBoolean());
- commondCloudSolrServer.setDefaultCollection(DEFAULT_COLLECTION);
- commondCloudSolrServer.connect();
+ commondCloudSolrClient.getLbClient().setConnectionTimeout(30000);
+ commondCloudSolrClient.setParallelUpdates(random().nextBoolean());
+ commondCloudSolrClient.setDefaultCollection(DEFAULT_COLLECTION);
+ commondCloudSolrClient.connect();
}
}
- return commondCloudSolrServer;
+ return commondCloudSolrClient;
}
public static String getUrlFromZk(ClusterState clusterState, String collection) {
@@ -1804,7 +1804,7 @@ public abstract class AbstractFullDistri
throw new RuntimeException("Could not find a live node for collection:" + collection);
}
- public static void waitForNon403or404or503(HttpSolrServer collectionClient)
+ public static void waitForNon403or404or503(HttpSolrClient collectionClient)
throws Exception {
SolrException exp = null;
long timeoutAt = System.currentTimeMillis() + 30000;
@@ -1836,8 +1836,8 @@ public abstract class AbstractFullDistri
long timeoutAt = System.currentTimeMillis() + 45000;
boolean found = true;
while (System.currentTimeMillis() < timeoutAt) {
- getCommonCloudSolrServer().getZkStateReader().updateClusterState(true);
- ClusterState clusterState = getCommonCloudSolrServer().getZkStateReader().getClusterState();
+ getCommonCloudSolrClient().getZkStateReader().updateClusterState(true);
+ ClusterState clusterState = getCommonCloudSolrClient().getZkStateReader().getClusterState();
if (!clusterState.hasCollection(collectionName)) {
found = false;
break;
@@ -1857,23 +1857,23 @@ public abstract class AbstractFullDistri
}
request.setPath("/admin/collections");
- String baseUrl = ((HttpSolrServer) shardToJetty.get(SHARD1).get(0).client.solrClient)
+ String baseUrl = ((HttpSolrClient) shardToJetty.get(SHARD1).get(0).client.solrClient)
.getBaseURL();
baseUrl = baseUrl.substring(0, baseUrl.length() - "collection1".length());
- HttpSolrServer baseServer = new HttpSolrServer(baseUrl);
- baseServer.setConnectionTimeout(15000);
- baseServer.setSoTimeout(60000 * 5);
- NamedList r = baseServer.request(request);
- baseServer.shutdown();
+ HttpSolrClient baseClient = new HttpSolrClient(baseUrl);
+ baseClient.setConnectionTimeout(15000);
+ baseClient.setSoTimeout(60000 * 5);
+ NamedList r = baseClient.request(request);
+ baseClient.shutdown();
return r;
}
protected void createCollection(String collName,
- CloudSolrServer client,
+ CloudSolrClient client,
int replicationFactor ,
int numShards ) throws Exception {
- int maxShardsPerNode = ((((numShards+1) * replicationFactor) / getCommonCloudSolrServer()
+ int maxShardsPerNode = ((((numShards+1) * replicationFactor) / getCommonCloudSolrClient()
.getZkStateReader().getClusterState().getLiveNodes().size())) + 1;
Map<String, Object> props = makeMap(
Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java?rev=1648697&r1=1648696&r2=1648697&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java Wed Dec 31 14:05:48 2014
@@ -18,7 +18,7 @@ package org.apache.solr.cloud;
*/
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.cloud.AbstractFullDistribZkTestBase.CloudJettyRunner;
import org.apache.solr.common.cloud.Slice;
@@ -73,7 +73,7 @@ public class ChaosMonkey {
private AtomicInteger expires = new AtomicInteger();
private AtomicInteger connloss = new AtomicInteger();
- private Map<String,List<SolrServer>> shardToClient;
+ private Map<String,List<SolrClient>> shardToClient;
private boolean expireSessions;
private boolean causeConnectionLoss;
private boolean aggressivelyKillLeaders;
@@ -423,14 +423,14 @@ public class ChaosMonkey {
return numActive;
}
- public SolrServer getRandomClient(String slice) throws KeeperException, InterruptedException {
+ public SolrClient getRandomClient(String slice) throws KeeperException, InterruptedException {
// get latest cloud state
zkStateReader.updateClusterState(true);
// get random shard
- List<SolrServer> clients = shardToClient.get(slice);
+ List<SolrClient> clients = shardToClient.get(slice);
int index = LuceneTestCase.random().nextInt(clients.size() - 1);
- SolrServer client = clients.get(index);
+ SolrClient client = clients.get(index);
return client;
}
Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/CloudInspectUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/CloudInspectUtil.java?rev=1648697&r1=1648696&r2=1648697&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/CloudInspectUtil.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/CloudInspectUtil.java Wed Dec 31 14:05:48 2014
@@ -1,12 +1,7 @@
package org.apache.solr.cloud;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
@@ -14,6 +9,11 @@ import org.apache.solr.common.params.Sol
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -160,9 +160,9 @@ public class CloudInspectUtil {
*
* @return true if the compared results are illegal.
*/
- public static boolean compareResults(SolrServer controlServer, SolrServer cloudServer)
+ public static boolean compareResults(SolrClient controlClient, SolrClient cloudClient)
throws SolrServerException {
- return compareResults(controlServer, cloudServer, null, null);
+ return compareResults(controlClient, cloudClient, null, null);
}
/**
@@ -170,25 +170,25 @@ public class CloudInspectUtil {
*
* @return true if the compared results are illegal.
*/
- public static boolean compareResults(SolrServer controlServer, SolrServer cloudServer, Set<String> addFails, Set<String> deleteFails)
+ public static boolean compareResults(SolrClient controlClient, SolrClient cloudClient, Set<String> addFails, Set<String> deleteFails)
throws SolrServerException {
SolrParams q = SolrTestCaseJ4.params("q","*:*","rows","0", "tests","checkShardConsistency(vsControl)"); // add a tag to aid in debugging via logs
- SolrDocumentList controlDocList = controlServer.query(q).getResults();
+ SolrDocumentList controlDocList = controlClient.query(q).getResults();
long controlDocs = controlDocList.getNumFound();
- SolrDocumentList cloudDocList = cloudServer.query(q).getResults();
+ SolrDocumentList cloudDocList = cloudClient.query(q).getResults();
long cloudClientDocs = cloudDocList.getNumFound();
// re-execute the query getting ids
- q = SolrTestCaseJ4.params("q","*:*","rows","100000", "fl","id", "tests","checkShardConsistency(vsControl)/getIds"); // add a tag to aid in debugging via logs
- controlDocList = controlServer.query(q).getResults();
+ q = SolrTestCaseJ4.params("q", "*:*", "rows", "100000", "fl", "id", "tests", "checkShardConsistency(vsControl)/getIds"); // add a tag to aid in debugging via logs
+ controlDocList = controlClient.query(q).getResults();
if (controlDocs != controlDocList.getNumFound()) {
log.error("Something changed! control now " + controlDocList.getNumFound());
};
- cloudDocList = cloudServer.query(q).getResults();
+ cloudDocList = cloudClient.query(q).getResults();
if (cloudClientDocs != cloudDocList.getNumFound()) {
log.error("Something changed! cloudClient now " + cloudDocList.getNumFound());
};
@@ -220,8 +220,8 @@ public class CloudInspectUtil {
"checkShardConsistency(vsControl)/getVers"); // add a tag to aid in
// debugging via logs
- SolrDocumentList a = controlServer.query(q).getResults();
- SolrDocumentList b = cloudServer.query(q).getResults();
+ SolrDocumentList a = controlClient.query(q).getResults();
+ SolrDocumentList b = cloudClient.query(q).getResults();
log.error("controlClient :" + a + "\n\tcloudClient :" + b);
}
Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/StopableIndexingThread.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/StopableIndexingThread.java?rev=1648697&r1=1648696&r2=1648697&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/StopableIndexingThread.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/StopableIndexingThread.java Wed Dec 31 14:05:48 2014
@@ -6,7 +6,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.common.SolrInputDocument;
@@ -38,16 +38,16 @@ public class StopableIndexingThread exte
protected Set<String> deleteFails = new HashSet<>();
protected boolean doDeletes;
private int numCycles;
- private SolrServer controlClient;
- private SolrServer cloudClient;
+ private SolrClient controlClient;
+ private SolrClient cloudClient;
private int numDeletes;
private int numAdds;
- public StopableIndexingThread(SolrServer controlClient, SolrServer cloudClient, String id, boolean doDeletes) {
+ public StopableIndexingThread(SolrClient controlClient, SolrClient cloudClient, String id, boolean doDeletes) {
this(controlClient, cloudClient, id, doDeletes, -1);
}
- public StopableIndexingThread(SolrServer controlClient, SolrServer cloudClient, String id, boolean doDeletes, int numCycles) {
+ public StopableIndexingThread(SolrClient controlClient, SolrClient cloudClient, String id, boolean doDeletes, int numCycles) {
super("StopableIndexingThread");
this.controlClient = controlClient;
this.cloudClient = cloudClient;