mirror of https://github.com/apache/lucene.git
tests: close requests (doesn't cause an error)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1023594 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e9b6561bbd
commit
9ec8bc6aee
|
@ -38,6 +38,7 @@ import org.apache.solr.common.params.MultiMapSolrParams;
|
|||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.ContentStream;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -73,14 +74,15 @@ public class SolrRequestParserTest extends SolrTestCaseJ4 {
|
|||
|
||||
// Make sure it got a single stream in and out ok
|
||||
List<ContentStream> streams = new ArrayList<ContentStream>();
|
||||
parser.buildRequestFrom( core, new MultiMapSolrParams( args ), streams );
|
||||
SolrQueryRequest req = parser.buildRequestFrom( core, new MultiMapSolrParams( args ), streams );
|
||||
assertEquals( 1, streams.size() );
|
||||
assertEquals( body1, IOUtils.toString( streams.get(0).getStream() ) );
|
||||
|
||||
req.close();
|
||||
|
||||
// Now add three and make sure they come out ok
|
||||
streams = new ArrayList<ContentStream>();
|
||||
args.put( CommonParams.STREAM_BODY, new String[] {body1,body2,body3} );
|
||||
parser.buildRequestFrom( core, new MultiMapSolrParams( args ), streams );
|
||||
req = parser.buildRequestFrom( core, new MultiMapSolrParams( args ), streams );
|
||||
assertEquals( 3, streams.size() );
|
||||
ArrayList<String> input = new ArrayList<String>();
|
||||
ArrayList<String> output = new ArrayList<String>();
|
||||
|
@ -94,15 +96,17 @@ public class SolrRequestParserTest extends SolrTestCaseJ4 {
|
|||
Collections.sort( input );
|
||||
Collections.sort( output );
|
||||
assertEquals( input.toString(), output.toString() );
|
||||
|
||||
req.close();
|
||||
|
||||
// set the contentType and make sure tat gets set
|
||||
String ctype = "text/xxx";
|
||||
streams = new ArrayList<ContentStream>();
|
||||
args.put( CommonParams.STREAM_CONTENTTYPE, new String[] {ctype} );
|
||||
parser.buildRequestFrom( core, new MultiMapSolrParams( args ), streams );
|
||||
req = parser.buildRequestFrom( core, new MultiMapSolrParams( args ), streams );
|
||||
for( ContentStream s : streams ) {
|
||||
assertEquals( ctype, s.getContentType() );
|
||||
}
|
||||
req.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -130,9 +134,10 @@ public class SolrRequestParserTest extends SolrTestCaseJ4 {
|
|||
|
||||
// Make sure it got a single stream in and out ok
|
||||
List<ContentStream> streams = new ArrayList<ContentStream>();
|
||||
parser.buildRequestFrom( core, new MultiMapSolrParams( args ), streams );
|
||||
SolrQueryRequest req = parser.buildRequestFrom( core, new MultiMapSolrParams( args ), streams );
|
||||
assertEquals( 1, streams.size() );
|
||||
assertEquals( txt, IOUtils.toString( streams.get(0).getStream() ) );
|
||||
req.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue