diff --git a/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java index 3f177359cf1..4c75a86dc7f 100644 --- a/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java +++ b/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java @@ -25,13 +25,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; - import junit.framework.Assert; -import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer; import org.apache.solr.client.solrj.request.DirectXmlRequest; import org.apache.solr.client.solrj.request.LukeRequest; -import org.apache.solr.client.solrj.request.RequestWriter; import org.apache.solr.client.solrj.request.SolrPing; import org.apache.solr.client.solrj.response.FieldStatsInfo; import org.apache.solr.client.solrj.request.UpdateRequest; @@ -567,7 +564,7 @@ abstract public class SolrExampleTests extends SolrJettyTestBase // System.out.println( rsp.getResults().getNumFound() + " :::: 444: "+ff.getValues() ); } - + @Test public void testStreamingRequest() throws Exception { @@ -576,38 +573,38 @@ abstract public class SolrExampleTests extends SolrJettyTestBase server.commit(); assertNumFound( "*:*", 0 ); // make sure it got in - // Add some docs to the index - UpdateRequest req = new UpdateRequest(); - for( int i=0; i<10; i++ ) { - SolrInputDocument doc = new SolrInputDocument(); - doc.addField("id", "" + i ); - doc.addField("cat", "foocat"); - req.add( doc ); - } - req.setAction(ACTION.COMMIT, true, true ); - req.process( server ); + // Add some docs to the index + UpdateRequest req = new UpdateRequest(); + for( int i=0; i<10; i++ ) { + SolrInputDocument doc = new SolrInputDocument(); + doc.addField("id", "" + i ); + doc.addField("cat", "foocat"); + req.add( doc ); + } + req.setAction(ACTION.COMMIT, true, true ); + req.process( server ); - // Make sure it ran OK - SolrQuery query = new SolrQuery("*:*"); - QueryResponse response = server.query(query); - assertEquals(0, response.getStatus()); - assertEquals(10, response.getResults().getNumFound()); + // Make sure it ran OK + SolrQuery query = new SolrQuery("*:*"); + QueryResponse response = server.query(query); + assertEquals(0, response.getStatus()); + assertEquals(10, response.getResults().getNumFound()); - // Now make sure each document gets output - final AtomicInteger cnt = new AtomicInteger( 0 ); - server.queryAndStreamResponse(query, new StreamingResponseCallback() { - - @Override - public void streamDocListInfo(long numFound, long start, Float maxScore) { - assertEquals(10, numFound ); - } - - @Override - public void streamSolrDocument(SolrDocument doc) { - cnt.incrementAndGet(); - } - - }); - assertEquals(10, cnt.get() ); - } + // Now make sure each document gets output + final AtomicInteger cnt = new AtomicInteger( 0 ); + server.queryAndStreamResponse(query, new StreamingResponseCallback() { + + @Override + public void streamDocListInfo(long numFound, long start, Float maxScore) { + assertEquals(10, numFound ); + } + + @Override + public void streamSolrDocument(SolrDocument doc) { + cnt.incrementAndGet(); + } + + }); + assertEquals(10, cnt.get() ); + } }