lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1068718 [18/21] - in /lucene/dev/branches/bulkpostings: ./ dev-tools/eclipse/ dev-tools/idea/.idea/ dev-tools/idea/lucene/ dev-tools/maven/ dev-tools/maven/lucene/ dev-tools/maven/lucene/contrib/ant/ dev-tools/maven/lucene/contrib/db/bdb-j...
Date Wed, 09 Feb 2011 01:04:13 GMT
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/ConvertedLegacyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/ConvertedLegacyTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/ConvertedLegacyTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/ConvertedLegacyTest.java Wed Feb  9 01:03:49 2011
@@ -123,9 +123,9 @@ public class ConvertedLegacyTest extends
     // test range
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"val_s\">apple</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"val_s\">banana</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"val_s\">pear</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"val_s\">apple</field><field name=\"val_s1\">apple</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"val_s\">banana</field><field name=\"val_s1\">banana</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"val_s\">pear</field><field name=\"val_s1\">pear</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("val_s:[a TO z]")
             ,"//*[@numFound='3'] "
@@ -228,7 +228,7 @@ public class ConvertedLegacyTest extends
     args = new HashMap<String,String>();
     args.put("version","2.0");
     args.put("defType","lucenePlusSort");
-    req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s asc",
+    req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s1 asc",
                                     "standard", 0, 0 , args);
     assertQ(req
             ,"//*[@numFound='3'] "
@@ -237,7 +237,7 @@ public class ConvertedLegacyTest extends
     args = new HashMap<String,String>();
     args.put("version","2.0");
     args.put("defType","lucenePlusSort");
-    req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s desc",
+    req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s1 desc",
                                     "standard", 0, 0 , args);
     assertQ(req
             ,"//*[@numFound='3'] "
@@ -509,133 +509,133 @@ public class ConvertedLegacyTest extends
     // test integer ranges and sorting
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i\">1234567890</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i\">10</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i\">1</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i\">2</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i\">15</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i\">-1</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i\">-987654321</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i\">2147483647</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i\">-2147483648</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i\">0</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i1\">1234567890</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i1\">10</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i1\">1</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i1\">2</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i1\">15</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i1\">-1</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i1\">-987654321</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i1\">2147483647</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i1\">-2147483648</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_i1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id:44")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_i:2147483647")
+    assertQ(req("num_i1:2147483647")
             ,"//@numFound[.='1']  "
             ,"//int[.='2147483647']"
             );
-    assertQ(req("num_i:\"-2147483648\"")
+    assertQ(req("num_i1:\"-2147483648\"")
             ,"//@numFound[.='1'] "
             ,"//int[.='-2147483648']"
             );
-    assertQ(req("id:44;num_i asc;")
+    assertQ(req("id:44;num_i1 asc;")
             ,"//doc[1]/int[.='-2147483648'] "
             ,"//doc[last()]/int[.='2147483647']"
             );
-    assertQ(req("id:44;num_i desc;")
+    assertQ(req("id:44;num_i1 desc;")
             ,"//doc[1]/int[.='2147483647'] "
             ,"//doc[last()]/int[.='-2147483648']"
             );
-    assertQ(req("num_i:[0 TO 9]")
+    assertQ(req("num_i1:[0 TO 9]")
             ,"*[count(//doc)=3]"
             );
-    assertQ(req("num_i:[-2147483648 TO 2147483647]")
+    assertQ(req("num_i1:[-2147483648 TO 2147483647]")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_i:[-10 TO -1]")
+    assertQ(req("num_i1:[-10 TO -1]")
             ,"*[count(//doc)=1]"
             );
 
     // test long ranges and sorting
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l\">1234567890</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l\">10</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l\">1</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l\">2</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l\">15</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l\">-1</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l\">-987654321</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l\">9223372036854775807</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l\">-9223372036854775808</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l\">0</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l1\">1234567890</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l1\">10</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l1\">1</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l1\">2</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l1\">15</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l1\">-1</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l1\">-987654321</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l1\">9223372036854775807</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l1\">-9223372036854775808</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_l1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id:44")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_l:9223372036854775807")
+    assertQ(req("num_l1:9223372036854775807")
             ,"//@numFound[.='1'] "
             ,"//long[.='9223372036854775807']"
             );
-    assertQ(req("num_l:\"-9223372036854775808\"")
+    assertQ(req("num_l1:\"-9223372036854775808\"")
             ,"//@numFound[.='1'] "
             ,"//long[.='-9223372036854775808']"
             );
-    assertQ(req("id:44;num_l asc;")
+    assertQ(req("id:44;num_l1 asc;")
             ,"//doc[1]/long[.='-9223372036854775808'] "
             ,"//doc[last()]/long[.='9223372036854775807']"
             );
-    assertQ(req("id:44;num_l desc;")
+    assertQ(req("id:44;num_l1 desc;")
             ,"//doc[1]/long[.='9223372036854775807'] "
             ,"//doc[last()]/long[.='-9223372036854775808']"
             );
-    assertQ(req("num_l:[-1 TO 9]")
+    assertQ(req("num_l1:[-1 TO 9]")
             ,"*[count(//doc)=4]"
             );
-    assertQ(req("num_l:[-9223372036854775808 TO 9223372036854775807]")
+    assertQ(req("num_l1:[-9223372036854775808 TO 9223372036854775807]")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_l:[-10 TO -1]")
+    assertQ(req("num_l1:[-10 TO -1]")
             ,"*[count(//doc)=1]"
             );
 
     // test binary float ranges and sorting
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf\">1.4142135</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf\">Infinity</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf\">-Infinity</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf\">NaN</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf\">2</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf\">-1</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf\">-987654321</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf\">-999999.99</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf\">-1e20</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf\">0</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">1.4142135</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">Infinity</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">-Infinity</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">NaN</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">2</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">-1</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">-987654321</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">-999999.99</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">-1e20</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id:44")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_sf:Infinity")
+    assertQ(req("num_sf1:Infinity")
             ,"//@numFound[.='1']  "
             ,"//float[.='Infinity']"
             );
-    assertQ(req("num_sf:\"-Infinity\"")
+    assertQ(req("num_sf1:\"-Infinity\"")
             ,"//@numFound[.='1']  "
             ,"//float[.='-Infinity']"
             );
-    assertQ(req("num_sf:\"NaN\"")
+    assertQ(req("num_sf1:\"NaN\"")
             ,"//@numFound[.='1']  "
             ,"//float[.='NaN']"
             );
-    assertQ(req("num_sf:\"-1e20\"")
+    assertQ(req("num_sf1:\"-1e20\"")
             ,"//@numFound[.='1']"
             );
-    assertQ(req("id:44;num_sf asc;")
+    assertQ(req("id:44;num_sf1 asc;")
             ,"//doc[1]/float[.='-Infinity'] "
             ,"//doc[last()]/float[.='NaN']"
             );
-    assertQ(req("id:44;num_sf desc;")
+    assertQ(req("id:44;num_sf1 desc;")
             ,"//doc[1]/float[.='NaN'] "
             ,"//doc[last()]/float[.='-Infinity']"
             );
-    assertQ(req("num_sf:[-1 TO 2]")
+    assertQ(req("num_sf1:[-1 TO 2]")
             ,"*[count(//doc)=4]"
             );
-    assertQ(req("num_sf:[-Infinity TO Infinity]")
+    assertQ(req("num_sf1:[-Infinity TO Infinity]")
             ,"*[count(//doc)=9]"
             );
 
@@ -644,50 +644,50 @@ public class ConvertedLegacyTest extends
     // test binary double ranges and sorting
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd\">1.4142135</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd\">Infinity</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd\">-Infinity</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd\">NaN</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd\">2</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd\">-1</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd\">1e-100</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd\">-999999.99</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd\">-1e100</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd\">0</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">1.4142135</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">Infinity</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">-Infinity</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">NaN</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">2</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">-1</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">1e-100</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">-999999.99</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">-1e100</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id:44")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_sd:Infinity")
+    assertQ(req("num_sd1:Infinity")
             ,"//@numFound[.='1']  "
             ,"//double[.='Infinity']"
             );
-    assertQ(req("num_sd:\"-Infinity\"")
+    assertQ(req("num_sd1:\"-Infinity\"")
             ,"//@numFound[.='1']  "
             ,"//double[.='-Infinity']"
             );
-    assertQ(req("num_sd:\"NaN\"")
+    assertQ(req("num_sd1:\"NaN\"")
             ,"//@numFound[.='1']  "
             ,"//double[.='NaN']"
             );
-    assertQ(req("num_sd:\"-1e100\"")
+    assertQ(req("num_sd1:\"-1e100\"")
             ,"//@numFound[.='1']"
             );
-    assertQ(req("num_sd:\"1e-100\"")
+    assertQ(req("num_sd1:\"1e-100\"")
             ,"//@numFound[.='1']"
             );
-    assertQ(req("id:44;num_sd asc;")
+    assertQ(req("id:44;num_sd1 asc;")
             ,"//doc[1]/double[.='-Infinity'] "
             ,"//doc[last()]/double[.='NaN']"
             );
-    assertQ(req("id:44;num_sd desc;")
+    assertQ(req("id:44;num_sd1 desc;")
             ,"//doc[1]/double[.='NaN'] "
             ,"//doc[last()]/double[.='-Infinity']"
             );
-    assertQ(req("num_sd:[-1 TO 2]")
+    assertQ(req("num_sd1:[-1 TO 2]")
             ,"*[count(//doc)=5]"
             );
-    assertQ(req("num_sd:[-Infinity TO Infinity]")
+    assertQ(req("num_sd1:[-Infinity TO Infinity]")
             ,"*[count(//doc)=9]"
             );
 
@@ -695,38 +695,38 @@ public class ConvertedLegacyTest extends
     // test sorting on multiple fields
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i\">10</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i\">1</field><field name=\"b_i\">100</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i\">-1</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i\">15</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i\">1</field><field name=\"b_i\">50</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i\">0</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i1\">10</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i1\">1</field><field name=\"b_i1\">100</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i1\">-1</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i1\">15</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i1\">1</field><field name=\"b_i1\">50</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id\">44</field><field name=\"a_i1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id:44")
             ,"*[count(//doc)=6]"
             );
 
-    assertQ(req("id:44; a_i asc,b_i desc")
+    assertQ(req("id:44; a_i1 asc,b_i1 desc")
             ,"*[count(//doc)=6] "
             ,"//doc[3]/int[.='100'] "
             ,"//doc[4]/int[.='50']"
             );
-    assertQ(req("id:44;a_i asc  , b_i asc;")
+    assertQ(req("id:44;a_i1 asc  , b_i1 asc;")
             ,"*[count(//doc)=6] "
             ,"//doc[3]/int[.='50'] "
             ,"//doc[4]/int[.='100']"
             );
-    assertQ(req("id:44;a_i asc;")
+    assertQ(req("id:44;a_i1 asc;")
             ,"*[count(//doc)=6] "
             ,"//doc[1]/int[.='-1'] "
             ,"//doc[last()]/int[.='15']"
             );
-    assertQ(req("id:44;a_i asc , score top;")
+    assertQ(req("id:44;a_i1 asc , score top;")
             ,"*[count(//doc)=6] "
             ,"//doc[1]/int[.='-1'] "
             ,"//doc[last()]/int[.='15']"
             );
-    assertQ(req("id:44; score top , a_i top, b_i bottom ;")
+    assertQ(req("id:44; score top , a_i1 top, b_i1 bottom ;")
             ,"*[count(//doc)=6] "
             ,"//doc[last()]/int[.='-1'] "
             ,"//doc[1]/int[.='15'] "
@@ -738,13 +738,13 @@ public class ConvertedLegacyTest extends
     // test sorting  with some docs missing the sort field
 
     assertU("<delete><query>id_i:[1000 TO 1010]</query></delete>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1000</field><field name=\"a_i\">1</field><field name=\"nullfirst\">Z</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1001</field><field name=\"a_i\">10</field><field name=\"nullfirst\">A</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1002</field><field name=\"a_i\">1</field><field name=\"b_si\">100</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1003</field><field name=\"a_i\">-1</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1004</field><field name=\"a_i\">15</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1005</field><field name=\"a_i\">1</field><field name=\"b_si\">50</field></doc></add>");
-    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1006</field><field name=\"a_i\">0</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1000</field><field name=\"a_i1\">1</field><field name=\"nullfirst\">Z</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1001</field><field name=\"a_i1\">10</field><field name=\"nullfirst\">A</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1002</field><field name=\"a_i1\">1</field><field name=\"b_si\">100</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1003</field><field name=\"a_i1\">-1</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1004</field><field name=\"a_i1\">15</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1005</field><field name=\"a_i1\">1</field><field name=\"b_si\">50</field></doc></add>");
+    assertU("<add overwrite=\"false\"><doc><field name=\"id_i\">1006</field><field name=\"a_i1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id_i:[1000 TO 1010]")
             ,"*[count(//doc)=7]"
@@ -759,13 +759,13 @@ public class ConvertedLegacyTest extends
             ,"//doc[1]/int[.='100'] "
             ,"//doc[2]/int[.='50']"
             );
-    assertQ(req("id_i:[1000 TO 1010]; a_i asc,b_si desc")
+    assertQ(req("id_i:[1000 TO 1010]; a_i1 asc,b_si desc")
             ,"*[count(//doc)=7] "
             ,"//doc[3]/int[.='100'] "
             ,"//doc[4]/int[.='50']  "
             ,"//doc[5]/int[.='1000']"
             );
-    assertQ(req("id_i:[1000 TO 1010]; a_i asc,b_si asc")
+    assertQ(req("id_i:[1000 TO 1010]; a_i1 asc,b_si asc")
             ,"*[count(//doc)=7] "
             ,"//doc[3]/int[.='50'] "
             ,"//doc[4]/int[.='100']  "

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/JSONTestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/JSONTestUtil.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/JSONTestUtil.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/JSONTestUtil.java Wed Feb  9 01:03:49 2011
@@ -135,14 +135,16 @@ class CollectionTester {
     if (!expected.equals(val)) {
 
       // make an exception for some numerics
-      if (expected instanceof Integer && val instanceof Long || expected instanceof Long && val instanceof Integer
+      if ((expected instanceof Integer && val instanceof Long || expected instanceof Long && val instanceof Integer)
           && ((Number)expected).longValue() == ((Number)val).longValue())
       {
-        // OK
-      } else if (expected instanceof Float && val instanceof Double || expected instanceof Double && val instanceof Float
-          && ((Number)expected).doubleValue() == ((Number)val).doubleValue())
-      {
-        // OK
+        return true;
+      } else if ((expected instanceof Float && val instanceof Double || expected instanceof Double && val instanceof Float)) {
+        double a = ((Number)expected).doubleValue();
+        double b = ((Number)val).doubleValue();
+        if (Double.compare(a,b) == 0) return true;
+        if (Math.abs(a-b) < 1e-5) return true;
+        return false;
       } else {
         setErr("mismatch: '" + expected + "'!='" + val + "'");
         return false;

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/SolrTestCaseJ4.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/SolrTestCaseJ4.java Wed Feb  9 01:03:49 2011
@@ -22,6 +22,7 @@ package org.apache.solr;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.noggit.CharArr;
 import org.apache.noggit.JSONUtil;
+import org.apache.noggit.ObjectBuilder;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.SolrInputField;
@@ -602,6 +603,7 @@ public abstract class SolrTestCaseJ4 ext
   /** Neccessary to make method signatures un-ambiguous */
   public static class XmlDoc {
     public String xml;
+    @Override
     public String toString() { return xml; }
   }
 
@@ -727,6 +729,7 @@ public abstract class SolrTestCaseJ4 ext
     public int order; // the order this document was added to the index
 
 
+    @Override
     public String toString() {
       return "Doc("+order+"):"+fields.toString();
     }
@@ -780,6 +783,7 @@ public abstract class SolrTestCaseJ4 ext
   public static class Fld {
     public FldType ftype;
     public List<Comparable> vals;
+    @Override
     public String toString() {
       return ftype.fname + "=" + (vals.size()==1 ? vals.get(0).toString() : vals.toString());
     }
@@ -834,17 +838,9 @@ public abstract class SolrTestCaseJ4 ext
     // commit an average of 10 times for large sets, or 10% of the time for small sets
     int commitOneOutOf = Math.max(nDocs/10, 10);
 
-
-    // find the max order (docid) and start from there
-    int order = -1;
-    for (Doc doc : model.values()) {
-      order = Math.max(order, doc.order);
-    }
-    order++;
-
     for (int i=0; i<nDocs; i++) {
       Doc doc = createDoc(descriptor);
-      doc.order = order++;
+      // doc.order = order++;
       updateJ(toJSON(doc), null);
       model.put(doc.id, doc);
 
@@ -867,6 +863,25 @@ public abstract class SolrTestCaseJ4 ext
       assertU(commit());
     }
 
+    // merging segments no longer selects just adjacent segments hence ids (doc.order) can be shuffled.
+    // we need to look at the index to determine the order.
+    String responseStr = h.query(req("q","*:*", "fl","id", "sort","_docid_ asc", "rows",Integer.toString(model.size()*2), "wt","json", "indent","true"));
+    Object response = ObjectBuilder.fromJSON(responseStr);
+
+    response = ((Map)response).get("response");
+    response = ((Map)response).get("docs");
+    List<Map> docList = (List<Map>)response;
+    int order = 0;
+    for (Map doc : docList) {
+      Object id = doc.get("id");
+      Doc modelDoc = model.get(id);
+      if (modelDoc == null) continue;  // may be some docs in the index that aren't modeled
+      modelDoc.order = order++;
+    }
+
+    // make sure we updated the order of all docs in the model
+    assertEquals(order, model.size());
+
     return model;
   }
 
@@ -1058,4 +1073,12 @@ public abstract class SolrTestCaseJ4 ext
     }
     return new File(base, "solr/").getAbsolutePath();
   }
+
+  public static Throwable getRootCause(Throwable t) {
+    Throwable result = t;
+    for (Throwable cause = t; null != cause; cause = cause.getCause()) {
+      result = cause;
+    }
+    return result;
+  }
 }

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestDistributedSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestDistributedSearch.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestDistributedSearch.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestDistributedSearch.java Wed Feb  9 01:03:49 2011
@@ -38,7 +38,7 @@ public class TestDistributedSearch exten
   String ndouble = "n_d";
   String tdouble = "n_td";
   String nlong = "n_l";
-  String tlong = "n_tl";
+  String tlong = "other_tl1";
   String ndate = "n_dt";
   String tdate = "n_tdt";
   
@@ -98,8 +98,8 @@ public class TestDistributedSearch exten
     query("q","*:*", "sort","{!func}add("+i1+",5)"+" desc");
     query("q","*:*", "sort",i1+" asc");
     query("q","*:*", "sort",i1+" desc", "fl","*,score");
-    query("q","*:*", "sort",tlong+" asc", "fl","score");  // test legacy behavior - "score"=="*,score"
-    query("q","*:*", "sort",tlong+" desc");
+    query("q","*:*", "sort","n_tl1 asc", "fl","score");  // test legacy behavior - "score"=="*,score"
+    query("q","*:*", "sort","n_tl1 desc");
     handle.put("maxScore", SKIPVAL);
     query("q","{!func}"+i1);// does not expect maxScore. So if it comes ,ignore it. JavaBinCodec.writeSolrDocumentList()
     //is agnostic of request params.

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestGroupingSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestGroupingSearch.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestGroupingSearch.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestGroupingSearch.java Wed Feb  9 01:03:49 2011
@@ -30,6 +30,10 @@ import java.util.*;
 
 public class TestGroupingSearch extends SolrTestCaseJ4 {
 
+  public static final String FOO_STRING_FIELD = "foo_s1";
+  public static final String SMALL_STRING_FIELD = "small_s1";
+  public static final String SMALL_INT_FIELD = "small_i";
+
   @BeforeClass
   public static void beforeTests() throws Exception {
     initCore("solrconfig.xml","schema12.xml");
@@ -376,9 +380,9 @@ public class TestGroupingSearch extends 
       types.add(new FldType("id",ONE_ONE, new SVal('A','Z',4,4)));
       types.add(new FldType("score_f",ONE_ONE, new FVal(1,100)));  // field used to score
       types.add(new FldType("foo_i",ZERO_ONE, new IRange(0,indexSize)));
-      types.add(new FldType("foo_s",ZERO_ONE, new SVal('a','z',1,2)));
-      types.add(new FldType("small_s",ZERO_ONE, new SVal('a',(char)('c'+indexSize/10),1,1)));
-      types.add(new FldType("small_i",ZERO_ONE, new IRange(0,5+indexSize/10)));
+      types.add(new FldType(FOO_STRING_FIELD,ZERO_ONE, new SVal('a','z',1,2)));
+      types.add(new FldType(SMALL_STRING_FIELD,ZERO_ONE, new SVal('a',(char)('c'+indexSize/10),1,1)));
+      types.add(new FldType(SMALL_INT_FIELD,ZERO_ONE, new IRange(0,5+indexSize/10)));
 
       clearIndex();
       Map<Comparable, Doc> model = indexDocs(types, null, indexSize);
@@ -389,36 +393,36 @@ public class TestGroupingSearch extends 
         clearIndex();
         model.clear();
         Doc d1 = createDoc(types);
-        d1.getValues("small_s").set(0,"c");
-        d1.getValues("small_i").set(0,5);
+        d1.getValues(SMALL_STRING_FIELD).set(0,"c");
+        d1.getValues(SMALL_INT_FIELD).set(0,5);
         d1.order = 0;
         updateJ(toJSON(d1), params("commit","true"));
         model.put(d1.id, d1);
 
         d1 = createDoc(types);
-        d1.getValues("small_s").set(0,"b");
-        d1.getValues("small_i").set(0,5);
+        d1.getValues(SMALL_STRING_FIELD).set(0,"b");
+        d1.getValues(SMALL_INT_FIELD).set(0,5);
         d1.order = 1;
         updateJ(toJSON(d1), params("commit","false"));
         model.put(d1.id, d1);
 
         d1 = createDoc(types);
-        d1.getValues("small_s").set(0,"c");
-        d1.getValues("small_i").set(0,5);
+        d1.getValues(SMALL_STRING_FIELD).set(0,"c");
+        d1.getValues(SMALL_INT_FIELD).set(0,5);
         d1.order = 2;
         updateJ(toJSON(d1), params("commit","false"));
         model.put(d1.id, d1);
 
         d1 = createDoc(types);
-        d1.getValues("small_s").set(0,"c");
-        d1.getValues("small_i").set(0,5);
+        d1.getValues(SMALL_STRING_FIELD).set(0,"c");
+        d1.getValues(SMALL_INT_FIELD).set(0,5);
         d1.order = 3;
         updateJ(toJSON(d1), params("commit","false"));
         model.put(d1.id, d1);
 
         d1 = createDoc(types);
-        d1.getValues("small_s").set(0,"b");
-        d1.getValues("small_i").set(0,2);
+        d1.getValues(SMALL_STRING_FIELD).set(0,"b");
+        d1.getValues(SMALL_INT_FIELD).set(0,2);
         d1.order = 4;
         updateJ(toJSON(d1), params("commit","true"));
         model.put(d1.id, d1);
@@ -447,11 +451,11 @@ public class TestGroupingSearch extends 
         
          // Test specific case
         if (false) {
-          groupField="small_i";
-          sortComparator=createComparator(Arrays.asList(createComparator("small_s", true, true, false, true)));
-          sortStr = "small_s asc";
-          groupComparator = createComparator(Arrays.asList(createComparator("small_s", true, true, false, false)));
-          groupSortStr = "small_s asc";
+          groupField=SMALL_INT_FIELD;
+          sortComparator=createComparator(Arrays.asList(createComparator(SMALL_STRING_FIELD, true, true, false, true)));
+          sortStr = SMALL_STRING_FIELD + " asc";
+          groupComparator = createComparator(Arrays.asList(createComparator(SMALL_STRING_FIELD, true, true, false, false)));
+          groupSortStr = SMALL_STRING_FIELD + " asc";
           rows=1; start=0; group_offset=1; group_limit=1;
         }
 
@@ -526,8 +530,7 @@ public class TestGroupingSearch extends 
       Map<String,Object> resultSet = new LinkedHashMap<String,Object>();
       group.put("doclist", resultSet);
       resultSet.put("numFound", grp.docs.size());
-      resultSet.put("start", start);
-
+      resultSet.put("start", group_offset);
       List docs = new ArrayList();
       resultSet.put("docs", docs);
       for (int j=group_offset; j<grp.docs.size(); j++) {

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestPluginEnable.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestPluginEnable.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestPluginEnable.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestPluginEnable.java Wed Feb  9 01:03:49 2011
@@ -1,5 +1,22 @@
 package org.apache.solr;
 
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import org.apache.solr.client.solrj.SolrServerException;
 import org.junit.BeforeClass;
 import org.junit.Test;

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestTrie.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestTrie.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestTrie.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/TestTrie.java Wed Feb  9 01:03:49 2011
@@ -41,6 +41,7 @@ public class TestTrie extends SolrTestCa
     initCore("solrconfig.xml","schema-trie.xml");
   }
   
+  @Override
   @After
   public void tearDown() throws Exception {
     clearIndex();

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/LengthFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/LengthFilterTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/LengthFilterTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/LengthFilterTest.java Wed Feb  9 01:03:49 2011
@@ -31,9 +31,19 @@ public class LengthFilterTest extends Ba
     Map<String, String> args = new HashMap<String, String>();
     args.put(LengthFilterFactory.MIN_KEY, String.valueOf(4));
     args.put(LengthFilterFactory.MAX_KEY, String.valueOf(10));
+    // default: args.put("enablePositionIncrements", "false");
     factory.init(args);
     String test = "foo foobar super-duper-trooper";
     TokenStream stream = factory.create(new WhitespaceTokenizer(DEFAULT_VERSION, new StringReader(test)));
-    assertTokenStreamContents(stream, new String[] { "foobar" });
+    assertTokenStreamContents(stream, new String[] { "foobar" }, new int[] { 1 });
+
+    factory = new LengthFilterFactory();
+    args = new HashMap<String, String>();
+    args.put(LengthFilterFactory.MIN_KEY, String.valueOf(4));
+    args.put(LengthFilterFactory.MAX_KEY, String.valueOf(10));
+    args.put("enablePositionIncrements", "true");
+    factory.init(args);
+    stream = factory.create(new WhitespaceTokenizer(DEFAULT_VERSION, new StringReader(test)));
+    assertTokenStreamContents(stream, new String[] { "foobar" }, new int[] { 2 });
   }
 }
\ No newline at end of file

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java Wed Feb  9 01:03:49 2011
@@ -1,3 +1,20 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.solr.analysis;
 
 import org.apache.lucene.analysis.core.WhitespaceTokenizer;

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestRemoveDuplicatesTokenFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestRemoveDuplicatesTokenFilterFactory.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestRemoveDuplicatesTokenFilterFactory.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestRemoveDuplicatesTokenFilterFactory.java Wed Feb  9 01:03:49 2011
@@ -48,6 +48,7 @@ public class TestRemoveDuplicatesTokenFi
           CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
           OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);
           PositionIncrementAttribute posIncAtt = addAttribute(PositionIncrementAttribute.class);
+          @Override
           public boolean incrementToken() {
             if (toks.hasNext()) {
               clearAttributes();

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java Wed Feb  9 01:03:49 2011
@@ -52,6 +52,7 @@ public class TestReversedWildcardFilterF
     initCore("solrconfig.xml","schema-reversed.xml");
   }
   
+  @Override
   @Before
   public void setUp() throws Exception {
     super.setUp();

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java Wed Feb  9 01:03:49 2011
@@ -30,6 +30,7 @@ import org.apache.solr.util.AbstractSolr
  */
 abstract public class SolrExampleTestBase extends AbstractSolrTestCase 
 {
+  @Override
   public String getSolrHome() { return "../../../example/solr/"; }
   
   @Override public String getSchemaFile()     { return getSolrHome()+"conf/schema.xml";     }

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java Wed Feb  9 01:03:49 2011
@@ -576,17 +576,17 @@ abstract public class SolrExampleTests e
     
     int id = 1;
     ArrayList<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
-    docs.add( makeTestDoc( "id", id++, "features", "AAA",  "cat", "a", "inStock", true  ) );
-    docs.add( makeTestDoc( "id", id++, "features", "AAA",  "cat", "a", "inStock", false ) );
-    docs.add( makeTestDoc( "id", id++, "features", "AAA",  "cat", "a", "inStock", true ) );
-    docs.add( makeTestDoc( "id", id++, "features", "AAA",  "cat", "b", "inStock", false ) );
-    docs.add( makeTestDoc( "id", id++, "features", "AAA",  "cat", "b", "inStock", true ) );
-    docs.add( makeTestDoc( "id", id++, "features", "BBB",  "cat", "a", "inStock", false ) );
-    docs.add( makeTestDoc( "id", id++, "features", "BBB",  "cat", "a", "inStock", true ) );
-    docs.add( makeTestDoc( "id", id++, "features", "BBB",  "cat", "b", "inStock", false ) );
-    docs.add( makeTestDoc( "id", id++, "features", "BBB",  "cat", "b", "inStock", true ) );
-    docs.add( makeTestDoc( "id", id++, "features", "BBB",  "cat", "b", "inStock", false ) );
-    docs.add( makeTestDoc( "id", id++, "features", "BBB",  "cat", "b", "inStock", true ) );
+    docs.add( makeTestDoc( "id", id++, "features", "aaa",  "cat", "a", "inStock", true  ) );
+    docs.add( makeTestDoc( "id", id++, "features", "aaa",  "cat", "a", "inStock", false ) );
+    docs.add( makeTestDoc( "id", id++, "features", "aaa",  "cat", "a", "inStock", true ) );
+    docs.add( makeTestDoc( "id", id++, "features", "aaa",  "cat", "b", "inStock", false ) );
+    docs.add( makeTestDoc( "id", id++, "features", "aaa",  "cat", "b", "inStock", true ) );
+    docs.add( makeTestDoc( "id", id++, "features", "bbb",  "cat", "a", "inStock", false ) );
+    docs.add( makeTestDoc( "id", id++, "features", "bbb",  "cat", "a", "inStock", true ) );
+    docs.add( makeTestDoc( "id", id++, "features", "bbb",  "cat", "b", "inStock", false ) );
+    docs.add( makeTestDoc( "id", id++, "features", "bbb",  "cat", "b", "inStock", true ) );
+    docs.add( makeTestDoc( "id", id++, "features", "bbb",  "cat", "b", "inStock", false ) );
+    docs.add( makeTestDoc( "id", id++, "features", "bbb",  "cat", "b", "inStock", true ) );
     docs.add( makeTestDoc( "id", id++ ) ); // something not matching
     server.add( docs );
     server.commit();
@@ -610,7 +610,14 @@ abstract public class SolrExampleTests e
 //      System.out.println();
 //    }
     
-    // Now make sure they have reasonable stuff
+    //  PIVOT: features,cat
+    //  features=bbb (6)
+    //    cat=b (4)
+    //    cat=a (2)
+    //  features=aaa (5)
+    //    cat=a (3)
+    //    cat=b (2)
+    
     List<PivotField> pivot = pivots.getVal( 0 );
     assertEquals( "features,cat", pivots.getName( 0 ) );
     assertEquals( 2, pivot.size() );
@@ -627,6 +634,15 @@ abstract public class SolrExampleTests e
     assertEquals( "a", counts.get(1).getValue() );
     assertEquals(   2, counts.get(1).getCount() );
     
+
+    //  PIVOT: cat,features
+    //  cat=b (6)
+    //    features=bbb (4)
+    //    features=aaa (2)
+    //  cat=a (5)
+    //    features=aaa (3)
+    //    features=bbb (2)
+    
     ff = pivot.get( 1 );
     assertEquals( "features", ff.getField() );
     assertEquals( "aaa", ff.getValue() );
@@ -638,16 +654,32 @@ abstract public class SolrExampleTests e
     assertEquals( "b", counts.get(1).getValue() );
     assertEquals(   2, counts.get(1).getCount() );
     
-    // 3 deep 
+    // Three deep:
+    //  PIVOT: features,cat,inStock
+    //  features=bbb (6)
+    //    cat=b (4)
+    //      inStock=false (2)
+    //      inStock=true (2)
+    //    cat=a (2)
+    //      inStock=false (1)
+    //      inStock=true (1)
+    //  features=aaa (5)
+    //    cat=a (3)
+    //      inStock=true (2)
+    //      inStock=false (1)
+    //    cat=b (2)
+    //      inStock=false (1)
+    //      inStock=true (1)
+    
     pivot = pivots.getVal( 2 );
     assertEquals( "features,cat,inStock", pivots.getName( 2 ) );
     assertEquals( 2, pivot.size() );
-    PivotField p = pivot.get( 1 ).getPivot().get(0);
+    PivotField p = pivot.get( 1 ).getPivot().get(0);     // get(1) should be features=AAAA, then get(0) should be cat=a
     assertEquals( "cat", p.getField() );
     assertEquals( "a", p.getValue() );
     counts = p.getPivot();
   //  p.write(System.out, 5 );
-    assertEquals( 1, counts.size() );
+    assertEquals( 2, counts.size() );  // 2 trues and 1 false under features=AAAA,cat=a
     assertEquals( "inStock",    counts.get(0).getField() );
     assertEquals( Boolean.TRUE, counts.get(0).getValue() );
     assertEquals(  2,           counts.get(0).getCount() );

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java Wed Feb  9 01:03:49 2011
@@ -1,5 +1,22 @@
 package org.apache.solr.client.solrj;
 
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import java.io.File;
 import java.io.IOException;
 

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java Wed Feb  9 01:03:49 2011
@@ -48,6 +48,7 @@ public class TestLBHttpSolrServer extend
   SolrInstance[] solr = new SolrInstance[3];
   HttpClient httpClient;
 
+  @Override
   public void setUp() throws Exception {
     super.setUp();
     httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java Wed Feb  9 01:03:49 2011
@@ -86,23 +86,23 @@ public class JettyWebappTest extends Luc
     // sure they compile ok
     
     String adminPath = "http://localhost:"+port+context+"/";
-    String html = IOUtils.toString( new URL(adminPath).openStream() );
-    assertNotNull( html ); // real error will be an exception
+    byte[] bytes = IOUtils.toByteArray( new URL(adminPath).openStream() );
+    assertNotNull( bytes ); // real error will be an exception
 
     adminPath += "admin/";
-    html = IOUtils.toString( new URL(adminPath).openStream() );
-    assertNotNull( html ); // real error will be an exception
+    bytes = IOUtils.toByteArray( new URL(adminPath).openStream() );
+    assertNotNull( bytes ); // real error will be an exception
 
     // analysis
-    html = IOUtils.toString( new URL(adminPath+"analysis.jsp").openStream() );
-    assertNotNull( html ); // real error will be an exception
+    bytes = IOUtils.toByteArray( new URL(adminPath+"analysis.jsp").openStream() );
+    assertNotNull( bytes ); // real error will be an exception
 
     // schema browser
-    html = IOUtils.toString( new URL(adminPath+"schema.jsp").openStream() );
-    assertNotNull( html ); // real error will be an exception
+    bytes = IOUtils.toByteArray( new URL(adminPath+"schema.jsp").openStream() );
+    assertNotNull( bytes ); // real error will be an exception
 
     // schema browser
-    html = IOUtils.toString( new URL(adminPath+"threaddump.jsp").openStream() );
-    assertNotNull( html ); // real error will be an exception
+    bytes = IOUtils.toByteArray( new URL(adminPath+"threaddump.jsp").openStream() );
+    assertNotNull( bytes ); // real error will be an exception
   }
 }

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java Wed Feb  9 01:03:49 2011
@@ -66,6 +66,7 @@ public class TestSolrProperties extends 
     return "solr.xml";
   }
 
+  @Override
   @Before
   public void setUp() throws Exception {
     super.setUp();
@@ -77,6 +78,7 @@ public class TestSolrProperties extends 
     cores = new CoreContainer(home.getAbsolutePath(), solrXml);
   }
 
+  @Override
   @After
   public void tearDown() throws Exception {
     if (cores != null)

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java Wed Feb  9 01:03:49 2011
@@ -1,92 +1,93 @@
-package org.apache.solr.cloud;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.File;
-
-import org.apache.solr.BaseDistributedSearchTestCase;
-import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.common.cloud.SolrZkClient;
-import org.apache.solr.core.SolrConfig;
-import org.junit.Before;
-
-public abstract class AbstractDistributedZkTestCase extends BaseDistributedSearchTestCase {
-  private static final boolean DEBUG = false;
-  protected ZkTestServer zkServer;
-
-  @Before
-  @Override
-  public void setUp() throws Exception {
-    super.setUp();
-    log.info("####SETUP_START " + getName());
-    
-    ignoreException("java.nio.channels.ClosedChannelException");
-    
-    String zkDir = testDir.getAbsolutePath() + File.separator
-    + "zookeeper/server1/data";
-    zkServer = new ZkTestServer(zkDir);
-    zkServer.run();
-    
-    System.setProperty("zkHost", zkServer.getZkAddress());
-    
-    AbstractZkTestCase.buildZooKeeper(zkServer.getZkHost(), zkServer.getZkAddress(), "solrconfig.xml", "schema.xml");
-
-    // set some system properties for use by tests
-    System.setProperty("solr.test.sys.prop1", "propone");
-    System.setProperty("solr.test.sys.prop2", "proptwo");
-  }
-  
-  protected void createServers(int numShards) throws Exception {
-    System.setProperty("collection", "control_collection");
-    controlJetty = createJetty(testDir, testDir + "/control/data", "control_shard");
-    System.clearProperty("collection");
-    controlClient = createNewSolrServer(controlJetty.getLocalPort());
-
-    StringBuilder sb = new StringBuilder();
-    for (int i = 1; i <= numShards; i++) {
-      if (sb.length() > 0) sb.append(',');
-      JettySolrRunner j = createJetty(testDir, testDir + "/jetty" + i, "shard" + (i + 2));
-      jettys.add(j);
-      clients.add(createNewSolrServer(j.getLocalPort()));
-      sb.append("localhost:").append(j.getLocalPort()).append(context);
-    }
-
-    shards = sb.toString();
-  }
-
-  @Override
-  public void tearDown() throws Exception {
-    if (DEBUG) {
-      printLayout();
-    }
-    zkServer.shutdown();
-    System.clearProperty("zkHost");
-    System.clearProperty("collection");
-    System.clearProperty("solr.test.sys.prop1");
-    System.clearProperty("solr.test.sys.prop2");
-    super.tearDown();
-    resetExceptionIgnores();
-    SolrConfig.severeErrors.clear();
-  }
-  
-  protected void printLayout() throws Exception {
-    SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT);
-    zkClient.printLayoutToStdOut();
-    zkClient.close();
-  }
-}
+package org.apache.solr.cloud;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+
+import org.apache.solr.BaseDistributedSearchTestCase;
+import org.apache.solr.client.solrj.embedded.JettySolrRunner;
+import org.apache.solr.common.cloud.SolrZkClient;
+import org.apache.solr.core.SolrConfig;
+import org.junit.Before;
+
+public abstract class AbstractDistributedZkTestCase extends BaseDistributedSearchTestCase {
+  private static final boolean DEBUG = false;
+  protected ZkTestServer zkServer;
+
+  @Before
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    log.info("####SETUP_START " + getName());
+    
+    ignoreException("java.nio.channels.ClosedChannelException");
+    
+    String zkDir = testDir.getAbsolutePath() + File.separator
+    + "zookeeper/server1/data";
+    zkServer = new ZkTestServer(zkDir);
+    zkServer.run();
+    
+    System.setProperty("zkHost", zkServer.getZkAddress());
+    
+    AbstractZkTestCase.buildZooKeeper(zkServer.getZkHost(), zkServer.getZkAddress(), "solrconfig.xml", "schema.xml");
+
+    // set some system properties for use by tests
+    System.setProperty("solr.test.sys.prop1", "propone");
+    System.setProperty("solr.test.sys.prop2", "proptwo");
+  }
+  
+  @Override
+  protected void createServers(int numShards) throws Exception {
+    System.setProperty("collection", "control_collection");
+    controlJetty = createJetty(testDir, testDir + "/control/data", "control_shard");
+    System.clearProperty("collection");
+    controlClient = createNewSolrServer(controlJetty.getLocalPort());
+
+    StringBuilder sb = new StringBuilder();
+    for (int i = 1; i <= numShards; i++) {
+      if (sb.length() > 0) sb.append(',');
+      JettySolrRunner j = createJetty(testDir, testDir + "/jetty" + i, "shard" + (i + 2));
+      jettys.add(j);
+      clients.add(createNewSolrServer(j.getLocalPort()));
+      sb.append("localhost:").append(j.getLocalPort()).append(context);
+    }
+
+    shards = sb.toString();
+  }
+
+  @Override
+  public void tearDown() throws Exception {
+    if (DEBUG) {
+      printLayout();
+    }
+    zkServer.shutdown();
+    System.clearProperty("zkHost");
+    System.clearProperty("collection");
+    System.clearProperty("solr.test.sys.prop1");
+    System.clearProperty("solr.test.sys.prop2");
+    super.tearDown();
+    resetExceptionIgnores();
+    SolrConfig.severeErrors.clear();
+  }
+  
+  protected void printLayout() throws Exception {
+    SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT);
+    zkClient.printLayoutToStdOut();
+    zkClient.close();
+  }
+}

Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/AbstractZkTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/AbstractZkTestCase.java?rev=1068718&r1=1068717&r2=1068718&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/AbstractZkTestCase.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/cloud/AbstractZkTestCase.java Wed Feb  9 01:03:49 2011
@@ -1,146 +1,147 @@
-package org.apache.solr.cloud;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.common.cloud.SolrZkClient;
-import org.apache.solr.common.cloud.ZkNodeProps;
-import org.apache.solr.core.SolrConfig;
-import org.apache.zookeeper.CreateMode;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Base test class for ZooKeeper tests.
- */
-public abstract class AbstractZkTestCase extends SolrTestCaseJ4 {
-
-  static final int TIMEOUT = 10000;
-
-  private static final boolean DEBUG = false;
-
-  protected static Logger log = LoggerFactory
-      .getLogger(AbstractZkTestCase.class);
-
-  protected static ZkTestServer zkServer;
-
-  protected static String zkDir;
-
-
-  @BeforeClass
-  public static void azt_beforeClass() throws Exception {
-    createTempDir();
-    zkDir = dataDir.getAbsolutePath() + File.separator
-        + "zookeeper/server1/data";
-    zkServer = new ZkTestServer(zkDir);
-    zkServer.run();
-    
-    System.setProperty("zkHost", zkServer.getZkAddress());
-    System.setProperty("hostPort", "0000");
-    
-    buildZooKeeper(zkServer.getZkHost(), zkServer.getZkAddress(),
-        "solrconfig.xml", "schema.xml");
-    
-    initCore("solrconfig.xml", "schema.xml");
-  }
-
-  // static to share with distrib test
-  static void buildZooKeeper(String zkHost, String zkAddress, String config,
-      String schema) throws Exception {
-    SolrZkClient zkClient = new SolrZkClient(zkHost, AbstractZkTestCase.TIMEOUT);
-    zkClient.makePath("/solr");
-    zkClient.close();
-
-    zkClient = new SolrZkClient(zkAddress, AbstractZkTestCase.TIMEOUT);
-
-    ZkNodeProps props = new ZkNodeProps();
-    props.put("configName", "conf1");
-    zkClient.makePath("/collections/collection1", props.store(), CreateMode.PERSISTENT);
-    zkClient.makePath("/collections/collection1/shards", CreateMode.PERSISTENT);
-
-    zkClient.makePath("/collections/control_collection", props.store(), CreateMode.PERSISTENT);
-    zkClient.makePath("/collections/control_collection/shards", CreateMode.PERSISTENT);
-
-    putConfig(zkClient, config);
-    putConfig(zkClient, schema);
-    putConfig(zkClient, "stopwords.txt");
-    putConfig(zkClient, "protwords.txt");
-    putConfig(zkClient, "mapping-ISOLatin1Accent.txt");
-    putConfig(zkClient, "old_synonyms.txt");
-    putConfig(zkClient, "synonyms.txt");
-    
-    zkClient.close();
-  }
-
-  private static void putConfig(SolrZkClient zkConnection, String name)
-      throws Exception {
-    zkConnection.setData("/configs/conf1/" + name, getFile("solr"
-        + File.separator + "conf" + File.separator + name));
-  }
-
-  public void tearDown() throws Exception {
-    if (DEBUG) {
-      printLayout(zkServer.getZkHost());
-    }
-
-    SolrConfig.severeErrors.clear();
-    super.tearDown();
-  }
-  
-  @AfterClass
-  public static void azt_afterClass() throws IOException {
-    zkServer.shutdown();
-    System.clearProperty("zkHost");
-    System.clearProperty("solr.test.sys.prop1");
-    System.clearProperty("solr.test.sys.prop2");
-  }
-
-  protected void printLayout(String zkHost) throws Exception {
-    SolrZkClient zkClient = new SolrZkClient(zkHost, AbstractZkTestCase.TIMEOUT);
-    zkClient.printLayoutToStdOut();
-    zkClient.close();
-  }
-
-  static void makeSolrZkNode(String zkHost) throws Exception {
-    SolrZkClient zkClient = new SolrZkClient(zkHost, TIMEOUT);
-    zkClient.makePath("/solr");
-    zkClient.close();
-  }
-  
-  static void tryCleanSolrZkNode(String zkHost) throws Exception {
-    tryCleanPath(zkHost, "/solr");
-  }
-  
-  static void tryCleanPath(String zkHost, String path) throws Exception {
-    SolrZkClient zkClient = new SolrZkClient(zkHost, TIMEOUT);
-    if (zkClient.exists(path)) {
-      List<String> children = zkClient.getChildren(path, null);
-      for (String string : children) {
-        tryCleanPath(zkHost, path+"/"+string);
-      }
-      zkClient.delete(path, -1);
-    }
-    zkClient.close();
-  }
-}
+package org.apache.solr.cloud;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.cloud.SolrZkClient;
+import org.apache.solr.common.cloud.ZkNodeProps;
+import org.apache.solr.core.SolrConfig;
+import org.apache.zookeeper.CreateMode;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base test class for ZooKeeper tests.
+ */
+public abstract class AbstractZkTestCase extends SolrTestCaseJ4 {
+
+  static final int TIMEOUT = 10000;
+
+  private static final boolean DEBUG = false;
+
+  protected static Logger log = LoggerFactory
+      .getLogger(AbstractZkTestCase.class);
+
+  protected static ZkTestServer zkServer;
+
+  protected static String zkDir;
+
+
+  @BeforeClass
+  public static void azt_beforeClass() throws Exception {
+    createTempDir();
+    zkDir = dataDir.getAbsolutePath() + File.separator
+        + "zookeeper/server1/data";
+    zkServer = new ZkTestServer(zkDir);
+    zkServer.run();
+    
+    System.setProperty("zkHost", zkServer.getZkAddress());
+    System.setProperty("hostPort", "0000");
+    
+    buildZooKeeper(zkServer.getZkHost(), zkServer.getZkAddress(),
+        "solrconfig.xml", "schema.xml");
+    
+    initCore("solrconfig.xml", "schema.xml");
+  }
+
+  // static to share with distrib test
+  static void buildZooKeeper(String zkHost, String zkAddress, String config,
+      String schema) throws Exception {
+    SolrZkClient zkClient = new SolrZkClient(zkHost, AbstractZkTestCase.TIMEOUT);
+    zkClient.makePath("/solr");
+    zkClient.close();
+
+    zkClient = new SolrZkClient(zkAddress, AbstractZkTestCase.TIMEOUT);
+
+    ZkNodeProps props = new ZkNodeProps();
+    props.put("configName", "conf1");
+    zkClient.makePath("/collections/collection1", props.store(), CreateMode.PERSISTENT);
+    zkClient.makePath("/collections/collection1/shards", CreateMode.PERSISTENT);
+
+    zkClient.makePath("/collections/control_collection", props.store(), CreateMode.PERSISTENT);
+    zkClient.makePath("/collections/control_collection/shards", CreateMode.PERSISTENT);
+
+    putConfig(zkClient, config);
+    putConfig(zkClient, schema);
+    putConfig(zkClient, "stopwords.txt");
+    putConfig(zkClient, "protwords.txt");
+    putConfig(zkClient, "mapping-ISOLatin1Accent.txt");
+    putConfig(zkClient, "old_synonyms.txt");
+    putConfig(zkClient, "synonyms.txt");
+    
+    zkClient.close();
+  }
+
+  private static void putConfig(SolrZkClient zkConnection, String name)
+      throws Exception {
+    zkConnection.setData("/configs/conf1/" + name, getFile("solr"
+        + File.separator + "conf" + File.separator + name));
+  }
+
+  @Override
+  public void tearDown() throws Exception {
+    if (DEBUG) {
+      printLayout(zkServer.getZkHost());
+    }
+
+    SolrConfig.severeErrors.clear();
+    super.tearDown();
+  }
+  
+  @AfterClass
+  public static void azt_afterClass() throws IOException {
+    zkServer.shutdown();
+    System.clearProperty("zkHost");
+    System.clearProperty("solr.test.sys.prop1");
+    System.clearProperty("solr.test.sys.prop2");
+  }
+
+  protected void printLayout(String zkHost) throws Exception {
+    SolrZkClient zkClient = new SolrZkClient(zkHost, AbstractZkTestCase.TIMEOUT);
+    zkClient.printLayoutToStdOut();
+    zkClient.close();
+  }
+
+  static void makeSolrZkNode(String zkHost) throws Exception {
+    SolrZkClient zkClient = new SolrZkClient(zkHost, TIMEOUT);
+    zkClient.makePath("/solr");
+    zkClient.close();
+  }
+  
+  static void tryCleanSolrZkNode(String zkHost) throws Exception {
+    tryCleanPath(zkHost, "/solr");
+  }
+  
+  static void tryCleanPath(String zkHost, String path) throws Exception {
+    SolrZkClient zkClient = new SolrZkClient(zkHost, TIMEOUT);
+    if (zkClient.exists(path)) {
+      List<String> children = zkClient.getChildren(path, null);
+      for (String string : children) {
+        tryCleanPath(zkHost, path+"/"+string);
+      }
+      zkClient.delete(path, -1);
+    }
+    zkClient.close();
+  }
+}



Mime
View raw message