SOLR-2112: fixing test spacing

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@996703 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2010-09-13 22:08:42 +00:00
parent 629e03811f
commit c838bbfbd1
1 changed files with 33 additions and 36 deletions

View File

@ -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() );
}
}