You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2010/07/14 00:31:49 UTC

svn commit: r963888 - /lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExceptionTest.java

Author: rmuir
Date: Tue Jul 13 22:31:49 2010
New Revision: 963888

URL: http://svn.apache.org/viewvc?rev=963888&view=rev
Log:
speed up test

Modified:
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExceptionTest.java

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExceptionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExceptionTest.java?rev=963888&r1=963887&r2=963888&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExceptionTest.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExceptionTest.java Tue Jul 13 22:31:49 2010
@@ -21,6 +21,8 @@ import java.net.UnknownHostException;
 
 import junit.framework.TestCase;
 
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.common.SolrException;
@@ -39,7 +41,10 @@ public class SolrExceptionTest extends T
     boolean gotExpectedError = false;
     try {
       // switched to a local address to avoid going out on the net, ns lookup issues, etc.
-      SolrServer client = new CommonsHttpSolrServer("http://localhost:11235/solr/");
+      // set a 1ms timeout to let the connection fail faster.
+      HttpClient httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
+      httpClient.getParams().setParameter("http.connection.timeout", new Integer(1));
+      SolrServer client = new CommonsHttpSolrServer("http://localhost:11235/solr/", httpClient);
       SolrQuery query = new SolrQuery("test123");
       client.query(query);
     } catch (SolrServerException sse) {