mirror of https://github.com/apache/lucene.git
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:
parent
629e03811f
commit
c838bbfbd1
|
@ -25,13 +25,10 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
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.DirectXmlRequest;
|
||||||
import org.apache.solr.client.solrj.request.LukeRequest;
|
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.request.SolrPing;
|
||||||
import org.apache.solr.client.solrj.response.FieldStatsInfo;
|
import org.apache.solr.client.solrj.response.FieldStatsInfo;
|
||||||
import org.apache.solr.client.solrj.request.UpdateRequest;
|
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() );
|
// System.out.println( rsp.getResults().getNumFound() + " :::: 444: "+ff.getValues() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStreamingRequest() throws Exception {
|
public void testStreamingRequest() throws Exception {
|
||||||
|
@ -576,38 +573,38 @@ abstract public class SolrExampleTests extends SolrJettyTestBase
|
||||||
server.commit();
|
server.commit();
|
||||||
assertNumFound( "*:*", 0 ); // make sure it got in
|
assertNumFound( "*:*", 0 ); // make sure it got in
|
||||||
|
|
||||||
// Add some docs to the index
|
// Add some docs to the index
|
||||||
UpdateRequest req = new UpdateRequest();
|
UpdateRequest req = new UpdateRequest();
|
||||||
for( int i=0; i<10; i++ ) {
|
for( int i=0; i<10; i++ ) {
|
||||||
SolrInputDocument doc = new SolrInputDocument();
|
SolrInputDocument doc = new SolrInputDocument();
|
||||||
doc.addField("id", "" + i );
|
doc.addField("id", "" + i );
|
||||||
doc.addField("cat", "foocat");
|
doc.addField("cat", "foocat");
|
||||||
req.add( doc );
|
req.add( doc );
|
||||||
}
|
}
|
||||||
req.setAction(ACTION.COMMIT, true, true );
|
req.setAction(ACTION.COMMIT, true, true );
|
||||||
req.process( server );
|
req.process( server );
|
||||||
|
|
||||||
// Make sure it ran OK
|
// Make sure it ran OK
|
||||||
SolrQuery query = new SolrQuery("*:*");
|
SolrQuery query = new SolrQuery("*:*");
|
||||||
QueryResponse response = server.query(query);
|
QueryResponse response = server.query(query);
|
||||||
assertEquals(0, response.getStatus());
|
assertEquals(0, response.getStatus());
|
||||||
assertEquals(10, response.getResults().getNumFound());
|
assertEquals(10, response.getResults().getNumFound());
|
||||||
|
|
||||||
// Now make sure each document gets output
|
// Now make sure each document gets output
|
||||||
final AtomicInteger cnt = new AtomicInteger( 0 );
|
final AtomicInteger cnt = new AtomicInteger( 0 );
|
||||||
server.queryAndStreamResponse(query, new StreamingResponseCallback() {
|
server.queryAndStreamResponse(query, new StreamingResponseCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void streamDocListInfo(long numFound, long start, Float maxScore) {
|
public void streamDocListInfo(long numFound, long start, Float maxScore) {
|
||||||
assertEquals(10, numFound );
|
assertEquals(10, numFound );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void streamSolrDocument(SolrDocument doc) {
|
public void streamSolrDocument(SolrDocument doc) {
|
||||||
cnt.incrementAndGet();
|
cnt.incrementAndGet();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
assertEquals(10, cnt.get() );
|
assertEquals(10, cnt.get() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue