SOLR-2672, SOLR-2673: Fix a bunch of tests to no longer depend on order

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1150362 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2011-07-24 13:44:04 +00:00
parent e5ac5ed28a
commit 9558bfe674
2 changed files with 15 additions and 8 deletions
solr/core/src/test/org/apache/solr

View File

@ -31,25 +31,32 @@ public class EchoParamsTest extends SolrTestCaseJ4 {
} }
private static final String HEADER_XPATH = "/response/lst[@name='responseHeader']"; private static final String HEADER_XPATH = "/response/lst[@name='responseHeader']";
@Test @Test
public void testDefaultEchoParams() { public void test() {
defaultEchoParams();
defaultEchoParamsDefaultVersion();
explicitEchoParams();
allEchoParams();
}
// the following test methods rely on their order, which is no longer guaranteed by Java 7, so call them directly above:
private void defaultEchoParams() {
lrf.args.put("wt", "xml"); lrf.args.put("wt", "xml");
lrf.args.put(CommonParams.VERSION, "2.2"); lrf.args.put(CommonParams.VERSION, "2.2");
assertQ(req("foo"),HEADER_XPATH + "/int[@name='status']"); assertQ(req("foo"),HEADER_XPATH + "/int[@name='status']");
assertQ(req("foo"),"not(//lst[@name='params'])"); assertQ(req("foo"),"not(//lst[@name='params'])");
} }
@Test private void defaultEchoParamsDefaultVersion() {
public void testDefaultEchoParamsDefaultVersion() {
lrf.args.put("wt", "xml"); lrf.args.put("wt", "xml");
lrf.args.remove(CommonParams.VERSION); lrf.args.remove(CommonParams.VERSION);
assertQ(req("foo"),HEADER_XPATH + "/int[@name='status']"); assertQ(req("foo"),HEADER_XPATH + "/int[@name='status']");
assertQ(req("foo"),"not(//lst[@name='params'])"); assertQ(req("foo"),"not(//lst[@name='params'])");
} }
@Test private void explicitEchoParams() {
public void testExplicitEchoParams() {
lrf.args.put("wt", "xml"); lrf.args.put("wt", "xml");
lrf.args.put(CommonParams.VERSION, "2.2"); lrf.args.put(CommonParams.VERSION, "2.2");
lrf.args.put("echoParams", "explicit"); lrf.args.put("echoParams", "explicit");
@ -58,8 +65,7 @@ public class EchoParamsTest extends SolrTestCaseJ4 {
assertQ(req("foo"),HEADER_XPATH + "/lst[@name='params']/str[@name='wt'][.='xml']"); assertQ(req("foo"),HEADER_XPATH + "/lst[@name='params']/str[@name='wt'][.='xml']");
} }
@Test private void allEchoParams() {
public void testAllEchoParams() {
lrf = h.getRequestFactory lrf = h.getRequestFactory
("crazy_custom_qt", 0, 20, ("crazy_custom_qt", 0, 20,
CommonParams.VERSION,"2.2", CommonParams.VERSION,"2.2",

View File

@ -36,6 +36,7 @@ public class TestFiltering extends SolrTestCaseJ4 {
public void testCaching() throws Exception { public void testCaching() throws Exception {
clearIndex();
assertU(adoc("id","4", "val_i","1")); assertU(adoc("id","4", "val_i","1"));
assertU(adoc("id","1", "val_i","2")); assertU(adoc("id","1", "val_i","2"));
assertU(adoc("id","3", "val_i","3")); assertU(adoc("id","3", "val_i","3"));