SOLR-2970 and SOLR-3281: Fix tests for IBM VM

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1306025 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jan Høydahl 2012-03-27 21:50:41 +00:00
parent fff288f735
commit 4859bd8b30
1 changed files with 13 additions and 3 deletions

View File

@ -26,6 +26,7 @@ import org.apache.solr.search.ReturnFields;
import org.junit.*;
import java.io.StringWriter;
import java.util.Arrays;
public class TestCSVResponseWriter extends SolrTestCaseJ4 {
@BeforeClass
@ -98,9 +99,9 @@ public class TestCSVResponseWriter extends SolrTestCaseJ4 {
assertEquals("1,,hi\n2,\"hi,there\",\n"
, h.query(req("q","id:[1 TO 2]", "wt","csv", "csv.header","false", "fl","id,v_ss,foo_s")));
// test SOLR-2970 not returning non-stored fields by default
assertEquals("id,foo_b,foo_d,foo_s,foo_f,foo_i,foo_dt,foo_l,v_ss,v2_ss\n"
, h.query(req("q","id:3", "wt","csv", "csv.header","true", "fl","*", "rows","0")));
// test SOLR-2970 not returning non-stored fields by default. Compare sorted list
assertEquals(sortHeader("v_ss,foo_b,v2_ss,foo_f,foo_i,foo_d,foo_s,foo_dt,id,foo_l\n")
, sortHeader(h.query(req("q","id:3", "wt","csv", "csv.header","true", "fl","*", "rows","0"))));
// now test SolrDocumentList
@ -166,4 +167,13 @@ public class TestCSVResponseWriter extends SolrTestCaseJ4 {
req.close();
}
/*
* Utility method to sort a comma separated list of strings, for easier comparison regardless of platform
*/
private String sortHeader(String input) {
String[] output = input.trim().split(",");
Arrays.sort(output);
return Arrays.toString(output);
}
}