Apache Lucene open-source search software
tests: close requests (doesn't cause an error)
Yonik Seeley9ec8bc6aeee5
diff --git a/solr/src/test/org/apache/solr/servlet/SolrRequestParserTest.java b/solr/src/test/org/apache/solr/servlet/SolrRequestParserTest.javaindex ba5ab8b321d..fc237ded58c 100644--- a/solr/src/test/org/apache/solr/servlet/SolrRequestParserTest.java+++ b/solr/src/test/org/apache/solr/servlet/SolrRequestParserTest.java@@ -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 okList<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 okstreams = 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 setString 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 okList<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