fix hangs/fails in test for certain name service configs

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@816264 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2009-09-17 16:28:13 +00:00
parent 1eb4697977
commit c968a41ef6
1 changed files with 4 additions and 1 deletions

View File

@ -38,14 +38,17 @@ public class SolrExceptionTest extends TestCase {
// if the compiler won't let you by without the try/catch // if the compiler won't let you by without the try/catch
boolean gotExpectedError = false; boolean gotExpectedError = false;
try { try {
SolrServer client = new CommonsHttpSolrServer("http://333.333.333.333:8080/solr/"); // switched to a local address to avoid going out on the net, ns lookup issues, etc.
SolrServer client = new CommonsHttpSolrServer("http://localhost:11235/solr/");
SolrQuery query = new SolrQuery("test123"); SolrQuery query = new SolrQuery("test123");
client.query(query); client.query(query);
} catch (SolrServerException sse) { } catch (SolrServerException sse) {
gotExpectedError = true; gotExpectedError = true;
/***
assertTrue(UnknownHostException.class == sse.getRootCause().getClass() assertTrue(UnknownHostException.class == sse.getRootCause().getClass()
//If one is using OpenDNS, then you don't get UnknownHostException, instead you get back that the query couldn't execute //If one is using OpenDNS, then you don't get UnknownHostException, instead you get back that the query couldn't execute
|| (sse.getRootCause().getClass() == SolrException.class && ((SolrException) sse.getRootCause()).code() == 302 && sse.getMessage().equals("Error executing query"))); || (sse.getRootCause().getClass() == SolrException.class && ((SolrException) sse.getRootCause()).code() == 302 && sse.getMessage().equals("Error executing query")));
***/
} }
assertTrue(gotExpectedError); assertTrue(gotExpectedError);
} }